//--------------------------------------------------------------------------------------------
//Rotating  images

//ALL images should be the same size
//This preloads images that are named imageXX.gif where XX is 1 to the number of images
//constants 
var IMAGEPATH = "images/"; //EDITTHIS to path of image directory
var IMAGECT = 6; //EDITTHIS with total number of images to rotate
var WIDTH_IMAGE = 709; //EDITTHIS with images' width (assumes all are same size)
var HEIGHT_IMAGE = 355; //EDITTHIS with images' height (assumes all are same size)

var garrImages = new Array();

//pre-load images
for (i = 1; i <= IMAGECT; i++) {
    var img = new Image(WIDTH_IMAGE, HEIGHT_IMAGE);
    if (i < 10)
        img.src = IMAGEPATH+"image0"+i+".jpg"; //EDITTHIS to name of image files
    else
        img.src = IMAGEPATH+"image"+i+".jpg"; //EDITTHIS to name of image files
    var index = i-1;
    garrImages[index] = img;
}
// if need to add custom file names do so here
// img = new Image(WIDTH_IMAGE, HEIGHT_IMAGE);
// img.src = IMAGEPATH+"anotherimage.gif"; //NEW CUSTOM FILENAME
// garrImages[] = img;

function randomImage1() {
    //randomly select a banner to display
    var nRand = Math.random();
    var nIndex = Math.floor(nRand*garrImages.length);    
    
        var s = "<img usemap='#FPMap0' name='banner' alt='' border='0' width='"+WIDTH_IMAGE+"' height='"+HEIGHT_IMAGE+"' "; //EDITTHIS change name to html img tag name
        s += "src='"+ garrImages[nIndex].src +"'>";
        document.write(s);
        return;
}


