/*
Browser strings
Netscape -- Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; nl; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7
Netscape -- Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7
Microsoft Internet Explorer -- Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
Netscape -- Mozilla/5.0 (Macintosh; U; PPC Mac OS X; nl-nl) AppleWebKit/419.3 (KHTML, like Gecko) Safari/419.3
*/

var margintop = -80;
var marginleft = -35;
var newmargintop = margintop;
var newmarginleft = marginleft;
var sitewidth = 1160; //visuals width = 1170px, higher value => start adjust earlier
var siteheight = 705; //visuals height = 650px

function setsitepos() { /* set position of all content according to webbrowser size*/
	var winheight = (document.documentElement.clientHeight); 
	var winwidth = (document.documentElement.clientWidth);

	//Account with a few browser specifics
	if (navigator.userAgent.indexOf("Safari") >=0) {
		var winheight = window.innerHeight;
		if (winheight < siteheight -240 ) { 
			//Safari sux
			document.getElementById("notice").innerHTML = (
			"<p>Safari can not reposition the page. </p><p>Enlarge browser window and <a href='?'>Reload</a>\
			</p>\
			<p>or use a <a href='http://www.mozilla.com/en-US/'>proper browser </a>;)</p>"); }
	}

	//Calculate website horizontal position
	var offsetleft = (winwidth - sitewidth);
	if (offsetleft > marginleft ) { // Larger than marginleft = action
		if ((offsetleft) <= 0) { // between marginleft and 0 we do... 
			var newmarginleft = offsetleft; 
		} else { //groter dan 0 breidt de marge zich uit
			var newmarginleft = parseInt(offsetleft/2);
		}
	} else { 
		var newmarginleft = marginleft; 
	}

	//Calculate website vertical position
	var offsettop = (winheight - siteheight); 
	if (offsettop > margintop) { // Largen than margintop = action
		if (offsettop <= 0) { // between margintop and 0 we do...
			var newmargintop = offsettop; 
		} else { 
			newmargintop = 0; 
		}
	} else { 
		var newmargintop = offsettop;
	}

	//Adjust website position
	document.getElementById("backgroundbox").style.marginLeft = (newmarginleft + 'px');
	document.getElementById("realbody").style.marginTop = (newmargintop + 'px');

/*
	document.getElementById("notice").innerHTML = (
	"ClientWidth: " + document.documentElement.clientWidth +
	"<br />ClientHeight: " + document.documentElement.clientHeight +
	"<br />winwidth: " + winwidth + 
	"<br />winheight: " + winheight + 
	"<br />newmarginleft: " + newmarginleft +
	"<br />newmargintop: " + newmargintop );
*/

	//loop disabled, function called from <body onload=> tag
	//if (loopthis > 0) { var window_id = setTimeout("setsitepos();", 40) }
}

