	//On Hover Over
	function megaHoverOver(){
		/*
		if ($(this).is('#selected'))
		{
			//alert('yep1');
			//$(this).hide();
		    $(this).find(".sub").stop().show()
			//$("#selected").hide()
		}else{
			//alert('nope1');
			//$(this).show();
			//$(this).find(".sub").stop().hide()
			//$(this).find(".sub").stop().hide()
			$(this).find(".sub").stop().fadeTo('fast', 1).show(); //Find sub and fade it in
		}
		*/
		//$(this).find(".sub").stop().fadeTo('fast', 1).show(); //Find sub and fade it in
	    //$(this).find(".sub").stop().fadeTo('fast', 1).show(); //Find sub and fade it in
		$(this).find(".sub").stop().slideDown("faster").fadeTo('fast', 1, function() { //Fade to 0 opactiy
		      $(this).show();  //after fading, hide it
		});
	}
	//On Hover Out
	function megaHoverOut(){
		$(this).find(".sub").stop().slideUp("fast").fadeTo('fast', 0, function() { //Fade to 0 opactiy
		      $(this).hide();  //after fading, hide it
		  });
		/*
		if ($(this).is('#selected'))
		{
			//alert('yep');
		    $("#selected").stop().show();
			//$("#selected").hide()
		}else{
			//alert('nope');
			 if ($("#selected").is(":visible")) {
				 //alert('visible');
				 $(this).find(".sub").stop().fadeTo('fast',0);
				 $(this).find("#selected").stop().show();
			 }else{
				 $("#selected").stop().show();
				 if ($(this).is('.sub'))
				 {
					 //alert('this sub');
					 //$(this).stop().fadeTo('fast',0);
				 }else{
					 $(this).find(".sub").stop().fadeTo('fast',0);
					 //alert('other sub');
				 }
				 //$("#selected").stop().show();
				 //$(this).find(".sub").stop().fadeTo('fast', 0, function() { //Fade to 0 opactiy
					 //$(this).find(".sub").hide();  //after fading, hide it
				  //});
			 }
			//$("#selected").stop().show()	
		}

	  if ( $(this).find(".selected") {
		  $(this).find(".selected").stop().fadeTo('fast', 1).show(); //Find sub and fade it in
	  }
	  //if ($(this.find("#selected").is(":hidden")) {
      if ($(this).find("#selected").is(":visible")) {
    	  //$(this).show();
		  //alert("bnnng");
		  //$("div#selected").show();
    	  //$("div").find("#selected").stop().fadeTo(2000, 1).show();
	  }else{
		  //$(this).find("#selected").stop().fadeTo('fast', 1).show(); //Find sub and fade it in
		  //alert("123");
		  //$("div").find("#selected").stop().fadeTo(2000, 1).show();
		  //$("div").find("#selected").stop().fadeTo('fast', 1).show(); //Find sub and fade it in
	  }
	  */
	}

	//Set custom configurations
	var config = {
	     sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
	     interval: 100, // number = milliseconds for onMouseOver polling interval
	     over: megaHoverOver, // function = onMouseOver callback (REQUIRED)
	     timeout: 500, // number = milliseconds delay before onMouseOut
	     out: megaHoverOut // function = onMouseOut callback (REQUIRED)
	};

	//$("#menu li div#selected").css({'opacity':'1'}); //Fade sub nav to 0 opacity on default
	$("#toplinks li").hoverIntent(config); //Trigger Hover intent with custom configurations
