function Change_Hidden_Check_Boxes(SpanName) {

var el=document.getElementById(SpanName);

if (el.style.display == 'block') {

el.style.display='none';
}

else {

el.style.display = 'block';
}

//end function
}


function Change_Patient_Relationship()
{

	if (document.pc.Patient_Relationship.options[document.pc.Patient_Relationship.selectedIndex].value == 3) {
	
		var el = document.getElementById('Health_Care_Providers');
		el.style.display = 'block';
	}
	
	else {
	
		var el = document.getElementById('Health_Care_Providers');
		el.style.display = 'none';
		
		var el = document.getElementById('Phsyician_Types');
		el.style.display = 'none';
	}
}

function Change_Health_Care_Provider() 
{
	if (document.pc.Health_Care_Provider.options[document.pc.Health_Care_Provider.selectedIndex].value == 3) {
	
	var el=document.getElementById('Phsyician_Types');el.style.display='block';
	}
	
	else {
	
	var el=document.getElementById('Phsyician_Types');el.style.display='none';
	}
	
	//end function
}


function Check_Age() 
{
	if (document.pc.Current_Age.selectedIndex == 1) {
	
	var agree=confirm("Are you really under 18?");
	
	if (agree) {
	
	location.href='http://www.oncolink.org/surveys/index.cfm?s=2';
	}
	
	else {
	
	return false;
	}
	}
	
	if (document.pc.Diagnosis_Age.selectedIndex == 1) {
	
	
	var agree=confirm("Were you really diagnosed earlier than the age of under 18?");
	
	if (agree) {
	
	location.href='questions-v6.cfm?Page=7';
	}
	
	else {
	
	return false;
	}
	}
}

