// JavaScript Document

//----------------------------------------------------------------------------------------------------
//Inhalt zweier Frames ändern, bei Auswahl eines Links
//----------------------------------------------------------------------------------------------------
function ZweiFrames(URL1,F1,URL2,F2){ 			
    parent.frames[F1].location.href=URL1;
    parent.frames[F2].location.href=URL2;		
}//ZweiFrames									

//----------------------------------------------------------------------------------------------------
//Überprüfung eines Formulars auf Vollständigkeit und Konsistenz
//----------------------------------------------------------------------------------------------------
function chkFormular()	{
	if(document.info.name.value == "")  {
   		alert("Bitte geben Sie Ihren Namen ein!");	
   		document.info.name.focus();				
   		return false;
  	}//if
 	if(document.info.vorname.value == "")  { 	 
   		alert("Bitte geben Sie Ihren Vornamen ein!");
   		document.info.vorname.focus(); 			 
   		return false;								 
  	}//if
 	if(document.info.strassenr.value == "")  {
   		alert("Bitte geben Sie Ihre Straße und Hausnr. ein!");	
   		document.info.strassenr.focus();
   		return false;											
  	}//if
 	if(document.info.plz.value == "")  {
   		alert("Bitte geben Sie Ihre PLZ ein!");		
   		document.info.plz.focus();
   		return false;
  	}//if
 	if(document.info.ort.value == "")  {
   		alert("Bitte geben Sie Ihren Wohnort ein!");
   		document.info.ort.focus();				
   		return false;
  	}//if
	if(document.info.tel.value == "")  {
   		alert("Bitte geben Sie Ihre Telefonnr. ein!");	
   		document.info.tel.focus();
   		return false;
  	}//if
	if(document.info.email.value == "")  {
   		alert("Bitte geben Sie Ihre E-mail Adresse ein!");
   		document.info.email.focus();					
   		return false;
  	}//if
	if(document.info.email.value.indexOf('@') == -1) {
   		alert("Keine E-Mail-Adresse!");						
 		document.info.email.focus();
   		return false;
  	}//if
		
 	var chkplz = 1;
 	for(i=0;i<document.info.plz.value.length;++i)
  		 if(document.info.plz.value.charAt(i) < "0" || document.info.plz.value.charAt(i) > "9")
     		chkplz = -1;
 	if(chkplz == -1) {		
  		alert("Ihre Postleitzahl wurde nicht korrekt eingegeben!");
   		document.info.plz.focus();
   		return false;
  	}//if
	var chktel = 1;											
	for(i=0;i<document.info.tel.value.length;++i)		
  		 if(document.info.tel.value.charAt(i) < "0" || document.info.tel.value.charAt(i) > "9")
     		chktel = -1;																		
 	if(chktel == -1) {										
  		alert("Ihre Telefonnummer wurde nicht korrekt eingegeben!");
   		document.info.tel.focus();						
   		return false;
  	}//if
}//chkFormular


//----------------------------------------------------------------------------------------------------------
// Cookies lesen und schreiben
//----------------------------------------------------------------------------------------------------------


function readCookie(name) {
  var wert = "";
  var search = name + "=";
  
  if(document.cookie.length > 0)  { 
    start = document.cookie.indexOf(search);
    if (start != -1){ 
      start = start + search.length;
      end = document.cookie.indexOf(";", start);
	  
      if (end == -1) end = document.cookie.length;	
	  wert = document.cookie.substring(start, end);
    }//if
  }//if
  return wert;
}//read cookie


function writeCookie(name, wert, days) {
  var Verfall = "";
    
  if(days != null) {
  	var jetzt = new Date();
    Verfall = new Date(jetzt.getTime() + days*86400000); 
    Verfall = "; expires=" + Verfall.toGMTString();
  }//if
  document.cookie = name + "=" + wert + Verfall;
}


//------------------------------------------------------------------------------------------------------
//Zähler für die Seitenbesuche eines Anwenders
//------------------------------------------------------------------------------------------------------



function Besuchszaehler(){
   var days = 365;										
   var Zaehleralt = readCookie("Zaehler");
   var Zaehlerneu = 0;
   
   if(Zaehleralt == ""){
      writeCookie("Zaehler", 1, days);
	  Zaehlerneu = 1;
      document.write("Ihr " + Zaehlerneu + ". Besuch");
	}//if
   else{
   	Zaehleralt = Number(Zaehleralt);
   	if (Zaehleralt == 5) Zaehleralt = 0;//Zurücksetzten bei jedem 5. Versuch
   	if(document.cookie) {	
    	Zaehlerneu = Zaehleralt + 1;
		writeCookie("Zaehler",Zaehlerneu,days);		
    	document.write("Ihr " + Zaehlerneu + ". Besuch");
	} //if
   }//else
}//Besuchszaehler

