// JavaScript Document
// accordian main navigation

$(document).ready(function(){
						
			$.fn.equalizeHeights = function(){
			return this.height(Math.max.apply(this, $(this).map(function(i,e){ return $(e).height() }).get() ) )
			}
			$('#nav_bg, #navigation ul').equalizeHeights();		

			  
	  $('div#nav_bg').hide(); //hide background color
	  $('#navigation ul').hide(); //hide all nested ul's

		//On Hover Over
		function megaHoverOver(){
			$(this).toggleClass('accordionExpanded'); //for CSS bgimage, but only on first a (sub li>a's don't need the class)
				  $('div#nav_bg').slideDown(600);
				  $(this).next('ul').slideDown(600);
				  $(this).parent().siblings('li').children('ul:visible').hide()
					 .parent('li').find('a').removeClass('accordionExpanded');
				  return false;
		}
		//On Hover Out
		function megaHoverOut(){
		}
		
		//Set custom configurations
		var config = {
			 sensitivity: 7, // number = sensitivity threshold (must be 1 or higher)
			 interval: 200, // number = milliseconds for onMouseOver polling interval
			 over: megaHoverOver, // function = onMouseOver callback (REQUIRED)
			 timeout: 300, // number = milliseconds delay before onMouseOut
			 out: megaHoverOut // function = onMouseOut callback (REQUIRED)
		};
		
		$("#navigation li:has(ul) > a").hoverIntent(config); //Trigger Hover intent with custom configurations
		
		$('div#navigation_wrapper').mouseleave(function() {
					$('#navigation ul').slideUp(600); //hide all nested ul's when mouse out of nav area
					$('div#nav_bg').slideUp(600); //hide background color as you mouse out of navigation area
					
			  });
});


