function calCalories(){var gender=document.getElementById("_ctl0_PlaceHolderMain_cboGender").value;
var memberage=document.getElementById("age").value;   
     var hf=document.getElementById("htf").value;
var hi=document.getElementById("hti").value;
var w=document.getElementById("wt").value;if((memberage=="")||(hf=="")||(w=="")){if (memberage == "") 
{alert("You have not filled in the age field.");    			return false;}if (hf == "") {
alert("You have not filled in the height field.");return false;}if (w == "")
 {alert("You have not filled in the weight field.");return false;}}

if(gender==0)

{var j = 12 * hf;
 if (hi ==""){hi=0;}var i =parseFloat(parseInt(j) + parseInt(hi));
var reccalories = 1.375 * (66 + (13.7 * (parseFloat(w))) + (2.54 * 5 * i) - (6.8 * (parseFloat(memberage))));
rounded=reccalories*100;rounded = Math.round(rounded);strrounded = "" + rounded;len = strrounded.length;

totalreccalories=(strrounded.substring(0, len - 2) + "." + strrounded.substring(len - 2, len));
}if(gender==1)
{var j = 12 * hf;
 if (hi ==""){hi=0;
}var i =parseFloat(parseInt(j) + parseInt(hi));
var reccalories = 1.375 * (655 + (9.6 * (parseFloat(w))) + (2.54 * 1.8 * (i)) - (4.7 * (parseFloat(memberage))));
rounded=reccalories*100;rounded = Math.round(rounded);
strrounded = "" + rounded;len = strrounded.length;
totalreccalories=(strrounded.substring(0, len - 2) + "." + strrounded.substring(len - 2, len));
}
document.getElementById('result').innerHTML="<h5 style='font:bold 12px arial;margin:5px 0px;padding:0px;'> Your recommended calorie intake daily should be <span style='color:#127cac'>"+totalreccalories+"</span> Calories.</h5>";
document.getElementById('maindiv').style.display= 'none';
document.getElementById('trresult').style.display= 'block';
return false;}

function actualfun()
{
document.getElementById('maindiv').style.display= 'block';
document.getElementById('trresult').style.display= 'none';

document.getElementById('htf').value= '';
document.getElementById('hti').value= '';
document.getElementById('wt').value= '';
document.getElementById('age').value= '';

}



    
    function clickButton(e, buttonid){
    
var bt = document.getElementById(buttonid);
if (typeof bt == 'object'){
if(navigator.appName.indexOf("Netscape")>(-1)){
if (e.keyCode == 13){
bt.click();
return false;
}
}
if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1)){
if (event.keyCode == 13){
bt.click();
return false;
}
}
}
}