//--------------------------------------------------------------------------------------------------------
//                            Datum / Uhrzeit
//--------------------------------------------------------------------------------------------------------

function ZeitAnzeigen() {
var Wochentagname =  new Array("Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag");

 var Jetzt = new Date();
 var Tag = Jetzt.getDate();
 var Monat = Jetzt.getMonth() + 1;
 var Jahr = Jetzt.getYear();
 if(Jahr < 999) Jahr += 1900;
 var Stunden = Jetzt.getHours();
 var Minuten = Jetzt.getMinutes();
 var Sekunden = Jetzt.getSeconds();
 var WoTag = Jetzt.getDay();
 var Vortag  = ((Tag < 10) ? "0" : "");
 var Vormon  = ((Monat < 10) ? ".0" : ".");
 var Vorstd  = ((Stunden < 10) ? "0" : "");
 var Vormin  = ((Minuten < 10) ? ":0" : ":");
 var Vorsek  = ((Sekunden < 10) ? ":0" : ":");
 var Datum = Vortag + Tag + Vormon + Monat  + "." + Jahr;
 var Uhrzeit = Vorstd + Stunden + Vormin + Minuten + Vorsek + Sekunden;
 var Gesamt = Wochentagname[WoTag] + ", " + Datum + ", " + Uhrzeit;

 if(DHTML) {
   if(NS) setCont("id","Uhr",null,"<span class=\"Uhr\">" + Gesamt + "<\/span>");
   else   setCont("id","Uhr",null,Gesamt);
 }
 else return;

 window.setTimeout("ZeitAnzeigen()",1000);
}

function Datumausgeben(){
	var Datum = new Date();
	var Jahr = Datum.getYear();
	var Monat = Datum.getMonth();
	var Tag = Datum.getDate();
	var Stunde = Datum.getHours();
	var Minute = Datum.getMinutes();
	var Sekunde = Datum.getSeconds();
	document.write(Tag+"."+(Monat +1)+"."+Jahr+", "+Stunde+":"+Minute+":"+Sekunde);
}// datumausgeben

/* DHTML-Bibliothek */

var DHTML = 0, DOM = 0, MS = 0, NS = 0, OP = 0;

function DHTML_init() {

 if (window.opera) {
     OP = 1;
 }
 if(document.getElementById) {
   DHTML = 1;
   DOM = 1;
 }
 if(document.all && !OP) {
   DHTML = 1;
   MS = 1;
 }
if(window.netscape && window.screen && !DOM && !OP) {
   DHTML = 1;
   NS = 1;
 }
}

function getElem(p1,p2,p3) {
 var Elem;
 if(DOM) {
   if(p1.toLowerCase()=="id") {
     if (typeof document.getElementById(p2) == "object")
     Elem = document.getElementById(p2);
     else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="name") {
     if (typeof document.getElementsByName(p2) == "object")
     Elem = document.getElementsByName(p2)[p3];
     else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="tagname") {
     if (typeof document.getElementsByTagName(p2) == "object" || (OP && typeof document.getElementsByTagName(p2) == "function"))
     Elem = document.getElementsByTagName(p2)[p3];
     else Elem = void(0);
     return(Elem);
   }
   else return void(0);
 }
 else if(MS) {
   if(p1.toLowerCase()=="id") {
     if (typeof document.all[p2] == "object")
     Elem = document.all[p2];
     else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="tagname") {
     if (typeof document.all.tags(p2) == "object")
     Elem = document.all.tags(p2)[p3];
     else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="name") {
     if (typeof document[p2] == "object")
     Elem = document[p2];
     else Elem = void(0);
     return(Elem);
   }
   else return void(0);
 }
 else if(NS) {
   if(p1.toLowerCase()=="id" || p1.toLowerCase()=="name") {
   if (typeof document[p2] == "object")
     Elem = document[p2];
     else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="index") {
    if (typeof document.layers[p2] == "object")
     Elem = document.layers[p2];
    else Elem = void(0);
     return(Elem);
   }
   else return void(0);
 }
}

function getCont(p1,p2,p3) {
   var Cont;
   if(DOM && getElem(p1,p2,p3) && getElem(p1,p2,p3).firstChild) {
     if(getElem(p1,p2,p3).firstChild.nodeType == 3)
       Cont = getElem(p1,p2,p3).firstChild.nodeValue;
     else
       Cont = "";
     return(Cont);
   }
   else if(MS && getElem(p1,p2,p3)) {
     Cont = getElem(p1,p2,p3).innerText;
     return(Cont);
   }
   else return void(0);
}

function getAttr(p1,p2,p3,p4) {
   var Attr;
   if((DOM || MS) && getElem(p1,p2,p3)) {
     Attr = getElem(p1,p2,p3).getAttribute(p4);
     return(Attr);
   }
   else if (NS && getElem(p1,p2)) {
       if (typeof getElem(p1,p2)[p3] == "object")
        Attr=getElem(p1,p2)[p3][p4]
       else
        Attr=getElem(p1,p2)[p4]
         return Attr;
       }
   else return void(0);
}

