$(document).ready(function() {

	
	$(".menu_content a").click(function() {

		var link = ($(this).attr("href"));
		var head = $(this).children().attr("src");
		if($(this).attr("class") == "facebook") {
			window.open(link,"claudius")
		} else {
		menu_click(link,head);
		}
		return false;

	});
	

	$(".menu_content a").hover(function() {

		var klasa = $(this).attr("class");
		$("."+klasa+" img").animate({
			"top": "-23px" 
		},100);
		
	},function() {
		
		var klasa = $(this).attr("class");
		$("."+klasa+" img").animate({
			"top": "0px" 
		},100);
		
	});
	
	

});


function menu_click(link,head) {

	$("#menu_top").animate({
		"top":"0px"
	},150);
	$("#menu").animate({
		"top":"10px"
	},250);
	
	$("#iga").animate({
		"top":"-200px"
	},150);	
	
		setTimeout(function() {
		$("#logo_wide_h1").animate({
			"marginLeft":"0px"
		},250);
		},400);
	
	setTimeout(function() {
		set_content(link,head);
	},300)

}


function close_content() {
	
	
	var szerokosc = $("#bg").width();
	$("#content").animate({
		"left": szerokosc+"px"
	},350);
	
	
}


function set_content(link,head) {
	
	
	var szerokosc = $("#bg").width();
	$("#content").animate({
		"left": szerokosc+"px"
	},350);
	
	$.get(url_base+link, function(back){
   		$("#content").html(back);
		$("#content #header").css("backgroundImage","url('"+head+"')");
		$("#content #header_red").css("backgroundImage","url('"+head+"')");
 		
	setTimeout(function() {
		$("#content").css("left","-980px");
		
		$("#content").show();		
		$("#content").animate({
			"left": ((szerokosc-980)/2)+"px"
		},350);
	},450);
	
	});
	
}

