$(document).ready(function(){
	
	//Fix Errors - http://www.learningjquery.com/2009/01/quick-tip-prevent-animation-queue-buildup/

	$("#menu .currentpage").css('opacity','0').css('height','0');
	$("#menu .currentpage a").css('opacity','0');
	$("#menu .menuactive").css('opacity','0').css('height','0');
	$("#menu .menuactive a").css('opacity','0');
	$("#content-title").css('opacity','0');
	
	

	
	setTimeout(function(){
		$("#menu .currentpage").stop().animate({height:'24px',opacity:1},{queue:false, duration:600});
		$("#menu .menuactive").stop().animate({height:'24px',opacity:1},{queue:false, duration:600});
		
		$("#home-title").stop().animate({opacity:1},{queue:false, duration:1240});
		$("#content-title").stop().animate({opacity:1},{queue:false, duration:1240});
		var options = {direction:"down"};
		$("#content-title").show('slide',options,600); 
		
	}, 40);
	
	setTimeout(function(){
		$("#menu .currentpage a").stop().animate({opacity:1},{queue:false, duration:600});
		$("#menu .menuactive a").stop().animate({opacity:1},{queue:false, duration:600});
		
		
	}, 400);
	
	//Remove outline from links
	$("a").click(function(){
		$(this).blur();
	});
	
	//When mouse rolls over
	$("#menu .menu-off").mouseover(function(){
		$(this).stop().css('background-image','url(/uploads/images/site/bg-nav-on.gif)').css('background-position','bottom').addClass("hilighted").css('color','#fac10f').animate({paddingTop:'26px'},{queue:false, duration:400});
	});
	
	$("#menu .parent").mouseover(function(){
		$(this).stop().css('background-image','url(/uploads/images/site/bg-nav-on.gif)').css('background-position','bottom').addClass("hilighted").css('color','#fac10f').animate({paddingTop:'26px'},{queue:false, duration:400});
	});
	
	//When mouse is removed
	$("#menu .menu-off").mouseout(function(){
		$(this).stop().css('background-image','url(/uploads/images/site/bg-nav-off.gif)').css('background-position','bottom').removeClass("hilighted").animate({paddingTop:'7px'},{queue:false, duration:400});
	});
	
	$("#menu .parent").mouseout(function(){
		$(this).stop().css('background-image','url(/uploads/images/site/bg-nav-off.gif)').css('background-position','bottom').removeClass("hilighted").animate({paddingTop:'7px'},{queue:false, duration:400});
	});

		
	
	$('#menu li.menu-off').css('cursor', 'pointer')
	$("#menu .menu-off").click(function() {
        // when user clicks this <li element, redirect it to the page
        // to where the fist child <a element points
        window.location = $('a', this).attr('href');
        });
	$('#menu li.currentpage').css('cursor', 'pointer')
	$("#menu .currentpage").click(function() {
        window.location = $('a', this).attr('href');
        });
	$('#menu li.parent').css('cursor', 'pointer')
	$("#menu .parent").click(function() {
        window.location = $('a', this).attr('href');
        });
        
	$('#menu li.menuactive').css('cursor', 'pointer')
	$("#menu .menuactive").click(function() {
        window.location = $('a', this).attr('href');
        });         
        
	$("#subnav").hide();
	var options = {direction:"left"};
	setTimeout(function(){
			$("#subnav").css('opacity','0');
			$("#subnav").stop().animate({opacity:1},{queue:false, duration:1000});
			$("#subnav").show('slide',options,600); 
			}, 40);

	$("#submit input").mouseover(function(){
		$(this).css('background-color','#d5c28b').css('color','#8b3304').css('cursor', 'pointer');
	});
		
	$("#submit input").mouseout(function(){
		$(this).css('background-color','#e4e2d0').css('color','#a05831');
	});
	
	
});
