/*!
* Last updated 3/1/2010 by Daniel Merchen
*/ 

$(document).ready(function(){
 
	$("ul.sub-menu").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled - Adds empty span tag after ul.sub-menu
	
	$("ul li span").click(function() { //When trigger is clicked...
		
		//Following events are applied to the sub-menu itself (moving sub-menu up and down)
		$(this).parent().find("ul.sub-menu").fadeIn('slow').show(); //Drop down the sub-menu on click.
		$(this).parent().find("ul.sub-menu").fadeIn('slow').hide(); //Make the sub-menu disappear when clicked while expanded. (Transition doesn't work)
 
		$(this).parent().hover(function() {
		}, function(){	
			$(this).parent().find("ul.sub-menu").slideUp('slow'); //When the mouse hovers out of the sub-menu, move it back up
		});
 
		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() { 
			$(this).addClass("subhover"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			$(this).removeClass("subhover"); //On hover out, remove class "subhover"
	});
 
});


$(document).ready(function() {
	// find the div.fade elements and hook the hover event
	$('.fadeThis').hover(function() {
		// on hovering over find the element we want to fade *up*
		var fade = $('> .hover', this);
 
		// if the element is currently being animated (to fadeOut)...
		if (fade.is(':animated')) {
			// ...stop the current animation, and fade it to 1 from current position
			fade.stop().fadeTo(500, 1);
		} else {
			fade.fadeIn(500);
		}
	}, function () {
		var fade = $('> .hover', this);
		if (fade.is(':animated')) {
			fade.stop().fadeTo(500, 0);
		} else {
			fade.fadeOut(500);
		}
	});
 
	// get rid of the text
	$('.fadeThis > .hover').empty();
})
/*!
* jQuery Sexy Drop Down Menu
* http://www.noupe.com/tutorial/drop-down-menu-jquery-css.html
*/ 
