var bg_im;
var mw = 1280;
var mh = 800;
var ratio = mw/mh;

function updateSize()
{
	if (typeof bg_im == "undefined")
		bg_im = document.getElementById("bg_container");
	var size = getWinsize();
	if (size.h > (size.w / ratio))
	{
		bg_im.style.width = Math.ceil(size.h*ratio) + "px"
		margin = "0 0 0 "+ Math.round((size.w-(size.h*ratio))/2) +"px";
		bg_im.style.margin = margin;
	}
	else
	{
			bg_im.style.width ="100%";
			bg_im.style.margin = "0";
	}
}

function getWinsize()
{
	var _obj = new Object();
	if( typeof( window.innerWidth ) == "number" )
	{
	//Non-IE
		_obj.w = window.innerWidth;
		_obj.h = window.innerHeight;
	}
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
	{
    //IE 6+ in 'standards compliant mode'
		_obj.w = document.documentElement.clientWidth;
		_obj.h = document.documentElement.clientHeight;
	}
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
	{
    //IE 4 compatible
        _obj.w = document.body.clientWidth;
        _obj.h = document.body.clientHeight;
	}
	return _obj;
}
