
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! Your body measurements seem to be in order. Continue looking after your health by exercising, moderating the size of your meals and eliminating stress from your life."}
else
{comments.innerHTML=comments.innerHTML+"<br>You should take steps to reduce your waistline and/or hips by about "+Math.abs(Free)+" "+Units+".<br>You could usefully:-<br>(1) Seek to reduce the level of stress that's part of your life. When you have chronically elevated levels of the stress hormone cortisol, you crave carbohydrates and fats, and these extra calories make a beeline for your abdomen.<br><br>(2) Eat foods that are high in fiber and other important nutrients and not those that are high in fat or sugar or are otherwise nutritionally lacking.<br><br>(3) Accruing 45 to 60 minutes of exercise daily can help to neutralize stress hormones.<br><br>(4) Reduce portions size - eat smaller meals more often. Many people eat more than is required at any one meal for the body to efficiently process. The idea is to eat more small-meals throughout the day to give the body ample time to process each meal while providing more energy because the blood sugar levels don’t rise and fall so dramatically. Also this does not stretch out the stomach wall."
}
}
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! Your body measurements seem to be in order. Continue looking after your health by exercising, moderating the size of your meals and eliminating stress from your life."}
else
{comments.innerHTML=comments.innerHTML+"<br>You should take steps to reduce your waistline and/or hips by about "+Math.abs(Free)+" "+Units+".<br>You could usefully:-<br>(1) Reduce the level of stress in your life. For generally lean women, abdominal fat may indicate an underlying sensitivity to stress rather than, in part, a result of obesity, 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 make a bee-line for your abdomen, 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 or are otherwise nutritionally lacking.<br><br>(3) Accruing 45 to 60 minutes of exercise daily can help to neutralize stress hormones.<br><br>(4) Reduce portions size - <a href='Keep_Weight_Off.asp'>eat smaller meals more often.</a> Many people eat more than is required at any one meal for the body to efficiently process. The idea is to eat more small meals throughout the day to give the body ample time to process each meal while providing more energy because the blood sugar levels don’t rise and fall so dramatically. Also this does not stretch out the stomach walls."}
}

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 putFocus(formInst, elementInst)
{document.forms[0].elements[5].focus();}

function select_area()
{WTHR.waist.select()}

function select_area1()
{WTHR.hips.select()}

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
		}

function addbookmark()
{
if (document.all)
{window.external.AddFavorite(document.location,document.title)}
}

var clockID=0
function UpdateClock()
{
if (clockID)
{clearTimeout(clockID);
clockID = 0;}

var H,M,S,Mth,Day,AMPM,Yr
var tDate = new Date();
Day=tDate.getDate()
if (Day<10)
{Day="0"+Day;}

Mth=tDate.getMonth()+1
if (Mth==1){Mth="Jan"}
if (Mth==2){Mth="Feb"}
if (Mth==3){Mth="Mar"}
if (Mth==4){Mth="Apr"}
if (Mth==5){Mth="May"}
if (Mth==6){Mth="Jun"}
if (Mth==7){Mth="Jul"}
if (Mth==8){Mth="Aug"}
if (Mth==9){Mth="Sep"}
if (Mth==10){Mth="Oct"}
if (Mth==11){Mth="Nov"}
if (Mth==12){Mth="Dec"}

Yr=tDate.getFullYear()

H=tDate.getHours();
if (H>11)
{AMPM="pm";}
else
{AMPM="am";}

if (H>12)
{H=H-12;}

if (H<10)
{H="0"+H;}

M=tDate.getMinutes()
if (M<10)
{M="0"+M;}

S=tDate.getSeconds()
if (S<10)
{S="0"+S;}

theTime.value = Mth+" "+Day+" "+Yr + "::"
+ H + ":" + M + ":" + S +" "+ AMPM;
clockID = setTimeout("UpdateClock()",1000);
}

var clockID=0
function StartClock() {
clockID = setTimeout("UpdateClock()",500);
}

function KillClock() {
if (clockID)
 {clearTimeout(clockID);
 clockID = 0;}
}

