Main.JSBackgroundSwitching



var mainMenuBGPanel = document.getElementById("BGPANELID");
var mainMenuTabs = [];
mainMenuTabs.push(document.getElementById("TAB1ID"));
mainMenuTabs.push(document.getElementById("TAB2ID"));
mainMenuTabs.push(document.getElementById("TAB3ID"));

function mainMenuTabOver(theEvent)
{
	// get event object describing this event, just in case
	if (!theEvent) 
		theEvent = window.event;

	// modify background image of main BG panel
	if (this.id == "TAB1ID")
		mainMenuBGPanel.style.backgroundImage = "url(dsfsfdsf1.jpg)";   // or use jquery addClass() etc
	else if (this.id == "TAB2ID")
		mainMenuBGPanel.style.backgroundImage = "url(dsfsfdsf2.jpg)";
	else if (this.id == "TAB3ID")
		mainMenuBGPanel.style.backgroundImage = "url(dsfsfdsf3.jpg)";

}

function mainMenuTabOut(e)
{
	mainMenuBGPanel.style.backgroundImage = "url(DEFAULT.jpg)";
}

// Register event handling functions
var mainMenuTabCount = mainMenuTabs.length;
for (var t = 0; t < mainMenuTabCount; t++)
{
	mainMenuTabs[t].onmouseover = mainMenuTabOver;
	mainMenuTabs[t].onmouseout = mainMenuTabOut;
}