if(top.location!=self.location)top.location=self.location;var stringerInc;
function Form1_onsubmit(){if(document.getElementById("cbShowHeadroom").checked&&document.getElementById("rbHeadroom").checked){var g=parseInt(document.getElementById("txtTotalRise").value),c=parseInt(document.getElementById("txtFloorThick").value);if(parseInt(document.getElementById("txtHeadRoom").value)+c>=g)if(confirm("To display Headroom, Total Rise must be larger than Floor Thickness + Headroom\n\nContinue?\n"))document.getElementById("cbShowHeadroom").checked=!1;else return!1}return!0}
function Radio_onchange(){if("inline"==document.getElementById("rfvTotalRun").style.display||"inline"==document.getElementById("rvTotalRun").style.display)return alert("Enter a valid number in Total Run first, then we'll have another go"),document.getElementById("txtTotalRun").focus(),!1;document.getElementById("spnAngle").style.display="none";document.getElementById("spnCalc").style.display="none";document.getElementById("spnIdealRun").style.display="none";document.getElementById("spnTotalRun").style.display=
"none";for(var g=document.getElementsByName("rblAdjustRun"),c=0;c<g.length;c++)if(g[c].checked)switch(g[c].value){case "UseAngle":document.getElementById("spnAngle").style.display="block";break;case "UseIdeal":document.getElementById("spnIdealRun").style.display="block";break;case "UseTotalRun":document.getElementById("spnTotalRun").style.display="block";break;case "CalcRun":document.getElementById("spnCalc").style.display="block"}}
function window_onload(){for(var g=document.getElementsByName("rblAdjustRun"),c=0;c<g.length;c++)g[c].onclick=Radio_onchange;Radio_onchange();for(c=16;22>c;c++)document.getElementById("ddIdealRise").options[c].style.color="Red";for(c=0;3>c;c++)document.getElementById("ddIdealRun").options[c].style.color="Red";for(c=15;18>c;c++)document.getElementById("ddIdealRun").options[c].style.color="Red";for(c=8;13>c;c++)document.getElementById("ddAngle").options[c].style.color="Red";10<stairData.length?DrawStairs():
(document.getElementById("cnvsStairs").style.display="none",document.getElementById("cnvsStringer").style.display="none");SetStringerType();SetNumeric();SetTitles()}
function DrawStairs(){var g,c=document.getElementById("cbColor").checked,a=document.getElementById("cnvsStairs");if(a.getContext){var d=a.width-60,b=stairData.split(","),o=b[0],r=b[1],s=b[2],C=b[3],p=b[5],t=b[6];g=b[7];var j=b[8],f=b[9],z=b[10],A=b[11],B=b[12],q=b[13],n=b[14],k=b[15],D=b[16],e=d*(r/o),b=d/o;a.setAttribute("height",e+60);var x=e/p,h=d/p,l=e,m=h,y=Math.atan(r/o),u=z*b,v=A*b,a=a.getContext("2d");a.beginPath();a.moveTo(m,l);for(var i=0;i<p-1;i++)l-=x,a.lineTo(m,l),m+=h,a.lineTo(m,l);
a.lineTo(d,v);a.lineTo(u,e);c?(a.save(),a.shadowOffsetY=6,a.shadowBlur=10,a.shadowColor=0==g?"#c0c0c0":"#deb887",a.fillStyle=0==g?"#00f":"#A1A1A1",a.fill(),a.restore()):a.stroke();if(0==g&&c){var w=20*b,l=e,m=h-w;a.moveTo(m,l);a.fillStyle="#f00";for(i=0;i<p-1;i++)l-=x,a.fillRect(m,l-w,h+w,w),m+=h}a.strokeStyle=c?"#c0c0c0":"#000";a.fillStyle="#000";a.beginPath();a.moveTo(0,e);a.lineTo(d,0);a.lineTo(d,e);a.lineTo(0,e);a.font="12px Verdana";a.textBaseline="top";a.moveTo(1,e);a.lineTo(1,e+50);a.fillText(o,
6,e+32);a.moveTo(h,e);a.lineTo(h,e+30);a.fillText(o-C,h+6,e+16);a.moveTo(u,e);a.lineTo(u,e+14);a.fillText(o-z,u+6,e+2);a.moveTo(d,0);a.lineTo(d+20,0);a.fillText(r,d+4,4);a.moveTo(d,v);a.lineTo(d+20,v);a.fillText(r-A,d+4,v+4);h=d-Math.floor((p-1)/2)*h;i=e-Math.floor(p/2)*x;a.moveTo(h,i);h+=t*b*Math.sin(y)+4;i+=t*b*Math.cos(y)+4;a.lineTo(h,i);a.stroke();0<g?(a.fillText(t+" Thick",h,i+2),a.fillText("Concrete "+g+" m\u00b3",h,i+22),a.fillText("Base Length "+B,h,i+42)):(a.fillText(t+" Throat",h,i+2),a.fillText(j+
" x "+f,h,i+20),a.fillText("Base Length "+B,h,i+38));if(0<q){j=n*b;f=d-q*b;c?(a.save(),a.fillStyle=0==g?"#00f":"#A1A1A1",a.shadowOffsetY=6,a.shadowBlur=8,a.shadowColor=0==g?"#c0c0c0":"#deb887",a.fillRect(0,0,f,j),a.restore()):a.strokeRect(0,0,f,j);a.beginPath();a.moveTo(f,0);a.lineTo(d,0);a.moveTo(f,j);a.lineTo(f+10,j);a.fillText(n,f+10,1);a.fillText("Floor Opening "+q,f+70,2);b=e-Math.tan(y)*f;a.moveTo(f,j);a.lineTo(f,b);a.stroke();a.save();if(2E3>k)a.fillStyle="#f00";a.fillText("Headroom "+k,f+
4,j+40);a.restore()}a.fillText("Void Volume "+D+" m\u00b3",d-200,e-20);j="Angle "+s+"\u00b0";f=a.measureText(j);a.fillText(j,d/2-f.width,e/2-40);if(2E3>k&&0<k)document.getElementById("txtHeadRoom").style.backgroundColor="#f00",document.getElementById("rbHeadroom").checked?alert(k+" Headroom is Low!\n\nCheck Local Building Regulations"):alert(k+" Headroom is Low!\n\nIncrease Floor Opening!\n\nCheck Local Building Regulations")}a=document.getElementById("cnvsStringer");d=a.width;b=stringerData.split(",");
j=parseFloat(b[0]);f=parseFloat(b[1]);k=parseFloat(b[2]);e=parseFloat(b[3]);s=parseFloat(b[4]);stringerInc=b[5];q=j-k-e;n=d*(f/j);b=d/j;a.setAttribute("height",n+40);a=a.getContext("2d");a.fillStyle=0==g?"#ffa500":"#A1A1A1";a.strokeStyle="#000";a.beginPath();a.moveTo(0,20);a.lineTo(d,20);a.lineTo(d-e*b,f*b+20);a.lineTo(k*b,f*b+20);a.lineTo(0,20);c?(a.save(),a.shadowOffsetY=6,a.shadowBlur=10,a.shadowColor=0==g?"#c0c0c0":"#deb887",a.fill(),a.restore()):a.stroke();a.strokeStyle=c?"#c0c0c0":"#000";a.beginPath();
a.moveTo(0,20);a.lineTo(0,20+f*b);a.lineTo(k*b,f*b+20);a.moveTo(d,20);a.lineTo(d,20+f*b);a.lineTo(d-e*b,20+f*b);a.stroke();h=d/(s+1);a.fillStyle="#000";for(i=1;i<s+1;i++)a.fillRect(i*h-2,20,2,4);a.font="12px Verdana";a.textBaseline="top";a.fillText(j,d/2,0);a.fillText(q,d/2,n+20+2);a.fillText(e,d-a.measureText(e).width,n+20+2);a.fillText(k,8,n+20+2);a.fillText(f,4,n/2+20-6)}
function SetStringerType(){var g=document.getElementById("rbUseStringerWidth").checked;document.getElementById("txtStringerWidth").disabled=!g;document.getElementById("txtConcreteThick").disabled=g}function RunTalk(){RunTalkQR("RunTalk - Metric",stringerInc,0)};
