
var name = navigator.userAgent.toLowerCase();
var thisBrowserName = "";
var thisBrowserVNr = "";
if (name.search("msie 5")!=-1){
	thisBrowserVNr = 5;
	thisBrowserName = "ie";
}else if (name.search("msie 6")!=-1){
	thisBrowserVNr = 6;
	thisBrowserName = "ie";
}else if (name.search("msie 7")!=-1){
	thisBrowserVNr = 7;
	thisBrowserName = "ie";
}else if (name.search("netscape")!=-1){
	thisBrowserVNr = name.substr(name.search("netscape")+9,1);
	thisBrowserName = "netscape";
}else if(name.search("firefox")!=-1){
	thisBrowserVNr = name.substr(name.search("firefox")+8,1);
	thisBrowserName = "firefox";
}else{
	thisBrowserVNr = 0;
	thisBrowserName = "Unbekannt";
}

function anpassen ()
{

	this.window.resizeTo ( 100, 100 );
	//this.window.resizeTo ( window.document.body.scrollWidth, window.document.body.scrollHeight );
	var clWidth, clHeight, scrollH, scrollW;
	if(thisBrowserName == "netscape"){
		window.scroll = true;
		this.window.resizeTo ( 570, 630 );
		scrollH 	=  630;
		scrollW		=  570;
		clWidth		= window.innerWidth;
		clHeight	= window.innerHeight;
	}else{
		this.window.resizeTo ( window.document.body.scrollWidth, window.document.body.scrollHeight );
		scrollH 	= window.document.body.scrollHeight;
		scrollW		= window.document.body.scrollWidth; 
		clWidth		= window.document.body.clientWidth;
		clHeight	= window.document.body.clientHeight;
	}


	var iMinWidth = 300;
	var iDifWidth = scrollW - clWidth;
	
	if ( iDifWidth + clWidth < iMinWidth )
		iDifWidth = iMinWidth - clWidth;
	
	var iDif = ( scrollH + 5 ) - clHeight;
	
	if(scrollH > clHeight) iDif = scrollH - clHeight;
	
	formPos(clHeight, clWidth);
	
	this.window.resizeBy ( iDifWidth, iDif );
	
	formPos(clHeight, clWidth);
	
}

function formPos(clHeight, clWidth){
	var iLeft = ( window.screen.availWidth - clWidth ) / 2;
	var iTop = 0;
	
	if(((window.screen.availHeight/4*3) - clHeight)>0)
		iTop = (window.screen.availHeight/4*3) - clHeight;
	else 
		iTop = ( window.screen.availHeight - clHeight) / 2;
		
	window.moveTo (iLeft,iTop - 55);

}

function trim(s) {
  while (s.substring(0,1) == ' ') {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
    s = s.substring(0,s.length-1);
  }
  return s;
}

function trimNull(s) {
  while (s.substring(0,1) == '0') {
    s = s.substring(1,s.length);
  }
  if(s=="")s=0;
  s = s*2;
  s = s*0.5;
  return s;
}
