function Window_onload(){document.getElementById("cbDrawStumps").onclick=DrawDeck;document.getElementById("cbDrawBearers").onclick=DrawDeck;document.getElementById("cbDrawJoists").onclick=DrawDeck;document.getElementById("cbDrawBoards").onclick=DrawDeck;DrawDeck();SetNumeric()}
function Form_Submit(){var b,c,d;if(document.getElementById("txtBearerSetinInner")!=null){if(b=parseInt(document.getElementById("txtBearerSetinInner").value),c=parseInt(document.getElementById("txtBearerSetinOuter").value),d=parseInt(document.getElementById("txtDeckWidth").value),d-=400,b+c>d)return alert("Total Inner + Outer Bearer Setin must be less than "+d),!1}else if(b=parseInt(document.getElementById("ddBearerInInnerFeet").value)*384+parseInt(document.getElementById("ddBearerInInnerInches").value)*
32+parseInt(document.getElementById("ddBearerInInnerFrac").value),c=parseInt(document.getElementById("ddBearerInOuterFeet").value)*384+parseInt(document.getElementById("ddBearerInOuterInches").value)*32+parseInt(document.getElementById("ddBearerInOuterFrac").value),d=parseInt(document.getElementById("ddWidthFeet").value)*384+parseInt(document.getElementById("ddWidthInches").value)*32+parseInt(document.getElementById("ddWidthFrac").value),d-=384,b+c>d)return alert("Total Inner + Outer Bearer Setin must be less than "+
ConEng(d,!0)),!1;return!0}
function DrawDeck(){var b=document.getElementById("cnvsDeck");if(b.getContext){var c=b.width,d=deckData.split(","),a=parseFloat(d[0]),h=parseFloat(d[1])/a;h*=c;b.setAttribute("height",h);var a=c/a,e=parseFloat(d[2])*a,j=parseFloat(d[3]*a),l=parseFloat(d[4]),o=parseFloat(d[5]),p=parseFloat(d[6])*a,f=parseFloat(d[7]),d=parseFloat(d[8])*a,d=Math.round(d),k=document.getElementById("cbDoubleBearers").checked,a=b.getContext("2d");a.fillStyle="#fff";a.fillRect(0,0,b.width,b.height);a.strokeStyle="#000";
var b=k?8:6,j=(h-(e+j)-b)/(l-1),g=e-3;if(document.getElementById("cbDrawStumps").checked){a.fillStyle="#5f9ea0";a.save();a.shadowOffsetY=10;a.shadowBlur=10;a.shadowColor="#c0c0c0";for(var m=k?14:12,r=(c-p*2-m)/(o-1),n,i=0;i<l;i++){n=p;for(var q=0;q<o;q++)a.fillRect(n,g,m,m),n+=r;g+=j}a.restore()}if(document.getElementById("cbDrawBearers").checked){g=e+b/2;for(i=0;i<l;i++){a.beginPath();a.strokeStyle="#f00";a.lineWidth=k?8:6;a.moveTo(0,g);a.lineTo(c,g);a.stroke();if(k)a.strokeStyle="#fff",a.lineWidth=
0.6,a.moveTo(0,g),a.lineTo(c,g),a.stroke();g+=j}}if(document.getElementById("cbDrawJoists").checked){a.beginPath();a.strokeStyle="#00f";a.lineWidth=4;e=2;for(f=(c-4)/(f-1);e<c;)a.moveTo(e,0),a.lineTo(e,h),e+=f;a.stroke()}if(document.getElementById("cbDrawBoards").checked){a.lineWidth=0.6;a.fillStyle="#deb887";a.strokeStyle="#8b4513";f=0;for(c*=0.75;f<h*0.6&&c>10;)a.fillRect(0,f,c,d),a.strokeRect(0,f,c,d),f+=d,c-=d}}}
function ShowBearer(b){var c=document.getElementById("divSetBearer");parseInt(c.style.left)>0?HideBearer():(c.style.top=FindPos(b).top+40+"px",c.style.left=FindPos(b).left+"px")}function HideBearer(){document.getElementById("divSetBearer").style.left="-10000px"}function ChangeBearer(b){b=b.value.split(",");document.getElementById("txtBearerDepth").value=b[0];document.getElementById("txtBearerThick").value=b[1];document.getElementById("cbDoubleBearers").checked=!0;HideBearer()}
function ShowJoist(b){var c=document.getElementById("divSetJoist");parseInt(c.style.left)>0?HideJoist():(c.style.top=FindPos(b).top+40+"px",c.style.left=FindPos(b).left+"px")}function HideJoist(){document.getElementById("divSetJoist").style.left="-10000px"}function ChangeJoist(b){b=b.value.split(",");document.getElementById("txtJoistDepth").value=b[0];document.getElementById("txtJoistThick").value=b[1];HideJoist()};
