<!--
var whichmodel ='<h4 class="ptop"><a href="portagester.shtml#model-information" title="More Digester Model Information">Digester Model Information</a>&nbsp;:</h4>'
var modlink = '<h4 class="ptop"><a href="portagester.shtml#model-information" title="More Digester Model Information">Digester Model Information</a>&nbsp;:</h4>'
var estbod = '<form name="estimator" id="est" action="GET">'
estbod += '<table width="85%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" id="formtable" summary="Estimator Table">'
estbod += '<tr><td width="100%" colspan="2" valign="middle" align="center" class="headerform"><h3 class="directmail">Digester Output Estimator</h3></td></tr>'
estbod += '<tr><td width="100%" colspan="2" height="20" valign="middle" align="center" class="padbot"><p class="estpar">Please enter a figure in Tonnes per Week<br>(from 1 tonne mimimum up to a maximum of 768 tonnes).</p><p class="estpar sm"><strong>All figures returned are to a max of 2 decimal places and are not rounded.</strong></p></td></tr>'
estbod += '<tr><td align="right" width="50%" valign="middle" class="padtop"><strong id="tonnagetext" class="tah"><label for="tonnage" onmouseover="colon(\'tonnagetext\');" onmouseout="coloff(\'tonnagetext\');">Tonnes per Week&nbsp;:</label></strong></td>'
estbod += '<td width="50%" valign="middle" align="left" class="padtop"><span id="calcbut"><img src="images/Buttons/Calculate.gif" name="calculate" onClick="calc();" onmousedown="cbdown(this);" onmouseup="cbup(this);" width="78" height="22" alt="Calculate" title="Click to calculate output"></span><input class="fldcalc" type="text" onkeydown="return checkkey(event);" onfocus="foc=\'tonnagetext\';colon(\'tonnagetext\');" onblur="foc=\'\';coloff(\'tonnagetext\');" name="ton" id="tonnage" size="7" tabindex="1" maxlength="6"></td></tr>'
estbod += '<tr><td align="right" width="50%" valign="middle"><strong class="tah">Heat Output (High)&nbsp;:</strong></td><td width="50%" nowrap valign="middle" align="left"><input class="flddis" type="text" name="hhi" size="6" disabled>&nbsp;<strong>(<abbr title="Kilowatt">kW</abbr>)</strong></td></tr>'
estbod += '<tr><td align="right" width="50%" valign="middle"><strong class="tah">Heat Output (Low)&nbsp;:</strong></td><td width="50%" nowrap valign="middle" align="left"><input  class="flddis" type="text" name="hlow" size="6" disabled>&nbsp;<strong>(kW)</strong></td></tr>'
estbod += '<tr><td align="right" width="50%" valign="middle"><strong class="tah">Electricity Generation (High)&nbsp;:</strong></td><td width="50%" nowrap valign="middle" align="left"><input class="flddis" type="text" name="ehi" size="6" disabled>&nbsp;<strong>(kW)</strong></td></tr>'
estbod += '<tr><td align="right" width="50%" valign="middle"><strong class="tah">Electricity Generation (Low)&nbsp;:</strong></td><td width="50%" nowrap valign="middle" align="left"><input class="flddis" type="text" name="elow" size="6" disabled>&nbsp;<strong>(kW)</strong></td></tr>'
estbod += '<tr><td align="right" width="45%" valign="middle" class="padbot"><strong class="tah"> Natural Fertiliser Nitrogen&nbsp;:</strong></td><td width="50%" nowrap valign="middle" align="left" class="padbot"><input class="flddis" type="text" name="nfert" size="6" disabled>&nbsp; <span class="sm"><strong>(100% N - approx tonnes per year)</strong></span></td></tr>'
estbod += '<tr><td width="100%" colspan="2" valign="top" align="left" class="bordtop back"><div id="model">'+ whichmodel +'</div></td></tr>'
estbod += '<tr><td width="100%" colspan="2" valign="top" align="left" class="bordtop"><p class="noteone ptop"><strong>Note: </strong></p><p class="notetwo ptop"><strong>High biogas yield</strong> - food, catering waste, grass etc.<br><strong>Low biogas yield</strong> - farm animal and horse stable manure etc.</p></td></tr></table></form>'


