//--------------------------------------------------
// Author: Chris Lock
// Copyright (c) 2009
//--------------------------------------------------

jQuery(document).ready(function($) {
//--------------------------------------------------
// MENU
//--------------------------------------------------	
	$('#menu_about h2 a, #menu_how h2 a').click( function(e) {
		e.preventDefault();
		var link = e.target;
		link.blur();	
	});
	
	$('#menu_about').hover( function() {
		$(this).attr('class', 'about_visible');
		$('#about_children, #about_shadow').show();
	}, function() {
		$(this).attr('class', 'about_hidden');
		$('#about_children, #about_shadow').hide();
	});
	
	$('#menu_how').hover( function() {
		$(this).attr('class', 'how_visible');
		$('#how_children, #how_shadow').show();
	}, function() {
		$(this).attr('class', 'how_hidden');
		$('#how_children, #how_shadow').hide();
	});
	
	var aboutHeight = $('#about_children').height();
	var aboutExpand = eval( aboutHeight + 45 );
	
	$('old #menu_about').mouseenter( function() {
		$('#about_children').stop();
		
		$('#about_children').attr('style', 'padding: 0px;');
		$('#about_children li').hide();
		$('#about_children').animate( { height:0 }, 0 );
		$('#about_children').show();
		$('#about_children').animate( { height:aboutExpand }, 600, function() {
			$('#about_children').animate( { height:aboutHeight }, 0 ).attr('style', 'padding: 10px 0px 35px 40px;');
			$('#about_children li').fadeIn(600);
		});
	});
	
	$('#old menu_about').mouseleave( function() {
		$('#about_children, #about_children li').stop(false, true);
		
		$('#about_children li').fadeOut(600);
		setTimeout( function() {
			$('#about_children').attr('style', 'padding: 0px;').animate( { height:aboutExpand }, 0);
			$('#about_children').animate( { height:0 }, 600, function() {
				$('#about_children').attr('style', 'display: none;');
				$('#about_children li').show();
			});
		}, 600);
	});
});
