
function goToTop()
{
	window.scrollTo(0,0);
}


var appHeight = 0;

function resizeApp(height)
{
	appHeight = height;
	
	if(height > 261)
	{
		if (window.innerHeight)
		{
			if(window.innerHeight < height)
			{
				document.getElementById('index').height = height;
			}
			else
			{
				document.getElementById('index').height = window.innerHeight;
			}
		}
		else if (document.documentElement && document.documentElement.clientHeight)
		{
			if(document.documentElement.clientHeight < height)
			{
				document.getElementById('index').height = height;
			}
			else
			{
				document.getElementById('index').height = document.documentElement.clientHeight;
			}
		}
		else if (document.body)
		{
			if(document.body.clientHeight < height)
			{
				document.getElementById('index').height = height;
			}
			else
			{
				document.getElementById('index').height = document.body.clientHeight;
			}
		}
		else
		{
			if(window.innerHeight < height)
			{
				document.getElementById('index').height = height;
			}
			else
			{
				document.getElementById('index').height = window.innerHeight;
			}
		}
	}
	goToTop();
}

function resizeBrowser()
{
	if (typeof( window.innerWidth ) == 'number' )
	{
		if(window.innerHeight > appHeight)
		{
			document.getElementById('index').height = window.innerHeight;
		}
	}
	else if (document.documentElement && document.documentElement.clientHeight)
	{
		if(document.documentElement.clientHeight > appHeight)
		{
			document.getElementById('index').height = document.documentElement.clientHeight;
		}
	}
	else if (document.body)
	{
		if(document.body.clientHeight > appHeight)
		{
			document.getElementById('index').height = document.body.clientHeight;
		}
	}
	else
	{
		if(window.innerHeight > appHeight)
		{
			document.getElementById('index').height = window.innerHeight;
		}
	}
}




function getBrowserHeight()
{
	var browserH = 0;
	
	if (window.innerHeight)
	{
		browserH = window.innerHeight;
	}
	else if(document.documentElement && document.documentElement.clientHeight)
	{
		browserH = document.documentElement.clientHeight;
	}
	else if(document.body)
	{
		browserH = document.body.clientHeight;
	}
	else
	{
		browserH = window.innerHeight;
	}
	return browserH;
}

function getScrollPos()
{
	if(navigator.appName == "Microsoft Internet Explorer")
	{
		return document.body.scrollTop;
	}
	else
	{
		return window.pageYOffset;
	}
}

function focusApp()
{
	if(document.getElementById('index') != undefined) document.getElementById('index').focus();
}



//Event listeners
window.onresize = resizeBrowser;
window.onload = focusApp;