browserName = navigator.appName;
browserVer = parseInt ( navigator.appVersion );
version = "";
//
// Define image(s) for preloading
//
if ( browserName == "Netscape" && browserVer >= 3 ) version = "n3";
if ( browserName == "Microsoft Internet Explorer" && browserVer >= 4 ) version = "e4";

if ( version == "n3" || version == "e4" ) {
   Calculate        = new Image (78,22)
   Calculate_On     = new Image (78,22)
   Calculate.src    = "images/Buttons/Calculate.gif";
   Calculate_On.src = "images/Buttons/Calculate-On.gif";
}
//
// Image swap functions
//
function cbdown (calcbut) { 
   calcbut.src = "images/Buttons/Calculate-On.gif";  
}
function cbup (calcbut) {
   calcbut.src = "images/Buttons/Calculate.gif";  
}
//
// Calculation functions
//
function calc() {
   var est = document.estimator;
   var ton = est.ton.value;
   //
   // Validation
   //
   if (parseInt(ton) > 768) {
      alert("Please enter a figure equal to or lower than 768 tonnes per week.");
      est.hhi.value = "0";
      est.hlow.value = "0";
      est.ehi.value = "0";
      est.elow.value = "0";
      est.nfert.value = "0";
      est.ton.focus();
      return false;
   }
   if(isNaN(parseInt(ton/4)  )) {
      alert("Please enter a valid number.");
      est.hhi.value = "0";
      est.hlow.value = "0";
      est.ehi.value = "0";
      est.elow.value = "0";
      est.nfert.value = "0";
      est.ton.value="";
      est.ton.focus();
      return false;
   }
   if(ton == "" || ton == " ") {
      alert("Please enter a valid number.");
      est.hhi.value = "0";
      est.hlow.value = "0";
      est.ehi.value = "0";
      est.elow.value = "0";
      est.nfert.value = "0";
      est.ton.value="";
      est.ton.focus();
      return false;
   }
   if (ton < 1) {
      alert("Please enter a minimum of 1 tonne per week.");
      est.hhi.value = "0";
      est.hlow.value = "0";
      est.ehi.value = "0";
      est.elow.value = "0";
      est.nfert.value = "0";
      est.ton.focus();
      return false;
   }
   //
   //Figure out which model portagester would fit figure entered and return info.
   //
   if (parseInt(ton) < 2){ 
   whichmodel = modlink;
   whichmodel += '<h4 class="ind">PG 1 Digester</h4>';
   whichmodel += '<ul><li>1 to 3 tonnes per week.<br>Mainly used for pasteurising the waste to achieve Animal By Product Regulations (ABPR) - 2nd stage biogas digestion may not be economic.</li>';
   whichmodel += '<li>Mobile operation, static option.</li>';
   whichmodel += '<li>Hotels, stables, smallholdings, community composting, zoos.</li></ul>';
   document.getElementById("model").innerHTML = whichmodel;
}
   if (parseInt(ton) >= 2 && parseInt(ton) <= 3){ 
   whichmodel = modlink;
   whichmodel += '<h4 class="ind">PG 1 Digester</h4>';
   whichmodel += '<ul><li>1 to 3 tonnes per week.<br>Mainly used for pasteurising the waste to achieve Animal By Product Regulations (ABPR) - 2nd stage biogas digestion may not be economic.</li>';
   whichmodel += '<li>Mobile operation, static option.</li>';
   whichmodel += '<li>Hotels, stables, smallholdings, community composting, zoos.</li></ul>';
   whichmodel += '<h4 class="ind">PG 2 Digester</h4>'
   whichmodel += '<ul><li>2 to 7 tonnes per week.<br>Mainly used for pasteurising the waste to achieve Animal By Product Regulations (ABPR) - 2nd stage biogas digestion may not be economic.</li>'
   whichmodel += '<li>Static operation, Chassis mounted option.</li>'
   whichmodel += '<li>Farms, food processors, abattoirs, prisons, golf clubs, hotels, schools, community composting etc.</li></ul>'
   document.getElementById("model").innerHTML = whichmodel;
}
   if (parseInt(ton) > 3 && parseInt(ton) <= 7){ 
   whichmodel = modlink;
   whichmodel += '<h4 class="ind">PG 2 Digester</h4>'
   whichmodel += '<ul><li>2 to 7 tonnes per week.<br>Mainly used for pasteurising the waste to achieve Animal By Product Regulations (ABPR) - 2nd stage biogas digestion may not be economic.</li>'
   whichmodel += '<li>Static operation, Chassis mounted option.</li>'
   whichmodel += '<li>Farms, food processors, abattoirs, prisons, golf clubs, hotels, schools, community composting etc.</li></ul>'
   document.getElementById("model").innerHTML = whichmodel;
}
   if (parseInt(ton) > 7 && parseInt(ton) < 15){ 
   whichmodel = modlink;
   whichmodel += '<h4 class="ind">PG 2 Digester (plus additional model/s required)</h4>'
   whichmodel += '<ul><li>2 to 7 tonnes per week.<br>Mainly used for pasteurising the waste to achieve Animal By Product Regulations (ABPR) - 2nd stage biogas digestion may not be economic.</li>'
   whichmodel += '<li>Static operation, Chassis mounted option.</li>'
   whichmodel += '<li>Farms, food processors, abattoirs, prisons, golf clubs, hotels, schools, community composting etc.</li></ul>'
   document.getElementById("model").innerHTML = whichmodel;
}
   if (parseInt(ton) >= 15 && parseInt(ton) <= 25){
   whichmodel = modlink;
   whichmodel += '<h4 class="ind">PG 3, 3a, 3b "Portagester &reg;"</h4>'
   whichmodel += '<ul><li>15 to 25 tonnes per week.<br>Can be used with 2nd stage anaerobic digestion for biogas - energy production.</li>'
   whichmodel += '<li>Farms, stables, vegetable growers, food processors, abattoirs, waste management companies etc.</li></ul>'
   document.getElementById("model").innerHTML = whichmodel;
}
   if (parseInt(ton) > 25 && parseInt(ton) < 35){
   whichmodel = modlink;
   whichmodel += '<h4 class="ind">PG 3, 3a, 3b "Portagester &reg;" (plus additional model/s required)</h4>'
   whichmodel += '<ul><li>15 to 25 tonnes per week.<br>Can be used with 2nd stage anaerobic digestion for biogas - energy production.</li>'
   whichmodel += '<li>Farms, stables, vegetable growers, food processors, abattoirs, waste management companies etc.</li></ul>'
   document.getElementById("model").innerHTML = whichmodel;
}

   if (parseInt(ton) >= 35 && parseInt(ton) <= 50){ 
   whichmodel = modlink;
   whichmodel += '<h4 class="ind">PG 4 Digester</h4>'
   whichmodel += '<ul><li>35 to 50 tonnes per week.<br>To be used with 2nd stage anaerobic digestion for biogas - energy production.</li>'
   whichmodel += '<li>Hook loader and walking floor options.</li>'
   whichmodel += '<li>Waste management companies, composters, larger organic waste producers.</li></ul>'
   document.getElementById("model").innerHTML = whichmodel;
}
   if (parseInt(ton) > 50 && parseInt(ton) < 192){ 
   whichmodel = modlink;
   whichmodel += '<h4 class="ind">PG 4 Digester (plus additional model/s required)</h4>'
   whichmodel += '<ul><li>35 to 50 tonnes per week.<br>To be used with 2nd stage anaerobic digestion for biogas - energy production.</li>'
   whichmodel += '<li>Hook loader and walking floor options.</li>'
   whichmodel += '<li>Waste management companies, composters, larger organic waste producers.</li></ul>'
   document.getElementById("model").innerHTML = whichmodel;
}
   if (parseInt(ton) >= 192 && parseInt(ton) <= 768){ 
   whichmodel = modlink;
   whichmodel += '<h4 class="ind">PG 5 Digester - RM High Rate Biogas Plant</h4>'
   whichmodel += '<ul><li>10,000 to 40,000 tonnes per annum input capacity (approx 192 to 768 tonnes per week). Can add modules including Portagesters.</li>'
   whichmodel += '<li>No or minimal surplus liquid, controlled biogas production, compact plant.</li>'
   whichmodel += '<li>Water and waste management companies, composters, larger organic waste producers.</li></ul>'
   document.getElementById("model").innerHTML = whichmodel;
}

   //
   // Perform calculations
   //
   var q = ton / 7 / 24;

   // figure out if above 192 then use different calculations
   if (parseInt(ton) >= 192 && parseInt(ton) <= 768){ 
   var hhi = ton * 3.46;
   } else {
   var hhi = q * 100 * 4;}

   //sort out decimal place setting
   hhi = hhi.toString();
   var decplace = hhi.indexOf(".");
   if ( decplace == -1 ) { 
      hhi = hhi;
   } else {
      if(hhi.charAt(decplace+2) == "0") {
         hhi = hhi.substr(0, decplace + 2)
      } else {
         hhi = hhi.substr(0,decplace + 3);
      }
   }
   // figure out if above 192 then use different calculations
   if (parseInt(ton) >= 192 && parseInt(ton) <= 768){ 
   var hlow = ton * 0.67;
   } else {
   var hlow = q * 20 * 4;}

   hlow = hlow.toString();
   var decplace = hlow.indexOf(".");
   if ( decplace == -1 ) { 
      hlow = hlow;
   } else {
      if(hlow.charAt(decplace+2) == "0") {
         hlow = hlow.substr(0, decplace + 2);
      } else {
         hlow = hlow.substr(0,decplace + 3);
      }
   }

// figure out if above 192 then use different calculations
   if (parseInt(ton) >= 192 && parseInt(ton) <= 768){ 
   var ehi = ton * 2.08;
   } else {
   var ehi = q * 100 * 1.5;}

   ehi = ehi.toString();
   var decplace = ehi.indexOf(".");
   if ( decplace == -1 ) { 
      ehi = ehi;
   } else {
      if (ehi.charAt(decplace+2) == "0") {
         ehi = ehi.substr(0, decplace + 2);
      } else {
         ehi = ehi.substr(0,decplace + 3);
      }
   }

// figure out if above 192 then use different calculations
   if (parseInt(ton) >= 192 && parseInt(ton) <= 768){ 
   var elow = ton * 0.4;
   } else {
   var elow = q * 20 * 1.5;}

   elow = elow.toString();
   var decplace = elow.indexOf(".");
   if ( decplace == -1 ) { 
      elow = elow;
   } else {
      if (elow.charAt(decplace+2) == "0") {
         elow = elow.substr(0, decplace + 2);
      } else {
         elow = elow.substr(0,decplace + 3);
      }
   }
   var nf = ton / 4;
   nf = nf.toString();
   var decplace = nf.indexOf(".")
   if ( decplace == -1 ) { 
      nf = nf;
   } else {
      if (nf.charAt(decplace+2) == "0") {
         nf = nf.substr(0, decplace + 2);
      } else {
         nf = nf.substr(0,decplace + 3);
      }
   }
   est.hhi.value = hhi;
   est.hlow.value = hlow;
   est.ehi.value = ehi;
   est.elow.value = elow;
   est.nfert.value = nf;
   return false;
}
//
// Reset fields
//
function fieldset () {
   var est = document.estimator;
   est.ton.value = "";
   est.hhi.value = "0";
   est.hlow.value = "0";
   est.ehi.value = "0";
   est.elow.value = "0";
   est.nfert.value = "0";
   est.ton.focus();
}
//
// Handle <CR>
//
function checkkey(e) {
   var keynum;
   var keychar;
   var numcheck;
   if (window.event) {
      // IE
      keynum = e.keyCode;
   } else {
      // Others (Netscape, Mozilla etc)
      if (e.which) {
         keynum = e.which;
      }
   }
   keychar = String.fromCharCode(keynum);
   numcheck = /\d/;
   if (keynum == 13) {
      //document.estimator.calculate.focus();
      calc();
   }
   return true;
}
// -->