<!--
var Feet,Result,Inches,Lbs,Cms,Kgs,Pinch,Peet,Metres,Height,Weight,x,active,gender,input,tot,carb,prot,fat,A1,A2,A3,A4,frac

function FeetConvert()
{
Result=document.TGrams.ft.value*30.48;
Result+=document.TGrams.ins.value*2.54;
decimal();
document.TGrams.cms.value=round2(Result,frac);
}

function InchConvert()
{
Peet=document.TGrams.ft.value;
Pinch=document.TGrams.ins.value;

if (Pinch >= 12)
	{FtInsConvert(Pinch);}
else
	{Feet=Peet*30.48;
	Inches=Pinch*2.54;
	Result=+Inches+Feet;
	decimal();
	document.TGrams.cms.value=round2(Result,frac);}
}

function FtInsConvert()
{
Inches=Pinch%12;
Feet=+Peet+parseInt(Pinch/12);
document.TGrams.ft.value=Feet;
decimal();
document.TGrams.ins.value=round2(Inches,frac);
Result=(Feet*30.48)+(Inches*2.54);
decimal();
document.TGrams.cms.value=round2(Result,frac);
}

function CmsConvert()
{
Cms=document.TGrams.cms.value;
Feet=parseInt(Cms/30.48);
Inches=(Cms % 30.48)/2.54;
document.TGrams.ft.value=Feet;
decimal();
document.TGrams.ins.value=round2(Inches,frac);
}

function LbsConvert()
{
Kgs=document.TGrams.lbs.value*0.45359;
decimal();
document.TGrams.kgs.value=round2(Kgs,frac);
}

function KgsConvert()
{
Lbs=document.TGrams.kgs.value*2.2;
decimal();
document.TGrams.lbs.value=round2(Lbs,frac);
}

function GramsCalculate()
{
decimal();InchConvert();LbsConvert();
carb=document.TGrams.carb.value;
prot=document.TGrams.prot.value;
fat=document.TGrams.fat.value;
tot=eval(parseInt(carb) + parseInt(prot) + parseInt(fat));
document.TGrams.carb.value=parseInt(carb/tot*100);
document.TGrams.prot.value=parseInt(prot/tot*100);
document.TGrams.fat.value=100-parseInt(carb/tot*100)-parseInt(prot/tot*100);

carb=document.TGrams.carb.value/100;
prot=document.TGrams.prot.value/100;
fat=document.TGrams.fat.value/100;
if (document.TGrams.radio3[1].checked)
	{Weight=document.TGrams.kgs.value*4.36*2.2046;
	Height=document.TGrams.cms.value*4.32/2.54;
	Age=document.TGrams.age.value*4.7;
	Result=round2((655+Weight+Height-Age),frac);}
else
	{Feet=document.TGrams.ft.value;
	Inches=document.TGrams.ins.value;
	Weight=document.TGrams.kgs.value*6.22*2.2046;
	Height=document.TGrams.cms.value*12.7/2.54;
	Age=document.TGrams.age.value*6.8;
	Result=round2((66+Weight+Height-Age),frac);}

if (document.TGrams.Activity[0].checked){
A1=round2(Result*carb/4,frac);
A2=round2(Result*prot/4,frac);
A3=round2(Result*fat/9,frac);
A4=round2(Result,frac);
active=document.TGrams.Activity[0].value;
for (x=0;x<=document.TGrams.radio3.length-1;x=x+1)
{if (document.TGrams.radio3[x].checked)
{gender=document.TGrams.radio3[x].value;}
}
}

else if (document.TGrams.Activity[1].checked){
A1=round2(Result*1.25*carb/4,frac);
A2=round2(Result*1.25*prot/4,frac);
A3=round2(Result*1.25*fat/9,frac);
A4=round2(Result*1.25,frac);
active=document.TGrams.Activity[1].value;
for (x=0;x<=document.TGrams.radio3.length-1;x=x+1)
{if (document.TGrams.radio3[x].checked)
{gender=document.TGrams.radio3[x].value;}
}
}

else if (document.TGrams.Activity[2].checked){
A1=round2(Result*1.3*carb/4,frac);
A2=round2(Result*1.3*prot/4,frac);
A3=round2(Result*1.3*fat/9,frac);
A4=round2(Result*1.3,frac);
active=document.TGrams.Activity[2].value;
for (x=0;x<=document.TGrams.radio3.length-1;x=x+1)
{if (document.TGrams.radio3[x].checked)
{gender=document.TGrams.radio3[x].value;}
}
}

else if (document.TGrams.Activity[3].checked){
A1=round2(Result*1.5*carb/4,frac);
A2=round2(Result*1.5*prot/4,frac);
A3=round2(Result*1.5*fat/9,frac);
A4=round2(Result*1.5,frac);
active=document.TGrams.Activity[3].value;
for (x=0;x<=document.TGrams.radio3.length-1;x=x+1)
{if (document.TGrams.radio3[x].checked)
{gender=document.TGrams.radio3[x].value;}
}
}

else if (document.TGrams.Activity[4].checked){
A1=round2(Result*1.7*carb/4,frac);
A2=round2(Result*1.7*prot/4,frac);
A3=round2(Result*1.7*fat/9,frac);
A4=round2(Result*1.7,frac);
active=document.TGrams.Activity[4].value;
for (x=0;x<=document.TGrams.radio3.length-1;x=x+1)
{if (document.TGrams.radio3[x].checked)
{gender=document.TGrams.radio3[x].value;}
}
}

else if (document.TGrams.Activity[5].checked){
A1=round2(Result*2*carb/4,frac);
A2=round2(Result*2*prot/4,frac);
A3=round2(Result*2*fat/9,frac);
A4=round2(Result*2,frac);
active=document.TGrams.Activity[5].value;
for (x=0;x<=document.TGrams.radio3.length-1;x=x+1)
{if (document.TGrams.radio3[x].checked)
{gender=document.TGrams.radio3[x].value;}
}
}
document.TGrams.actgender.value=active+" for "+gender+"  : "+A4+" Calories";
document.TGrams.carbs.value="Carbohydrates  : "+A1+" grams  ("+round2(A1/28.35,frac)+" ozs.)";
document.TGrams.protein.value="Protein                  : " +A2+" grams ("+round2(A2/28.35,frac)+" ozs.)";
document.TGrams.fats.value="Fat                          : "+A3+" grams  ("+round2(A3/28.35,frac)+" ozs.)";
}

function validateInput()
	{
	x=document.TGrams
	input=x.cms.value
	if (input<1)
		{alert("Your height, please!");
		focus(cms);
		return false;}

		input=x.kgs.value;
	if (input<1)
		{alert("Your weight, please!");
		focus(kgs);
		return false;}

		input=x.age.value;
	if (input<1)
		{alert("Your age, please!");
		focus(age);
		return false;}
	else
		{return true;}
	}	

function decimal()
{
for (x=0;x<=document.TGrams.Decimal.length;x=x+1){
if (document.TGrams.Decimal[x].selected)
{frac=x;
return true;}
}
}


function addbookmark()
{
if (document.all)
{window.external.AddFavorite(document.location,document.title)}
}

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 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
		}

//-->