<!--
	//alert('common_calc loaded')
	
	if (navigator.appName.indexOf("Netscape") > -1) {
		myBrowser = "netscape"
	} else {
		myBrowser = "intex"
	}
	
	function menuCalc(formName) {
		//used with menus and final summary value field
		//will populate summary field for this form
		if (myBrowser == "netscape") {
			myForm = document.eval(formName)
		} else {
			myForm = eval(formName)
		}
		menuNum = myForm.elements.length-1
		thisVal = 0
		for (i=0;i<menuNum;i++) {
			//thisVal += Math.abs(myForm.elements[i].selectedIndex + -5)
			//thisVal += Math.abs(myForm.elements[i].value)
			thisVal += Math.abs(myForm.elements[i].options[myForm.elements[i].selectedIndex].value)
		}
		myForm.elements[myForm.elements.length-1].value = thisVal
		myForm.elements[myForm.elements.length-1].focus()
		myForm.elements[myForm.elements.length-1].blur()
	}
	
	function menuCalcInt(formName) {
		//used with menus and final summary value field
		//will populate summary field for this form
		if (myBrowser == "netscape") {
			myForm = document.eval(formName)
		} else {
			myForm = eval(formName)
		}
		menuNum = myForm.elements.length-1
		thisVal = 0
		for (i=0;i<menuNum;i++) {
			thisVal += parseInt(myForm.elements[i].options[myForm.elements[i].selectedIndex].value)
		}
		myForm.elements[myForm.elements.length-1].value = thisVal
		/*myForm.elements[myForm.elements.length-1].focus()
		myForm.elements[myForm.elements.length-1].blur()*/
	}
	
	function calcRadio(formName) {
		if (myBrowser == "netscape") {
			theForm = document.eval(formName)
		} else {
			theForm = eval(formName)
		}
		menuNum = theForm.elements.length-1
		thisVal = 0;
		for (i=0;i<menuNum;i++) {
			if (theForm.elements[i].type == "radio") {
				if (theForm.elements[i].checked) {
				thisVal += parseInt(theForm.elements[i].value);
				}
			}
		theForm.elements[theForm.elements.length-1].value = thisVal;
		}
	
	}
	
	function calcCheckbox(formName) {
		if (myBrowser == "netscape") {
			theForm = document.eval(formName)
		} else {
			theForm = eval(formName)
		}
		menuNum = theForm.elements.length-1
		thisVal = 0;
		for (i=0;i<menuNum;i++) {
			if (theForm.elements[i].type == "checkbox") {
				if (theForm.elements[i].checked) {
				thisVal += parseInt(theForm.elements[i].value);
				}
			}
		theForm.elements[theForm.elements.length-1].value = thisVal;
		}
	
	}


	
	/*
	function displayLocus(whichLocus) {
		if (thisLocusVal >= 23) {
			rating = "You have a strong belief " 
		} else if (thisLocusVal >= 15 && thisLocusVal < 23) {
			rating = "You have a moderate belief " 
		} else {
			rating = "You generally do not believe "			
		} 
		
		if (whichLocus == 1) {
			outputString = rating + "that your health is a matter of chance."
		} else if (whichLocus == 2) {
			outputString = rating + "that your health is due to powerful others."
		} else {
			outputString = rating + "that you control your own health."			
		} 
		myForm.locusVal.value = outputString			
	}
	*/
	

		function displayBMI() {
			calcBMI()
			document.bmiForm.evalNum.value = myBMI.toString()
			evalBMI()
			if (window.opener) {
				window.opener.displayBMI(myBMI)
				alert("Your Body Mass Index has been recorded.\r\r\rClose the BMI Calculator window to continue.")
			}
		}
		
		function calcBMI() {
			menuArray = document.bmiForm.heightMajorUnits.options
			heightMajorText = menuArray[menuArray.selectedIndex].text
			weightMajor = document.bmiForm.weightUnits.options
			weightMajorText = weightMajor[weightMajor.selectedIndex].text
			
			if (heightMajorText == "Units..." || weightMajorText == "Units...") {
				alert("Please specify units.")
				return false
			}
			
			if (document.bmiForm.heightMajor.value == "" || document.bmiForm.weight.value == "") {
				alert("Please enter values for height and weight.")
				return false
			}
			
			if (heightMajorText == "ft") {
				myMeters = ((validateNumVal(document.bmiForm.heightMajor.value) * 12) + validateNumVal(document.bmiForm.heightMinor.value))/39.4
			} else if (heightMajorText == "in") {
				myMeters = validateNumVal(document.bmiForm.heightMajor.value)/39.4
			} else if (heightMajorText == "m") {
				myMeters = validateNumVal(document.bmiForm.heightMajor.value) + (validateNumVal(document.bmiForm.heightMinor.value)/100)
			} else if (heightMajorText == "cm") {
				myMeters = validateNumVal(document.bmiForm.heightMajor.value)/100
			}
			
			myMeters = roundToTwoPlaces(myMeters)
			
			if (weightMajorText == "lbs") {
				myKilograms = (validateNumVal(document.bmiForm.weight.value)/2.2)
			} else if (weightMajorText == "kgs") {
				myKilograms = validateNumVal(document.bmiForm.weight.value)
			}
			
			myKilograms = roundToTwoPlaces(myKilograms)
			
			myBMI = myKilograms/(myMeters*2)
			
			myBMI = roundToTwoPlaces(myBMI)
		}
		
		function evalBMI() {
			if (myBMI < 20) {
				document.bmiForm.evalString.value = "Below normal weight"
			} else if (myBMI >= 20 && myBMI < 25) {
				document.bmiForm.evalString.value = "Normal weight"
			} else if (myBMI >= 25 && myBMI < 30) {
				document.bmiForm.evalString.value = "Overweight"
			} else if (myBMI >= 30) {
				document.bmiForm.evalString.value = "Extremely overweight"
			}
		}
		
		function roundToTwoPlaces(myInput) {		
			var s = "" + Math.round(myInput * 100) / 100
  			var i = s.indexOf('.')
  			if (i < 0) return s + ".00"
  			var t = s.substring(0, i + 1) + s.substring(i + 1, i + 3)
  			if (i + 2 == s.length) t += "0"
  			return eval(t)
		}
		
		function validateNumVal(formInput) {
			parseFloat(formInput)
			if (isNaN(formInput)) {
				alert("Please enter only numbers.")
			}
			if (formInput == "") {
				return 0
			} else {
				return parseFloat(formInput)
			}
		}

		function updateMinorMenu(whichUnit) {
			if (whichUnit == "Units...") {
				heightMinorText = "Units..."
			} else if (whichUnit == "ft") {
				heightMinorText = "in"
				document.bmiForm.weightUnits.options[0].text = "lbs"
			} else if (whichUnit == "in") {
				heightMinorText = "none"
				document.bmiForm.weightUnits.options[0].text = "lbs"
			} else if (whichUnit == "m") {
				heightMinorText = "cm"
				document.bmiForm.weightUnits.options[0].text = "kgs"
			} else if (whichUnit == "cm") {
				heightMinorText = "none"
				document.bmiForm.weightUnits.options[0].text = "kgs"
			}
			document.bmiForm.heightMinorUnits.options[0].text = heightMinorText
		}
	
//-->
