// closeMe used to close the last menu opened
var closeMe = '';

/*
creating image objects forces the browser cache the image
and makes the rollovers run more smoothly
*/

home_on = new Image();
home_on = '/images/home_on.gif';
home_off = new Image();
home_off = '/images/home_off.gif';

products_on = new Image();
products_on = '/images/products_on.gif';
products_off = new Image();
products_off = '/images/products_off.gif';

tourn_on = new Image();
tourn_on = '/images/tourn_on.gif';
tourn_off = new Image();
tourn_off = '/images/tourn_off.gif';

forum_on = new Image();
forum_on = '/images/forum_on.gif';
forum_off = new Image();
forum_off = '/images/forum_off.gif';

email_on = new Image();
email_on = '/images/email_on.gif';
email_off = new Image();
email_off = '/images/email_off.gif';
/*
The rollOver function expects the name attribute of the image to be passed to it,
plus 1 or 0 corresponding to 'on' or 'off', respectively.

also, the function works with the sub_nav div id's so be sure all names and ids match up
*/

function rollOver(imgName,state,rootPath) {

	imgObj = eval('document.' + imgName);

	//menuObj = buildObj('sub_' + imgName);

	if (state) {
		imgObj.src =eval(imgName + '_on');
		//alert(imgObj.src);
		
		/*
		if (closeMe) & if (menuObj)
		Easy way to be sure subnav menu object exists before trying to use it.
		This allows you to use this same function for non-nav rollovers and keeps you from having to build empty menus or exclude mouseover code on nav without subnav.
		*/

		/*if (closeMe) {
			closeMe.style.visibility = 'hidden';
		}

		if (menuObj) {
			menuObj.style.visibility = 'visible';
			closeMe = menuObj;
		}*/

	} else {
		//alert(imgName);
		
		imgObj.src=eval(imgName + '_off');
		//alert(imgObj.src);
	}

}

/*
generic function for creating an object by its id attribute
*/

function buildObj(id) {

	if (document.all) {
		obj = document.all[id];
	} else {
		obj = document.getElementById(id);
	}

	return obj;

}

/*
generic pop up function, expects filename to be opened to be passed to it
*/

function popWin(fileName) {
	newWin = window.open(fileName,'popup','width=289,height=332,scrollbars=no,resizable=no');
}
function showFlash(object) {
  	document.getElementById(object).style.display = 'inline';
}
function hideFlash(object) {
	document.getElementById(object).style.display = 'none';
}