function mOver(){
'window.event.srcElement.style.backgroundColor  = "#CC2D30";'
'window.event.srcElement.style.color  = "#FFFFFF";'
}
function mOut(){
'window.event.srcElement.style.backgroundColor ="#F8DEDF";'
'window.event.srcElement.style.color = "#CC2D30";'
}

function page( pnr, kz, CurPage, ZielPage, Artikel, Anfrage, MngFeld, WarenkorbID, rub, kat, uka)
{   

    document.gw.pnr.value = pnr;
    document.gw.cpa.value = CurPage;
    document.gw.zpa.value = ZielPage;
    document.gw.mng.value = 0;

	var newstr = "";
	var str = document.se.sea.value;
	for(var i=0; i<str.length; i++)
	{   var chr = str.charAt(i) + '';
	 if  ( ((chr>="0")&(chr<="9"))||((chr>=" ")&(chr<=" "))||((chr>="-")&(chr<="-"))||((chr>="Ä")&(chr<="Ä"))||((chr>="ä")&(chr<="ä"))||((chr>="Ö")&(chr<="Ö"))||((chr>="ö")&(chr<="ö"))||((chr>="Ü")&(chr<="Ü"))||((chr>="ü")&(chr<="ü"))||((chr>="ß")&(chr<="ß"))||((chr>="A")&(chr<="Z"))||((chr>="a")&(chr<="z")) )
	  	    { newstr=newstr + chr;    }; 
	}
	document.se.sea.value = newstr;


    if(kz == "1")  	//Schnellsuche
	  { 	if ( document.se.sea.value.length < 3 )
		{	alert ( "Suchbegriff mindestens 3-stellig!" )
			document.se.sea.focus();	}
		else
		{	document.gw.sea.value = document.se.sea.value;
			document.gw.submit();  		}	
	  }
    else if (kz == "2")    //Artikelblättern
	  { 
		document.gw.submit();
	  }
    else if (kz == "3")    //Artikeldetails
	  { 
		document.gw.anr.value = Artikel;
		document.gw.submit();
	  }
    else if (kz == "4")    //Anfrageformular 
	  { 
			document.gw.anr.value = Artikel;
			document.gw.anf.value = Anfrage;
			document.gw.submit();	
	  }
    else if (kz == "5")    //Prüfen Anfrage
	  { 
		if ( document.an.an_name.value == "" )
		    {	alert( "Geben Sie bitte Ihren Namen ein!" );
			document.an.an_name.focus;  }
		else if ( document.an.an_mail.value == "" & document.an.an_tel.value == "" )
		    {   alert( "Geben Sie bitte Ihre eMail Adresse oder Ihre Telefonnr. an!" );
			document.an.an_mail.focus;  }

		else if ( document.an.an_text.value == "" )
		    {   alert( "Geben Sie bitte Ihre Anfrage ein!" );
			document.an.an_text.focus;  }
		else
		    { 	document.gw.an_name.value = document.an.an_name.value;
			document.gw.an_mail.value = document.an.an_mail.value;
			document.gw.an_tel.value = document.an.an_tel.value;
			document.gw.an_betr.value = document.an.an_betr.value;
			document.gw.an_text.value = document.an.an_text.value;
			document.gw.submit();  }
	  }
    else if (kz == "6")    //Händlerlogin
	  { 
		document.gw.knr.value = document.lo.knr.value;
		document.gw.kpw.value = document.lo.kpw.value;
		document.gw.submit();
	  }
    else if (kz == "7")    //Artikel in Warenkorb
	  { 
   		var newstr = "";
		var str = "";
		for( i = 0; i < document.forms.de.elements.length; i++ )
		{  var s = document.forms.de.elements[ i ].name;
			if ( s == MngFeld )
			 { str = document.de.elements[ i ].value; }
		}

    		for(var i=0; i<str.length; i++)
     		{   var chr = str.charAt(i) + ''
        		if ((chr>="0")&(chr<="9"))
       	    		 { newstr=newstr + chr;    } 
		}
		if ( newstr >= 1 && newstr <= 999 )
		   {
			document.gw.mng.value = newstr;
			document.gw.aid.value = Artikel;
			document.gw.submit();	
		   }
		else
		   {alert( "Bitte geben Sie eine gültige Menge an (1-999)!" );}
	  }
    else if (kz == "8")    //Warenkorbposition Menge neu berechnen
	  { 
   		var newstr = "";
		var str = "";
		for( i = 0; i < document.forms.wk.elements.length; i++ )
		{  var s = document.forms.wk.elements[ i ].name;
			if ( s == MngFeld )
			 { str = document.wk.elements[ i ].value; }
		}

    		for(var i=0; i<str.length; i++)
     		{   var chr = str.charAt(i) + ''
        		if ((chr>="0")&(chr<="9"))
       	    		 { newstr=newstr + chr;    } 
		}
		if ( newstr >= 1 && newstr <= 999 )
		   {
			document.gw.mng.value = newstr;
			document.gw.wid.value = WarenkorbID;
			document.gw.submit();	
		   }
		else
		   {alert( "Bitte geben Sie eine gültige Menge an (1-999)!" );}
	  }
    else if (kz == "9")    //Warenkorbposition löschen
	  { 
			document.gw.mng.value = 0;
			document.gw.wid.value = WarenkorbID
			document.gw.submit();	
	  }
    else if (kz == "10")    //Adresseingabe
		if ( replaceSubstring(document.ad.RngAnr.value, " ", "") == "")
		       {alert( "Rechnungsanschrift <Name> fehlt" );}
		else if ( replaceSubstring(document.ad.RngStr.value, " ", "") == "")
		       {alert( "Rechnungsanschrift <Strasse> fehlt" );}
		else if ( replaceSubstring(document.ad.RngPLZ.value, " ", "") == "")
		       {alert( "Rechnungsanschrift <PLZ> fehlt" );}
		else if ( replaceSubstring(document.ad.RngOrt.value, " ", "") == "")
		       {alert( "Rechnungsanschrift <Ort> fehlt" );}
		else if ( replaceSubstring(document.ad.RngEmail.value, " ", "") == "")
		       {alert( "eMail-Adresse fehlt" );}
		else if ( replaceSubstring(document.ad.RngEmail.value, " ", "") != replaceSubstring(document.ad.RngEmailW.value, " ", ""))
		       {alert( "eMail-Adresse ist fehlerhaft" );}
		
		else if ( replaceSubstring(document.ad.RngTel.value, " ", "") == "")
		       {alert( "Telefonnummer fehlt" );}
		
		else if ( document.ad.cb_agb.checked == false )
		       {alert( "Bestätigen Sie bitte, dass Sie die AGB akzeptieren." );}
		
	
		else
		   {	document.gw.RngAnr.value = document.ad.RngAnr.value;
			document.gw.RngName1.value = document.ad.RngName1.value;
			document.gw.RngName2.value = document.ad.RngName2.value;
			document.gw.RngStr.value = document.ad.RngStr.value;
			document.gw.RngPLZ.value = document.ad.RngPLZ.value;
			document.gw.RngOrt.value = document.ad.RngOrt.value;
			document.gw.RngKZLand.value = document.ad.RngLand.options[ document.ad.RngLand.selectedIndex ].value;
			document.gw.RngLand.value = document.ad.RngLand.options[ document.ad.RngLand.selectedIndex ].text;
			document.gw.LiefAnr.value = document.ad.LiefAnr.value;
			document.gw.LiefName1.value = document.ad.LiefName1.value;
			document.gw.LiefName2.value = document.ad.LiefName2.value;
			document.gw.LiefStr.value = document.ad.LiefStr.value;
			document.gw.LiefPLZ.value = document.ad.LiefPLZ.value;
			document.gw.LiefOrt.value = document.ad.LiefOrt.value;
			document.gw.LiefLand.value = document.ad.LiefLand.options[ document.ad.LiefLand.selectedIndex ].text;
			document.gw.RngKZZahl.value = document.ad.RngZahl.options[ document.ad.RngZahl.selectedIndex ].value;
			document.gw.RngZahl.value = document.ad.RngZahl.options[ document.ad.RngZahl.selectedIndex ].text;
			document.gw.RngEmail.value = document.ad.RngEmail.value;
			document.gw.RngTel.value = document.ad.RngTel.value;
			document.gw.RngBem.value = document.ad.RngBem.value;
			
			document.gw.Bank.value = document.ad.Bank.value;
			document.gw.BLZ.value = document.ad.BLZ.value;
			document.gw.Konto.value = document.ad.Konto.value;
			
			
			if ( navigator.appName == "Microsoft Internet Explorer" )
			 {
    			   if ( confirm( "Sie bestellen jetzt zu unseren Allgemeinen Geschäftsbedingungen die im Warenkorb abgelegten Waren. Sind Sie sicher?" ) == true)
				{document.gw.submit();}
			 }
			else
			 { 
    			   //alert( "Sie bestellen jetzt zu unseren Allgemeinen Geschäftsbedingungen die im Warenkorb abgelegten Waren. Sind Sie sicher?" );
			   document.gw.submit();
			 }

		   }
    else if (kz == "11")    //Artikel aus Baumstruktur
	  {		document.gw.sea.value = "";
			document.gw.rub.value = rub;
			document.gw.kat.value = kat;
			document.gw.uka.value = uka;
			document.gw.submit();	
	  }
    
	else if (kz == "13")    //Newsletter
	  {	alert("Ihre Emailadresse wird übermittelt. Vielen Dank!");
	    if  (EmailCheck(document.nl.nwl.value)==false)
	    {
		alert("<Email-Adresse> ist nicht korrekt!");
        document.nl.nwl.focus();
	    }
		else
		{	document.gw.nwl.value = document.nl.nwl.value;
			document.gw.submit();		}
	    }

	
	else if (kz == "12")    //Suchbegriff
	  {	if ( document.se.sea.value.length > 0 & document.se.sea.value.length < 3 )
		{	alert ( "Suchbegriff mindestens 3-stellig!" )
			document.se.sea.focus();	}
		else
		{	document.gw.sea.value = document.se.sea.value;
			document.gw.submit();		}
	  }
    else 		//normaler Link
	  {		document.gw.sea.value = "";
			document.gw.submit();
	  }


}


