//Create an array of images.
var ads = new Array('http://www.joshcomic.com/music/pmachete.jpg','http://www.joshcomic.com/music/srmunoz.jpg','http://www.joshcomic.com/music/novel.jpg','http://www.joshcomic.com/music/ninarock.jpg');
var links = new Array('http://www.patomachete.com/','http://itunes.apple.com/mx/album/sr-munoz/id359537125','http://itunes.apple.com/mx/album/novel/id366598478','http://www.myspace.com/ninarock');

//Get the max length.
var max = ads.length;

//Get the random number between 1 and max length.
var num = Math.floor((Math.random() * max));

//Create variable for displaying the image.
var DisplayAd = "<table border=0 cellspacing=0 cellpadding=0><tr><td><a href='" + links[num] + "'><img src='" + ads[num] + "' border=0></a></td></tr></table>";

//Display the image where the javascript is located in the html file.
document.write(DisplayAd);// JavaScript Document