// Cookie-System fuer Online-Bestellungen

// korrigiert MAC-Bug

function FixCookieDate(date)

{

var basis=new Date(0);

var chk=basis.getTime();

if (chk > 0) date.setTime(date.getTime() - chk);

}



function loescheCookie(Name)

{

if (holeCookie(Name)) {

	document.cookie=Name+"="+"000; expires=Thu, 01-Jan-70 00:00:01 GMT";

}

}



function holeCookie(Name)

{

var nam=Name+"=";

var Laenge=nam.length;

var Cookie_Laenge=document.cookie.length;

var i=0;

while (i < Cookie_Laenge) {

	var j = i+Laenge;

	if (document.cookie.substring(i,j)== nam){

	 	return holeCookieWert(j);

	}

	i=document.cookie.indexOf(" ",i)+1;

	if (i==0) break;

}

return null;

}



function holeCookieWert(Position) 

{

var Ende=document.cookie.indexOf(";",Position);

if (Ende==-1) Ende=document.cookie.length;

return unescape(document.cookie.substring(Position,Ende));

}



function setzeCookie(Name,Wert,Datum)	

{

if (Datum!=null) {

	var expires = Datum.toGMTString();

	document.cookie=Name+"="+escape(Wert)+"; expires="+expires;

}

if (Datum==null)document.cookie=Name+"="+escape(Wert);

}





function formular_pruefen(language)

{

var chk=true;

if (document.BESTELLUNG.ANMERKUNG.length > 2048) { 

	if (language=="e") {

		alert("Max. 2048 Chars at QUESTIONS ...");

	} else alert("Im Feld ANMERKUNG duerfen maximal 2048 Zeichen eingegeben werden.");

	chk=false;

	document.BESTELLUNG.ANMERKUNG.focus();

}

var email=document.BESTELLUNG.EMAIL.value;

if (email !="")	{

   var atpos=email.indexOf("@");

	if (atpos<0) {

		if (language=="e") {

			alert("We need a correct email-address");

		} else alert("Bitte geben Sie Ihre E-Mail-Adresse korrekt ein: Fehlendes @");

    	chk=false;

	} else {

		if (email.lastIndexOf("@") != atpos) {

			if (language=="e") {

				alert("We need a correct email-address");

			} else alert("Bitte geben Sie Ihre E-Mail-Adresse korrekt ein: Mehrfaches @");

			chk=false;

		}	

	}

}		

if (document.BESTELLUNG.NAME.value=="") { 

	if (language=="e") {

		alert("Please give us your name (SURNAME, FIRSTNAME).");

	} else alert("Bitte fuellen Sie das Feld NAME, VORNAME korrekt aus.");

	chk=false;

	document.BESTELLUNG.NAME.focus();

}

if (document.BESTELLUNG.STRASSE.value=="") { 

	if (language=="e") {

		alert("Please give us your street.");

	} else alert("Bitte fuellen Sie das Feld STRASSE korrekt aus.");

	chk=false;

	document.BESTELLUNG.STRASSE.focus();

}

if (document.BESTELLUNG.ORT.value=="") { 

	if (language=="e") {

		alert("Please give us your city (ZIP-CODE, CITY).");

	} else alert("Bitte fuellen Sie das Feld ORT korrekt aus.");

	chk=false;

	document.BESTELLUNG.ORT.focus();

}

return chk;

}	


