function Cscreendata(){
}
Cscreendata.prototype.go=function(){ 
//	this.mWidth		= window.innerWidth || (window.document.documentElement.clientWidth || window.document.body.clientWidth);
//	this.mHeight	= window.innerHeight || (window.document.documentElement.clientHeight || window.document.body.clientHeight);

	this.body= document.getElementsByTagName("body")[0];
	this.nav=document.getElementById('nav');
	this.site=document.getElementById('site');

//	this.main=document.getElementById('main');
	this.content=document.getElementById('content');
	this.bottom=document.getElementById('bottom');
	this.top=document.getElementById('top');
	var BrowserName = navigator.appName;
	if(BrowserName == "Microsoft Internet Explorer") this.IE=true; else  this.IE= false;
	this.aktiv = window.setInterval("screendata.scrolltest()", 2000);
	this.scrolltest();
}
Cscreendata.prototype.scrolltest=function(){ 

	this.mWidth		= window.innerWidth || (window.document.documentElement.clientWidth || window.document.body.clientWidth);
	this.mHeight	= window.innerHeight || (window.document.documentElement.clientHeight || window.document.body.clientHeight);

	var t=0;
	if(this.IE){
		t=document.documentElement.scrollTop
	}else{
		t=window.pageYOffset;
	}
	t+=10;
	
//	var mh=this.main.offsetHeight; //grösse fenster
	var mh=this.mHeight; //grösse fenster
//	alert(this.mWidth);
	var nh=this.nav.offsetHeight;
	var ch=this.content.offsetHeight;
	var th=this.top.offsetHeight;
	var vk=  th-t;
	if(vk<0) vk=0;
	if(nh>mh-vk) t=0;
	var uh=this.bottom.offsetTop-(t+nh);
	if(uh<0) t+=uh;
	if(t<th) t=th+10;
	this.nav.style.top=t+'px';
	var sl = this.site.offsetLeft;
	if(this.autohor){
//		var left= (this.main.offsetWidth -this.site.offsetWidth)/2;
		var left= (this.mWidth -this.site.offsetWidth)/2;
		if(left<0)left=0;
		this.site.style.left=left+"px";
	}else if(sl<0){
		this.site.style.left="0px";
		this.site.style.marginLeft="0px";
		this.autohor=true;
	}
}
screendata=new Cscreendata();
function screendata_go(){
	screendata.go();
}
window.addEventListener?window.addEventListener('load',screendata_go,false):window.attachEvent('onload',screendata_go);

