// Bildwechsler (in 2 Versionen: Adminbereich und Public
function change(img,ref) { document.images[img].src = "bilder/"+ref+".jpg"; }
function changeadmin(img,ref) { document.images[img].src = "../bilder/"+ref+".jpg"; }

// Popup für Bilder (in 2 Versionen: Adminbereich und Public
function popup(imgid,breite,hoehe) {
   window.open("popup.php?img="+imgid,"b"+imgid,"width="+breite+",height="+hoehe+",top=100,left=100,location=no,menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no"); }
function popupadmin(imgid,breite,hoehe) {
   window.open("popup.php?img="+imgid,"b"+imgid,"width="+breite+",height="+hoehe+",top=100,left=100,location=no,menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no"); }

function rootchangespop(site) {
   window.open("root_changes_pop.php?site=" + site,"changes","width=420,height=480,location=no,menubar=no,resizeable=yes,scrollbars=yes,status=no,toolbar=no");
}
function norootchangespop(site) {
   window.open("noroot_changes_pop.php?site=" + site,"changes","width=420,height=480,location=no,menubar=no,resizeable=yes,scrollbars=yes,status=no,toolbar=no");
}

function openKalender(ziel) {
   window.open("kalender.php?targetid="+ziel,ziel,"width=400,height=350,location=no,menubar=no,resizeable=yes,scrollbars=yes,status=no,toolbar=no");
}

// Funktionen für Hauptbuttons oben - wird nicht genutzt, da zu starker effekt
function bon (BUTTON) { document.getElementById(BUTTON).style.background = '#fff'; }
function bof (BUTTON) { document.getElementById(BUTTON).style.background = '#99cc2b'; }
function aof (BUTTON) { document.getElementById(BUTTON).style.background = '#ebebeb'; }

function Go (select) {
  var wert = select.options[select.options.selectedIndex].value;
  if (wert != "leer") {
    location.href = wert;
    return;
  }
}

function Goto (URL) { location.href = URL; }
function popupWebsite (URL) {
   window.open(URL,'GMap',"width=800,height=600,location=no,menubar=yes,resizeable=yes,scrollbars=yes,status=no,toolbar=no");
}
function popupPrintSH(ID) {
   window.open("shsinglepopup.php?shid="+ID,"a"+ID,"width=550,height=480,location=no,menubar=yes,resizeable=yes,scrollbars=yes,status=no,toolbar=no");
}
function popupZuweisen(ID,ZID) {
   window.open("popup_zuweisen.php?shid="+ID+"&zid="+ZID,"z"+ID,"width=450,height=350,location=no,menubar=no,resizeable=yes,scrollbars=yes,status=no,toolbar=no");
}
function popupEingestellt(ID,EID) {
   window.open("popup_eingestellt.php?shid="+ID+"&eid="+EID,"e"+ID,"width=400,height=250,location=no,menubar=no,resizeable=yes,scrollbars=yes,status=no,toolbar=no");
}

function popupURL(URL,CHILDNAME,WIDTH,HEIGHT) {
   window.open(URL,CHILDNAME,"width="+WIDTH+",height="+HEIGHT+",location=no,menubar=yes,resizeable=yes,scrollbars=yes,status=no,toolbar=no");
}


// 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 > 1100) {
      document.getElementById('maintab').style.width = "1000px";
      document.getElementById('headtable').style.width = "1000px";
      document.getElementById('footertable').style.width = "1000px";
      if(document.getElementById('admintable')) {
         document.getElementById('admintable').style.width = "1000px"; }
   } else {
      document.getElementById('maintab').style.width = "95%";
      document.getElementById('headtable').style.width = "95%";
      document.getElementById('footertable').style.width = "95%";
      if(document.getElementById('admintable')) {
         document.getElementById('admintable').style.width = "95%"; }
   }
}
function weiteOnload() {
   Weite = holeWeite();
   fixWeite(Weite);
}

function hideDiv(DAT) {
   $status = document.getElementById(DAT).style.display;
   if($status == 'none') {
      document.getElementById(DAT).style.display = 'block';
   } else {
      document.getElementById(DAT).style.display = 'none';
   }
}

function boxOn(ARR) {
   for (var i = 0; i < ARR.length; ++i) {
     document.getElementById(ARR[i]).checked = true;
   }
}
function boxOff(ARR) {
   for (var i = 0; i < ARR.length; ++i) {
     document.getElementById(ARR[i]).checked = false;
   }
}

function writeInput(ID,WERT) {
   document.getElementById(ID).value = WERT;
}
