
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 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 setBackground(color) {

	var windowWidth = getWindowWidth();
	var windowHeight = getWindowHeight();

// content area size

        var contentWidth = 799;
        var contentHeight = 700;
        
        if (windowHeight < (contentHeight+125)) windowHeight = contentHeight+125;

        document.getElementById('wrap').style.left = (Math.abs((windowWidth-contentWidth)/2)) + 'px';
        document.getElementById('wrap').style.top = (Math.abs((windowHeight-contentHeight-35)/2)) + 'px';

        document.getElementById('bg-left').style.width = (Math.floor(windowWidth/2)) + 'px';
        document.getElementById('bg-left').style.height = windowHeight + 'px';

        document.getElementById('bg-right').style.left = (Math.floor(windowWidth/2)) + 'px';
        document.getElementById('bg-right').style.width = (Math.ceil(windowWidth/2)) + 'px';
        document.getElementById('bg-right').style.height = windowHeight + 'px';

        document.getElementById('bg-left').innerHTML = '<img src="backgrounds/bg-'+color+'-left.jpg" width="'+(Math.abs(windowWidth/2))+'" height="'+windowHeight+'" border="0" alt="" />';
        document.getElementById('bg-right').innerHTML = '<img src="backgrounds/bg-'+color+'-right.jpg" width="'+(Math.ceil(windowWidth/2))+'" height="'+windowHeight+'" border="0" alt="" />';

}

