function Window_onload(){document.getElementById("cbDrawStumps").onclick=DrawDeck;document.getElementById("cbDrawBearers").onclick=DrawDeck;document.getElementById("cbDrawJoists").onclick=DrawDeck;document.getElementById("cbDrawBoards").onclick=DrawDeck;DrawDeck()}
function DrawDeck(){var d=document.getElementById("cnvsDeck");if(d.getContext){var c=d.width,b=deckData.split(","),a=parseFloat(b[0]),h=parseFloat(b[1])/a;h=c*h;d.setAttribute("height",h);a=c/a;var e=parseFloat(b[2])*a,j=parseFloat(b[3]*a),l=parseFloat(b[4]),o=parseFloat(b[5]),p=parseFloat(b[6])*a,f=parseFloat(b[7]);b=parseFloat(b[8])*a;b=Math.round(b);var k=document.getElementById("cbDoubleBearers").checked;a=d.getContext("2d");a.fillStyle="#fff";a.fillRect(0,0,d.width,d.height);a.strokeStyle="#000";
d=k?8:6;j=(h-(e+j)-d)/(l-1);var g=e-3;if(document.getElementById("cbDrawStumps").checked){a.beginPath();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+d/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=c*0.75;f<h*0.6&&c>10;){a.fillRect(0,f,c,b);a.strokeRect(0,f,c,b);f+=b;c-=b}}}};