  var ajaxTimeout; 
  var xmlToShow; 
  var DEF_PAGE_URL; 
   
  function ajaxInit() 
  {
   if (ajaxObject()) 
   { 
    ajaxEnabled = true; 
    ajaxInitLinks(); 
   } 
    
   checkIEmargin();
   setMetaNavi();
  } 
 
  function checkIEmargin() { 
   if (document.all) 
   { 
    if ((document.body.clientWidth % 2) != 0) obj = document.getElementById('overall').style.marginLeft = '-441px'; 
    else  obj = document.getElementById('overall').style.marginLeft = '-442px'; 
   }
   // safari
   
   /*if ((userAgent.indexOf('applewebkit') != -1) || (navigator.vendor == "Apple Computer, Inc.")) {
   	if ((document.body.clientWidth % 2) != 0) obj = document.getElementById('overall').style.marginLeft = '-441px'; 
    else  obj = document.getElementById('overall').style.marginLeft = '-442px'; 
	 }
	 */
  } 
 
   function ajaxObject() { 
    var A; 
   try 
   { 
    A=new ActiveXObject("Msxml2.XMLHTTP"); 
   } 
   catch (e) 
   { 
    try 
    { 
     A=new ActiveXObject("Microsoft.XMLHTTP"); 
    } 
    catch (oc) 
    { 
     A=null; 
    } 
   } 
   if(!A && typeof XMLHttpRequest != "undefined") A = new XMLHttpRequest(); 
   //if (!A) alert("error"); 
   return A; 
  } 
 
  // lädt eine seite per ajax 
  // wird über vorbereitete links aufgerufen, also mainnav und subnav 
  //  
  function ajaxLoad(uri, id) 
  { 
   // seite wird gesetzt, damit z.B. Druckversion die korrekte "aktuelle" Seite anzeigt 
   DEF_PAGE_URL = uri; 
   DEF_PAGE_ID_LAST = DEF_PAGE_ID; 
   DEF_PAGE_ID = id; 
 
 
   // wenn auf home drauf 
   if (DEF_PAGE_ID == "ajax1") 
   { 
    document.body.style.backgroundImage = 'url(/bilder/body.bg.home.gif)';
		document.getElementById('overall').style.backgroundImage = 'url(/bilder/overall.bg.home.jpg)';  
    obj = document.getElementById('colRightContent'); 
    obj.style.display = "none"; 
   } 
   // wenn von home weg 
   else if (DEF_PAGE_ID_LAST == "ajax1" || DEF_PAGE_ID != "ajax1") 
   { 
	    document.body.style.backgroundImage = 'url(/bilder/body.bg.gif)'; 
	    document.getElementById('overall').style.backgroundImage = 'url(/bilder/overall.bg.gif)';
	    obj = document.getElementById('colRightContent'); 
	    obj.style.display = "block"; 	
   } 
 
   //  
   var x; 
   ajaxPageTransform(id); 
 
   if (uri.indexOf("?")) uri = uri + '&ajax'; 
   else  uri = uri + '?ajax'; 
 
   x = ajaxObject(); 
   x.open("GET", uri, true); 
   x.onreadystatechange = function() 
   { 
    if (x.readyState != 4) return; 
    xmlToShow = x.responseText; 
    ajaxWaitForShow(); 
   } 
   x.send(null); 
   delete x; 
  } 
 
  function ajaxShow() 
  { 
   obj = document.getElementById('colCenterContent'); 
   obj.innerHTML = xmlToShow + '&nbsp;'; 
   ajaxInitLinks(); 
   timeoutOpacity(1); 
  } 
 
  function ajaxWaitForShow() 
  { 
   if (!cActive) ajaxShow(); 
   else ajaxTimeout = window.setTimeout('ajaxWaitForShow()', 20); 
  } 
 
  function trace(value) 
  { 
   obj = document.getElementById("tracer"); 
  } 
 
  function ajaxHandleLink() 
  { 
   timeoutOpacity(-1); 
   ajaxLoad(this.href, this.id); 
   if (this.blur) this.blur(); 
   return false; 
  } 
 
  function ajaxInitLinks() 
  { 
   links = document.getElementsByTagName("a");  
   for (var i = 0; i < links.length; i++) 
   { 
    if (links[i].id.substr(0, 4) == "ajax") links[i].onclick = ajaxHandleLink; 
   } 
  } 
 
  // id des aktuellen main navi punktes 
  var actMainId = 0; 
  // wird über den load-befehl eines "ajax.." links aufgerufen 
  // hier also ggf header zeigen und sunavi anpassen 
  function ajaxPageTransform(id) 
  { 
   pid = id.substr(4); 
 
   for (var index in ajaxPagesMain) 
   { 
    if (index == pid) 
    { 
     // geklickter link ist mainnavi gewesen 
     // setze neue actMainId 
     if (actMainId != pid) 
     { 
      actMainId = pid; 
      // header 
      headerZeigeUrl(ajaxPagesMain[index][2]); 
      obj = document.getElementById('header'); 
 
      // subnavi 
      subnaviEmpty(); 
      obj = document.getElementById('naviSub'); 
      if (obj && ajaxPagesSub['' + pid] && ajaxPagesSub['' + pid].length) 
      { 
       for (var subId in ajaxPagesSub['' + pid]) 
       { 
        neuLi = document.createElement("li"); 
        neuA = document.createElement("a"); 
        neuA.setAttribute("href", ajaxPagesSub['' + pid][subId][1]); 
        neuA.setAttribute("id", "ajax" + subId); 
        neuText = document.createTextNode(ajaxPagesSub['' + pid][subId][0]) 
        neuA.appendChild(neuText); 
        neuLi.appendChild(neuA); 
        obj.appendChild(neuLi); 
       } 
      } 
 
      neuLi = document.createElement("li"); 
      neuLi.className = 'empty'; 
      neuText = document.createTextNode("leer") 
      neuLi.appendChild(neuText); 
      if (obj) obj.appendChild(neuLi); 
 
      // links neu initiieren 
      ajaxInitLinks(); 
     } 
    } 
   } 
 
   // set em class on 
   setMainNavOn(pid);
   setMetaNavi();
   setSubNavOn(pid); 
  } 
 
  // hauptnavi erst alle off, dann den onnen auf on 
  function setMainNavOn(id) 
  {
  	var i;
   obj = document.getElementById("ulMain"); 
   arrA = obj.getElementsByTagName("a");
	   
   actMain = getMainIdById(id); 
	
   for (i = 0; i < arrA.length; i++) 
   {
			arrA[i].className = (arrA[i].id == "ajax" + actMain) ? 'on' : '';
   } 
  } 
 
  // subnavi erst alle off, dann den onnen auf on 
  function setSubNavOn(id) 
  {
  	var i;
   obj = document.getElementById("naviSub"); 
   if (!obj) return false; 
   arrA = obj.getElementsByTagName("a"); 
   actSub = getSubIdById(id); 
   for (i = 0; i < arrA.length; i++) 
   { 
    if (arrA[i]) arrA[i].className = (arrA[i].id == "ajax" + actSub) ? 'on' : ''; 
   } 
  }
  
	// meta navi
	function setMetaNavi() {
		var i;
		obj = document.getElementById("naviMeta"); 
		arrA = obj.getElementsByTagName("img");
		
		for (i = 0; i < arrA.length; i++) 
		{
		
			// grafiken auf 0
			arrA[i].src = '/bilder/nav.meta.' + arrA[i].id + '.' + DEF_LANG + '.off.gif';
		
			// is active?
			active = (arrA[i].parentNode.id == "ajax" + actMain);
			
			if (active) {
				// setzen und funcs weg
				arrA[i].src = '/bilder/nav.meta.' + arrA[i].id + '.' + DEF_LANG + '.on.gif';
				arrA[i].onmouseover = function() {}
				arrA[i].onmouseout = function() {}
			}
			else {
				// funcs hin
				arrA[i].onmouseover = function() {
					this.src = '/bilder/nav.meta.' + this.id + '.' + DEF_LANG + '.on.gif';
				}
				arrA[i].onmouseout = function() {
					this.src = '/bilder/nav.meta.' + this.id + '.' + DEF_LANG + '.off.gif';
				}
			}

		}
	}
 
  function getMainIdById(id) 
  { 
   for (var indexMain in ajaxPagesSub) 
   { 
    for (var indexSub in ajaxPagesSub[indexMain]) 
    { 
     if (parseInt(indexSub) == parseInt(id)) return parseInt(indexMain); 
    } 
   } 
 
   if (ajaxPagesMain[id].length) return id; 
   return 0; 
  } 
 
  function getSubIdById(id) 
  { 
   for (var indexMain in ajaxPagesSub) 
   { 
    for (var indexSub in ajaxPagesSub[indexMain]) 
    { 
     if (parseInt(indexSub) == parseInt(id)) return parseInt(indexSub); 
    } 
   } 
   return 0; 
  } 
 
 
  //  
  function subnaviEmpty() 
  { 
   obj = document.getElementById('naviSub'); 
   if (!obj) return false; 
   while (obj.hasChildNodes()) 
   { 
    obj.removeChild(obj.firstChild); 
   } 
  } 
 
 
 
  // opacity blendings 
  var cOpacity = 100; 
  var cTimer = false; 
  var cActive = false; 
  var cTimeout = 10; 
 
 
  function startEs() 
  { 
   timeoutOpacity(-1); 
  } 
 
  function timeoutOpacity(intDir) 
  { 
   if (cTimer) window.clearTimeout(cTimer); 
   cActive = true; 
 
   if (intDir < 0) cOpacity -= 10; 
   else cOpacity += 10; 
 
   obj = document.getElementById('colCenter'); 
   setOpacity(obj, cOpacity); 
 
   if (intDir < 0) 
   { 
    if (cOpacity > 0) cTimer = window.setTimeout('timeoutOpacity('+intDir+')', cTimeout); 
    else 
    { 
     cActive = false; 
    } 
   } 
   else 
   { 
    if (cOpacity < 100) cTimer = window.setTimeout('timeoutOpacity('+intDir+')', cTimeout); 
    else cActive = false; 
   } 
  } 
 
 
 
  function setOpacity(obj, opacity) { 
   opacity = (opacity == 100)?99.999:opacity; // IE/Win 
   obj.style.filter = "alpha(opacity:"+opacity+")"; // Safari<1.2, Konqueror 
   obj.style.KHTMLOpacity = opacity/100;  // Older Mozilla and Firefox 
   obj.style.MozOpacity = opacity/100; // Safari 1.2, newer Firefox and Mozilla, CSS3 
   obj.style.opacity = opacity/100; 
  } 
   
 
 
  // flash header blendings 
 
  var intZindex = 0; 
  var swfLayers = new Array(); 
  swfLayers[0] = "layer1"; 
  swfLayers[1] = "layer2"; 
  var swfLayerIndex = 0; 
 
  function headerGetCode(imgurl) 
  { 
   var code = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="884" height="135" id="header" align="middle"> <param name="allowScriptAccess" value="sameDomain" /> <param name="movie" value="/swf/header.swf?imageurl=' + imgurl + '" /><param name="loop" value="false" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#ffffff" /><embed src="/swf/header.swf?imageurl=' + imgurl + '" loop="false" quality="high" wmode="transparent" bgcolor="#ffffff" width="884" height="135" name="header" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> </object>'; 
   return code; 
  } 
 
  function headerZeigeUrl(imgurl) 
  { 
   var code; 
   code = headerGetCode(imgurl); 
   obj = document.getElementById(swfLayers[swfLayerIndex]); 
 
   obj.innerHTML = ""; 
   obj.style.visibility = "hidden"; 
   obj.innerHTML = code; 
   obj.style.zIndex = intZindex++; 
   obj.style.visibility = "visible"; 
 
   if (swfLayerIndex == 0) swfLayerIndex = 1; 
   else swfLayerIndex = 0; 
  } 
 
 
 
  function returnSearchSubmit() 
  { 
   if (!ajaxEnabled) return true; 
   var searchPhrase = document.getElementById('search').value; 
   var query = "/" + DEF_LANG + "/suche.html?search=" + searchPhrase; 
 
   timeoutOpacity(-1); 
   ajaxLoad(query, "ajax16");
   return false; 
  } 
 
  function changeLang(lang) 
  { 
   var newURL; 
   newURL = DEF_PAGE_URL; 
 
   newURL = newURL.replace(/\/de\//, "/" + lang + "/"); 
   newURL = newURL.replace(/\/en\//, "/" + lang + "/");
   newURL = newURL.replace(/\/es\//, "/" + lang + "/");  
 
   location.href = newURL; 
  }
