function DoActive(tabstring)
{var de_act=document.getElementById('active_tab').value;document.getElementById('what_glucomax').style.display="none";document.getElementById(de_act).className="inactive_carb";document.getElementById(de_act+"_1").style.display="none";document.getElementById(de_act+"_2").style.display="block";document.getElementById(de_act+"_cont").style.display="none";document.getElementById(tabstring).className="active_carb";document.getElementById(tabstring+"_1").style.display="block";document.getElementById(tabstring+"_2").style.display="none";document.getElementById(tabstring+"_cont").style.display="block";document.getElementById('active_tab').value=tabstring;}
function calculate_bmi()
{var height_cent=document.getElementById('height_cent').value;var height_feet=document.getElementById('height_feet').value;var height_inches=document.getElementById('height_inches').value;var weight_kg=document.getElementById('weight_kg').value;var weight_stone=document.getElementById('weight_stone').value;var weight_pounds=document.getElementById('weight_pounds').value;if(isWhitespace(height_cent)&&isWhitespace(height_feet)&&isWhitespace(height_inches))
{alert('Please enter only one measurement for height.');document.getElementById('height_cent').focus();return false;}
else if((!isWhitespace(height_cent)&&!isWhitespace(height_feet))||(!isWhitespace(height_cent)&&!isWhitespace(height_inches)))
{alert('Please enter height in either centimeters or inches.');return false;}
else if(isWhitespace(weight_kg)&&isWhitespace(weight_stone)&&isWhitespace(weight_pounds))
{alert('Please enter only one measurement for weight.');return false;}
else if((!isWhitespace(weight_kg)&&!isWhitespace(weight_stone))||(!isWhitespace(weight_kg)&&!isWhitespace(weight_pounds)))
{alert('Please enter weight in either kilograms or pounds.');return false;}
if(height_cent>0)
{var height_cent_meter=height_cent/100;}
else
{if(height_feet>0)
{var ht_feet_meter=height_feet*0.3048;}
else
{var ht_feet_meter=0;}
if(height_inches>0)
{var ht_in_meter=height_inches*0.0254;}
else
{var ht_in_meter=0;}
var height_cent_meter=ht_feet_meter+ht_in_meter;}
if(weight_kg>0)
{var weight_kilo=weight_kg;}
else
{if(weight_pounds>0)
{var weight_p_kilo=weight_pounds*0.45359237;}
else
{var weight_p_kilo=0;}
if(weight_stone>0)
{var weight_s_kilo=weight_stone*6.35029318;}
else
{var weight_s_kilo=0;}
var weight_kilo=weight_p_kilo+weight_s_kilo;}
var bmi=roundNumber(weight_kilo/(height_cent_meter*height_cent_meter),2);if(bmi>27)
{document.getElementById('disp_p').style.display='';document.getElementById('disp_p').innerHTML='<strong><br>Your BMI is '+bmi+'. As your BMI is over 27, you can proceed to purchase Biocarb.</strong>';}
else
{document.getElementById('disp_p').style.display='';var bmi_id='bmi_calc'+bmi;document.getElementById('disp_p').innerHTML="<strong><br>Your BMI is "+bmi+".  This is usually considered underweight. Biocarb is not suitable for use if your BMI is under 28. To re-enter your weight";}}
var whitespace=" \t\n\r";function isEmpty(s){return((s==null)||(s.length==0))}
function isWhitespace(s){var i;if(isEmpty(s))return true;for(i=0;i<s.length;i++){var c=s.charAt(i);if(whitespace.indexOf(c)==-1)return false}
return true}
