// javascript background switcher by pixeline
function switchBckgrndImg(){
	document.body.style.background="";
	// THIS BIT DETECTS THE AVAILABLE SCREEN SPACE AND ORIGINATES FROM http://www.quirksmode.org/viewport/compatibility.html
	var x,y;
	if ( sessionStorage.introbackg == 'yes' )
	{
		imagename = 'intro'
	}
 	else {
 		imagename = 'news'
 	}
 	sessionStorage.introbackg = "";
	if (self.innerHeight) // all except Explorer
	{
		x = self.innerWidth;
		y = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
	// Explorer 6 Strict Mode
	{
 		x = document.documentElement.clientWidth;
 		y = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		x = document.body.clientWidth;
		y = document.body.clientHeight;
	}
	// THE FOLLOWING assigns a background image to each resolution
	myscreenWidth = x;
	if(myscreenWidth > 1680) { var myImg ="fileadmin/images/backgrounds/"+imagename+"1920.jpg";}
	else if(myscreenWidth > 1280) { var myImg ="fileadmin/images/backgrounds/"+imagename+"1680.jpg";}
	else if(myscreenWidth > 1024) { var myImg ="fileadmin/images/backgrounds/"+imagename+"1280.jpg";}
	else { var myImg ="fileadmin/images/backgrounds/"+imagename+"1024.jpg" };
	// image switching occurs now !
	document.body.style.background="#CCCCCC url("+myImg +") no-repeat";
	//alert("width = "+myscreenWidth);
}

function onResizeHandler()
{
	// ALL FUNCTION CALLS TO PERFORM ON RESIZE...
	switchBckgrndImg();
}
function onLoadHandler()
{
	switchBckgrndImg();
}
window.onresize = onResizeHandler;
window.onload = onLoadHandler;

