function hide_subnav(){
	x = $("li.navitem");
	x.children("ul:visible").hide();
}

$(document).ready(function(){
	var options = {
		resizeLgImages:     true,
		handleUnsupported:  'remove',
		loadingImage: 		'media/shadowbox/loading.gif',
		overlayOpacity:		0.85
	};
	Shadowbox.init(options);

   
	// create variables  
	var subNavTimer;  
	var open;  
	// to make sure that when user mouses over sub menu ul it stays open  
	$("ul.nav_submenu").mouseover(function() {  
		 $(this).show();  
		 // lets remember what's open  
		 open = $(this).parent();  
	});  
	   
	// when user mouses over main item in navbar  
	$("li.navitem").mouseover(function() {  
		 // close other nav item submenus  
		 if (open != null) open.children("ul").hide();
		 // stop the timer  
		 clearTimeout(subNavTimer);  
		 // show this nav item's sub menu  
		 if ($(this) != open) $(this).children("ul:hidden").show();  
	   
	});  
	  
	// when user's mouse leaves the navbar item  
	$("li.navitem").mouseout(function() {  
		 // lets keep tabs of what is open  
		 // start the timer for 2 seconds until it closes.  
		  open = $(this);
		  //subNavTimer = setTimeout('hide_subnav();', 5); 
		  hide_subnav(); 
	}); 

});


