// JavaScript Document

function start(){
	parent.subnav.location='html/sub_blank.htm';
	parent.content.location='php/start.php';
}

function team(){
	parent.subnav.location='html/sub_team.htm';
	parent.content.location='html/aerzte.htm';
}

function aerzte(){
	parent.subnav.location='html/sub_blank.htm';
	parent.content.location='html/aerzte.htm';
}

function themen(){
	parent.subnav.location='html/sub_themen.htm';
	parent.content.location='html/themen_besonderheiten.htm';
}

function leistungen(){
	parent.subnav.location='html/sub_leistungen.htm';
	parent.content.location='html/leistungen_sprechstunde.htm';
}

function anfahrt(){
	parent.subnav.location='html/sub_blank.htm';
	parent.content.location='html/anfahrt.htm';
}

function kontakt(){
	parent.subnav.location='html/sub_blank.htm';
	parent.content.location='php/kontakt.php';
}

function impressum(){
	parent.subnav.location='html/sub_blank.htm';
	parent.content.location='html/impressum.htm';
}

function news(){
	parent.subnav.location='html/sub_blank.htm';
	parent.content.location='php/news.php';
}

function openit(page){
	window.open(page,"win","scrollbars=0,width=570,height=490,resizable=no");	
}

function sayit(tosay){
	alert(tosay);
}


//------------Überprüfung beliebiger Formularfelder auf Inhalt------------------------
function checkIt(i1,i2){
	teststring = document.forms[i1].elements[i2].value;
	if(teststring==''){		//Steht was (nix) im Feld
		return false;									//steht nix drin, schicke false zurück
	}	//end if
}	//end checkIt
//------------------------------------------------------------------------------------

function checkMail(i1,i2)
{
 s = document.forms[i1].elements[i2].value;
 var a = false;
 var res = false;
 
 if(typeof(RegExp) == 'function')
 {
  var b = new RegExp('abc');
  if(b.test('abc') == true){a = true;}
  }

 if(a == true)
 {
  reg = new RegExp('^([a-zA-Z0-9\\-\\.\\_]+)'+
                   '(\\@)([a-zA-Z0-9\\-\\.]+)'+
                   '(\\.)([a-zA-Z]{2,4})$');
  res = (reg.test(s));
 }
 else
 {
  res = (s.search('@') >= 1 &&
         s.lastIndexOf('.') > s.search('@') &&
         s.lastIndexOf('.') >= s.length-5)
 }
 return(res);
} 

//-----------------------------------------------------------------------------------------
//-------------pruefen kontaktformular-----------------------------------------------------
function KformularPruefen(){

	fehler = true;
	
	fehler = checkIt(0,0);							//Überprüfung Nachname
	if(fehler==false){
		sayit("Bitte Name eintragen.");			//Fehlermeldung
		document.forms[0].elements[0].focus();		//Cusor in Fehlerfeld setzen
		return;
	}	//end if

	fehler = checkIt(0,6);						//Überprüfung Mitteilung
	if(fehler==false){
		sayit("Bitte Nachricht eintragen.");
		document.forms[0].elements[6].focus();		//Cusor in Fehlerfeld setzen
		return;
	}	//end if
	
	fehler = checkIt(0,8);						//Überprüfung Telefon
	if(fehler==false){
		sayit("Bitte Telefonnummer eintragen.");
		document.forms[0].elements[8].focus();		//Cusor in Fehlerfeld setzen
		return;
	}	//end if

	fehler = checkMail(0,10);						//Überprüfung Mail
	if(fehler==false){
		sayit("Bitte eine gültige Email-Adresse eintragen.");
		document.forms[0].elements[10].focus();		//Cusor in Fehlerfeld setzen
		return;
	}	//end if
	

	if(fehler==true){
		document.forms[0].submit();
	}	//end if
}