$(document).ready(function() {

  $('#nav ul li ul').css({
	display: 'none',
	//left: 'auto'
	//left: '-9999px'
  });
  
  $('#nav ul li').children('a[href=#]').click(function(e) {
	e.preventDefault();
	$(this).blur();
  });
  
  $('#nav ul li').hover(
    function() {
	  $(this)
	    .find('ul')
		.stop(true, true)
		.slideDown('fast');
	  $(this)
	    .children('a.dropdown')
		.not('#nav_a_adventure')
		.children('span')
		.css({
			backgroundPosition: 'center -63px'
		});
	},
	function() {
	  $(this)
	    .find('ul')
		.stop(true, true)
		//.fadeOut('slow');
		.slideUp('fast');
	  $(this)
	  	.children('a.dropdown')
		.not('#nav_a_adventure')
		.children('span')
		.css({
			backgroundPosition: 'center -16px'	 
		});
	}				
  );
  
  var browser_version = $.browser.version.substr(0,1);
  
  /*
  //if (!($.browser.msie && browser_version == '6')) {
	  $("#middle_menu li a[href='/directions.php'], #nav ul li a[href='/directions.php']").click(function(e) {
		   e.preventDefault();
		   $(this).blur();
		   $(window)
		     .scrollTo('#driving_directions', 900, {
			   onAfter: function() {
			     $('#driving_directions').animate({ opacity: 0.05 }, 300, function() {
				    $(this).animate({ opacity: 1.0 }, 300, function() { $('#fromAddress').focus(); });
				 });
			   }
		     });
	  });															
  //}
  */
  
  /*
  // Hacks for the Lovely IE6 and IE7  
  if ($.browser.msie && (browser_version == '6' || browser_version == '7')) {
	$('#nav ul li ul').css('left', '-40px');  
	$('#nav ul > li > a').hover(
	   function() {
	     $(this).css({
		   background: 'url(/images/layout/middle_nav_bg.jpg) left top repeat-x',
		   borderLeft: '1px solid #FFFFFF',
		   borderRight: '1px solid #FFFFFF'
		 });
	   },
	   function() {
		 $(this).css({
		   background: 'url(/images/layout/top_nav_ul_bg.jpg) left top repeat-x',
		   borderLeft: 'none',
		   borderRight: 'none'
		 });   
	   }
	 );
  }*/

});
