only a plain canvas shows up and the images don't load
<canvas width=800 height=500 id='egypt_id'></canvas>
<script>
//setup
var canvas = document.getElementById('egypt_id');
var context = canvas.getContext('2d');
var mubarak_x = 700;
var mubarak_y = 50;
var morsi_x = 25;
var morsi_y = 150;
var qm_x = 500;
var qm_y = 200;
//make new image objects
var egypt_img = new Image();
var mubarak_img = new Image();
var morsi_img = new Image();
var qm_img = new Image();
//these functions draw images on the canvas, at the given position
egypt.onload=function draw_egypt()
{
context.drawImage(egypt_img,0, 0);
}
function draw_mubarak()
{
//image
context.drawImage(mubarak_img, mubarak_x, mubarak_y);
//label
context.fillStyle = 'black';
context.font = 'bold 16px Arial';
context.fillText('Mubarak', mubarak_x, mubarak_y);
}
function draw_morsi()
{
//image
context.drawImage(morsi_img, morsi_x, morsi_y);
//label
context.fillStyle = 'black';
context.font = 'bold 16px Arial';
context.fillText('Morsi', morsi_x, morsi_y);
}
function draw_qm()
{
//image
context.drawImage(qm_img, qm_x, qm_y);
//label
context.fillStyle = 'black';
context.font = 'bold 16px Arial';
context.fillText('?', qm_x, qm_y);
}
//load images
//draw this image as soon as it loads
egypt_img.onload = draw_egypt;
egypt_img.src = 'media/egypt.png';
function line_mubarak_morsi()
{
//draw line between mubarak and morsi
context.lineWidth = 5;
context.strokeStyle = 'lightblue';
//pick-up pen
context.beginPath();
//start
context.moveTo(mubarak_x, mubarak_y);
//end
context.lineTo(morsi_x, morsi_y);
//draw it
context.stroke();
}
function line_morsi_qm()
{
//draw line between morsi and qm
context.lineWidth = 5;
context.strokeStyle = 'lightblue';
//pick-up pen
context.beginPath();
//start
context.moveTo(morsi_x, morsi_y);
//end
context.lineTo(qm_x, qm_y);
//draw it
context.stroke();
}
function redraw()
{
//redraws everything, spread over three seconds...
//immediately draw background (covering all old stuff)
draw_egypt();
//after one second
setTimeout(draw_mubarak, 1000);
//after two seconds
setTimeout(line_mubarak_morsi, 2000);
setTimeout(draw_morsi, 2000);
//after three seconds
setTimeout(line_morsi_qm, 3000);
setTimeout(draw_qm, 3000);
}
//finally: call the redraw function every four seconds, forever...
setInterval(redraw, 4000);
</script>




var egypt_imgandegypt.onloaddon't match. Don't you meanegypt_img.onload?