/*****************************************************************\
 *	Menu script and css adapted from
 *  http://www.kriesi.at/archives/create-a-multilevel-dropdown-menu-with-css-and-improve-it-via-jquery
\*****************************************************************/

function mainMenu(){

	// Opera Fix
	$(" #ccNav ul ").css({display: "none"}); 
	
	// indent sub level items in dropdown
	$(" a.ccNavIndent ")
		.prepend('&nbsp;&nbsp;&middot;&nbsp;');  

	// add a border to the bottom of the last list item in a dropdown
	$(" ul.ccNavSubLevel > li:last-child ")
		.css({borderBottom: "1px #003366 solid"});  

    // call the functions over or out when hovering over menu items
    $(" #ccNav > li ").hover(over, out);
    
    /* call the functions over or out when focus enters or leaves menu items
    $(" #ccNav .ccNavTopLevel a").focus(
    	function() {
    		alert('we have focus');
    	}
    );

    $(" #ccNav > .ccNavTopLevel a ").blur(out);
    */
    
}

// Actions to take when the mouse moves over a top level link
function over(event) {
	$(this).css("cursor", "pointer");
	$(this)
		.find('a:first')
			.addClass("hover")
			.end()
		.find('ul:first:hidden')
			.css({visibility: "visible",display: "none"})
			.slideDown(300);
}

// Actions to take when the mouse moves out of a top level link    
function out(event) {
	$(this)
		.children('a')
			.removeClass("hover")
			.end()
		.find('ul:first')
			.css({visibility: "hidden",display: "none"});
}


$(document).ready(function(){
	mainMenu();
});
