/*
Per voi da http://www.skipstorm.org
in licenza MIT
http://www.opensource.org/licenses/mit-license.php

*/

var background = new Image();
var ar;
$(document).ready(function(){
	background.src = $('body').attr('background');
	$('body').attr('background', '');
		
	$('body').html('<div id="imgWrap" style="overflow:hidden;position:absolute; top:0; left:0; z-index:-1;"><img id="backgroundImage" src="'+background.src
		+'" /></div>'+$('body').html());
	resizeBg();
	$(window).resize(function(){
		resizeBg();
	});
	
	function resizeBg(){
		$('#imgWrap').css('width', $(window).width());
		$('#backgroundImage').attr('width', $(window).width());
		//$('#backgroundImage').removeAttr('height');
		$('#imgWrap').css('height', $(window).height());
		
		$('#spacer').css('height', parseInt($(window).height())-parseInt($('#wrapper').css('height')));
	}
});
