<!--

  // © 2007 Bitpalast GmbH. Alle Rechte vorbehalten.


	function lettersonly(e){
		var unicode=e.charCode? e.charCode : e.keyCode
		if ((unicode!=8) && (unicode!=9)){ //if the key isn't the backspace or tab key (which we should allow)
		if (unicode>=48 && unicode<=57) //if a number
		return false //disable key press
		}
	}

	function numbersonly(e){
		var unicode=e.charCode? e.charCode : e.keyCode
		if ((unicode!=8) && (unicode!=9)){ //if the key isn't the backspace or tab key (which we should allow)
		if (unicode<48||unicode>57) //if not a number
		return false //disable key press
		}
	}

	function numbersandcommasonly(e){
		var unicode=e.charCode? e.charCode : e.keyCode
		if ((unicode!=8) && (unicode!=44) && (unicode!=9)){ //if the key isn't the backspace key, tab key, or a comma(which we should allow)
		if (unicode<48||unicode>57) //if not a number
		return false //disable key press
		}
	}

	function removedivider(number) {
		var newvalue = number.replace(/\./g, "");
		return (newvalue);
	}

	function insertdivider(number) {
		number = '' + number;
		number = number.replace(/\./g, "");

		if (number.length>1) {
			number = number.replace(/^0+/,"");
		}

		if (number.length > 3) {
			var mod = number.length % 3;
			var output = (mod > 0 ? (number.substring(0,mod)) : '');
			for (i=0 ; i < Math.floor(number.length / 3); i++) {
				if ((mod == 0) && (i == 0))
				output += number.substring(mod+ 3 * i, mod + 3 * i + 3);
				else
				// set divider character '.'
				output+= '.' + number.substring(mod + 3 * i, mod + 3 * i + 3);
			}
			return (output);
		}
		else return number;
	}


  function order_validator(theForm)
  {	
  
	if ((theForm.personentyp[0].checked) && (theForm.anrede.selectedIndex <= 0)) {
      alert("Bitte wählen Sie die Anrede aus.");
      theForm.anrede.focus();
      return (false);
	}

    if ((theForm.personentyp[0].checked) && (theForm.name.value.length < 2))
    {
      alert("Bitte tragen Sie Ihren Namen ein.");
      theForm.name.focus();
      return (false);
    } else if ((theForm.personentyp[1].checked) && (theForm.firma.value.length < 2)) {
      alert("Bitte tragen Sie Ihre Firma ein.");
      theForm.firma.focus();
      return (false);
	}

    if (theForm.strasse.value.length < 2)
    {
      alert("Bitte tragen Sie Ihre vollständige Straßenadresse ein.");
      theForm.strasse.focus();
      return (false);
    }

    if (theForm.plz.value.length < 4)
    {
      alert("Bitte tragen Sie Ihre Postleitzahl ein.");
      theForm.plz.focus();
      return (false);
    }

    if (theForm.ort.value.length < 3)
    {
      alert("Bitte geben Sie Ihren Ort ein.");
      theForm.ort.focus();
      return (false);
    }


    if (theForm.telefon.value.length < 6)
    {
      alert("Ihre Telefonnummer ist nicht vollständig. Bitte tragen Sie ggf. auch die Vorwahl ein.");
      theForm.telefon.focus();
      return (false);
    }

    if (theForm.email.value == "")
    {
      alert("Bitte geben Sie Ihre e-Mail Adresse ein.");
      theForm.email.focus();
      return (false);
    }

    if (theForm.email.value.length < 8)
    {
      alert("Ihre e-Mail Adresse muss mindestens acht Zeichen lang sein.");
      theForm.email.focus();
      return (false);
    }

    if ((theForm.email.value.indexOf("sdf") > -1) || (theForm.email.value.indexOf("jkl") > -1) || (theForm.email.value.indexOf(".") == -1) || (theForm.email.value.indexOf("@") == -1))
    {
      alert("Ihre e-Mail Adresse ist ungültig.");
      theForm.email.focus();
      return (false);
    }

    var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒ0123456789@-_.";
    var checkStr = theForm.email.value;
    var allValid = true;
    var validGroups = true;
    for (i = 0;  i < checkStr.length;  i++)
    {
      ch = checkStr.charAt(i);
      for (j = 0;  j < checkOK.length;  j++)
        if (ch == checkOK.charAt(j))
          break;
      if (j == checkOK.length)
      {
        allValid = false;
        break;
      }
    }
    if (!allValid)
    {
      alert("Bitte geben Sie nur Buchstaben, Ziffern und \"@-_.\" Zeichen in die e-Mail Adresse ein.");
      theForm.email.focus();
      return (false);
    }

	if ((theForm.anzahlgerahmt.value+theForm.anzahlungerahmt.value+theForm.mittel_grossformat.value+theForm.negative.value <1))
	 {
		alert("Bitte tragen Sie noch ein, wieviele Dias oder Negative Sie einsenden (eine ungefähre Anzahl genügt).");
		theForm.anzahlgerahmt.focus();
		return (false);
	}
	
	if ((theForm.fotoshow.checked==true) && (theForm.fotoshowtitel.value.length<1)) 
	{
		alert("Wenn Sie eine Fotoshow beauftragen, geben Sie bitte auch den Titel der Fotoshow an,\nder auf dem DVD-Cover aufgedruckt werden soll.");
		theForm.fotoshowtitel.focus();
		return (false);
	}

	if ((theForm.fotoshow.checked==false) && (theForm.fotoshowtitel.value.length>0)) 
	{
		alert("Sie haben einen Fotoshowtitel eingetragen, aber nicht angekreuzt, dass eine Fotoshow erstellt werden soll.\nBitte überprüfen Sie Ihre Auswahl.");
		theForm.fotoshow.focus();
		return (false);
	}

	if (theForm.anzahlkopie.value.length<1) 
	{
		alert("Bitte tragen Sie ein, wieviele Sicherungskopien erstellt werden sollen.");
		theForm.anzahlkopie.focus();
		return (false);
	}

	if ((theForm.versandart[1].checked == true) && (theForm.abholtermin.value.length <1)) 
	{
		alert("Bitte wählen Sie einen Abholtermin für Ihre Dias aus.");
		theForm.abholtermin.focus();
		return (false);
	}

	if (theForm.versandart[1].checked == true) 
	{
		var arrivaldate=Date.UTC('20'+theForm.abholtermin.value.substr(6,2), theForm.abholtermin.value.substr(3,2)-1, theForm.abholtermin.value.substr(0,2), 0, 0, 0);
		var now = new Date();
		var referencedate = Date.UTC(now.getYear(), now.getMonth(), now.getDate()+2, 0, 0, 0);
		if (referencedate>arrivaldate) {
			alert('Die Abholung ist frühestens in zwei Tagen (ausser Sonntag) möglich. Bitte wählen Sie einen späteren Abholtermin.');
			return (false);
		}
		
		if (theForm.anzahl_pakete.value.length<1) 
		{
			alert("Bitte tragen Sie ein, wieviele Pakete abgeholt werden sollen.");
			theForm.anzahl_pakete.focus();
			return (false);
		}
	}
		
	if ((theForm.anzahlkopie.value == 0) || (theForm.anzahlkopie.value.length == 0)) {
		theForm.sicherungskopie_translated.value = 'Es sollen keine Sicherungskopien angefertigt werden.';
	} else if (theForm.anzahlkopie.value == 1) {
		theForm.sicherungskopie_translated.value = 'Es soll eine Sicherungskopie angefertigt werden.';
	} else if (theForm.anzahlkopie.value.length > 1) {
		theForm.sicherungskopie_translated.value = 'Es sollen '+theForm.anzahlkopie.value+' Sicherungskopien angefertigt werden.';
	}

	if (theForm.anzahlgerahmt.value.length==0)
		theForm.anzahlgerahmt.value = '0';

	if (theForm.anzahlungerahmt.value.length==0)
		theForm.anzahlungerahmt.value = '0';

	if (theForm.mittel_grossformat.value.length==0)
		theForm.mittel_grossformat.value = '0';

	if (theForm.negative.value.length==0)
		theForm.negative.value = '0';

	if (theForm.fotoshow.checked == true) {
		theForm.fotoshow_translated.value = 'Es soll eine TV-Fotoshow erstellt werden mit dem Titel "'+theForm.fotoshowtitel.value+'".';
	} else {
		theForm.fotoshow_translated.value = '';
	}

	if (theForm.versandart[1].checked == true) {
		theForm.versandart_translated.value = 'Die Dias werden von ExpressDIA.de bei Ihnen abgeholt am '+theForm.abholtermin.value+'.';
	} else {
		theForm.versandart_translated.value = 'Die Dias werden vom Auftraggeber an ExpressDIA.de geschickt.';
	}

    return (true);
  }


//-->