// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// CMS UNABHÄNGIGE FUNKTIONEN
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------

   function jumpTo(URL) {
      location.href = URL;
   }


// -----------------------------------------------------------------------------
// Topmenu

   function tophover(ID,STATUS) {
      $left  = "tml"+ID;
      $right = "tmr"+ID;
      if(STATUS == 1) {
         document.getElementById($left).src  = 'templates/tan_home/topmenu4.png';
         document.getElementById($right).src = 'templates/tan_home/topmenu5.png';
      } else {
         document.getElementById($left).src  = 'templates/tan_home/trans.png';
         document.getElementById($right).src = 'templates/tan_home/trans.png';
      }
   }

// -----------------------------------------------------------------------------
// Suchfeld

   function tandemsuchfeld(TYP) {
      $text = document.getElementById('tandemsuche').value;
      if(TYP == 1) {
         if($text == 'Suche') {
            document.getElementById('tandemsuche').value = '';
         }
      } else {
         if($text == '') {
            document.getElementById('tandemsuche').value = 'Suche';
         }
      }
   }

// -----------------------------------------------------------------------------
// Menü

   function tshover(ID,COL) {
      document.getElementById(ID).style.backgroundImage = "url('templates/tan_menu/"+COL+".png')";
   }
   function tshover2(ID) {
      document.getElementById(ID).style.backgroundImage = "none";
   }






// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// CMS ABHÄNGIGE FUNKTIONEN
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------


// -----------------------------------------------------------------------------
// Funktionen für Breitenbeschränkung

   function neuAufbau() {
      location.href = location.href;
   }
   function holeWeite() {
      var xInnen = 0;
   	// Prüfung ob normaler Browser (kein IE)
   	if(window.innerWidth && window.outerWidth) {
   		xInnen   = window.innerWidth;
   	// Prüfung für IE6+ im Standard-Konformen Modus
   	} else if (document.documentElement.clientWidth) {
   		xInnen = document.documentElement.clientWidth;
   	// Prüfung für IE6+ im NICHT Standard-Konformen Modus und anderen IE Versionen
   	} else if (document.body.clientWidth) {
   		xInnen = document.body.clientWidth;
   	// Wenn Browser garnichts unterstützt
   	} else {
         xInnen = false;
   	}
   	return xInnen;
   }
   function fixWeite(Weite) {
      if(Weite > 980) {
         document.getElementById('toplogo').style.width = "960px";
         document.getElementById('topmenu').style.width = "960px";
         document.getElementById('maintable').style.width = "960px";
         document.getElementById('footer').style.width = "960px";
         if(document.getElementById('cmsadminmenu')) {
            document.getElementById('cmsadminmenu').style.width = "960px"; }
      } else {
         document.getElementById('toplogo').style.width = "98%";
         document.getElementById('topmenu').style.width = "98%";
         document.getElementById('maintable').style.width = "98%";
         document.getElementById('footer').style.width = "98%";
         if(document.getElementById('cmsadminmenu')) {
            document.getElementById('cmsadminmenu').style.width = "98%"; }
      }
   }
   function weiteOnload() {
      Weite = holeWeite();
      fixWeite(Weite);
   }


// -----------------------------------------------------------------------------
// Bilder
// -----------------------------------------------------------------------------

   function cmsimgpopup(imgid,breite,hoehe,session) {
      window.open("modules/cms_sites/pics_popup.php?img="+imgid+"&PHPSESSID="+session,
                  "b"+imgid,
                  "width="+breite+",height="+hoehe+",top=100,left=100,location=no"+
                  ",menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no"
      );
   }



// -----------------------------------------------------------------------------
// AJAX Funktionen
// -----------------------------------------------------------------------------

   function ajax(pURL,FUNKTION) {
      if(window.XMLHttpRequest) {
         xmlhttp = new XMLHttpRequest();
         xmlhttp.onreadystatechange = eval(FUNKTION);
         xmlhttp.open("GET", pURL, true);
         xmlhttp.send(null);
      } else if (window.ActiveXObject) {
         xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
         if (xmlhttp) {
            xmlhttp.onreadystatechange = eval(FUNKTION);
            xmlhttp.open('GET', pURL, false);
            xmlhttp.send();
         }
      }
   }

// Funktionen für Dateiverwaltung

   function cmsdz(CMSSITE,CMSLANGID,FILEMENUPID,SESS) {
      pURL = "modules/cms_sites/files_ajax.php";
      pURL = pURL + "?cmssite="+CMSSITE;
      pURL = pURL + "&cmslangid="+CMSLANGID;
      pURL = pURL + "&pid="+FILEMENUPID;
      pURL = pURL + "&PHPSESSID="+SESS;
      ajax(pURL,'cmsdz2');
   }
   function cmsdz2() {
      if(xmlhttp.readyState==4) {
         if(xmlhttp.status==200) {
            document.getElementById("cmsdateizuordnung").innerHTML = xmlhttp.responseText;
         }
      }
   }

// Funktionen für Bildverwaltung

   function cmsbz(CMSSITE,CMSLANGID,FILEMENUPID,SESS) {
      pURL = "modules/cms_sites/pics_ajax.php";
      pURL = pURL + "?cmssite="+CMSSITE;
      pURL = pURL + "&cmslangid="+CMSLANGID;
      pURL = pURL + "&pid="+FILEMENUPID;
      pURL = pURL + "&PHPSESSID="+SESS;
      ajax(pURL,'cmsbz2');
   }
   function cmsbz2() {
      if(xmlhttp.readyState==4) {
         if(xmlhttp.status==200) {
            document.getElementById("cmsdateizuordnung").innerHTML = xmlhttp.responseText;
         }
      }
   }

