////////////////////////////////////////////////////////////////
// the following 4 variables can be changed
//
// NOTE: if this script is not working, make sure that you
// have the TITLES variable set on the calling page
////////////////////////////////////////////////////////////////

////////////////////////////////////////////
// an array of image string names for the
// rollovers
////////////////////////////////////////////

var TITLES = new Array("home", "portfolio", "about", "publications", "contact");

////////////////////////////////////////////
// the default nav menu for this page to leave on
////////////////////////////////////////////

var DEFAULT_ROLLOVER_MENU = "";

////////////////////////////////////////////
// basic settings for where items are,
// what extension is used and what prefix
// is used to show the rollover image
//
// NOTE: these can be moved out to the 
// calling page if for some reason they
// vary from page to page
////////////////////////////////////////////

var PIC_DIR = "images/nav/";
var OVER_PREFIX = "_o";
var IMG_EXTENSION = ".gif";

////////////////////////////////////////////////////////////////
// do not edit code below this point
////////////////////////////////////////////////////////////////

// if this isn't ok, then i'll eat my hat (it's an old script)
var BROSWER_ROLLOVER = (document.images) ? true : false;

// the array of menu images
var menuImages = new Array();

// the preload
function preloadImages () {
    if (TITLES == null) {
        // this should only happen if there's an error
        alert("There are no images in the TITLES array");
        return;
    }

    if (BROSWER_ROLLOVER) {
        for (i=0; i < TITLES.length; i++) {
            var btn = (PIC_DIR + TITLES[i] + OVER_PREFIX + IMG_EXTENSION);
            menuImages[i] = new Image();
            menuImages[i].src = btn;
        }
    }
}

// the rollover function        
function imgRoll (item, state) {
    if (TITLES == null) {
		return;
	} else if (BROSWER_ROLLOVER) {
        var a = (PIC_DIR + TITLES[item] + OVER_PREFIX + IMG_EXTENSION);
        var b = (PIC_DIR  + TITLES[item] + IMG_EXTENSION);
        document.getElementById(TITLES[item]).src = (state) ? a : b;
		// the default item
		if ((DEFAULT_ROLLOVER_MENU != "") && (! state)) {
            document.getElementById(DEFAULT_ROLLOVER_MENU).src = (PIC_DIR + DEFAULT_ROLLOVER_MENU + OVER_PREFIX + IMG_EXTENSION);
        }
    }
}

// change the class name of an object
var ignoreItemId = "";
function itemRoll (el, cssClass) {
	if ((ignoreItemId == "") || ((ignoreItemId != "") && (ignoreItemId != el))) {
		document.getElementById(el).className = cssClass;
	}
}

// window.onload = preloadImages;

