var from=0,to=0,incs=0;function CreateTable(){from=parseInt(document.getElementById("ddFromFeet").value)*384+parseInt(document.getElementById("ddFromInches").value)*32+parseInt(document.getElementById("ddFromFrac").value);GoTable()}
function GoTable(){incs=parseInt(document.getElementById("ddIncs").value);if(from==0)from=incs;var a=parseInt(document.getElementById("ddRows").value),b=parseInt(document.getElementById("ddCols").value);to=from+incs*a*b;for(var g=1,i=document.getElementById("rbFeet").checked,c=document.getElementById("tblResults");c.rows.length>0;)c.deleteRow(c.rows.length-1);c=c.insertRow(0);var d,h=parseInt(document.getElementById("ddPresc").value),f="";d=0;var e=20;switch(b){case 1:e=0;break;case 2:e=100;break;
case 3:e=60;break;case 4:e=40;break;case 5:e=20}for(b=from;b<to;b+=incs){d=h>0?(b*0.79375).toFixed(h):Math.round(b*0.79375);f+="<span class='Etbl'>"+ConEng(b,i)+"</span> - <span class='Mtbl'>"+d+"</span><br />";if(g%a==0){d=c.insertCell(c.cells.length);d.setAttribute("vAlign","top");d.innerHTML="Imperial to Millimetres<br />"+f;f="";d=c.insertCell(c.cells.length);d.setAttribute("width",e)}g++}runs<2&&runs++}var runs=0;function SetUp(){CreateTable()}function AutoUp(){from+=incs;GoTable()}
var upTimer=null;function StartUp(){upTimer=setInterval("AutoUp()",100)}function EndUp(){clearInterval(upTimer)}function AutoDown(){if(from-incs>0){from-=incs;GoTable()}}var downTimer=null;function StartDown(){downTimer=setInterval("AutoDown()",100)}function EndDown(){clearInterval(downTimer)}function PageUp(){from=to;GoTable()}function PageDown(){var a=parseInt(document.getElementById("ddRows").value),b=parseInt(document.getElementById("ddCols").value);a=a*b;if(from>a){from-=a;GoTable()}}
function PrintTable(){var a=window.open("",null,"width=1000,height=800,status=no,toolbar=no,menubar=yes,scrollbars=yes,location=no"),b=document.getElementById("divResults");a.document.open();a.document.write('<html><head><link href="Styles/Bl2.css" type="text/css" rel="stylesheet"></head><body onload="window.print();window.close();"><div align="center">');a.document.write(b.innerHTML);a.document.write("\n</div></body></html>");a.document.close();a.focus()};
