


$(document).ready(function($){
	
	
	var resizePage = function(){		
		
			
		if($(window).height()>640){
			$("#bg_container").height($(window).height()-40);
			$(".overlay").height($(window).height());
		}else{
			
			$("#bg_container").height(600);
			$(".overlay").height(640);
		}
	}
	
	resizePage();
	$(window).resize(resizePage);
	
	
	$(".logo").fadeIn("slow", function() {$(".pointer").fadeIn("slow");});

	$("#menu li").mouseenter(function(){
		
		$(this).animate({marginLeft:-30},200);
		
	}).mouseleave(function(){
		
		$(this).animate({marginLeft:0},200);
		
	}).click(function(event){
		
		event.preventDefault();		
		
		var mylink = $(this).find("a").attr("href")
		//console.log(mylink);		
		
		$('.content').load(mylink+'?ajax=1', function() {
		  $(".overlay").fadeIn("slow");
		});
		
		
		
	});
	
	$("a.pointer:not(.external_link)").click(function(event){
		
		
		event.preventDefault();		
		
		var mylink = $(this).attr("href")
		//console.log(mylink);		
		
		$('.content').load(mylink+'?ajax=1', function() {
		  $(".overlay").fadeIn("slow");
		});
		
	});
	
	
	$(".backlink").click(function(event){
		
		event.preventDefault();
		$(".overlay").fadeOut("fast");
		
	});
	
	
});

