var theWidth, theHeight;


function setup( page ) {
	
	// call on every page
	bg();
	
	// call only if this is the map page
	if( page == 'map' ) {
		
		load();
		
	}
	MM_preloadImages('/images/logo-button-roll.png','/images/weather_roll.png','/images/1024.jpg','/images/1280.jpg','/images/1440.jpg','/images/1680.jpg','/images/1920.jpg','/images/logo_roll.png');	
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function bg(){

	// Window dimensions:
	if (window.innerWidth) {
		theWidth=window.innerWidth;
	}
	else if (document.documentElement && document.documentElement.clientWidth) {
		theWidth=document.documentElement.clientWidth;
	}
	else if (document.body) {
		theWidth=document.body.clientWidth;
	}

	if (window.innerHeight) {
		theHeight=window.innerHeight;
	}

	else if (document.documentElement && document.documentElement.clientHeight) {
		theHeight=document.documentElement.clientHeight;
	}

	else if (document.body) {
		theHeight=document.body.clientHeight;
	}

	if(theWidth <= 1920 && theHeight <= 1440){
		document.body.style.backgroundImage = 'url(images/1920.jpg)';
	}

	if(theWidth <= 1680 && theHeight <= 1260){
		document.body.style.backgroundImage = 'url(images/1680.jpg)';
	}

	if(theWidth <= 1440 && theHeight <= 1080){
		document.body.style.backgroundImage = 'url(images/1440.jpg)';
	}

	if(theWidth <= 1280 && theHeight <= 960){
		document.body.style.backgroundImage = 'url(images/1280.jpg)';
	}

	if(theWidth <= 1024 && theHeight <= 768){
		document.body.style.backgroundImage = 'url(images/1024.jpg)';
	}
	var contentHeight = document.getElementById("content").offsetHeight;
	document.getElementById("browserHeight").innerHTML = theHeight;          
    document.getElementById("browserWidth").innerHTML = theWidth;
    document.getElementById("contentHeight").innerHTML = contentHeight;
        
	//if(contentHeight <= theHeight){
		//document.getElementById("content").style.height = theHeight - 120 + "px";
	//}
}