function setCont(p1,p2,p3,p4) {
   if(DOM && getElem(p1,p2,p3) && getElem(p1,p2,p3).firstChild)
     getElem(p1,p2,p3).firstChild.nodeValue = p4;
   else if(MS && getElem(p1,p2,p3))
     getElem(p1,p2,p3).innerText = p4;
   else if(NS && getElem(p1,p2,p3)) {
     getElem(p1,p2,p3).document.open();
     getElem(p1,p2,p3).document.write(p4);
     getElem(p1,p2,p3).document.close();
   }
}

DHTML_init();

<!------------------------------------------------------------------------------------------
<!--   Bilder Menüleiste
<!------------------------------------------------------------------------------------------
Normal1 = new Image();
Normal1.src = "../grafik/button1.jpg";     /* erste Standard-Grafik */
Highlight1 = new Image();
Highlight1.src = "../grafik/button1h.jpg"; /* erste Highlight-Grafik */
								
Normal2 = new Image();
Normal2.src = "../grafik/button2.jpg";     /* erste Standard-Grafik */
Highlight2 = new Image();
Highlight2.src = "../grafik/button2h.jpg"; /* erste Highlight-Grafik */

Normal3 = new Image();
Normal3.src = "../grafik/button3.jpg";     /* erste Standard-Grafik */
Highlight3 = new Image();
Highlight3.src = "../grafik/button3h.jpg"; /* erste Highlight-Grafik */

Normal4 = new Image();
Normal4.src = "../grafik/button4.jpg";     /* erste Standard-Grafik */
Highlight4 = new Image();
Highlight4.src = "../grafik/button4h.jpg"; /* erste Highlight-Grafik */

Normal5 = new Image();
Normal5.src = "../grafik/button5.jpg";     /* erste Standard-Grafik */
Highlight5 = new Image();
Highlight5.src = "../grafik/button5h.jpg"; /* erste Highlight-Grafik */

Normal6 = new Image();
Normal6.src = "../grafik/button6.jpg";     /* erste Standard-Grafik */
Highlight6 = new Image();
Highlight6.src = "../grafik/button6h.jpg"; /* erste Highlight-Grafik */

Normal7 = new Image();
Normal7.src = "../grafik/button7.jpg";     /* erste Standard-Grafik */
Highlight7 = new Image();
Highlight7.src = "../grafik/button7h.jpg"; /* erste Highlight-Grafik */

Normal8 = new Image();
Normal8.src = "../grafik/button8.jpg";     /* erste Standard-Grafik */
Highlight8 = new Image();
Highlight8.src = "../grafik/button8h.jpg"; /* erste Highlight-Grafik */

Normal9 = new Image();
Normal9.src = "../grafik/button9.jpg";     /* erste Standard-Grafik */
Highlight9 = new Image();
Highlight9.src = "../grafik/button9h.jpg"; /* erste Highlight-Grafik */
<!-- Spielbetrieb-------------------------------------------------------->
Normal10 = new Image();
Normal10.src = "../grafik/button10.jpg";     /* erste Standard-Grafik */
Highlight10 = new Image();
Highlight10.src = "../grafik/button10h.jpg"; /* erste Highlight-Grafik */

Normal11 = new Image();
Normal11.src = "../grafik/button11.jpg";     /* erste Standard-Grafik */
Highlight11 = new Image();
Highlight11.src = "../grafik/button11h.jpg"; /* erste Highlight-Grafik */

Normal12 = new Image();
Normal12.src = "../grafik/button12.jpg";     /* erste Standard-Grafik */
Highlight12 = new Image();
Highlight12.src = "../grafik/button12h.jpg"; /* erste Highlight-Grafik */

Normal13 = new Image();
Normal13.src = "../grafik/button13.jpg";     /* erste Standard-Grafik */
Highlight13 = new Image();
Highlight13.src = "../grafik/button13h.jpg"; /* erste Highlight-Grafik */

<!--Lehrgänge-------------------------------------------------------------->
Normal14 = new Image();
Normal14.src = "../grafik/button14.jpg";     /* erste Standard-Grafik */
Highlight14 = new Image();
Highlight14.src = "../grafik/button14h.jpg"; /* erste Highlight-Grafik */

Normal15 = new Image();
Normal15.src = "../grafik/button15.jpg";     /* erste Standard-Grafik */
Highlight15 = new Image();
Highlight15.src = "../grafik/button15h.jpg"; /* erste Highlight-Grafik */

/* usw. fuer alle weiteren zu benutzenden Grafiken */
				
function Bildwechsel(Bildnr,Bildobjekt) {
	window.document.images[Bildnr].src = Bildobjekt.src;
}
					