

;(function($){
	$(function(){
			   
		var animationSpeed	= 800
		var currentlyAnimating	= false
		var easing			= 'easeOutCirc'
		
		$('#menuContainer > ul > li > a').each(function(){
			$(this).append('<dfn></dfn><dfn class="right"></dfn>')

			var $this_ul	= $(this).parent().find('ul')
			if($this_ul.length){
				$this_ul.data( 'height_val', $this_ul.height() )
				$this_ul
					.animate({'height':0, 'opacity' : 0}, 0 )
					.hide();
			}
		})
		
		$('#menuContainer > ul > li').mouseenter(function(){
			var $this_ul		= $(this).find('ul')
			currentlyAnimating	= true
			if( $this_ul.height() ){
				$this_ul
					.stop()
					.animate({'height': $this_ul.data('height_val'), 'opacity':1}, animationSpeed , easing, function(){
						currentlyAnimating	= false
					} )
			}
			else {
				$this_ul.animate({'height': $this_ul.data('height_val'), 'opacity':1}, animationSpeed , easing, function(){
					currentlyAnimating	= false
				})
			}
		})
		$('#menuContainer > ul > li').mouseleave(function(){
			
			var $this_ul		= $(this).find('ul')
			//var originalHeight	= $this_ul.height()
			
			if(currentlyAnimating){
				$this_ul
					.stop()
					.animate({'height' : 0, 'opacity' : 0}, animationSpeed , easing, function(){
						$this_ul.hide()
						currentlyAnimating	= false
					} )
			}
			else $this_ul.animate({'height' : 0, 'opacity' : 0}, animationSpeed , easing, function(){
					$this_ul.hide()
					currentlyAnimating	= false
				 } )
		})
	})// END OF DOCUMENT READY FUNCTION

})(jQuery)
















