////
jQuery.fn.navMouseover = function() 
	{
	$(this).removeClass('navButton');
	$(this).addClass('navButtonHover');
	var div = $(this).children();												
	$(div).stop().animate(	{'top':'0'}, {'queue':'false', 'duration':'500'});
	var div2 = div.children();
	$(div2).each(function()
		{
		if ($(this).hasClass('navCopy')) 
			{
			$(this).css('opacity','0');
			$(this).stop().animate(	{'opacity':'0.9'},  {'queue':'false', 'duration':900});
			}
		});

	$(this).stop().animate(	{'height':'200'}, 
										{	queue:false, 
											duration:400, 
											easing: 'easeOutBounce'
										});

	};
////
jQuery.fn.navMouseout = function(completeFunction) 
	{
													
	$(this).stop().animate(	{'height':'40'}, 
											{
											queue:false, 
											duration:100, 
											easing: 'linear', 
											complete: function() 
												{
												$(this).removeClass('navButtonHover');
												$(this).addClass('navButton');
												if ($.isFunction(completeFunction))
													{
													completeFunction();	
													}
												} 
										});
	};
////


$(document).ready(function()
	{ 
	var allowClick = true;

	$( ".accordion" ).accordion();
	

////
	$(".navHover a").click(function(e)
		{
		e.preventDefault();
		allowClick = false;
		if ($(this).attr('href')) url = $(this).attr('href');
//alert($(this).parent().parent().parent().html());
//return;
		if (url) 
			{
			var ele  = $(this).parent();
			while (!ele.hasClass('navHover'))
				{
				ele = ele.parent();	
				}
			}
		ele.navMouseout(function() {window.location = url;});
		});
////

	$(".navHover").click(function(e)
		{
		if (allowClick)
			{
			var ele = $(this).children();
			var url = '';
			$(ele).each(function()
				{
				if ($(this).attr('href')) url = $(this).attr('href');
				});
			if (url) $(this).navMouseout(function() {window.location = url;});
			}
		allowClick = true;
		});
////

	$(".navHover").hover(
			function() 
				{
				$(this).navMouseover();
				},
			function ()
				{
				$(this).navMouseout();
				
				}
			);
////

	});
////

