function WaistToHipRatio()
{
Waist=WTHR.waist.value;
if (Waist.length<1 || WTHR.waist.value<1)
{alert("Please enter your waist size");
WTHR.waist.focus();
WTHR.waist.select();
return false;}
Hips=WTHR.hips.value;
if (Hips.length<1 || WTHR.hips.value<1)
{alert("Please enter your hip size");
WTHR.hips.focus();
WTHR.hips.select();
return false;}
Result=(Waist/Hips).toFixed(2);
ratio.innerHTML="Your waist-to-hip ratio is "+Result;

if (WTHR.radio2[0].checked)
	{Units="inches"}
else
	{Units="centimeters"}

if (WTHR.radio3[1].checked)
{Free=Math.round(((Hips*.89)-Waist));
comments.innerHTML="<b>For men the ideal waist-to-hip ratio is 0.89 or less.</b>";
if (Result<=0.89)
{comments.innerHTML=comments.innerHTML+"<br>Congratulations! You appear to be in good physical shape. Continue doing what you have done in the past like getting regular exercise, eating moderately and reducing life's stresses, wherever possible."}
else
{comments.innerHTML=comments.innerHTML+"<br>You should take steps to reduce your waistline and/or hips by about "+Math.abs(Free)+" "+Units+".<br>Possible steps are :<br>(1) Reduce the level of stress in your life. Stress produces the hormone cortisol, which makes you crave extra carbohydrates and fats, that could end up around the waistline.<br><br>(2) Eat foods that are high in fiber and other important nutrients, and eliminate those that are high in fat and sugar.<br><br>(3) Exercise for 45 to 60 minutes daily as a form of stress-reduction.<br><br>(4) Eat four(4) or five(5) small meals throughout the day to give the body more energy because the blood sugar levels are evened out. Also these smaller meals do not stretch out the stomach walls and expand the waistline."
}
}
if (WTHR.radio3[0].checked)
{Free=Math.round(((Hips*.72)-Waist));
comments.innerHTML="<b>For women the ideal waist-to-hip ratio is 0.72 or less.</b>";
if (Result<=0.72)
{comments.innerHTML=comments.innerHTML+"<br>Congratulations! You appear to be in good physical shape. Continue doing what you have done in the past like getting regular exercise, eating moderately and reducing life's stresses, wherever possible."}
else
{comments.innerHTML=comments.innerHTML+"<br>You should take steps to reduce your waistline and/or hips by about "+Math.abs(Free)+" "+Units+".<br>Some steps are :<br>(1) Reduce the level of stress in your life. For women who are, in most respects lean, abdominal fat may indicate an underlying sensitivity to stress according to Elissa Epel,PhD, of Yale University at New Haven,Connecticut. When you have chronically elevated levels of the stress hormone cortisol, you crave carbohydrates and fats, and these extra calories are deposited as abdominal fat, she explains.<br><br>(2) Eat foods that are high in fiber and other important nutrients and not those that are high in fat or sugar.<br><br>(3) Exercise for 45 to 60 minutes daily as a form of stress-reduction.<br><br>(4) Reduce portions size - <a href='Keep_Weight_Off.asp'>eat smaller meals more often.</a> The idea is to eat more small meals throughout the day to provide more energy because the blood sugar levels don’t rise and fall so dramatically. Also this does not stretch out the stomach walls thereby expanding the waistline."}
}

if (WTHR.radio3[0].checked)
{var Range=round2((Hips*.28),0);
var Lower=WTHR.waist.value;
var Index=round2((Range/Lower*100),0)}
else
{var Range=round2((Hips*.11),0);
var Lower=WTHR.waist.value;
var Index=round2((Range/Lower*100),0)}

if (Index>100){Index=100}

if (Free>=0)
	{lose.innerHTML="Good Shape Index (indicates how close you are to the ideal shape - the higher the better) : <:><:><:> "+Index+" %"}
else
	{lose.innerHTML="You need to lose about "+Math.abs(Free)+" " +Units+" from your waist/hips"}
}

function round2(nbr,digits){
		nbr=nbr.toString()
		if (nbr.indexOf(".")==-1){
			int_part=nbr
			decimal_part=""
			}
		else{
			int_part=nbr.substring(0,nbr.indexOf("."))
			decimal_part=nbr.substring(1+nbr.indexOf("."),2+nbr.indexOf(".")+digits)
			}
		while(decimal_part.length<digits+1)
			decimal_part+="0"
		if (Number(decimal_part.charAt(decimal_part.length-1)<5))
			decimal_part=decimal_part.substring(0,digits)
		else{
			decimal_part=(Number(decimal_part)+10).toString()
			if (decimal_part.length>digits+1){
				int_part=(Number(int_part)+1).toString()
				decimal_part=decimal_part.substring(1,digits+1)
				}
			decimal_part=decimal_part.substring(0,digits)
			}
		if (int_part=="")
			int_part=0;
		if (Number(digits)>0)
			return int_part+"."+decimal_part
		else
			return int_part
		}

var clockID=0
function UpdateClock()
{
if (clockID)
{clearTimeout(clockID);
clockID = 0;}

var tDate = new Date();
var dayofweek = tDate.getDay();
if (dayofweek==0){dayofweek="Sunday"}
if (dayofweek==1){dayofweek="Monday"}
if (dayofweek==2){dayofweek="Tuesday"}
if (dayofweek==3){dayofweek="Wednesday"}
if (dayofweek==4){dayofweek="Thursday"}
if (dayofweek==5){dayofweek="Friday"}
if (dayofweek==6){dayofweek="Saturday"}

var Day=tDate.getDate()

var Mth=tDate.getMonth()+1
if (Mth==1){Mth="January"}
if (Mth==2){Mth="February"}
if (Mth==3){Mth="March"}
if (Mth==4){Mth="April"}
if (Mth==5){Mth="May"}
if (Mth==6){Mth="June"}
if (Mth==7){Mth="July"}
if (Mth==8){Mth="August"}
if (Mth==9){Mth="September"}
if (Mth==10){Mth="October"}
if (Mth==11){Mth="November"}
if (Mth==12){Mth="December"}

var Yr=tDate.getFullYear()

var H=tDate.getHours();
if (H>11)
{var AMPM="PM";}
else
{var AMPM="AM";}

if (H>12)
{H=H-12;}

if (H<10)
{H="0"+H;}

var M=tDate.getMinutes()
if (M<10)
{M="0"+M;}

var S=tDate.getSeconds()
if (S<10)
{S="0"+S;}

theDate.innerHTML=dayofweek+", "+Mth+" "+Day+", "+Yr+" ---"+H+":"+M+":"+S+" "+AMPM;
clockID = setTimeout("UpdateClock()",1000);
}

function StartClock() {
clockID = setTimeout("UpdateClock()",500);
}

function KillClock() {
if (clockID)
 {clearTimeout(clockID);
 clockID = 0;}
}

function addbookmark()
{
if (document.all)
{window.external.AddFavorite(document.location,document.title)}
}
