function initLayout()
{
	var _image = document.getElementById('bg-image');
	var _bg = document.getElementById('bg-body');
	var _main = document.getElementById('main-wrapper');

	if(_image && _bg) {
		var _width;
		var _height;
		_imgWidth = 1130;
		_imgHeight = 650;

		function handleResize() {
			_width = getClientWidth();
			_height = getClientHeight();

			// img min-width for ie6
			if (document.uniqueID && document.compatMode && !window.XMLHttpRequest) {
				if(_bg.offsetWidth < _imgWidth) {
					_image.style.width = _imgWidth+"px";
					_image.style.height = "auto";
				} else {
					_image.style.width = "50%";
					_image.style.height = "auto";
				}
			}

			// set height holder
			_main.style.height = _height+"px";
		}
		window.onresize = handleResize;
		setTimeout(function(){handleResize()},100);
	}
}

function getClientWidth(){return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;}
function getClientHeight(){return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;}
if (window.addEventListener) window.addEventListener("load", initLayout, false);
else if (window.attachEvent) window.attachEvent("onload", initLayout);
