//var navlist = new Array("ListInventory","SearchInventory","AsAdvertised","ProductLines", "MapDirection","TradeIn","Rentals","HoursDirectory","ContactUs","Home","Parts");
var navlist = new Array("ListInventory", "SearchInventory", "AsAdvertised", "ProductLines", "ProductLines", "TradeIn", "Rentals", "HoursDirectory", "ContactUs", "Home", "Parts");
var navlistInitState = new Array("off", "off", "off", "off", "off", "off", "off", "off", "off", "off", "off");

var loaded = false;

function preLoadImages() {
    if (document.images) {
        AsAdvertisedoff = new Image();
        AsAdvertisedoff.src = "images/AsAdvertisedoff.jpg";
        AsAdvertisedon = new Image();
        AsAdvertisedon.src = "images/AsAdvertisedon.jpg";
        ContactUsoff = new Image();
        ContactUsoff.src = "images/ContactUsoff.jpg";
        ContactUson = new Image();
        ContactUson.src = "images/ContactUson.jpg";
        HoursDirectoryoff = new Image();
        HoursDirectoryoff.src = "images/HoursDirectoryoff.jpg";
        HoursDirectoryon = new Image();
        HoursDirectoryon.src = "images/HoursDirectoryon.jpg";
        ListInventoryoff = new Image();
        ListInventoryoff.src = "images/ListInventoryoff.jpg";
        ListInventoryon = new Image();
        ListInventoryon.src = "images/ListInventoryon.jpg";
        //        	MapDirectionoff = new Image();
        //          MapDirectionoff.src = "images/MapDirectionoff.jpg";
        //		MapDirectionon = new Image();
        //      MapDirectionon.src = "images/MapDirectionon.jpg";
        SearchInventoryoff = new Image();
        SearchInventoryoff.src = "images/SearchInventoryoff.jpg";
        SearchInventoryon = new Image();
        SearchInventoryon.src = "images/SearchInventoryon.jpg";
        TradeInoff = new Image();
        TradeInoff.src = "images/TradeInoff.jpg";
        TradeInon = new Image();
        TradeInon.src = "images/TradeInon.jpg";
        Rentalsoff = new Image();
        Rentalsoff.src = "images/Rentalsoff.jpg";
        Rentalson = new Image();
        Rentalson.src = "images/Rentalson.jpg";
        ProductLinesoff = new Image();
        ProductLinesoff.src = "images/ProductLinesoff.jpg";
        ProductLineson = new Image();
        ProductLineson.src = "images/ProductLineson.jpg";
        Homeoff = new Image();
        Homeoff.src = "images/Homeoff.jpg";
        Homeon = new Image();
        Homeon.src = "images/Homeon.jpg";
        Partsoff = new Image();
        Partsoff.src = "images/Partsoff.jpg";
        Partson = new Image();
        Partson.src = "images/Partson.jpg";

        loaded = true;
    }
    resetNav();
}

function switchImageNav(imgName) {
    for (i = 0; i < navlist.length; i++) {
        if (imgName == navlist[i])
            rollOver(navlist[i], "on");
        else
            rollOver(navlist[i], "off")
    }
}

function rollOver(iName, iState) {
    if (document.images) {
        if (loaded) {
            document.images[iName].src = eval(iName + iState + '.src');
        }
    }
}

function resetNav() {
    for (i = 0; i < navlist.length; i++) {
        rollOver(navlist[i], navlistInitState[i])
    }
}
