 var sw;
 var sh;

function setBackground(sw,sh){
	//alert(sw+"x"+sh);
	$.get("/ajax.php?page=getbackground&w="+sw+"&h="+sh, function(data){
																
	  	str = data.replace('/ /g','');
		str = str.replace('/\\n/g', '');
		//document.body.background = "http://www.platformduurzaamrijnmond.nl/images/fl_single_background/originals/"+str;
		//document.getElementById('background_image').background = "http://www.platformduurzaamrijnmond.nl/images/fl_single_background/originals/"+str;
		document.getElementById('background_image').style.background = "url(http://www.platformduurzaamrijnmond.nl/images/fl_single_background/originals/"+str+")";
	});
}
function updateViewPort(){
	 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 
	 if (typeof window.innerWidth != 'undefined')
	 {
		  sw = window.innerWidth,
		  sh = window.innerHeight
	 }
	 
	// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
	
	 else if (typeof document.documentElement != 'undefined'
		 && typeof document.documentElement.clientWidth !=
		 'undefined' && document.documentElement.clientWidth != 0)
	 {
		   sw = document.documentElement.clientWidth,
		   sh = document.documentElement.clientHeight
	 }
	 
	 // older versions of IE
	 
	 else
	 {
		   sw = document.getElementsByTagName('body')[0].clientWidth,
		   sh = document.getElementsByTagName('body')[0].clientHeight
	 }

	document.getElementById('container').style.minHeight = (sh)+'px'; 
	setBackground(sw,sh);
	// alert(sw+'x'+sh);	
}

window.onresize = function (){
	updateViewPort();
}
$(document).ready(function() {
	updateViewPort();
});
