window.onload = Initall;
function Initall() {
	rolloverInit();
	thumboverInit();
}

function rolloverInit() {

    // Go over all the images in the document
    for (var i=0; i<document.images.length; i++) {

        // check to see if the image is inside a link
        if (document.images[i].parentNode.tagName == "A") {

            // if yes, create a rollover
            setupRollover(document.images[i]);
        }
    }
}       
        

// This function assumes that the user has set up some
// fields in the HTML file as follows:
//
//      id          - is the name of the image
//      id_out.gif  - is the default image
//      id_on.gif   - is the image when the mouse is over it
//
function setupRollover(thisImage) {
    
    // Create a place to store the current image
    thisImage.outImage = new Image();

    // Copy that image for use later
    thisImage.outImage.src = thisImage.src;

    // Set up the event handler
    thisImage.onmouseout = rollOut;

    // Create a place to store the new image
    thisImage.overImage = new Image();

    // Construct the path to the hover image, this loads it
    // as well
    thisImage.overImage.src = "../images/" + thisImage.id + "_over.gif";

    // Set up the event handler
    thisImage.onmouseover = rollOver;
}       

function rollOver() {
    this.src = this.overImage.src;
}       

function rollOut() {
    this.src = this.outImage.src;
}
