function viewport()
{
	// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
	if (typeof window.innerWidth != 'undefined')
	{
		return { width: window.innerWidth, height: window.innerHeight };
	}

	// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
	if (typeof document.documentElement != 'undefined'
			&& typeof document.documentElement.clientWidth != 'undefined'
			&& document.documentElement.clientWidth != 0)
	{
		return { width: document.documentElement.clientWidth, height: document.documentElement.clientHeight };
	}

	// Anything else gets this
	return { width: document.getElementsByTagName('body')[0].clientWidth, height: document.getElementsByTagName('body')[0].clientHeight };
}

function setResMode()
{
	var vp = viewport();
	if ( vp.width < 1000 )
	{
		$('body').addClass('mode800');
		$('#leftcolumn').append( $('#rightcolumn') );
	}
	else
	{
		$('body').removeClass('mode800');
		try
		{
			$('#main').append( $('#rightcolumn') );
		}
		catch(err)
		{
		
		}
	
	}
}

window.onresize = setResMode;
window.onload = setResMode;
