// JavaScript Document

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

wmtt = null;

function updateWMTT(e) {
	var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY) 	{
		posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop	+ document.documentElement.scrollTop;
	}
	if (wmtt != null) {
		wmtt.style.left = (posx + 20) + "px";
		wmtt.style.top 	= (posy + 20) + "px";
	}
}




function showWMTT(id) {
	wmtt = document.getElementById(id);
	wmtt.style.display = "block"
}

function hideWMTT() {
	wmtt.style.display = "none";
}

/*Schriftgroessen-Aenderungen*/

function insertActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function setActiveStyleSheet(title) {
  insertActiveStyleSheet(title);
  createCookie("style", title, 365);
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/; domain=.meta.lmz-bw.de";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

function workWithCookie(e) {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  insertActiveStyleSheet(title);
}

function init() {
	workWithCookie();
}
window.onload = init;


function zeigePulldown(erstes,zweites) {
	document.getElementById(erstes).style.display = "none";
	document.getElementById(zweites).style.display = "block";
}

//function zeigeKalender(aTag, welchen) {
function zeigeKalender(welchen) {
	var kalender = document.getElementById(welchen);
	kalender.style.display = "block";
	/*if(navigator.appName.indexOf("Explorer") != -1) {
		addY = 336;
	} else {
		addY = 150;
	}
	var ky = (aTag.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.offsetTop+addY)/12;
	var kx = (document.getElementById("content").offsetLeft+600)/12;
	kalender.style.left = kx+"em";
	kalender.style.top 	= ky+"em";*/
}

/*function schliesseKalender(welchen) {
	var kalender = document.getElementById(welchen);
	kalender.style.display = "none";	
}*/

function zeigeLogin(check,welchen) {
	var diesen = document.getElementById(welchen);
	var checker = document.getElementById(check).checked;
	if(checker) {
		diesen.style.display = "block";
	} else {
		diesen.style.display = "none";
	}
}

function popUpWindow(URLStr) {
	window.open(URLStr,'popUpWin','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=580,height=630');
}

function popUpWindowGross(URLStr,breite,hoehe) {
	window.open(URLStr,'popUpWin','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+breite+',height='+hoehe);
}

function hideSelect(welches) {
	var ua = navigator.userAgent.toLowerCase();
	var av = navigator.appVersion;
	var version = av.substring(0, av.indexOf(".")) *1;
	if (iebrowser = (ua.indexOf("msie") > -1 && ua.indexOf("opera") == -1) && version==4 && ua.indexOf("msie 6")>-1) {
		var dieses = document.getElementById(welches);
		dieses.style.display = "none";
	}
}

function showSelect(welches) {
	var ua = navigator.userAgent.toLowerCase();
	var av = navigator.appVersion;
	var version = av.substring(0, av.indexOf(".")) *1;
	if (iebrowser = (ua.indexOf("msie") > -1 && ua.indexOf("opera") == -1) && version==4 && ua.indexOf("msie 6")>-1) {
		var dieses = document.getElementById(welches);
		dieses.style.display = "block";
	}
}

function mailMETA()
{
	var mail_str;
	mail_str = "mailto:?subject= Empfehlung: " + document.title;
	mail_str += "&body=Schauen Sie sich diese Internetseite einmal an: " + document.title;
	mail_str += ", " + location.href;
	mail_str += "!";
	location.href = mail_str;
}

function focuselement(){
    this.value='';
    this.className = 'fokus';
}


function changediv1(){
  var s ;
  s = 'Schulnummer<div id="schulnummer">' ;
	s +=  '<input type="text" name="schulnummer" onfocus="focuselement();" class="start" tabindex="1" /> ';
	s +=		'<a href="#" onmouseover="hideSelect(\'medienzentrum"\'); showWMTT(\'helpSuchtext\')" onmouseout="showSelect(\'medienzentrum\'); hideWMTT()">';
	s +=       '<img src="pictures/ico_hilfe.gif" alt="Hilfe" class="hilfe" /></a>' ;
	s +=  '</div>Kundennummer<div id="kundennummer"> ' ;
	s +=     '<input type="text" name="kundennummer" onfocus="focuselement();" class="start" tabindex="2" /> ' ;
	s +=			 '<a href="#" onmouseover="hideSelect(\'medienzentrum\'); showWMTT(\'helpSuchtext\')" onmouseout="showSelect(\'medienzentrum\'); hideWMTT()">' ;
	s +=					'<img src="pictures/ico_hilfe.gif" alt="Hilfe" class="hilfe" /></a>' ;
	s +=	'</div>Medienzentrum<div id="medienzentrum">' ;
	s +=	'<select name="medienzentrum" tabindex="3"><option>Bitte ausw&auml;hlen</option><option value="1">Aalen</option><option value="2">Albstadt</option>option value="3">Backnang</option>option value="82">Bad S&auml;ckingen</option>option value="24">Bad Saulgau</option>option value="5">Biberach</option>option value="6">Böblingen</option>option value="62">Bruchsal</option>option value="69">Buchen</option>option value="76">Mittelbaden</option>option value="51">Calw</option>option value="7">Crailsheim</option>option value="80">Donaueschingen</option>option value="8">Ehingen</option>option value="52">Emmendingen</option>option value="9">Esslingen</option>option value="63">Ettlingen</option>option value="53">Freiburg</option>option value="56">Freudenstadt</option><option value="10">Friedrichshafen</option><option value="11">G&ouml;ppingen</option><option value="12">Hechingen</option><option value="59">Heidelberg</option><option value="13">Heidenheim</option><option value="14">Heilbronn</option><option value="57">Horb</option><option value="99">Karlsruhe</option><option value="92">Karlsruhe (Filmkiste e.V.)</option><option value="39">VIDEMA-Lizenz</option><option value="71">Kehl</option><option value="15">Ki&szlig;legg</option><option value="64">Konstanz</option><option value="16">K&uuml;nzelsau</option><option value="72">Lahr</option><option value="44">Landesarchiv-LMZ</option><option value="17">Leonberg</option><option value="66">L&ouml;rrach</option><option value="18">Ludwigsburg</option><option value="67">Mannheim</option><option value="68">Mosbach</option><option value="19">M&uuml;nsingen</option><option value="20">N&uuml;rtingen</option><option value="21">&Ouml;hringen</option><option value="70">Offenburg</option><option value="74">Pforzheim</option><option value="22">Ravensburg</option><option value="23">Reutlingen</option><option value="77">Rottweil</option><option value="25">Schw&auml;bisch Gm&uuml;nd</option><option value="26">Schw&auml;bisch Hall</option><option value="27">Sigmaringen</option><option value="49">Stuttgart</option><option value="28">Tauberbischofsheim</option><option value="29">T&uuml;bingen</option><option value="78">Tuttlingen</option><option value="30">&Uuml;berlingen</option><option value="31">Ulm</option><option value="32">Vaihingen</option><option value="79">Villingen-Schwenningen</option><option value="33">Waiblingen</option><option value="81">Waldshut</option><option value="73">Wolfach</option><option value="">Suche in allen Medienzentren</option></select>' ;
	s +=		 '</div>Passwort<div id="passwort">' ;
	s +=				'<input type="password" name="Passwort" onfocus="focuselement()" class="start" tabindex="4" /> ' ;
	s +=					'<button class="login" title="Klicken Sie hier, um die Anmeldung auszuführen oder bestätigen Sie Ihre Anmeldung mit der ENTER-Taste " tabindex="5" type="submit">&nbsp;</button>';
	s +=						'</div><div id="formular"><a href="#" onclick="changediv2()">Formular wechseln</a></div>	<p>&nbsp;</p>' ;
  var formDiv = document.getElementById('anmeldung') ;
  formDiv.innerHTML = s ;
}

function changediv2(){
  var s ;
  s = 'Anmeldename<div id="name">' ;
	s +=		'<input type="text" name="Benutzername" onfocus="focuselement()" class="start" /> ';
	s +=					'<a href="#" onmouseover="showWMTT(\'helpSuchtext\')" onmouseout="hideWMTT()">';
	s +=							'<img src="pictures/ico_hilfe.gif" alt="Hilfe" class="hilfe" /></a>' ;
	s +=  '</div>Passwort<div id="passwort">' ;
	s +=		'<input type="password" name="Passwort"onfocus="focuselement()" class="start" /> ' ;
	s +=				'<button class="login" title="Klicken Sie hier, um die Anmeldung auszuführen oder bestätigen Sie Ihre Anmeldung mit der ENTER-Taste " tabindex="102" type="submit">&nbsp;</button>' ;
	s +=					'</div><div id="pwVergessen"><a href="#">Passwort vergessen?</a></div>' ;
	s +=							'<p>&nbsp;</p><p>&nbsp;</p><p>Oder möchten Sie sich mit Ihrer Schulnummer und der Kundennummer anmelden?</p>' ;
	s +=					'<div id="formular"><a href="#" onclick="changediv1()">Formular wechseln</a></div><p>&nbsp;</p><p>&nbsp;</p>' ;
  var formDiv = document.getElementById('anmeldung') ;
  formDiv.innerHTML = s ;
}



