var theWidth, theHeight;
var i = 0;
var currentBg;

function bg(){
	i++;
	// 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 < 800 && theHeight < 518){
		if(currentBg != "800"){
			currentBg = "800";
			document.body.className = "s800";
		}
		return;
	}

	if(theWidth < 1024 && theHeight < 663){
		if(currentBg != "1024"){
			currentBg = "1024";
			document.body.className = "s1024";
		}
		return;
	}

	if(theWidth < 1224 && theHeight < 792){
		if(currentBg != "1224"){
			currentBg = "1224";
			document.body.className = "s1224";
		}
		return;
	}

	if(theWidth < 1440 && theHeight < 932){
		if(currentBg != "1440"){
			currentBg = "1440";
			document.body.className = "s1440";
		}
		return;
	}

	if(currentBg != "1920"){
		currentBg = "1920";
			document.body.className = "s1920";
	}
}

