startList = function() {
        if (document.all&&document.getElementById) {
                navRoot = document.getElementById("nav");
                for (i=0; i<navRoot.childNodes.length; i++) {
                        node = navRoot.childNodes[i];
                        if (node.nodeName=="LI") {
                                node.onmouseover=function() {
                                        this.className+=" over";
                                }
                                node.onmouseout=function() {
                                        this.className=this.className.replace(" over", "");
                                }
                        }
                }
        }
}
window.onload=startList;

function mod(div,base)
{
	return Math.round(div - (Math.floor(div/base)*base));
}
function calcBmi()
{
	var w = document.bmi.weight.value * 1;
	var HeightFeetInt = document.bmi.htf.value * 1;
	var HeightInchesInt = document.bmi.hti.value * 1;
	HeightFeetConvert = HeightFeetInt * 12;
	h = HeightFeetConvert + HeightInchesInt;
	displaybmi = (Math.round((w * 703) / (h * h)));
	var rvalue = true;
	if ( (w <= 35) || (w >= 500)  || (h <= 48) || (h >= 120) )
	{
		alert ("Please check your input and try again.");
		rvalue = false;
	}
	if (rvalue)
	{
		if (HeightInchesInt > 11)
		{
			reminderinches = mod(HeightInchesInt,12);
			document.bmi.hti.value = reminderinches;
			document.bmi.htf.value = HeightFeetInt + ((HeightInchesInt - reminderinches)/12);
			document.bmi.answer.value = displaybmi;
		}
/*
		if (displaybmi <19) 
			document.bmi.comment.value = "Underweight";
		if (displaybmi >=19 && displaybmi <=25) 
			document.bmi.comment.value = "Desirable";
		if (displaybmi >=26 && displaybmi <=29) 
			document.bmi.comment.value = "prone to health risks";
		if (displaybmi >=30 && displaybmi <=40) 
			document.bmi.comment.value = "Obese";
		if (displaybmi >40) 
			document.bmi.comment.value = "Extremely obese";
*/
		document.bmi.answer.value = displaybmi;
	}
	// return rvalue;
	return false;
}

function slideSwitch()
{
	var $active = $('#banner img.active');

	if ($active.length == 0)
		$active = $('#banner img:last');

	var $next = $active.next().length ? $active.next() : $('#banner img:first');

	$active.addClass('last-active');

	$next.css({opacity: 0.0})
	.addClass('active')
	.animate({opacity: 1.0}, 1000, function()
	{
		$active.removeClass('active last-active');
	});
}


