﻿
function preloadImages() {

    // Declare variables
    var imageList = [];
    var d = document;
    
    // Add images to array
    imageList.push("images/mbhomehover.jpg");
    imageList.push("images/mbaboutushover.jpg");
    imageList.push("images/mbserviceshover.jpg");
    imageList.push("images/mbproductshover.jpg");
    imageList.push("images/mbcontactushover.jpg");
    
    // Convert base name to an image url and store in a document-level array,
    // called imageList.
    d.imageList = [];
    for (var i=0; i < imageList.length; i++) {
        d.imageList[i] = new Image();
        d.imageList[i].src = imageList[i];
    }
}
function swapImage(id, src) {
    
    var img = document.getElementById(id);
    if (img != null) {
        if (img.src != src)
            img.src = src;
    }
}

