// JavaScript Document

function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	} else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		} else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}
function getWindowWidth() {
	var windowWidth = 0;
	if (typeof(window.innerWidth) == 'number') {
		windowWidth = window.innerWidth;
	} else {
		if (document.documentElement && document.documentElement.clientWidth) {
			windowWidth = document.documentElement.clientWidth;
		} else {
			if (document.body && document.body.clientWidth) {
				windowWidth = document.body.clientWidth;
			}
		}
	}
	return windowWidth;
}
function setBG() {
	if (document.getElementById) {
		var windowWidth = getWindowWidth();
		
		if (windowWidth > 0) {
			var pageBody = document.getElementsByTagName('body');
			if (pageBody[0].scrollWidth < windowWidth) {
				windowWidth = pageBody[0].scrollWidth;
				scrollW = windowWidth - pageBody[0].scrollWidth;
			}
			if (windowWidth<940) {
				windowWidth = 940;
				/*if (scrollW <0) {
					windowWidth = 960+scrollW;
				}*/
			}
			pageBody[0].style.backgroundPosition = ((windowWidth / 2) - (1300 / 2)) + 'px 0';
			//alert ('sw:'+pageBody[0].scrollWidth+' ww:'+windowWidth+' bp:'+pageBody[0].style.backgroundPosition);
		}
		
	}
}
window.onload = function() {
	setBG();
}
window.onresize = function() {
	setBG();
}
