// JavaScript Document

// --------------------------------------
// BMI Calcuator 
// --------------------------------------

function  calculateBMI() {
	toggle_visibility("rightbottomboxpatient");
	toggle_visibility("rightbottomboxbmi");
  var weight = eval(document.form.weight.value)
  var height = eval(document.form.height.value)
  var height2 = height / 100
  var BMI = weight  / (height2 * height2)
  document.form.BodyMassIndex.value=custRound(BMI,1);
}

function custRound(x,places) {
  return (Math.round(x*Math.pow(10,places)))/Math.pow(10,places)
}

    function toggle_visibility(id) {
       var e = document.getElementById(id);
       if(e.style.display == 'block')
          e.style.display = 'none';
       else
          e.style.display = 'block';
	}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

// --------------------------------------
// SHOW HIDE LAYER for BMI CALC
// --------------------------------------

function turnOnLayer(vLayerID){
	/*for (i=1;i<5;i++){ */
		if (1==vLayerID){
			document.getElementById("sub"+1).style.display = "block";
		}else{
			document.getElementById("sub"+1).style.display = "none";
		/*}*/
	}
}

function turnOffLayer(vLayerID){
	document.getElementById("sub"+vLayerID).style.display = "none";
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


// --------------------------------------
// PRELOAD IMG CODE
// --------------------------------------

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}