/*js		:	hhform v1.0			:	Form functions (see below for complete descriptiondate	:	5/20/2004				Copyright 2004 hh Software & Web Services. All rights reserved.				You may use this script in your Web pages, provided these opening credit				lines are kept intact.*/// formContinue: check value for checked object// thisForm: form object must have an checked object named "cbAgree"function formContinue(thisForm){	if (thisForm.cbAgree == null || thisForm.cbAgree.checked == false ){		alert('Please check the box to continue.');		return false;	}	else{		return true;	}}// formDisplayAlert: display object value in alert box// thisObjfunction formDisplayAlert(thisOjb){	alert(thisOjb);}// formDisplayElements: display the form element(s) property and value// thisForm: form objectfunction formDisplayElements(thisForm){	var alertText = "";	  for(i=0; i<thisForm.elements.length; i++){		alertText += "[" + thisForm.elements[i].name + "] {" + thisForm.elements[i].type + "} ";		if(thisForm.elements[i].type == "text" || thisForm.elements[i].type == "textarea" || thisForm.elements[i].type == "button"){			alertText += "Value: " + thisForm.elements[i].value + "\n";		} else if(thisForm.elements[i].type == "checkbox"){			alertText += "Checked? " + thisForm.elements[i].checked + "\n";		}	else if(thisForm.elements[i].type == "select-one"){			alertText += "SO Text: " + thisForm.elements[i].options[thisForm.elements[i].selectedIndex].text + "\n";		}	else{			alertText += "\n";			}	}   	alert(alertText)}// formResultsSA: display results from sleep apnea test// thisForm: form objectfunction formResultsSA(thisForm){	var alertText = "SPLEEP APNEA TEST RESULT\n\n";	var iResults = 0;	  for(i=0; i<thisForm.elements.length; i++){		if(thisForm.elements[i].type == "checkbox" && thisForm.elements[i].checked == true){			iResults += 1;		}	}	if(iResults >= 3){		alertText += "YOU SHOW SYMPTOMS OF SLEEP APNEA, which frequently causes you to stop breathing in your sleep.  ";		alertText += "Please review your results with your doctor to discuss your symptoms.";	}	else{		alertText += "You do not show symptoms of SLEEP APNEA.";	}	alertText = formResultsDisclaimer(alertText);	formDisplayAlert(alertText);	thisForm.reset();} // formResultsSS: display results from snore score test// thisForm: form objectfunction formResultsSS(thisForm){	var alertText = "SNORE-SCORE TEST RESULT";	var iResults = new Array (0,0,0);	var fNoresult = false;	  for(i=0; i<thisForm.elements.length; i++){		if(thisForm.elements[i].type == "checkbox" && thisForm.elements[i].checked == true){			if (i == 0){				iResults[0] += 1;			} else if(i == 1){				iResults[0] += 1;			} else if(i == 2){				iResults[0] += 1;			} else if(i == 3){				iResults[0] += 1;				iResults[2] += 1;			} else if(i == 4){				iResults[1] += 1;			} else if(i == 5){				iResults[2] += 1;			} else if(i == 6){				iResults[2] += 1;			} else if(i == 7){				iResults[2] += 1;			} else if(i == 8){//				iResults[2] += 1;			} else if(i == 9){				iResults[2] += 1;			}		}	}	if(iResults[0] >= 4){		alertText += "\n\nYour snoring probably interferes with your personal life.";		fNoresult = true;	}	if(iResults[1] >= 1){		alertText += "\n\nYou may be a positional snorer -- one who snores in certain positions.";		fNoresult = true;	}	if(iResults[2] >= 5){		alertText += "\n\nThere is a good chance you have SLEEP APNEA.";		fNoresult = true;	}	if(fNoresult == false){		alertText += "\n\nSnoring is probably NOT a health concern to you.";	} else{		alertText += "\n\nPlease review your results with your doctor to discuss your symptoms.";	}	alertText = formResultsDisclaimer(alertText);	formDisplayAlert(alertText);	thisForm.reset();} // formResultsESS: display results from Epworth Sleepiness Scale test// thisForm: form objectfunction formResultsESS(thisForm){	var alertText = "EPWORTH SLEEPINESS SCALE TEST RESULT\n\n";	var iResults = 0;	  for(i=0; i<thisForm.elements.length; i++){		if(thisForm.elements[i].type == "select-one"){			iResults += thisForm.elements[i].selectedIndex;		}	}	alertText += "Your Epworth Sleepiness Score is " + iResults + "\n\n"	if(iResults >= 10){		alertText += "Your score suggest that you may need further evaluation by a physician to determine the cause of your excessive daytime sleepiness and whether you have underlying sleep disorder(s).\n\n";		alertText += "Please review your Epworth Sleepiness Score with your doctor and discuss your symptoms for medical advice about diagnosis and treatment of Excessive Daytime Sleepiness.";	}	else{		alertText += "Your score suggests that you are not suffering from Excessive Daytime Sleepiness.";	}	alertText = formResultsDisclaimer(alertText);	formDisplayAlert(alertText);	thisForm.reset();} // formResultsDisclaimer: add disclaimer to message// alertText: messagefunction formResultsDisclaimer(alertText){	alertText += "\n\nDISCLAIMER: This test is for informational purposes only, and not intended ";	alertText += "to be a substitute for professional medical advice, diagnosis ";	alertText += "or treatment. Should you have any health care related questions, ";	alertText += "call or see your physician promptly.";	alertText += "\n\nCopyright @ 2004 International Sleep Labs of America";	return(alertText);}