if(top!=self)top.location=self.document.location;function Window_onload(){Calculate()}
function Calculate(){var b=document.getElementById("cnvsDovetail");if(b.getContext){var c=(parseFloat(document.getElementById("ddWidthInches").value)*32+parseFloat(document.getElementById("ddWidthFrac").value))*3,n=(parseFloat(document.getElementById("ddOffsetInches").value)*32+parseFloat(document.getElementById("ddOffsetFrac").value))*3,i=parseFloat(document.getElementById("ddTailThick").value)*3,j=parseFloat(document.getElementById("ddSocketThick").value)*3,o=document.getElementById("cbColor").checked,
m=parseFloat(document.getElementById("ddRatio").value),p=parseFloat(document.getElementById("ddTails").value),k=document.getElementById("cbFullTemplate").checked,l=k?420:280,e=l/2,f=i/2;i=e-f;f=k?e+f:80;var q=i-j;j=f+j;var u=i-n;n=f+n;var r=c/2,a=b.getContext("2d");b.setAttribute("height",l);b.setAttribute("width",c+1);a.clearRect(0,0,b.width,b.height);b=c/(p+1+p*m);m=b*m;a.font="28px Arial";a.textBaseline="top";var g="X",h=a.measureText(g).width;h=h/2;var s=e-h,d=b;a.fillStyle="#000";k&&a.fillText(g,
d/2-h,s);e="";for(var t=0;t<p;t++){e+=ConEng(d/3)+", ";a.beginPath();if(k){a.moveTo(r,u);a.lineTo(d,i);a.lineTo(d,f)}else a.moveTo(d,f);a.lineTo(r,n);d+=m;e+=ConEng(d/3)+", ";a.lineTo(d,f);if(k){a.lineTo(d,i);a.fillText(g,d+b/2-h,s)}a.closePath();if(o){a.save();a.fillStyle="#00f";a.fill();a.restore()}a.stroke();d+=b}e=e.substring(0,e.length-2);a.fillStyle=o?"#00f":"#fff";if(k){a.fillRect(0,0,c,q);a.strokeRect(0,0,c,q)}a.fillRect(0,j,c,l-j);a.strokeRect(0,j,c,l-j);if(k){a.beginPath();a.moveTo(0,i);
a.lineTo(c,i);a.moveTo(0,f);a.lineTo(c,f);a.stroke()}a.font="10px Verdana";a.fillStyle=o?"#fff":"#000";g="Tail Width "+ConEng(m/3,true)+" - Gap "+ConEng(b/3,true);h=a.measureText(g).width;a.fillText(g,c/2-h/2,l-40);g="Tails "+e;h=a.measureText(g).width;a.fillText(g,c/2-h/2,l-18)}};
