var j = jQuery.noConflict();

j(document).ready(function() {
						   
j.fn.fadeToggle = function(speed, easing, callback) {
   return this.animate({opacity: 'toggle'}, speed, easing, callback);

};

j.fn.heightToggle = function(speed,easing,callback){
	return this.animate({height: 'toggle'}, speed, easing, callback);
	};
	
j.fn.heightFadeToggle = function(speed,easing,callback){
	return this.animate({height: 'toggle', opacity: 'toggle'}, speed, easing, callback);
	}; 
	
j.fn.heightFadeIn = function(speed,easing,callback){
	return this.animate({height: 'show', opacity: 'show'}, speed, easing, callback);
	};

j.fn.heightFadeOut = function(speed,easing,callback){
	return this.animate({height: 'hide', opacity: 'hide'}, speed, easing, callback);
	};


j('#gnav ul:not(.sub-menu) > li').hoverIntent(
								 
			function() {
					j(this).addClass('hovered');
					j('ul.sub-menu:first', this).heightFadeToggle(200);	
			},
			function() {
					j(this).removeClass('hovered');
					j('ul.sub-menu:first', this).heightFadeToggle(500);
			});

j('#gnav ul.sub-menu > li').hoverIntent(
								 
			function() {
					j(this).addClass('hovered');
					j('ul.sub-menu', this).heightFadeToggle(200);	
			},
			function() {
					j(this).removeClass('hovered');
					j('ul.sub-menu', this).heightFadeToggle(500);
			});

});
