function How_Much_Water_To_Drink(){
var x=1;
if (water.weight.value<1){alert("There must be a figure for weight");water.weight.focus();return false;}
tot=0;
if (water.lbkl[0].checked)
{weight=Math.round(water.weight.value/2);tot=tot+weight;
results.innerHTML="("+x+") Weigh -------------------------------- <b>"+weight+" ounces.</b><br>"}

else if (water.lbkl[1].checked)
{weight=Math.round(water.weight.value*1.1);tot=tot+weight;
results.innerHTML="("+x+") Weigh -------------------------------- <b>"+weight+" ounces.</b><br>"}
else
{alert("Please select lbs or kilos");water.lbkl[0].focus();return false;}

if (water.active.value!="")
{activity=Math.round(water.active.value/20*8);tot=tot+activity;x=x+1;
results.innerHTML=results.innerHTML+"("+x+") Exercise ----------------------------- <b>"+activity+" ounces.</b><br>"}
else
{activity=0;}

if (water.coffee.value!="")
{coff=water.coffee.value*8;tot=tot+coff;x=x+1;
results.innerHTML=results.innerHTML+"("+x+") Coffee drinking -------------------- <b>"+coff+" ounces.</b><br>"}
else
{coff=0;}

if (water.alcohol.value!="")
{alc=water.alcohol.value*8;tot=tot+alc;x=x+1;
results.innerHTML=results.innerHTML+"("+x+") Alcohol-use ------------------------- <b>"+alc+" ounces.</b><br>"}
else
{alc=0;}

if (water.climate[0].checked)
{clime=16;tot=tot+16;x=x+1;
results.innerHTML=results.innerHTML+"("+x+") Climate ------------------------------ <b>"+clime+" ounces.</b><br>"}
else
{clime=0;}

if (water.high_altitudes[0].checked)
{altitudes=8;tot=tot+8;x=x+1;
results.innerHTML=results.innerHTML+"("+x+") High altitude ------------------------ <b>"+altitudes+" ounces.</b><br>"}
else
{altitudes=0}

if (water.very_hot_cold[0].checked)
{very_hot=16;tot=tot+16;x=x+1;
results.innerHTML=results.innerHTML+"("+x+") Very cold/hot weather ---------- <b>"+very_hot+" ounces.</b><br>"}
else
{very_hot=0}

if (water.pregnant[0].checked)
{preg=16;tot=tot+16;x=x+1;
results.innerHTML=results.innerHTML+"("+x+") Pregnancy -------------------------- <b>"+preg+" ounces.</b><br>"}
else
{preg=0}

if (water.breast_feeding[0].checked)
{breast=24;tot=tot+24;x=x+1;
results.innerHTML=results.innerHTML+"("+x+") Breast-feeding --------------------- <b>"+breast+" ounces.</b><br>"}
else
{breast=0}

if (water.fever_diarrhea[0].checked)
{fever=8;tot=tot+8;x=x+1;
results.innerHTML=results.innerHTML+"("+x+") Fever or diarrhea ------------------ <b>"+fever+" ounces.</b>"}
else
{fever=0}

total.innerHTML="Amount of water to drink is <b>"+tot+" ounces</b> ("+Math.round(tot/16)+" pts or "+(tot/33.84).toFixed(1) +" liters)";
}

 function putFocus(formInst, elementInst)
{
document.forms[0].elements[1].focus();
}

function BreastFeedingP(){
if (water.pregnant[0].checked)
{alert("We don't want you to be pregnant and breast-feeding at the same time.\nSelect 'no' to 'Are you pregnant?', and try again!");water.breast_feeding[1].checked="true";return false;}
}

function PregnantB(){
if (water.breast_feeding[0].checked)
{alert("We don't want you to be pregnant and breast-feeding at the same time.\nSelect 'no' to 'Are you breast-feeding?', and try again!");water.pregnant[1].checked="true";return false;}
}

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 = Day + " " + Mth + " " + 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)}
}
