function cal_demand()
{
 
var var_capacity
var var_bathers
var var_active_chlorine
var var_cal_demand

var_capacity = document.forms[0].capacity.value * 2.5;
var_bathers=document.forms[0].bathers.value * 11;
var_active_chlorine = var_capacity + var_bathers;
var_active_chlorine = Math.round(var_active_chlorine*Math.pow(10,2))/Math.pow(10,2);
var_cal_demand=var_active_chlorine / 24;
var_cal_demand = Math.round(var_cal_demand*Math.pow(10,2))/Math.pow(10,2);
document.forms[0].activity.value=var_active_chlorine;
document.forms[0].chlorine_amt.value=var_cal_demand;
}

function in_cal_demand()
{
var var_in_capacity
var var_in_bathers
var var_in_active_chlorine
var var_in_cal_demand

var_in_capacity = document.forms[1].in_capacity.value * 2;
var_in_bathers=document.forms[1].in_bathers.value * 11;
var_in_active_chlorine = var_in_capacity + var_in_bathers
var_in_active_chlorine = Math.round(var_in_active_chlorine*Math.pow(10,2))/Math.pow(10,2);
var_in_cal_demand=var_in_active_chlorine / 24
var_in_cal_demand = Math.round(var_in_cal_demand*Math.pow(10,2))/Math.pow(10,2);
document.forms[1].in_activity.value=var_in_active_chlorine
document.forms[1].in_chlorine_amt.value=var_in_cal_demand
}
function capacity_metric()
{
var var_met_cap
var_met_cap = document.forms[2].length_meter.value * document.forms[2].depth_meter.value * document.forms[2].width_meter.value ;
var_met_cap = Math.round(var_met_cap*Math.pow(10,2))/Math.pow(10,2);
document.forms[2].cubicmeter.value=var_met_cap;

}
function capacity_us()
{
var var_ft_cap;
var var_metus_cap;
var var_gal_cap
var_ft_cap = document.forms[3].length_ft.value * document.forms[3].depth_ft.value * document.forms[3].width_ft.value ;
var_ft_cap1= var_ft_cap * .0283;
var_ft_cap2 = var_ft_cap * 7.48;
var_ft_cap = Math.round(var_ft_cap*Math.pow(10,2))/Math.pow(10,2);
var_ft_cap1 = Math.round(var_ft_cap1*Math.pow(10,2))/Math.pow(10,2);
var_ft_cap2 = Math.round(var_ft_cap2*Math.pow(10,2))/Math.pow(10,2);
document.forms[3].cubicft.value=var_ft_cap;
document.forms[3].cubicmet.value=var_ft_cap1;
document.forms[3].cubicgallon.value=var_ft_cap2;


}

function doze()
{
var var_dozequan;
var var_dozeppm;
var var_dozeliter;
var_dozeliter = (document.forms[4].doze_quan.value * document.forms[4].doze_ppm.value )/8 ;
var_dozeliter = Math.round(var_dozeliter*Math.pow(10,2))/Math.pow(10,2);
document.forms[4].dozelitre.value=var_dozeliter;


}
function clearvals(clrvals)
{
 if (clrvals=="c1")
 {
	document.forms[0].capacity.value="";
	document.forms[0].bathers.value="";
	document.forms[0].activity.value="";
	document.forms[0].chlorine_amt.value="";
 }
 if(clrvals=="c2")
 {
	document.forms[1].in_capacity.value="";
	document.forms[1].in_bathers.value="";
	document.forms[1].in_activity.value="";
	document.forms[1].in_chlorine_amt.value="";
 }
 if(clrvals=="c3")
 {
	document.forms[2].length_meter.value="";
	document.forms[2].width_meter.value="";
	document.forms[2].depth_meter.value="";
	document.forms[2].cubicmeter.value="";
 }
 if(clrvals=="c4")
 {
	document.forms[3].length_ft.value="";
	document.forms[3].width_ft.value="";
	document.forms[3].depth_ft.value="";
	document.forms[3].cubicft.value="";
	document.forms[3].cubicmet.value="";
	document.forms[3].cubicgallon.value="";
 }
 if(clrvals=="c5")
 {
	document.forms[4].doze_quan.value="";
	document.forms[4].doze_ppm.value="";
	document.forms[4].dozelitre.value="";
	
 }
 
}
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);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function getX(obj)
{
	//return obj.offsetLeft;
  return( obj.offsetParent==null ? obj.offsetLeft : obj.offsetLeft+getX(obj.offsetParent) );
}

function getY(obj)
{
  return( obj.offsetParent==null ? obj.offsetTop : obj.offsetTop+getY(obj.offsetParent) );
}


// Function to write the coordinates of Layer ArticleOptions
function openTip(myLyr,obj,leftOff,topOff)
{
 
 if(leftOff == null) { leftOff = 0; } 
 if(topOff == null) { topOff = 0; }

 var o = MM_findObj(myLyr);
 MM_showHideLayers(myLyr,'','show');
 

 with(o){
  style.left = getX(obj); // + leftOff;
  style.top = getY(obj) + 15; //offsetHeight ; //+ topOff;
 }
}

function closeTip(lyr)
{
	MM_showHideLayers(lyr,'','hide');
}