var _run; // Set an empty variable named “_run”

function syncnav(deeplink) {
	// synchronisiert die Navigation bei HTML navigation.
	// Aufruf über onload
	if (parent.frames["nav"].makeCall) {
	parent.frames["nav"].makeCall(deeplink);
	}
}

if(document.ids)x='nc4';
else if( document.all && !document.getElementById )x='ie4';
else if( window.opera && !document.createElement )x='op5';
else if( window.opera && window.getComputedStyle )  {
          if(document.createRange)x='op8';
            else if(window.navigate)x='op7.5';
                             else x='op7.2';                   }
else if( window.opera && document.compatMode )x='op7';
else if( window.opera && document.releaseEvents )x='op6';
else if( document.contains && !window.opera )x='kq3';
else if(window.pkcs11&&window.XML)x='f15';
else if( window.getSelection && window.atob )x='nn7';
else if( window.getSelection && !document.compatMode )x='nn6';
else if( window.clipboardData && document.compatMode )
  x=window.XMLHttpRequest? 'IE7' : 'IE6';
else if( window.clipboardData ){x='ie5';
     if( !document.createDocumentFragment ) x+='.5';
     if( document.doctype && !window.print ) x+='m';}
else if( document.getElementById && !document.all ) x='op4';
else if( document.images && !document.all ) x='nn3';
else if(document.clientWidth&&!window.RegExp)x='kq2';
else x='???';

if(navigator.userAgent.indexOf("Firebird")!=-1||navigator.userAgent.indexOf("Firefox")!=-1||navigator.appName=="Microsoft Internet Explorer")
  // if the browser is Firebird/Firefox or MSIE
        {_run=false;} // set the variable _run to false
else {_run= true;} // otherwise, set _run to true




function scrollR() 
{
		 var topframe = parent.frames["nav"];
        var left = (window.pageXOffset)?(window.pageXOffset):(document.documentElement)?document.documentElement.scrollLeft:document.body.scrollLeft;   
		
		if (navigator.appName=="Microsoft Internet Explorer") {
			var w = document.documentElement.clientWidth;
			var widthelem = topframe.document.getElementById("topcontainer");	
		}   else {
			var w = window.innerWidth;
			var widthelem = document.getElementById("pseudowidth");
		}
	
		var widthminusscrollbar = widthelem.offsetWidth;
	
		topframe.scrollTo(left,0); 
		var tc = topframe.document.getElementById("topcontainer");
		if (navigator.appName=="Microsoft Internet Explorer") {
			var dif = (w - widthminusscrollbar);
			// Korrektur IE7
			if (x == "IE7") {
				tc.style.marginLeft =  dif +"px";
			} else {
				// Korrektur IE6
				tc.style.marginLeft = 0;
			}
		}/* else {
			var dif = (w - widthminusscrollbar) /2;
			tc.style.marginLeft = - dif +"px";
		}*/
		var dif = (w - widthminusscrollbar);
		if (dif > 0) {
			tc.style.overflowY = "scroll";
			
		} else {
			tc.style.overflow = "hidden";
			tc.style.overflowY = "hidden";
		}
		
		//MM_setTextOfLayer('apDiv1','',"Browser= " + x + "<BR> widthminusscrollbar =  " +widthminusscrollbar + "<BR>, w =" + w + "<BR>, widthelem =" + widthelem + "<BR>tc=" + tc + ", dif=" + dif);

} 
var lastdif;
function initScroll(){
	//delete lastdif;
	window.setTimeout("searchScroll();",10); /* run this function once every millisecond, or 1,000 times a second */
	
}
function searchScroll(){
 	var topframe = parent.frames["nav"];
 	var left = (window.pageXOffset)?(window.pageXOffset):(document.documentElement)?document.documentElement.scrollLeft:document.body.scrollLeft;
  /* This is what was done earlier. We’re setting the left variable to the distance (in pixels) that the document has been scrolled from the left to the right. */
	
	
	var w = window.innerWidth;
	
	var widthelem = document.getElementById("pseudowidth");
	
//	pseudowidth
	var widthminusscrollbar = widthelem.offsetWidth;
  	var dif = (w - widthminusscrollbar) /2;

	
	var tc = topframe.document.getElementById("topcontainer");

	if (dif > 0) {
		if (! lastdif || lastdif != dif) {
			tc.style.overflowY = "scroll";
			tc.style.overflowX = "hidden";
			window.resizeTo(window.outerWidth +1, window.outerHeight);
			lastdif = dif;
			//alert("scroll");
		}
	} else {
		if (lastdif != dif) {
			tc.style.overflow = "hidden";
			tc.style.overflowY = "hidden";
			tc.style.overflowX = "hidden";
			lastdif = dif;
			window.resizeTo(window.outerWidth -1, window.outerHeight);
			//alert("dif="+dif+", lastdif= " + lastdif);
		}
	}
	topframe.scrollTo(left,0); /* scroll the left frame to the position of this this frame */
	window.setTimeout("searchScroll();",10);
}

if(_run == false) // if _run was set to false
{
	window.onscroll=function(){scrollR();} /* run the function scrollR() when the document is scrolled */
	window.onload=function(){scrollR();} /* run the function scrollR() when the document is scrolled */
	window.onresize=function(){scrollR();} /* run the function scrollR() when the document is scrolled */
} else { // if the variable _run is set to true
	window.onload=function(){initScroll()} /* when the document loads, run the searchScroll() function 1,000 times a second (because there is a setTimeout() function inside the searchScroll() function).*/
}