function canvasReady() {
draw(document.getElementById('canvas').getContext('2d'));
}
function draw(ctx) {
ctx.translate(-10, 5);
ctx.scale(1.2, 0.8);
ctx.rotate(5 * Math.PI / 180);
// create new image object to use as pattern
var img = new Image();
img.onload = function(){
// create pattern
var ptrn = ctx.createPattern(img,'repeat');
ctx.shadowBlur = 15;
ctx.shadowOffsetX = 10;
ctx.shadowOffsetY = 10;
ctx.shadowColor = "gray";
ctx.beginPath();
ctx.strokeStyle = ptrn;
ctx.fillStyle = ptrn;
ctx.lineWidth = 6;
ctx.strokeRect(10,10,40,40);
ctx.strokeRect(30,30,40,40);
ctx.fillRect(50,50,40,40);
ctx.fillRect(70,70,40,40);
// prevent IE6 memory leak
img = null;
}
img.src = '../img/wallpaper.png';
}