function getWindowHeight() 
{
    if (document.all)
    {
        return document.body.offsetHeight; 
    } 
    else 
    { 
        return window.innerHeight; 
    } 
} 

function getWindowWidth() 
{ 
    if (document.all) 
    { 
        return document.body.offsetWidth; 
    } 
    else 
    { 
        return window.innerWidth; 
    } 
} 


function MyResize(){
var wHeight = getWindowHeight();
var wWidth = getWindowWidth();

if (document.getElementById("menu")) {	document.getElementById("menu").style.left = Math.max(0,wWidth/2 - 500); }
if (document.getElementById("menu")) {	document.getElementById("menu").style.top = wHeight - 50;}
if (document.getElementById("menu2")) {	document.getElementById("menu2").style.left = Math.max(0,wWidth/2 + 100);}
if (document.getElementById("mainarea")) {	document.getElementById("mainarea").style.height = wHeight - 140;}
if (document.getElementById("mainarea")) {	document.getElementById("mainarea").style.width = Math.min(800,wWidth -200 );}
if (document.getElementById("mainarea")) {	document.getElementById("mainarea").style.left = Math.max(210,wWidth/2-300 ) ;}
if (document.getElementById("lev3clipper")) {	document.getElementById("lev3clipper").style.left = Math.max(0,wWidth/2-500 ) ;}
if (document.getElementById("lev3clipper")) {	document.getElementById("lev3clipper").style.height = wHeight - 250;}
if (document.getElementById("hyves")) {	document.getElementById("hyves").style.top = wHeight - 160;}
if (document.getElementById("hyves")) {	document.getElementById("hyves").style.left = Math.max(0,wWidth/2-500 ) ;}
if (document.getElementById("logo")) {	document.getElementById("logo").style.left = Math.max(0,wWidth/2-500 ) ;}
if (document.getElementById("header")) {	document.getElementById("header").style.left = Math.max(0,wWidth/2-500 ) ;}
if (document.getElementById("lev0")) {	document.getElementById("lev0").style.left = Math.max(80,wWidth/2-420 ) ;}
}
function domFunction(f, a)
{
	var n = 0;
	var t = setInterval(function()
	{
		var c = true;
		n++;
		if(typeof document.getElementsByTagName != 'undefined' && (document.getElementsByTagName('body')[0] != null || document.body != null))
		{
			c = false;
			if(typeof a == 'object')
			{
				for(var i in a)
				{
					if
					(
						(a[i] == 'id' && document.getElementById(i) == null)
						||
						(a[i] == 'tag' && document.getElementsByTagName(i).length < 1)
					) 
					{ 
						c = true; 
						break; 
					}
				}
			}
			if(!c) { f(); clearInterval(t); }
		}
		if(n >= 60)
		{
			clearInterval(t);
		}
		
	}, 250);
};
var myStartup = new domFunction(MyResize);
