$(document).ready(function() {
	/**
	 * Image slideshow
	 */
	$(window).load(function() {
		$('#slider').nivoSlider({
			controlNav:false,
			pauseTime:10000,
			pauseOnHover:true
		});
	});

	
	/**
	 * Highlight the applicable navigation link 
	 */
	$( ".menuClass" ).hide();
	
	
	/**
	 * Menu animations
	 */
	var topMenus = $( ".menu" );
	for (var i=0; i<topMenus.length; i++) {
		topMenus[i].onmouseover = function() {
			var id = this.id;
			var subMenus = $( ".menuClass" );
			for (var j=0; j<subMenus.length; j++) {
				if (!subMenus[j].className.match(id)) {
					$( subMenus[j] ).stop(true, true);	// End other animations
					$( subMenus[j] ).hide();			// Hide anything that was animating
				}
			}
			
			$( "."+id ).fadeIn(500);
		}
	}
	
	
	/**
	 * Hide menus when mousing over certain areas
	 */
	$( ".noMenu" ).mouseover( function() {
		$( ".menuClass" ).fadeOut(300);
	});
});
