function resizeSWF(height)
{
	if (resizeSWF.lastH != null && height != resizeSWF.lastH)
	{
		getApp().style.height = Math.max(height + 20, f_clientHeight());
		//scrollToTop();
	}
}

resizeSWF.lastH = -1;

function scrollToTop()
{
	if (document.body) document.body.scrollTop = 0;
	else document.documentElement.scrollTop = 0;
}

function getApp(id)
{
	if (typeof id == 'undefined')
			id = 'index';
	
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	return (isIE) ? window[id] : document[id]; 
}

window.onresize = function()
{
	if (!getApp()) return;
	if (parseFloat(getApp().style.height) < f_clientHeight())
		getApp().style.height = f_clientHeight() + "px";
	fixBackground();

}

window.onload = function()
{
	fixBackground();
}

function fixBackground()
{
	var el = document.getElementById('index');
	if (!el) return;
	var pos=cumulativeOffset(el);
	var ox = pos[0]-200;
	var oy = pos[1]-200;
	document.body.style.backgroundPosition = ox+'px '+oy+'px';
}


function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}

function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}

function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}

function getBrowserInfo()
{
	return {clientHeight:f_clientHeight(), scrollBarPos:f_scrollTop()};
}

function getLocation()
{
	return window.location.href;
}

function cumulativeOffset(element)
{
	var valueT = 0, valueL = 0;
	do
	{
		valueT += element.offsetTop || 0;
		valueL += element.offsetLeft || 0;
		element = element.offsetParent;
	} while (element);
	return [valueL, valueT];
}

//window.setInterval('getBrowserInfo()', 500);