var window_width = 0
var window_height = 0;

var container_width = 0;
var left_width = 0;
var top_width = 0;

function resize()
{ 
	var container = document.getElementById('container');
	var left = document.getElementById('middle_section');
	var top = document.getElementById('top');
	if (left) 
	{
		if (left_width == 0) left_width = left.offsetWidth-56;
	}
	else
	{
		left = document.getElementById('combine_section');
		if (left_width == 0) left_width = left.offsetWidth;
	}
	
	if (container_width == 0) container_width = container.offsetWidth;
	if (top_width == 0) top_width = top.offsetWidth-17;

	get_window_size();

	resize_element('container',979,755);
	left.style.width = (left_width-(container_width-parseInt(container.style.width)))+'px';
	top.style.width = (top_width-(container_width-parseInt(container.style.width)))+'px';
} 

function resize_element(id,max,min)
{
	window_width = window_width-19;
	var element = document.getElementById(id);
	if (window_width<max)
	{
		if (window_width>min)
		{
			element.style.width = window_width + "px"; 
		}
		else
		{
			element.style.width = min + "px"; 
		}
	}
	else
	{
		element.style.width = max + "px"; 
	}
}

function get_window_size ()
{
	if( typeof( window.innerWidth ) == 'number' ) 
	{
		//Non-IE
		window_width = window.innerWidth;
		window_height = window.innerHeight;
	} 
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
	{
		//IE 6+ in 'standards compliant mode'
		window_width = document.documentElement.clientWidth;
		window_height = document.documentElement.clientHeight;
	} 
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
	{
		//IE 4 compatible
		window_width = document.body.clientWidth;
		window_height = document.body.clientHeight;
	}
}

window.onresize = resize;
window.onload = resize;