function init() {
	mainMenu = document.getElementById("MainMenu");
	menuLinks = mainMenu.getElementsByTagName("a");
	
	for( var i = 0 ; i<menuLinks.length ; i++ ) {
		menuLinks[i].onmouseover = overImage;
		menuLinks[i].onmouseout = outImage;
		if( isLinkActive(menuLinks[i].href) ) {
			
			imgList =  menuLinks[i].getElementsByTagName("img");
			theImg = imgList[0];
			theImageLink = theImg.src;
			pathIndex = theImageLink.lastIndexOf("/");
			theImageLink = theImageLink.substr(0,pathIndex+1);
			
			theImg.src = theImageLink+theImg.getAttribute("oimg");
			theImg.setAttribute("nimg",theImg.getAttribute("oimg"));
		} 
	}
	//alert(menuLinks);
}

function isLinkActive( inLink ) {
	return (window.location == inLink);
}

function overImage( e ) {
	//if( e == null ) e = event;
	imgList = this.getElementsByTagName("img");
	theImg = imgList[0];
	theImageLink = theImg.src;
	pathIndex = theImageLink.lastIndexOf("/");
	theImageLink = theImageLink.substr(0,pathIndex+1);
	
	theImg.src = theImageLink+theImg.getAttribute("oimg");
	//alert(theImageLink);
}

function outImage( e ) {
	if( e == null ) e = event;
	imgList = this.getElementsByTagName("img");
	theImg = imgList[0];
	theImageLink = theImg.src;
	pathIndex = theImageLink.lastIndexOf("/");
	theImageLink = theImageLink.substr(0,pathIndex+1);
	
	theImg.src = theImageLink+theImg.getAttribute("nimg");
	//alert(theImageLink);
}
