if(top!=self)top.location=self.document.location;function Window_onload(){Calculate();SetNumeric()}
function Calculate(){for(var o=0;o<2;o++){var p=o==1,b;b=p?document.getElementById("cnvsDovetailR"):document.getElementById("cnvsDovetail");if(b.getContext){var e=parseFloat(document.getElementById("txtWidth").value);if(isNaN(e)||e<60||e>400){alert("Please Enter Valid Width\n\nMin 60 Max 400");document.getElementById("txtWidth").focus();return}e=e*3.77952755905512;var c=parseFloat(document.getElementById("ddThick").value)*3.77952755905512,q=parseFloat(document.getElementById("ddPinWidth").value)*
3.77952755905512,l=document.getElementById("cbColor").checked,m=parseFloat(document.getElementById("ddPitch").value),h=c/2,i=240-h,g=240+h,j=i-c;h=g+c;var f=c/m,d=c/2;m=d;var k=c-f*2,n=e-(d*2+q*2+f*4+k*2),a=b.getContext("2d");b.setAttribute("height",480);b.setAttribute("width",e);a.clearRect(0,0,b.width,b.height);if(l){a.fillStyle=p?"#f00":"#00f";a.fillRect(0,0,e,j);a.fillRect(0,h,e,480-h);if(p){a.fillRect(0,j,e,h-j);a.fillStyle="#fff"}else{a.fillStyle="#fff";a.fillRect(0,j,e,h-j);a.fillStyle="#00f"}}a.beginPath();
a.moveTo(d,h);a.lineTo(d+f,g);a.lineTo(d-f,j);a.lineTo(d+k+f*3,j);a.lineTo(d+f+k,g);a.lineTo(d+k+f*2,h);a.closePath();l?a.fill():a.stroke();d+=k+f*2+q;a.beginPath();a.moveTo(d+f,h);a.lineTo(d,g);a.lineTo(d+f*2,j);a.lineTo(d+n-f*2,j);a.lineTo(d+n,g);a.lineTo(d+n-f,h);a.closePath();l?a.fill():a.stroke();d+=n+q;a.beginPath();a.moveTo(d,h);a.lineTo(d+f,g);a.lineTo(d-f,j);a.lineTo(d+k+f*3,j);a.lineTo(d+f+k,g);a.lineTo(d+k+f*2,h);a.closePath();l?a.fill():a.stroke();l||a.strokeRect(0,0,b.width,b.height);
a.beginPath();a.moveTo(0,i);a.lineTo(e,i);a.moveTo(0,g);a.lineTo(e,g);a.moveTo(0,i-c);a.lineTo(e,i-c);a.moveTo(0,g+c);a.lineTo(e,g+c);a.stroke();a.font="22px  Verdana";a.fillStyle="#000";b="X";a.textBaseline="top";c=a.measureText(b).width;c=c/2;i=240-c;g=e/2;if(p){a.fillText(b,m/2-c+k,i);a.fillText(b,g-c,i);a.fillText(b,e-m/2-c-k,i)}else{a.fillText(b,m/2-c,i);a.fillText(b,g-n/2-q/2-c,i);a.fillText(b,g+n/2+q/2-c,i);a.fillText(b,e-m/2-c,i)}a.font="bold 16px  Verdana";a.fillStyle="#fff";b="Print - Fold Over Wood";
c=a.measureText(b).width;a.fillText(b,e/2-c/2,20);b="Cut Through Paper Template";c=a.measureText(b).width;a.fillText(b,e/2-c/2,47);a.fillStyle=l?"#fff":"#000";a.font="bold 36px  Verdana";b=p?"B":"A";c=a.measureText(b).width;a.fillText(b,e/2-c/2,h+6)}}}
function PitchChanged(o){if(o.value=="0"){document.getElementById("rbEvenGapsTails").checked=true;document.getElementById("rbEvenSpacing").checked=true;document.getElementById("spn4t2c").style.display="none";document.getElementById("spnSetTailWidth").style.display="none";document.getElementById("divGapType").style.display="none"}else{document.getElementById("spn4t2c").style.display="block";document.getElementById("spnSetTailWidth").style.display="block";document.getElementById("divGapType").style.display=
"block"}Calculate()};
