﻿/* 
    This code runs when the page loads. It pre-caches all of the main and rollover images for
    our navigation.
*/

if (document.images)
{
    var imagesNormal = new Object();
    imagesNormal['billpaymentinformation'] = new Image(140, 10);
    imagesNormal['billpaymentinformation'].src = 'images/billPaymentInformation.jpg';
    imagesNormal['accountmanagement'] = new Image(110, 10);
    imagesNormal['accountmanagement'].src = 'images/accountManagement.jpg';
    imagesNormal['yourhome'] = new Image(54, 10);
    imagesNormal['yourhome'].src = 'images/yourhome.jpg';
    imagesNormal['yourbusiness'] = new Image(71, 10);
    imagesNormal['yourbusiness'].src = 'images/yourbusiness.jpg';
    imagesNormal['electricsafety'] = new Image(77, 10);
    imagesNormal['electricsafety'].src = 'images/electricsafety.jpg';
    imagesNormal['spanish'] = new Image(55, 10);
    imagesNormal['spanish'].src = 'images/spanish.jpg';
    
 
    var imagesHighlight = new Object();
    imagesHighlight['billpaymentinformation'] = new Image(140, 10);
    imagesHighlight['billpaymentinformation'].src = 'images/billPaymentInformation_selected.jpg';
    imagesHighlight['accountmanagement'] = new Image(110, 10);
    imagesHighlight['accountmanagement'].src = 'images/accountManagement_selected.jpg';
    imagesHighlight['yourhome'] = new Image(54, 10);
    imagesHighlight['yourhome'].src = 'images/yourhome_selected.jpg';
    imagesHighlight['yourbusiness'] = new Image(71, 10);
    imagesHighlight['yourbusiness'].src = 'images/yourbusiness_selected.jpg';
    imagesHighlight['electricsafety'] = new Image(77, 10);
    imagesHighlight['electricsafety'].src = 'images/electricsafety_selected.jpg';
    imagesHighlight['spanish'] = new Image(55, 10);
    imagesHighlight['spanish'].src = 'images/spanish_selected.jpg';
    
}
        
function setImage(imgName, type)
{
    if (document.images)
    {
        if (type == 'hilite')
        {
            document.images[imgName].src = imagesHighlight[imgName].src;
            return true;
        }
        else if (type = 'normal')
        {
            document.images[imgName].src = imagesNormal[imgName].src;
            return true; 
        }
        return false;
    }
}