function PC_Demographic(Page) {

var missing_answers = "";
var errors = "";
var errors_found = 0;

if (Page == 1) {
	//Check if user selected a Gender
	
	if (document.pc.Gender[0].checked == false && document.pc.Gender[1].checked == false) {
	
		missing_answers = missing_answers + "Gender\n";
		
		errors_found++;
	}
	
	
	//Check if user selected an Diagnosis Age
	if (document.pc.Diagnosis_Age.selectedIndex == 0) {
	
		missing_answers = missing_answers + "Age at Diagnosis\n";
		
		errors_found++;
	}
	
	//Check if user selected a Current Age
	if (document.pc.Current_Age.selectedIndex == 0) {
	
		missing_answers = missing_answers + "Current Age\n";
		
		errors_found++;
	}
	
	
	//Check if the current age is less than the age of diagnosis
	
	if (document.pc.Current_Age.selectedIndex != 0 && document.pc.Diagnosis_Age.selectedIndex != 0 && (document.pc.Current_Age.selectedIndex < document.pc.Diagnosis_Age.selectedIndex)) {
	
		missing_answers = missing_answers + "Your current age can't be younger than your age at diagnosis.\n";
		
		errors_found++;
	}
	
	//Check if user selected a Race
	if (document.pc.Race.selectedIndex == 0) {
	
		missing_answers = missing_answers + "Race\n";
		
		errors_found++;
	}
	
	// If 'Other' Race is selected, enforce the user to enter it in
	
	//Check if user entered Other Race
	if (document.pc.Race.value == "Other" && document.pc.race_other.value == "") {
	
		missing_answers = missing_answers + "Please specify your Other Race\n";
		
		errors_found++;
	}
	
	
	//Check if user selected a Income
	if (document.pc.Income.selectedIndex == 0) {
	
		missing_answers = missing_answers + "Annual Household Income\n";
		
		errors_found++;
	}
	
	//Check if user selected a Living
	
	if (document.pc.Living[0].checked == false && document.pc.Living[1].checked == false && document.pc.Living[2].checked == false) {
	
		missing_answers = missing_answers + "Indicate where you live\n";
		
		errors_found++;
	}
	
	//Make sure other geographical information is selected or inputted
	
	
	//US geographical check
	
	if (document.pc.Country[0].checked == true) {
	
	
		if (document.pc.State.selectedIndex == 0) {
		
			missing_answers = missing_answers + "Select State\n";
			
			errors_found++;
		}
		
	}
	
	//Canada geographical check
	
	if (document.pc.Country[1].checked == true && document.pc.Province.selectedIndex == 0) {
	
		missing_answers = missing_answers + "Select Province\n";
		
		errors_found++;
	}
	
	//Other country geographical check
	
	if (document.pc.Country[2].checked == true && document.pc.Other_Country.selectedIndex == 0) {
	
		missing_answers = missing_answers + "Please Select Country\n";
		
		errors_found++;
	}
	
	
	//Determine how many cancer types were selected
	
	var items_checked = 0;
	for (i = 0; i < document.pc.Type_Of_Cancer.length; i++) {
		if (document.pc.Type_Of_Cancer[i].checked == true) {
			items_checked++;
		}
		//end for loop
	}
	
	
	//If user answered yes to having IV administered, check to see if they selected a chemotherapy
	
	if (items_checked == 0) {
		missing_answers = missing_answers + "What type of cancer/s did you have?\n";
		errors_found++;
	}
	
	
	
	
	
	//Check if a option to indicate your relationship 
	
	if (document.pc.Patient_Relationship.selectedIndex == 0) {
	
		missing_answers = missing_answers + "Please indicate your relationship to the patient?\n";
		
		errors_found++;
	}
	
	//Check if user selects health care provider other text for managing your healthcare needs
	
	if (document.pc.Patient_Relationship.options[document.pc.Patient_Relationship.selectedIndex].value == 3) {
		if (document.pc.Health_Care_Provider.selectedIndex == 0) {
			missing_answers = missing_answers + "Healthcare Prodiver Type?\n";
			
			errors_found++;
		}
	}
	
	//Check if user selects physician type
	
	if (document.pc.Health_Care_Provider.options[document.pc.Health_Care_Provider.selectedIndex].value == 3) {
		if (document.pc.Physician_Type.selectedIndex == 0) {
		
			missing_answers = missing_answers + "Physician_Type?\n";
			
			errors_found++;
		}
	}
	
	
	//Determine how many cancer types were selected
	
	var items_checked1 = 0;
	for (i = 0; i < document.pc.treatment.length; i++) {
		if (document.pc.treatment[i].checked == true) {
			items_checked1++;
		}
		//end for loop
	}
	
	//Check if a Treatment was selected
	if (items_checked1 == 0) {
		missing_answers = missing_answers + "What types of treatment/s have you received?\n";
		errors_found++;
	}
	
	//If Other Treatment was selected, check for Other
	
	if (document.pc.treatment[4].checked == true && document.pc.treatment_other.value == "") {
		missing_answers = missing_answers + "Other types of treatment?\n";
		errors_found++;
	}
	
	
	//Check if user selected a Undergone remission as a result of treatment
	
	if (document.pc.remission[0].checked == false && document.pc.remission[1].checked == false) {
	
		missing_answers = missing_answers + "Undergone remission as a result of treatment?\n";
		
		errors_found++;
	}
	
	
	//Check if user selected a Undergone remission as a result of treatment
	
	if (document.pc.remission[1].checked == true &&
	document.pc.num_treatments[0].checked == false &&
	document.pc.num_treatments[1].checked == false &&
	document.pc.num_treatments[2].checked == false &&
	document.pc.num_treatments[3].checked == false &&
	document.pc.num_treatments[4].checked == false) {
	
		missing_answers = missing_answers + "How many additional treatments you have undergone?\n";
		
		errors_found++;
	}
	
	
	//Check if user indicated the number of different prescription drugs you take regularly
	
	if (document.pc.prescriptions[0].checked == false &&
	document.pc.prescriptions[1].checked == false &&
	document.pc.prescriptions[2].checked == false &&
	document.pc.prescriptions[3].checked == false &&
	document.pc.prescriptions[4].checked == false) {
	
		missing_answers = missing_answers + "Please indicate the number of different prescription drugs you take regularly?\n";
		
		errors_found++;
	}
	
	//Check if user indicated the number of different nonprescription drugs you take regularly
	
	if (document.pc.nonprescriptions[0].checked == false &&
	document.pc.nonprescriptions[1].checked == false &&
	document.pc.nonprescriptions[2].checked == false &&
	document.pc.nonprescriptions[3].checked == false &&
	document.pc.nonprescriptions[4].checked == false) {
	
		missing_answers = missing_answers + "Please indicate the number of different non-prescription drugs you take regularly?\n";
		
		errors_found++;
	}	
	
	//Check if user indicated Enrolled in a study?
	
	if (document.pc.drug_study[1].checked == false &&
	document.pc.drug_study[0].checked == false) {
	
		missing_answers = missing_answers + "Enrolled in a study?\n";
		
		errors_found++;
	}
	
}

if (Page == 2) {


	// I am usually one of the first ones among my friends and family to try new things.
	
	if (document.pc.Try_new_things[0].checked == false &&
	document.pc.Try_new_things[1].checked == false &&
	document.pc.Try_new_things[2].checked == false &&
	document.pc.Try_new_things[3].checked == false &&
	document.pc.Try_new_things[4].checked == false) {
	
		missing_answers = missing_answers + "I am usually one of the first ones among my friends and family to try new things?\n";
		
		errors_found++;
	}
	
	
	// I tend to feel that the old ways of living and doing things are the best ways.
	
	if (document.pc.Feel_of_Living[0].checked == false &&
	document.pc.Feel_of_Living[1].checked == false &&
	document.pc.Feel_of_Living[2].checked == false &&
	document.pc.Feel_of_Living[3].checked == false &&
	document.pc.Feel_of_Living[4].checked == false) {
	
		missing_answers = missing_answers + "I tend to feel that the old ways of living and doing things are the best ways?\n";
		
		errors_found++;
	}
	
	// I am very interested in new inventions and new ways of thinking.
	
	if (document.pc.Interest_Level[0].checked == false &&
	document.pc.Interest_Level[1].checked == false &&
	document.pc.Interest_Level[2].checked == false &&
	document.pc.Interest_Level[3].checked == false &&
	document.pc.Interest_Level[4].checked == false) {
	
		missing_answers = missing_answers + "I am very interested in new inventions and new ways of thinking?\n";
		
		errors_found++;
	}
	// I am generally cautious about new ideas.
	
	if (document.pc.cautious_New_Ideas[0].checked == false &&
	document.pc.cautious_New_Ideas[1].checked == false &&
	document.pc.cautious_New_Ideas[2].checked == false &&
	document.pc.cautious_New_Ideas[3].checked == false &&
	document.pc.cautious_New_Ideas[4].checked == false) {
	
		missing_answers = missing_answers + "I am generally cautious about new ideas?\n";
		
		errors_found++;
	}
	// I will consider a new way of doing things even if I haven't seen anyone else do it
	
	if (document.pc.Consider_New_Ways[0].checked == false &&
	document.pc.Consider_New_Ways[1].checked == false &&
	document.pc.Consider_New_Ways[2].checked == false &&
	document.pc.Consider_New_Ways[3].checked == false &&
	document.pc.Consider_New_Ways[4].checked == false) {
	
		missing_answers = missing_answers + "I will consider a new way of doing things even if I haven't seen anyone else do it?\n";
		
		errors_found++;
	}
	// I rarely trust new ideas until I can see whether the vast majority of people around me accept them.
	
	if (document.pc.Comfortable_New_Ideas[0].checked == false &&
	document.pc.Comfortable_New_Ideas[1].checked == false &&
	document.pc.Comfortable_New_Ideas[2].checked == false &&
	document.pc.Comfortable_New_Ideas[3].checked == false &&
	document.pc.Comfortable_New_Ideas[4].checked == false) {
	
		missing_answers = missing_answers + "I rarely trust new ideas until I can see whether the vast majority of people around me accept them?\n";
		
		errors_found++;
	}
	
	// I am comfortable with taking risks.
	
	if (document.pc.Comfortable_Risk_Taking[0].checked == false &&
	document.pc.Comfortable_Risk_Taking[1].checked == false &&
	document.pc.Comfortable_Risk_Taking[2].checked == false &&
	document.pc.Comfortable_Risk_Taking[3].checked == false &&
	document.pc.Comfortable_Risk_Taking[4].checked == false) {
	
		missing_answers = missing_answers + "I am comfortable with taking risks?\n";
		
		errors_found++;
	}
	
}

if (Page == 3) {

	//Have you ever heard of proton therapy
	
	if (document.pc.proton_therapy[0].checked == false && document.pc.proton_therapy[1].checked == false) {
	
		missing_answers = missing_answers + "Have you ever heard of proton therapy?\n";
		
		errors_found++;
	}
	
	
	//If yes, from where
	
	if (document.pc.proton_therapy[0].checked == true &&
	document.pc.proton_therapy_yes[0].checked == false &&
	document.pc.proton_therapy_yes[1].checked == false &&
	document.pc.proton_therapy_yes[2].checked == false &&
	document.pc.proton_therapy_yes[3].checked == false) {
	
		missing_answers = missing_answers + "Where have you heard of Proton Therapy?\n";
		
		errors_found++;
	}
	
	//If yes, from a Physician, what type?
	
	if (document.pc.proton_therapy[0].checked == true && document.pc.proton_therapy_yes[0].checked == true) 
	{
		if (document.pc.proton_therapy_yes_physician.value == "" &&
		document.pc.proton_therapy_yes_physician1.selectedIndex == 0) 
		{
			missing_answers = missing_answers + "You have heard of Proton Therapy from a Physician, please specify radiation oncologist, surgeon, etc\n";
			errors_found++;
		}
	}
	
	
	// Proton facility within 30 miles 
	
	if (document.pc.facility[0].checked == false &&
	document.pc.facility[1].checked == false &&
	document.pc.facility[2].checked == false) {
	
		missing_answers = missing_answers + "Proton facility within 30 miles of your home?\n";
		
		errors_found++;
	}
	
	// If I wanted to be considered for proton therapy
	
	if (document.pc.consider_proton_therapy[0].checked == false &&
	document.pc.consider_proton_therapy[1].checked == false &&
	document.pc.consider_proton_therapy[2].checked == false &&
	document.pc.consider_proton_therapy[3].checked == false &&
	document.pc.consider_proton_therapy[4].checked == false &&
	document.pc.consider_proton_therapy[5].checked == false &&
	document.pc.consider_proton_therapy[6].checked == false) {
	
		missing_answers = missing_answers + "If I wanted to be considered for proton therapy, I would?\n";
		
		errors_found++;
	}
	
	//If I wanted to be considered for proton therapy, I would (please choose all that apply): 
	
	if (document.pc.consider_proton_therapy[6].checked == true &&
	document.pc.consider_proton_therapy_other.value == "") {
	
		missing_answers = missing_answers + "If I wanted to be considered for proton therapy, Other?\n";
		
		errors_found++;
	}
	
	
	
	//  I am willing to try proton therapy if my physician recommends it.
	
	if (document.pc.Physician_Recomm[0].checked == false &&
	document.pc.Physician_Recomm[1].checked == false &&
	document.pc.Physician_Recomm[2].checked == false &&
	document.pc.Physician_Recomm[3].checked == false &&
	document.pc.Physician_Recomm[4].checked == false) {
	
		missing_answers = missing_answers + " I am willing to try proton therapy if my physician recommends it?\n";
		
		errors_found++;
	}
	
	//I am skeptical of the effectiveness of proton therapy.
	
	if (document.pc.therapy_effecitiveness[0].checked == false &&
	document.pc.therapy_effecitiveness[1].checked == false &&
	document.pc.therapy_effecitiveness[2].checked == false &&
	document.pc.therapy_effecitiveness[3].checked == false &&
	document.pc.therapy_effecitiveness[4].checked == false) {
	
		missing_answers = missing_answers + "I am skeptical of the effectiveness of proton therapy?\n";
		
		errors_found++;
	}
	
	//I am reluctant about possibly using proton therapy until I can see whether the vast majority of patients around me accept it.
	
	if (document.pc.patient_accept[0].checked == false &&
	document.pc.patient_accept[1].checked == false &&
	document.pc.patient_accept[2].checked == false &&
	document.pc.patient_accept[3].checked == false &&
	document.pc.patient_accept[4].checked == false) {
	
		missing_answers = missing_answers + "I am reluctant about possibly using proton therapy?\n";
		
		errors_found++;
	}
	
	//Proton therapy is easily accessible and affordable for me.
	
	if (document.pc.therapy_accessible[0].checked == false &&
	document.pc.therapy_accessible[1].checked == false &&
	document.pc.therapy_accessible[2].checked == false &&
	document.pc.therapy_accessible[3].checked == false &&
	document.pc.therapy_accessible[4].checked == false) {
	
		missing_answers = missing_answers + "Proton therapy is easily accessible and affordable for me?\n";
		
		errors_found++;
	}
	
	//Proton therapy is better for some patients
	
	if (document.pc.therapy_better[0].checked == false &&
	document.pc.therapy_better[1].checked == false &&
	document.pc.therapy_better[2].checked == false &&
	document.pc.therapy_better[3].checked == false &&
	document.pc.therapy_better[4].checked == false) {
	
		missing_answers = missing_answers + "Proton therapy is better for some patients?\n";
		
		errors_found++;
	}
	
	//Proton therapy will have minimal or no side effects
	
	if (document.pc.therapy_effects[0].checked == false &&
	document.pc.therapy_effects[1].checked == false &&
	document.pc.therapy_effects[2].checked == false &&
	document.pc.therapy_effects[3].checked == false &&
	document.pc.therapy_effects[4].checked == false) {
	
		missing_answers = missing_answers + "Proton therapy will have minimal or no side effects?\n";
		
		errors_found++;
	}
	
	//Proton therapy is only for tumors of a specific size.
	
	if (document.pc.therapy_tumors[0].checked == false &&
	document.pc.therapy_tumors[1].checked == false &&
	document.pc.therapy_tumors[2].checked == false &&
	document.pc.therapy_tumors[3].checked == false &&
	document.pc.therapy_tumors[4].checked == false) {
	
		missing_answers = missing_answers + "Proton therapy is only for tumors of a specific size?\n";
		
		errors_found++;
	}
	
	
	//Proton therapy cannot be used with chemotherapy.
	
	if (document.pc.therapy_chemo[0].checked == false &&
	document.pc.therapy_chemo[1].checked == false &&
	document.pc.therapy_chemo[2].checked == false &&
	document.pc.therapy_chemo[3].checked == false &&
	document.pc.therapy_chemo[4].checked == false) {
	
		missing_answers = missing_answers + "Proton therapy cannot be used with chemotherapy?\n";
		
		errors_found++;
	}
	
	
	//There is less risk associated with proton therapy than with other forms of radiation.
	
	if (document.pc.therapy_risk[0].checked == false &&
	document.pc.therapy_risk[1].checked == false &&
	document.pc.therapy_risk[2].checked == false &&
	document.pc.therapy_risk[3].checked == false &&
	document.pc.therapy_risk[4].checked == false) {
	
		missing_answers = missing_answers + "There is less risk associated with proton therapy?\n";
		
		errors_found++;
	}
	
	
}





//Display errors if they're any

if (errors_found > 0) {

alert("Please answer the following question(s)?\n\n" + missing_answers);

return false;
}

//end function
}

