function Setup(){document.getElementById("cbDrawStumps").onclick=DrawDeck;document.getElementById("cbDrawBearers").onclick=DrawDeck;document.getElementById("cbDrawJoists").onclick=DrawDeck;document.getElementById("cbDrawBoards").onclick=DrawDeck;DrawDeck()}
function DrawDeck(){var a=document.getElementById("cnvsDeck");if(a.getContext){var c=a.width,b=deckData.split(","),d=parseFloat(b[0]),h=parseFloat(b[1])/d;h=c*h;a.setAttribute("height",h);var e=c/d,f=parseFloat(b[2])*e,j=parseFloat(b[3]*e),k=parseFloat(b[4]),n=parseFloat(b[5]),o=parseFloat(b[6])*e;d=parseFloat(b[7]);b=parseFloat(b[8])*e;b=Math.round(b);e=document.getElementById("cbDoubleBearers").checked;a=a.getContext("2d");a.strokeStyle="#000";var p=e?4:3;j=(h-(f+j)-p)/(k-1);var g=f-3;if(document.getElementById("cbDrawStumps").checked){a.fillStyle=
"#5f9ea0";a.save();a.shadowOffsetY=6;a.shadowBlur=6;a.shadowColor="#c0c0c0";for(var l=e?12:10,r=(c-o*2-l)/(n-1),m,i=0;i<k;i++){m=o;for(var q=0;q<n;q++){a.fillRect(m,g,l,l);m+=r}g+=j}a.restore()}if(document.getElementById("cbDrawBearers").checked){g=f+p/2;for(i=0;i<k;i++){a.strokeStyle="#f00";a.lineWidth=e?6:4;a.beginPath();a.moveTo(0,g);a.lineTo(c,g);a.stroke();if(e){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.strokeStyle=
"#00f";a.lineWidth=3;f=1.5;d=(c-3)/(d-1);for(a.beginPath();f<c;){a.moveTo(f,0);a.lineTo(f,h);f+=d}a.stroke()}if(document.getElementById("cbDrawBoards").checked){a.lineWidth=0.6;a.fillStyle="#deb887";a.strokeStyle="#8b4513";d=0;for(c=c*0.75;d<h*0.6&&c>10;){a.fillRect(0,d,c,b);a.strokeRect(0,d,c,b);d+=b;c-=b}}}};