// Functions to do roll-overs and update the menu in relation to links on subpages.
// The parameters are the id of the image as defined under <img> and - in the case 
// of switchPage - the link to follow.
// Tested on Explorer 5-6, Netscape 6, Omniweb 4, iCab 2.8
// Depends on currentImage, defined in menu.html
//
// Joakim NygŚrd, July 2002 - http://jokke.dk

// imageOn turns on one image and turns off all others
function imageOn(theImage)
{
	for(var i=1; i<=6; i++)
	{
		if(i == theImage || i == parent.menu.currentImage ){
			eval("parent.menu.document.images['item"+i+"'].src='images/menu/item"+i+"_on.gif'");
		}else{
			eval("parent.menu.document.images['item"+i+"'].src='images/menu/item"+i+"_off.gif'");
		}
	}
}

// imageOff turns off all images but the currently active.
function imageOff(theImage)
{
	for(var i=1; i<=6; i++)
		{
			if( i == parent.menu.currentImage ){
				eval("parent.menu.document.images['item"+i+"'].src='images/menu/item"+i+"_on.gif'");
			}else{
				eval("parent.menu.document.images['item"+i+"'].src='images/menu/item"+i+"_off.gif'");
			}
		}	
}	

// updates currentImage and calls imageOn	
function turnOn(theImage)
{
	parent.menu.currentImage = theImage;
	imageOn(theImage);
	
}

// turns the correct image on and follows the link
function switchPage(theImage, thePage)
{
	turnOn(theImage);
	self.location = thePage;
}
