
//  CLIENT_SIDE SNIFFER CODE

// convert all characters to lowercase to simplify testing 
var agt=navigator.userAgent.toLowerCase(); 

//BROWSER VERSION
// Note: On IE5, these return 4, so use is_ie5up to detect IE5. 
var is_major = parseInt(navigator.appVersion); 
var is_minor = parseFloat(navigator.appVersion); 

//BROWSER TYPE 
var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) 
            && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) 
            && (agt.indexOf('webtv')==-1));
var is_nav4up = (is_nav && (is_major >= 4));  
var is_nav6 = (document.getElementById && !document.all); 
var is_ie   = (agt.indexOf("msie") != -1); 
var is_ie3  = (is_ie && (is_major < 4)); 
var is_ie4  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")==-1) );
var is_ie4up  = (is_ie  && (is_major >= 4));
var is_ie5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );  
var is_ie5up  = (is_ie  && !is_ie3 && !is_ie4);  
var is_dom = (document.getElementById);

//PLATFORM 
var is_win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
var is_mac    = (agt.indexOf("mac")!=-1);
var is_sun   = (agt.indexOf("sunos")!=-1);
var is_irix  = (agt.indexOf("irix") !=-1);    // SGI
var is_hpux  = (agt.indexOf("hp-ux")!=-1);
var is_aix   = (agt.indexOf("aix") !=-1);      // IBM
var is_linux = (agt.indexOf("inux")!=-1);
var is_sco   = (agt.indexOf("sco")!=-1) || (agt.indexOf("unix_sv")!=-1);
var is_unixware = (agt.indexOf("unix_system_v")!=-1); 
var is_mpras    = (agt.indexOf("ncr")!=-1); 
var is_reliant  = (agt.indexOf("reliantunix")!=-1);
var is_dec   = ((agt.indexOf("dec")!=-1) || (agt.indexOf("osf1")!=-1) || 
       (agt.indexOf("dec_alpha")!=-1) || (agt.indexOf("alphaserver")!=-1) || 
       (agt.indexOf("ultrix")!=-1) || (agt.indexOf("alphastation")!=-1)); 
var is_sinix = (agt.indexOf("sinix")!=-1);
var is_freebsd = (agt.indexOf("freebsd")!=-1);
var is_bsd = (agt.indexOf("bsd")!=-1);
var is_unix  = ((agt.indexOf("x11")!=-1) || is_sun || is_irix || is_hpux || 
             is_sco ||is_unixware || is_mpras || is_reliant || 
             is_dec || is_sinix || is_aix || is_linux || is_bsd || is_freebsd);
             
             
// Popup Fenster

var winID = 0;
var popUp = new Array();
 
function fensterAuf(inhalt, breite, hoehe) {
  var xOff = 10;
  var yOff = 10;
  if (parseInt(navigator.appVersion)>=4) { //Koordinaten fuer zentriertes PopUp Fenster festlegen
    xOff = (screen.width-breite)/2;
    yOff = (screen.height-(hoehe))/2;
    yOff -= 20; //Hoehenjustage, Wert anpassen, wenn Fenster Toolbar/Adresszeile/Statuszeile etc. hat
  }
  popUp[winID] = window.open(inhalt, 'fenster', 'toolbar=no,status=no,location=no,directories=no,resizable=no,scrollbars=auto,width='+breite+',height='+hoehe+',left='+xOff+',top='+yOff);
  winID++;
}



//Standardbildwechsel
function bild_on(name) {
	// document.images[name].src = "/shared_img/n_" + name + "_mo.gif";
  document.images[name].src = "/shared_img/n_navibutton_mo.gif";
} 

function bild_out(name) {
  document.images[name].src = "/shared_img/n_navibutton_na.gif";
}

function bild_on2(name) {
	// document.images[name].src = "/shared_img/n_" + name + "_mo.gif";
  document.images[name].src = "/shared_img/p_navibutton_mo.gif";
} 

function bild_out2(name) {
  document.images[name].src = "/shared_img/p_navibutton_na.gif";
}

// oeffnet pop up - fenster2 mit ausgelesenen hoehen und breiteangaben 
function fenster(URL,w,h) 
{
  win = window.open('/images.php?img='+URL,'fenster','toolbar=no,status=no,location=no,directories=no,resizable=no,scrollbars=auto,width='+w+',height='+h);
}


function fensterVideo(URL) {
  win = window.open(URL,'fenster','');
}



function handleResize() {
   if (((initWidth != window.innerWidth) || (initHeight != window.innerHeight)) && (typeof disableReload == "undefined")) {
     location.reload();
   }
   return false;
}


//initialisierung navi-layer in den seiten:
abstand="";


function initPages()
  { 
    layerPos1();
    
				
    if (is_nav)
      {
        window.captureEvents(Event.RESIZE);
        window.onresize = handleResize;
        initWidth = window.innerWidth;
        initHeight = window.innerHeight;
    }
    else
      {
        window.onresize = layerPos1;
    }
    menuPos = 0;
    bildPos = 0;

}

