if(top.location!=self.location)top.location=self.location;var stringerInc;
function Form1_onsubmit(){if(document.getElementById("cbShowHeadroom").checked&&document.getElementById("rbHeadroom").checked){var d=384*parseInt(document.getElementById("ddTotalRiseFeet").value),d=d+32*parseInt(document.getElementById("ddTotalRiseInches").value),d=d+parseInt(document.getElementById("ddTotalRiseFrac").value),c=32*parseInt(document.getElementById("ddFloorThickInches").value),c=c+parseInt(document.getElementById("ddFloorThickFrac").value),a=384*parseInt(document.getElementById("ddHeadroomFeet").value),
a=a+32*parseInt(document.getElementById("ddHeadroomInches").value),a=a+parseInt(document.getElementById("ddHeadroomFrac").value);if(a+c>=d)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(){document.getElementById("spnAngle").style.display="none";document.getElementById("spnCalc").style.display="none";document.getElementById("spnIdealRun").style.display="none";document.getElementById("spnUseTotalRun").style.display="none";for(var d=document.getElementsByName("rblAdjustRun"),c=0;c<d.length;c++)if(d[c].checked)switch(d[c].value){case "UseAngle":document.getElementById("spnAngle").style.display="block";break;case "UseIdeal":document.getElementById("spnIdealRun").style.display=
"block";break;case "CalcRun":document.getElementById("spnCalc").style.display="block";break;case "UseTotalRun":document.getElementById("spnUseTotalRun").style.display="block"}}
function window_onload(){for(var d=document.getElementsByName("rblAdjustRun"),c=0;c<d.length;c++)d[c].onclick=Radio_onchange;Radio_onchange();for(c=7;11>c;c++)document.getElementById("ddIdealRise").options[c].style.color="Red";for(c=0;4>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();SetTitles()}
function DrawStairs(){var d,c=document.getElementById("cbColor").checked,a=document.getElementById("cnvsStairs");if(a.getContext){var e=a.width-80,b=stairData.split(","),o=b[0],q=b[1],r=b[2],C=b[3],p=b[5],s=b[6];d=b[7];var g=b[8],j=b[9],z=b[10],A=b[11],B=b[12],n=b[13],t=b[14],k=b[15],D=b[16],f=e*(q/o),b=e/o;a.setAttribute("height",f+60);var x=f/p,h=e/p,l=f,m=h,y=Math.atan(q/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(e,v);a.lineTo(u,f);c?(a.save(),a.shadowOffsetY=6,a.shadowBlur=10,a.shadowColor=0==d?"#c0c0c0":"#deb887",a.fillStyle=0==d?"#00f":"#A1A1A1",a.fill(),a.restore()):a.stroke();if(0==d&&c){var w=20*b,l=f,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.fillStyle="#000";a.strokeStyle=c?"#c0c0c0":"#000";a.beginPath();a.moveTo(0,f);a.lineTo(e,0);a.lineTo(e,f);a.lineTo(0,f);a.font="12px Verdana";a.textBaseline="top";a.moveTo(1,f);a.lineTo(1,f+50);a.fillText(ConEng(o,
!0),6,f+32);a.moveTo(h,f);a.lineTo(h,f+30);a.fillText(ConEng(o,!0),6,f+32);a.moveTo(h,f);a.lineTo(h,f+30);a.fillText(ConEng(o-C,!0),h+6,f+16);a.moveTo(u,f);a.lineTo(u,f+14);a.fillText(ConEng(o-z,!0),u+6,f+2);a.moveTo(e,0);a.lineTo(e+20,0);a.fillText(ConEng(q,!0),e+4,4);a.moveTo(e,v);a.lineTo(e+20,v);a.fillText(ConEng(q-A,!0),e+4,v+4);h=e-Math.floor((p-1)/2)*h;i=f-Math.floor(p/2)*x;a.moveTo(h,i);h+=s*b*Math.sin(y)+4;i+=s*b*Math.cos(y)+4;a.lineTo(h,i);a.stroke();0<d?(a.fillText(ConEng(s,!1)+" Thick",
h,i+2),a.fillText("Concrete "+d+" y\u00b3",h,i+22),a.fillText("Base Length "+ConEng(B,!0),h,i+42)):(a.fillText(ConEng(s,!1)+" Throat",h,i+2),a.fillText(ConEng(g,!0)+" x "+ConEng(j,!0),h,i+20),a.fillText("Base Length "+ConEng(B,!0),h,i+38));if(0<n){j=t*b;g=e-n*b;c?(a.save(),a.fillStyle=0==d?"#00f":"#A1A1A1",a.shadowOffsetY=6,a.shadowBlur=8,a.shadowColor=0==d?"#c0c0c0":"#deb887",a.fillRect(0,0,g,j),a.restore()):a.strokeRect(0,0,g,j);a.beginPath();a.moveTo(g,0);a.lineTo(e,0);a.moveTo(g,j);a.lineTo(g+
10,j);a.fillText(ConEng(t,!0),g+10,1);a.fillText("Floor Opening "+ConEng(n,!0),g+70,2);b=f-Math.tan(y)*g;a.moveTo(g,j);a.lineTo(g,b);a.stroke();a.save();if(2560>k)a.fillStyle="#f00";a.fillText("Headroom "+ConEng(k,!0),g+4,j+40);a.restore()}a.fillText("Void Volume "+D+" y\u00b3",e-200,f-20);g="Angle "+r+"\u00b0";j=a.measureText(g);a.fillText(g,e/2-j.width,f/2-40);2560>k&&0<k&&(document.getElementById("rbHeadroom").checked?alert(ConEng(k,!0)+" Headroom is Low!\n\nCheck Local Building Regulations"):
alert(ConEng(k,!0)+" Headroom is Low!\n\nIncrease Floor Opening!\n\nCheck Local Building Regulations"))}a=document.getElementById("cnvsStringer");e=a.width;b=stringerData.split(",");g=parseFloat(b[0]);j=parseFloat(b[1]);k=parseFloat(b[2]);f=parseFloat(b[3]);r=parseFloat(b[4]);stringerInc=b[5];t=g-k-f;n=e*(j/g);b=e/g;a.setAttribute("height",n+40);a=a.getContext("2d");a.fillStyle=0==d?"#ffa500":"#A1A1A1";a.strokeStyle="#000";a.beginPath();a.moveTo(0,20);a.lineTo(e,20);a.lineTo(e-f*b,j*b+20);a.lineTo(k*
b,j*b+20);a.lineTo(0,20);c?(a.save(),a.shadowOffsetY=6,a.shadowBlur=10,a.shadowColor=0==d?"#c0c0c0":"#deb887",a.fill(),a.restore()):a.stroke();a.strokeStyle=c?"#c0c0c0":"#000";a.beginPath();a.moveTo(0,20);a.lineTo(0,20+j*b);a.lineTo(k*b,j*b+20);a.moveTo(e,20);a.lineTo(e,20+j*b);a.lineTo(e-f*b,20+j*b);a.stroke();h=e/(r+1);a.fillStyle="#000";for(i=1;i<r+1;i++)a.fillRect(i*h-2,20,2,4);a.font="12px Verdana";a.textBaseline="top";a.fillText(ConEng(g,!0),e/2,0);a.fillText(ConEng(t,!0),e/2,n+20+2);g=ConEng(f,
!0);a.fillText(g,e-a.measureText(g).width,n+20+2);a.fillText(ConEng(k,!0),8,n+20+2);a.fillText(ConEng(j,!0),4,n/2+20-6)}function ShowTotalRise(d){document.getElementById("tblTotalRise").style.background=0==d?"#ffff00":""}function SetStringerType(){var d=document.getElementById("rbUseStringerWidth").checked;document.getElementById("ddStringerWidthInches").disabled=!d;document.getElementById("ddStringerWidthFrac").disabled=!d;document.getElementById("ddConcThick").disabled=d}
function RunTalk(){RunTalkQR("RunTalk - Imperial",stringerInc,0)};
