Canvas drawing..strange behaviour
===

I have a problem with the canvas element. The code is really simple, but if I switch from my tab to another and after i go back, what happens is shown in the figure. Anyone has an explanation for this?

    var canvas = $('#image')[0];
    canvas.height = 785;
    canvas.width = 448;
	
    var img = new Image();
    img.onload = function() {
        var context = canvas.getContext('2d');
        context.drawImage(img, 0, 0);
    };![This is what happens][1]


  [1]: http://i.stack.imgur.com/Li09K.png