$(function(){
	if($("body").height() <= $(document).height()){
		
		var documentHeight = $(document).height();
		
		$("body").css({
			height: (documentHeight+26)+"px"
		});
		$("#home").css({
			height: documentHeight+"px"
		});
	}
	
	$("header nav ul li a").click(function(){
		
		if($("section.panel:animated").size() <= 0){		
			var clickEl = this;
			var areaEl = 'default';
			$("section.panel").each(function(){
				if($(this).css("left") == "408px"){
					areaEl = this;
				}
			});

			if(areaEl == 'default'){
				$($(this).attr("href")+"").animate({
					left: "408px"
				},550,"easeInOutExpo");
				return false;
			} else if($(areaEl).attr("id") != $(clickEl).attr("href").substr(1,$(clickEl).attr("href").length)){
				$(areaEl).animate({
					left: "-510px"
				},550,"easeInOutExpo",function(){
					$($(clickEl).attr("href")+"").animate({
						left: "408px"
					},550,"easeInOutExpo");
				});
			}
		}
		return false;
		
	});
	
	$("section.panel nav.showcase-list li h3 a").each(function(){
		var aElHeight = $(this).height()+16;
		$(this).parent("h3").css({
			bottom: "-"+aElHeight+"px"
		});
	});
	
	$("section.panel nav.showcase-list li").mouseover(function(){
		$(this).children("h3").animate({
			bottom: 0
		},200,"easeInOutExpo");
	}).mouseleave(function(){
		var aElHeight = $(this).find("h3 a").height()+16;
		$(this).children("h3").animate({
			bottom: "-"+aElHeight+"px"
		},200,"easeInOutExpo");
	});
	
	$("a:not([href*='"+window.location.host+"']):not([href*='#'])").attr("target", "_blank");

});