/*
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 = -120;
var marginleftmax = 300;
var newmargintop = margintop;
var newmarginleft = marginleft;
var sitewidth = 1200; //visuals width = 1240px, lower 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
	//alert("win " + winwidth + " site " + sitewidth);
	var offsetleft = (winwidth - sitewidth) ;
	if (offsetleft > marginleft ) { // Larger than marginleft = action
		if ((offsetleft) <= 0) { // between marginleft and 0 we do... 
			var newmarginleft = offsetleft; 
		} else if ((offsetleft/2) > marginleftmax) { // above marginleftmax, stick to marginleftmax
			var newmarginleft = marginleftmax;
		} else { // keep site centered
			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'); //horizontal
        //alert("marginleft: " + newmarginleft);

	//document.getElementById("realbody").style.marginTop = (newmargintop + 'px'); //vertical

/*
	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) }
}

var startPos = 0;
function moveObject(event) {
        document.getElementById("logo").innerHTML = (
	"<p>FF " + self.pageYOffset + "</p>" + 
	"<p>IE " + document.body.scrollTop + "</p>"
	);

	  var mobject = 'logo';
	  var delta = 0;
	  if (!event) event = window.event;
	  // normalize the delta
	  if (event.wheelDelta)
	  {
	    // IE & Opera
	   //delta = event.wheelDelta / 120;
		delta = (document.body.scrollTop);
	  }
	  else if (event.detail) // W3C
	  {
		delta = (window.pageYOffset);
	    //delta = -event.detail / 3;
	  }
	if (startPos == 0) startPos = document.getElementById(mobject).offsetTop;
	currPos = startPos + delta;
	  //var currPos=document.getElementById(mobject).offsetTop;
	  //calculating the next position of the object
	  //currPos=parseInt(currPos)+(delta);
	  //moving the position of the object
	//  document.getElementById(mobject).style.top=currPos+"px";
	  document.getElementById(mobject).style.visibility="hidden";
	  document.getElementById(mobject).style.top=currPos+"px";
	 setTimeout('(document.getElementById("logo").style.visibility="visible")', 1000)  	
//	setTimeout("alert('de tijd is om!!!')", 1000);
	
}

