$(document).ready(function(){
	var xImg=1280;
	var yImg=773;
	var rapporto=xImg/yImg;
	
	// Resize sfondo
	function resize(){
		var xWind=$(window).width();
		var yWind=$(window).height();
		var rapportoAttuale= xWind/yWind;
		
		if(rapporto<=rapportoAttuale){
			$('img.bg').css({width:'100%', height:'auto'});
		}else{
			$('img.bg').css({width:'auto', height:'100%'});
		}
	}
	
	// Resize footer
	function resizeFooter(){
		var xWind=$(window).width();
		var yWind=$(window).height();
		var hContainer = $("#container").height();
		if(yWind < hContainer+60 ){
			$("#container").removeClass("containerAbs").addClass("containerRel");
			$("#wrapper").height(hContainer+60);
		} else {
			$("#container").removeClass("containerRel").addClass("containerAbs");
			$("#wrapper").height(yWind);
		}
		
	}
	
	$(window).bind('resize', function() {
		resize();
		//resizeFooter();
	});
	
	
	// Init
	resize();
	//resizeFooter();
	
});
