I am trying to implement this code to get my page to change a picture based on timer.

I am just learning and do not fully understand the whole piece of code, so if any can point me in the right direction i would appreciate it


HTML Code:
 <script type="text/javascript">

   <!--

if (document.images) { // Preloaded images
demo1 = new Image();
demo1.src = "http://node_charts_production.s3.amazonaws.com/cc9dcdc0389a7ff2c8af40ff6007e51c.png";

demo2 = new Image();
demo2.src = "http://node_charts_production.s3.amazonaws.com/85b6d5036c50481eb6f020372d4765ec.png";


}

function timeimgs(numb) { // Reusable timer
thetimer = setTimeout("imgturn('" +numb+ "')", 1000);
}

function imgturn(numb) { // Reusable image turner
if (document.images) {

if (numb == "2") { // This will loop the image
document["demo"].src = eval("demo2.src");
timeimgs('2');
}

else { document["demo"].src = eval("demo" + numb + ".src");

timeimgs(numb = ++numb);
}
}
}

// -->
</script>
Here is the img I am trying to change

HTML Code:
                <img src="http://node_charts_production.s3.amazonaws.com/85b6d5036c50481eb6f020372d4765ec.png"name="demo" alt="Mortgage Rate Chart" />