/* javascript image changer for the header of the iohelix pages created by benjam welker 2005-07-30 last updated 2007-05-23 function call: changeimage(index); where index is a bit flag letting the script know if the calling document is the main index page for the site 1 = yes, 0 = no, null = no example: changeimage(1); ----------------- given data: today - 0907 dir_image - solar dir - solar */ function changeimage(index) { // create an array with all the image names in it var image = new Array( 'backlit_saturn.jpg','death_star_2.jpg','earth.jpg','hoags_object.jpg','jovian_moon.jpg','jupiter_crescent.jpg','luna.jpg','lunar_eclipse.jpg','marble.jpg','mars.jpg','neptune.jpg','o.jpg','saturn.jpg','sol.jpg','triton.jpg','jupiter.jpg','blue_sun.jpg','annular_eclipse.jpg','milky_way.jpg' ); // select a random image from the array var i = Math.floor(Math.random( ) * image.length); // use small images by default var sizePre = 'sm_'; var divName = 'headerwrapper'; if (1 == index) { // if we are veiwing the index page, use large images sizePre = ''; divName = 'hsolarobject'; } //setup the image string and send it to the user var bgimage = "url('/images/solar/" + sizePre + image[i] + "')"; document.getElementById(divName).style.backgroundImage = bgimage; }