if(!window.all){document.attachEvent("onreadystatechange",function(){if(document.readyState=="complete"){var d=document.getElementById("canvas"),a=document.createElement(d.outerHTML);d.parentNode.replaceChild(a,d);d=a;d.getContext=function(){if(this.cont)return this.cont;return this.cont=new PMD_2D(this)};d.style.width=d.attributes.width.nodeValue+"px";d.style.height=d.attributes.height.nodeValue+"px"}});var convert_style=function(d){var a=[];a=d.match(/.*\((\d*),(\d*),(\d*),(\d*)\)/);for(d=1;d<=
3;d++)a[d]=(a[d]*1).toString(16).length<2?"0"+(a[d]*1).toString(16):(a[d]*1).toString(16);return["#"+a[1]+a[2]+a[3],1]},PMD_2D=function(d){this.element_=d;this.pmd_arr=[];this.closePath=function(){this.pmd_arr.push({type:"close"})};this.clearRect=function(){this.element_.innerHTML="";this.pmd_arr=[]};this.beginPath=function(){this.pmd_arr=[]};this.moveTo=function(a,c){this.pmd_arr.push({type:"moveTo",x:a,y:c})};this.lineTo=function(a,c){this.pmd_arr.push({type:"lineTo",x:a,y:c})};this.arc=function(a,
c,b,e,f,g){if(!g){g=e;e=f;f=g}this.pmd_arr.push({type:"arc",x:a,y:c,radius:b,xStart:a+Math.cos(e)*b,yStart:c+Math.sin(e)*b,xEnd:a+Math.cos(f)*b,yEnd:c+Math.sin(f)*b})};this.rect=function(a,c,b,e){this.moveTo(a,c);this.lineTo(a+b,c);this.lineTo(a+b,c+e);this.lineTo(a,c+e);this.closePath()};this.fillRect=function(a,c,b,e){this.beginPath();this.moveTo(a,c);this.lineTo(a+b,c);this.lineTo(a+b,c+e);this.lineTo(a,c+e);this.closePath();this.stroke(true)};this.stroke=function(a){var c=[],b=convert_style(a?
this.fillStyle:this.strokeStyle)[0];c.push("<v:shape",' fillcolor="',b,'"',' filled="',Boolean(a),'"',' style="position:absolute;width:10;height:10;"',' coordorigin="0 0" coordsize="10 10"',' stroked="',!a,'"',' strokeweight="',this.lineWidth,'"',' strokecolor="',b,'"',' path="');for(a=0;a<this.pmd_arr.length;a++){b=this.pmd_arr[a];if(b.type=="moveTo"){c.push(" m ");c.push(Math.floor(b.x),",",Math.floor(b.y))}else if(b.type=="lineTo"){c.push(" l ");c.push(Math.floor(b.x),",",Math.floor(b.y))}else if(b.type==
"close")c.push(" x ");else if(b.type=="arc"){c.push(" ar ");c.push(Math.floor(b.x-b.radius),",",Math.floor(b.y-b.radius)," ",Math.floor(b.x+b.radius),",",Math.floor(b.y+b.radius)," ",Math.floor(b.xStart),",",Math.floor(b.yStart)," ",Math.floor(b.xEnd),",",Math.floor(b.yEnd))}}c.push(' ">');c.push("</v:shape>");this.element_.insertAdjacentHTML("beforeEnd",c.join(""));this.pmd_arr=[]}}};
