// Rollover script
// 2010 - James DiEdwardo:  Thank you God for all of my wonderful gifts!

// Test for occurence of strings in location href to determine what button to display in it's 'over' state

// This variable indicates which button to have in it's 'over' state - 0 means no buttons lit
var navnum = 0;

// In case a query string was passed, save it
var qstring = self.location.search.substring(1,self.location.search.length);

// The string we're testing is the location href
var targetstr = new String(self.location);

// This array holds all the strings we'll be testing for
var lookfor = new Array();
	lookfor[1] = /About/;
	lookfor[2] = /gallery/;
	lookfor[3] = /Vendors/;
	lookfor[4] = /Information/;
	lookfor[5] = /contact.asp/;

// This variable indicates how many nav items there are
var itemnum = lookfor.length-1;

// This determines which string is present in the location href
for (i=1; i<=itemnum; i++)
	{
	var strcheck = targetstr.search(lookfor[i]);
	if (strcheck != -1)
		{
		navnum = i;
		break;
		}
	}

// If a query string was passed, use that instead to force a menu item to be lit
//if (qstring !="")
//	{
//	var navstr = new String(qstring);
//	navnum = navstr.substring(1,navstr.length)
//	}

// The filepath to the images -  don't forget to include a forward slash at the end
var path = "graphics/";

// Initialize images
var nav_out = new Array();
var nav_over = new Array();
	for (i=1; i<=itemnum; i++)
		{
		nav_out[i] = new Image();
		nav_out[i].src = path + "menu" + i + "_out" + ".png";
		nav_over[i] = new Image();
		nav_over[i].src = path + "menu" + i + "_over" + ".png";
		}

// MouseOver
function imgOn(imgNum)
	{
	// If this button is not lit
	if (("nav"+navnum)!=("nav"+imgNum))
		{
		document["menu"+imgNum].src = nav_over[imgNum].src;
		}
	}
            
// MouseOut
function imgOut(imgNum)
	{
	// If this button is not lit
	if (("nav"+navnum)!=("nav"+imgNum))
		{
		document["menu"+imgNum].src = nav_out[imgNum].src;
		}
	}

function initRollovers()
	{
	if(navnum != 0){document["menu"+navnum].src = nav_over[navnum].src;}
	}

window.onload = initRollovers;