//positionierung des navi-layer in den seiten:
function layerPos1()
  {
		
		   if (is_nav6)
   {
		  leftBorder = ((window.innerWidth)- 771)/2;
				leftBorder = (leftBorder < 0) ? 9 : leftBorder;
			document.getElementById('navinull').style.left = (leftBorder) +0;
			document.getElementById('navieins').style.left = (leftBorder) +123;
			document.getElementById('navizwei').style.left = (leftBorder) +247;
			document.getElementById('navidrei').style.left = (leftBorder) +367;
			document.getElementById('navivier').style.left = (leftBorder) +493;
			document.getElementById('navifuenf').style.left = (leftBorder) +620;
     

   }		
   else if (is_nav)
      {
        document.layers["navinull"].left = leftBorder = document.images["1stPic"].x + 0; //13
        document.layers["navieins"].left = leftBorder = document.images["1stPic"].x + 125; //137
        document.layers["navizwei"].left = leftBorder = document.images["1stPic"].x + 249;
        document.layers["navidrei"].left = leftBorder = document.images["1stPic"].x + 369;
        document.layers["navivier"].left = leftBorder = document.images["1stPic"].x + 495;
        document.layers["navifuenf"].left = leftBorder = document.images["1stPic"].x + 622;
     }
     else
      { 
        //bugfixing: set properties only, if object exists - f.kores@21torr.com 2005 september 16th
        obj = document.all["navinull"].style;
        leftBorder = ((document.body.clientWidth - 772) / 2) + 1;
        leftBorder = (leftBorder < 0) ? 0 : leftBorder;
        if(document.all["navinull"]) {
          document.all["navinull"].style.left = (leftBorder - 10) + "px";
        }
        if(document.all["navieins"]) {
          document.all["navieins"].style.left = (leftBorder + 115) + "px";
        }
        if(document.all["navizwei"]) {
          document.all["navizwei"].style.left = (leftBorder + 239) + "px";
        }
        if(document.all["navidrei"]) {
          document.all["navidrei"].style.left = (leftBorder + 362) + "px";
        }
        if(document.all["navivier"]) {
          document.all["navivier"].style.left = (leftBorder + 486) + "px";
        }
        if(document.all["navifuenf"]) {
          document.all["navifuenf"].style.left = (leftBorder + 610) + "px";
        }  
    }
}



function initPages2()
  { 
    layerPos2();
    
				
    if (is_nav)
      {
        window.captureEvents(Event.RESIZE);
        window.onresize = handleResize;
        initWidth = window.innerWidth;
        initHeight = window.innerHeight;
    }
    else
      {
        window.onresize = layerPos1;
    }
    menuPos = 0;
    bildPos = 0;

}


//positionierung des navi-layer in den seiten:
function layerPos2()
  {
		
		   if (is_nav6)
   {
		  leftBorder = ((window.innerWidth)- 771)/2;
				leftBorder = (leftBorder < 0) ? 9 : leftBorder;
			document.getElementById('sitenavinull').style.left = (leftBorder) +0;
			document.getElementById('sitenavieins').style.left = (leftBorder) +133;
			document.getElementById('sitenavizwei').style.left = (leftBorder) +262;
			document.getElementById('sitenavidrei').style.left = (leftBorder) +397;
			document.getElementById('sitenavivier').style.left = (leftBorder) +528;
			document.getElementById('sitenavifuenf').style.left = (leftBorder) +655;

   }
		
   else if (is_nav)
      {
        document.layers["sitenavinull"].left = leftBorder = document.images["1stPic"].x + 16; //13
        document.layers["sitenavieins"].left = leftBorder = document.images["1stPic"].x + 146; //137
        document.layers["sitenavizwei"].left = leftBorder = document.images["1stPic"].x + 276;
        document.layers["sitenavidrei"].left = leftBorder = document.images["1stPic"].x + 405;
        document.layers["sitenavivier"].left = leftBorder = document.images["1stPic"].x + 535;
        document.layers["sitenavifuenf"].left = leftBorder = document.images["1stPic"].x + 666;
     }
     else
      { 
        obj = document.all["sitenavinull"].style;
        leftBorder = ((document.body.clientWidth - 772) / 2) + 1;
        leftBorder = (leftBorder < 0) ? 0 : leftBorder;
        document.all["sitenavinull"].style.left = (leftBorder - 5) + "px";
        document.all["sitenavieins"].style.left = (leftBorder + 126) + "px";
        document.all["sitenavizwei"].style.left = (leftBorder + 255) + "px";
        document.all["sitenavidrei"].style.left = (leftBorder + 385) + "px";
        document.all["sitenavivier"].style.left = (leftBorder + 516) + "px";
        document.all["sitenavifuenf"].style.left = (leftBorder + 645) + "px";
    }
}




//initialisierung fuer die layers
function init() 
{
  if(is_ie)
  {
	  genObj="document.all"
	  genStyle=".style"
  }

  if(is_nav4up)
  {
	  genObj="document.layers"
	  genStyle=""
  }
}
 
init();


function getArguments(argArray, varToSearchFor) {
	var variableValue;
	
	for (var i = 0; i < argArray.length; i++) {
		if (varToSearchFor == argArray[i].substring(0, varToSearchFor.length)) {
			variableValue = argArray[i].substring(varToSearchFor.length+1, argArray[i].length);
		}
	}	
	return variableValue;
}
function getSearchString(aParam) {
	var arguments = new Array();
	var strArgsLength = location.search.length;
	var aValue = "0";
	if (strArgsLength > 0) {
		var strArgs = location.search.substring(1, location.search.length);
		// ergaenzt (dk):
		if (strArgs.indexOf("?") > -1) strArgs = strArgs.substring(strArgs.lastIndexOf("?")+1,strArgs.length);
		// ergaenzung ende
		arguments = strArgs.split("&");
		aValue = getArguments(arguments, aParam);
	}
	return aValue;
}
var reloaded = getSearchString("no");
