function trimString(str) 
{ 
	return str.replace(/^\s*/, '').replace(/\s*$/, ''); 
}
//###########################################################
function obenmenu(Y,x,z)
{
//	alert (x+ " " +z + " " + Y);
	document.navigat.Z.value=z;
	document.navigat.X.value=x;
	document.navigat.OBEN_MENU.value=Y;
	document.navigat.LINKS_MENU.value=Y;
	
	if (Y==10) document.navigat.Z.value="";
	
	document.navigat.submit();	
}
//###########################################################
function senkmenu(Y,x,z)
{
//	alert (x+ " " +z);
	document.navigats.Z.value=z;
	document.navigats.X.value=x;
	document.navigats.OBEN_MENU.value=Y;
	document.navigats.submit();	
}

//###########################################################
function eingabetest()
{
	n=trimString(document.emwww.firma.value);
	e=trimString(document.emwww.emailadresse.value);
	i=trimString(document.emwww.internetadr.value);
	
//	alert(n+e+i);

	if (n.length < 5)
	{
		document.emwww.firma.focus(); 
		alert ("Fehlerhafte Eingabe"); 
		return false;
	}

	
	if (e.length > 0)    //E-MAIL PRÜFEN WENN EINGETRGEN
	{
		var regex = /^([a-zA-Z0-9][a-zA-Z0-9_.-]*)\@([a-zA-Z0-9]([a-zA-Z0-9_.-]*)\.)*([a-zA-Z0-9][a-zA-Z0-9_.-]*\.)[a-zA-Z]{2,4}$/;
 
 		if(e.search(regex) == -1 && e != '')
 		{
 			document.emwww.emailadresse.focus();  
 			alert ("Fehlerhafte Eingabe"); 
 			return false;	
 		}
	}
	else
	{
		document.emwww.emailadresse.focus(); 
		alert ("Fehlerhafte Eingabe"); 
		return false;
	}
	if (i.length < 5)
	{
		document.emwww.internetadr.focus(); 
		alert ("Fehlerhafte Eingabe"); 
		return false;
	}
	return true;
	
}
//###########################################################
function kontakttest()
{
	var plz1 = document.kontaktform.plz.value;
	var name = document.kontaktform.name.value;
	var str = document.kontaktform.str.value;
	var	ort = document.kontaktform.ort.value;
	var text = document.kontaktform.kommentar.value;
	var mail = document.kontaktform.eemail.value;

//	 alert(plz1+name+str+ort+text+mail);
	
	if(name.length < 3)
	{
		document.kontaktform.name.focus();
		alert("Eingabe fehlerhaft ! Bitte füllen Sie alle Eingabefelder!");
		return false;
	}
	if(str.length < 3)
	{
		document.kontaktform.str.focus();
		alert("Eingabe fehlerhaft ! Bitte füllen Sie alle Eingabefelder!");
		return false;
	}
	if (isNaN(plz1) || plz1.length < 5) 
	{
//		alert(plz);
		document.kontaktform.plz.focus();
		alert("Eingabe fehlerhaft ! Bitte füllen Sie alle Eingabefelder!");
		return false;
	
	}
	if(ort.length < 3)
	{
		document.kontaktform.ort.focus();
		alert("Eingabe fehlerhaft ! Bitte füllen Sie alle Eingabefelder!");
		return false;
	}	


	if (mail.length > 0)    //E-MAIL PRÜFEN WENN EINGETRGEN
	{
		var regex = /^([a-zA-Z0-9][a-zA-Z0-9_.-]*)\@([a-zA-Z0-9]([a-zA-Z0-9_.-]*)\.)*([a-zA-Z0-9][a-zA-Z0-9_.-]*\.)[a-zA-Z]{2,4}$/;
 
 		if(mail.search(regex) == -1 && mail != '')
 		{
 			document.kontaktform.eemail.focus();  
 			alert ("Fehlerhafte Eingabe"); 
 			return false;	
 		}
	}
	
	return true;
}
//###########################################################################
function kommloesch()
{
	if(document.getElementById("eintrag"))
	{
		document.kontaktform.eintragsbest.value="";
	}		
}
//###########################################################
function kontakttest_eng()
{
	var plz1 = document.kontaktform.plz.value;
	var name = document.kontaktform.name.value;
	var str = document.kontaktform.str.value;
	var	ort = document.kontaktform.ort.value;
	var text = document.kontaktform.kommentar.value;
	var mail = document.kontaktform.eemail.value;

//	 alert(plz1+name+str+ort+text+mail);
	
	if(name.length < 3)
	{
		document.kontaktform.name.focus();
		alert("Incorrect input! Please complete all input fields.");
		return false;
	}
	if(str.length < 3)
	{
		document.kontaktform.str.focus();
		alert("Incorrect input! Please complete all input fields.");
		return false;
	}
	if (isNaN(plz1) || plz1.length < 5) 
	{
//		alert(plz);
		document.kontaktform.plz.focus();
		alert("Incorrect input! Please complete all input fields.");
		return false;
	
	}
	if(ort.length < 3)
	{
		document.kontaktform.ort.focus();
		alert("Incorrect input! Please complete all input fields.");
		return false;
	}	


	if (mail.length > 0)    //E-MAIL PRÜFEN WENN EINGETRGEN
	{
		var regex = /^([a-zA-Z0-9][a-zA-Z0-9_.-]*)\@([a-zA-Z0-9]([a-zA-Z0-9_.-]*)\.)*([a-zA-Z0-9][a-zA-Z0-9_.-]*\.)[a-zA-Z]{2,4}$/;
 
 		if(mail.search(regex) == -1 && mail != '')
 		{
 			document.kontaktform.eemail.focus();  
 			alert ("Incorrect input!"); 
 			return false;	
 		}
	}
	
	return true;
}
//###########################################################################
function kommloesch()
{
	if(document.getElementById("eintrag"))
	{
		document.kontaktform.eintragsbest.value="";
	}		
}
//#######################################################################################
function weiter(p,g)
{
 //	alert(p g );	
 
	if(screen.width > "1024")		g=1;
		
	if(g==1) top.ANZEIGE2.location.href="./index1.php?OBEN_MENU=11&SLINK=./produkte/produkte.php&par=" + p + " ";
	if(g==0) top.location.href="./index1.php?OBEN_MENU=11&SLINK=./produkte/produkte.php&par=" + p + " ";
}
//########################################################################################
function preisliste(g)
{
// 	alert(p);	

	if(g==1)	top.ANZEIGE2.location.href="./index1.php?OBEN_MENU=11&SLINK=./kontakt/preislisteanf.php"; 
	if(g==0)	top.location.href="./index1.php?OBEN_MENU=11&SLINK=./kontakt/preislisteanf.php";
}
//########################################################################################
function eng_startseite(p)
{

//	alert(p);	
	
	if(screen.width > "1024")
	{
		top.location.href="./index2.php	?englisch=" + p + " ";
	}
	else
	{	
		top.location.href="./index1.php	?englisch=" + p + " ";
	}
/*	
	if (p==3)
	{
		p=1;
		top.location.href="./index2.php?englisch=" + p + " ";
		top.location.href="./index2.php?englisch=" + p + " ";
	}
	if (p==4)
	{
		p=2;
		top.location.href="./index2.php?englisch=" + p + " ";
	}
*/	
}
//########################################################################################
