function multtableMain(){w=610
h=380
s="";s+='
';s+='
';s+='
3 x 3 = 9
';s+='
© 2015 MathsIsFun.com v 0.81
';s+='
';s+='
';document.write(s);el=document.getElementById('canvasId');ratio=4
el.width=w*ratio;el.height=h*ratio;el.style.width=w+"px";el.style.height=h+"px";g=el.getContext("2d");g.setTransform(ratio,0,0,ratio,0,0)
tiles=[]
for(var c=0;c<=12;c++){tiles[c]=[]
for(var r=0;r<=12;r++){var t=new Tile(g,r,c)
tiles[c][r]=t}}
el.addEventListener('touchmove',ontouchmove,false);el.addEventListener('mousemove',onmousemove,false);update();}
function onmousemove(e){var rect=el.getBoundingClientRect();var x0=(e.clientX-rect.left);var y0=(e.clientY-rect.top);var c0=Math.floor(x0/45);var r0=Math.floor(y0/25);if(c0<1||c0>12)return
if(r0<1||r0>12)return
document.getElementById("mult").innerHTML=r0+" × "+c0+" = "+r0*c0
for(var c=0;c<=12;c++){for(var r=0;r<=12;r++){lvl=1
var t=tiles[r][c]
if(r==r0&&c0)s=this.r
if(this.c>0)s=this.c
this.g.fillStyle="#0000ff"
this.g.textAlign="center"
this.g.font="bold 17px Verdana"
this.g.fillText(s,lt+wd/2,tp+20)}}else{this.g.stroke();lvls=["#eeeeff","#eeeeff","#ffffee","#aaccff"]
this.g.fillStyle=lvls[this.lvl]
this.g.fill()
this.g.fillStyle="#000000"
this.g.textAlign="center"
this.g.font="15px Verdana"
this.g.fillText(this.c*this.r,lt+wd/2,tp+18)}};function hiGraphics(){lineWidth=5;lineJoin="round";strokeStyle="#333";}
hiGraphics.prototype.clear=function(el){g=el.getContext("2d");g.clearRect(0,0,el.width,el.height);return true;};hiGraphics.prototype.lineStyle=function(width,clr,opacity){lineWidth=width;lineJoin="round";strokeStyle=clr;};hiGraphics.prototype.stt=function(){g.beginPath();g.lineWidth=lineWidth;g.lineJoin=lineJoin;g.strokeStyle=strokeStyle;};hiGraphics.prototype.drawCircle=function(g,circleX,circleY,circleRadius){this.stt();g.fillStyle="#FF0000";g.arc(circleX,circleY,circleRadius,0,2*Math.PI);g.stroke();return true;};hiGraphics.prototype.drawCompass=function(g,circleX,circleY,tickRadius){var tickLen=15;for(var i=0;i<360;i+=15){var angle=i*Math.PI/180.;if(i%90){this.lineStyle(1,"#888888",1);}else{this.lineStyle(2,"#444444",1);}
this.stt();var cX=circleX+Math.cos(angle)*tickRadius;var cY=circleY-Math.sin(angle)*tickRadius;g.moveTo(cX,cY);cX=circleX+Math.cos(angle)*(tickRadius+tickLen);cY=circleY-Math.sin(angle)*(tickRadius+tickLen);g.lineTo(cX,cY);g.stroke();cX=circleX+Math.cos(angle)*(tickRadius+tickLen+14)-12;cY=circleY-Math.sin(angle)*(tickRadius+tickLen+14)+5;g.font="12px Arial";g.fillText(i+"°",cX,cY,100);}};hiGraphics.prototype.drawArc=function(g,midX,midY,radius,fromAngle,toAngle){this.stt();g.arc(midX,midY,radius,fromAngle,toAngle);g.stroke();};hiGraphics.prototype.drawBox=function(g,midX,midY,radius,angle){this.stt();var pts=[[0,0],[Math.cos(angle),Math.sin(angle)],[Math.cos(angle)+Math.cos(angle+Math.PI/2),Math.sin(angle)+Math.sin(angle+Math.PI/2)],[Math.cos(angle+Math.PI/2),Math.sin(angle+Math.PI/2)],[0,0]];for(var i=0;i