function replaceSubstring(inputString, fromString, toString) 
{  var temp = inputString;
   if (fromString == "") 
	{ return inputString; }
   if (toString.indexOf(fromString) == -1) 
     {  while (temp.indexOf(fromString) != -1) 
	{
         var toTheLeft = temp.substring(0, temp.indexOf(fromString));
         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
         temp = toTheLeft + toString + toTheRight;
      	}
     } 
   else 
     { 
      var midStrings = new Array("~", "`", "_", "^", "#");
      var midStringLen = 1;
      var midString = "";
      while (midString == "") {
         for (var i=0; i < midStrings.length; i++) {
            var tempMidString = "";
            for (var j=0; j < midStringLen; j++) { tempMidString += midStrings[i]; }
            if (fromString.indexOf(tempMidString) == -1) {
               midString = tempMidString;
               i = midStrings.length + 1;
            }
         }
      } 
      while (temp.indexOf(fromString) != -1) 
      {  var toTheLeft = temp.substring(0, temp.indexOf(fromString));
         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
         temp = toTheLeft + midString + toTheRight;
      }
      while (temp.indexOf(midString) != -1) 
      {  var toTheLeft = temp.substring(0, temp.indexOf(midString));
         var toTheRight = temp.substring(temp.indexOf(midString)+midString.length, temp.length);
         temp = toTheLeft + toString + toTheRight;
      }
     } 
   return temp; 
} 


function EmailCheck(email)
{	//var pos = email.indexOf("@");
	
	var suche = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*$/;
	var Ergebnis = suche.test(email);
	
	if (Ergebnis==false)	  		
	{return false;}
	else
	{return true;}
	//if((pos <= 0)||(email.indexOf(".", pos) < 0)||(email.indexOf(".", pos)==(email.length-1))) 
}