// get browser screen width
function getBrowserWidth() {
	var w;
	if(document.innerWidth){ w=document.innerWidth;
	} else if(document.documentElement.clientWidth){ w=document.documentElement.clientWidth;
	} else if(document.body){ w=document.body.clientWidth; }
	return w;
}

// get browser screen height
function getBrowserHeight() {
	var h;
	if(document.innerHeight){ h=document.innerHeight;
	} else if(document.documentElement.clientHeight){ h=document.documentElement.clientHeight;
	} else if(document.body){ h=document.body.clientHeight; }
	return h;
}

var browserWidth, browserHeight, topBottomPadding=0;

function repositionDivs() {
	browserWidth = getBrowserWidth();
	browserHeight = getBrowserHeight();
	
	// reposition mainbg1
	if(browserHeight>601) {
		topBottomPadding = Math.floor((browserHeight-601)/2);
		document.getElementById('mainbg').style.paddingTop = topBottomPadding+'px';
		document.getElementById('mainbg').style.paddingBottom = topBottomPadding+'px';
	}
	
	// reposition playerdiv
	document.getElementById('playerdiv').style.top = (topBottomPadding+15)+'px';
	document.getElementById('playerdiv').style.left = (Math.floor((browserWidth+901)/2)-222)+'px';

	// reposition top2links
	document.getElementById('top2links').style.top = (topBottomPadding+12)+'px';
	document.getElementById('top2links').style.left = (Math.floor((browserWidth-901)/2)+302)+'px';
}

onload = function() {
	repositionDivs();
};