$(document).ready(function()
{
	// settings
	var settings = {
		colorBgOff: 	"#272F8F",
		colorBgOn: 		"#3C4398",
		colorBgCurrent:	"#5259A5",
		timeSlideDown: 	900,
		timeSlideUp: 	400
	}
	
	// set bgcolor for active item
	$("#mainMenu div.menuItemCurrent").css({backgroundColor: settings.colorBgCurrent });
	
	
	//
	// MENU
	//
	
	$("#mainMenu div.menuSubItemsCurrent").each(function()
	{
		if( !$(this).hasClass('beOpen') ) $(this).slideDown( settings.timeSlideDown );
		else $(this).css({display:'block'});
	});
	
	$("#mainMenu div.menuItem").hover(function()
    {	
		// MOUSE OVER
		
		// bg color
		$("div.menu div.menuItem").css({backgroundColor: settings.colorBgOff });
		$(this).css({backgroundColor: settings.colorBgOn });
	}, function()
	{
		// MOUSE OUT
		
		// bg color
		$("div.menu div.menuItem").css({backgroundColor: settings.colorBgOff });
	});
	
	$("#mainMenu").hover(null,function()
	{
		// when mouse out of whole mainmenu, turn all off
		$("div.menu div.menuItem").css({backgroundColor: settings.colorBgOff });
	});
	
	//open link
	$("#mainMenu div.menuItem, #mainMenu div.menuItemCurrent").click(function()
    {
		var childAnchors = $(this).children("a");
		if(childAnchors.length > 0) window.open( childAnchors[0], "_self" );
	});
	
});