

var mainMenu = {
	
	highLight : function(event) {
		var listItemLink = Event.element(event);
		var listItem = listItemLink.up(0); 
		var unsortedList = listItem.up(0); 
		
		unsortedList.immediateDescendants().each(function(thisLI){
			thisLI.setStyle({
				background: 'none'
			});
			thisLI.down(0).setStyle({
				fontWeight: 'normal'
			});
		});
		
		listItemLink.setStyle({
			fontWeight: 'bold'
		});
		
		listItemLink.up(0).setStyle({
			backgroundImage: 'url("'+jsImagePath+'menu_content_active.jpg")',
			backgroundRepeat: 'no-repeat',
			backgroundPosition: 'right'
		});
		
		if(listItem.immediateDescendants().length > 1) {
			var thisSubMenu = listItem.down(1);
			$('submenu_holder').update(thisSubMenu.innerHTML);
		}
		
	}
	
	
};

Event.observe(window, 'load', function() { 
	// Do mainmenu
	if($('main_navigation')) {
		var mainItems = $('main_navigation').down(0).immediateDescendants();
		
		mainItems.each(function(mainItem){
			Event.observe(mainItem.down(0), 'mouseover', mainMenu.highLight.bindAsEventListener(mainMenu));
		});
	}
	
	// Init mainmenu
	if($('main_navigation')) {
		var firstMenuitem = $('main_navigation').down(1);
		firstMenuitem.down(0).setStyle({
			fontWeight: 'bold'
		});
		firstMenuitem.setStyle({
			backgroundImage: 'url("'+jsImagePath+'menu_content_active.jpg")',
			backgroundRepeat: 'no-repeat',
			backgroundPosition: 'right'
		});
		if(firstMenuitem.immediateDescendants().length > 1) {
			var thisSubMenu = firstMenuitem.down(1);
			$('submenu_holder').update(thisSubMenu.innerHTML);
		}
	}
});
