function menu(obj){
	src=$(obj).attr("href");
	val=src+'?ajax=1';
	
	$('.content').load(val, function(response, status, xhr) {
		
		if (status == "error") {
			alert('Wystąpił bład: '+ xhr.status + " " + xhr.statusText);
		}else{
			 dopasowanie();
			// reloadfun();
		}
	}); 
	
	$('.menu li').removeClass("active");
	$('.menu_footer p span').removeClass("active");
	$('.menu li a[href="'+src+'"]').parent().parent().addClass("active");
	$('.menu_footer p span a[href="'+src+'"]').parent().addClass("active");

}

function reloadfun(){
	/*
	$('.title span').FontEffect({
		 mirror:true,
		 mirrorColor:"#000",
		 mirrorOffset:-6,
		 mirrorHeight:"100",
		 mirrorTLength:"19",
		 mirrorTSTart:0.9
	});
	*/
}
function bg(){
	max_bg_h=1080;
	max_bg_w=1920;
	okno_h=$(window).height();
	okno_w=$(window).width();
	div_h=$("#container").height();
	div_w=$("#container").width();
	
	//wysokość - dostosowanie
	p_h=max_bg_h-okno_h;
	if(p_h>0){
		if(okno_h<div_h){
			pos=(max_bg_h-div_h)/2;
		}else{
			pos=p_h/2;
		}
	}else{
		pos=0;	
	}
	//szerokość dostosowanie
	if(okno_w<div_w){
		pos_w='-'+((max_bg_w-div_w)/2)+'px';
	}else{
		pos_w='50%';
	}
	
	$('body').css("background-position",''+pos_w+' -'+pos+'px');
	
}

function dopasowanie(){
	$('.content').css("height",'');
	//alert($(".content").height());
	obudowa=$(".top").height()+$(".header").height()+$(".footer").height();
	//rozmiar okna przegladarki
	
	okno=$(window).height();
	
	
	
	//if (navigator.appName.indexOf("Microsoft") != -1) 
			
//	else 
	//		okno=$(document).height();

	dlugosc_pierwotna=$(".content").height();

	if(dlugosc_pierwotna+obudowa < okno){
		$(".content").height(okno-obudowa);
	}else{
		//$(".content").height($(".content").height());
		$('.content').css("height",'');
		//$(".content").height(aktualna_dlugosc);
	}
}


	
$(function() {
	bg();
	$(window).resize(function() {
		bg();
	});
	/*
	$(".menu li").hover(
	  function () {
		$(this).addClass("hover");
	  },
	  function () {
		$(this).removeClass("hover");
	  }
	);
	
	$(".menu li a").click(
	  function () {
		 menu(this);
		return false;
	  }
	);
	$(".menu_footer p span a").click(
	  function () {
		 menu(this);
		return false;
	  }
	);

	$(".social img").hover(
	  function () {
		  var src = $(this).attr("src").match(/[^\.]+/) + "-over.png";
		  $(this).attr("src", src);
	  },
	  function () {
		 var src = $(this).attr("src").replace("-over", "");
		 $(this).attr("src", src);
	  }
	);

	reloadfun();
	*/

	

});	


