function Std_getFieldValue ( theField, vType ) {
        //this function will return the field value (or value list) based on the element type
        theValue = "";
        sep = "";
        hits = 0;
        //text is the user-entered value as a string
        if ( vType == "text" ) return ( theField.value );
        //textarea is the user-entered value as a string array of one element
        if ( vType == "textarea" ) return ( theField.value );
        //select is an array of selection pointers to an array of strings representing the choices
        if ( vType == "select" ) {
                for ( i = 0; i < theField.options.length; i++ ) {
                        if ( theField.options[i].selected ) {
                                if ( theField.options[i].value == "" ) {
                                        theValue += theField.options[i].text
                                } else {
                                        theValue += theField.options[i].value
                                }
                        }
                }
                return ( theValue );
        }
        //checkboxes & radio buttons are not so simple
        if ( vType == "checkbox" || vType == "radio" ) {
                if ( theField.value == null ) {
                        //if we're here, we are validating a radio button or a nn multi-element checkbox
                        for ( i = 0; i < theField.length; i++ ) {
                                if ( theField[i].checked ) {
                                        hits++;
                                        if ( hits > 1 ) {
                                                sep = "; ";
                                        }
                                        theValue += sep + theField[i].value;
                                }
                        }
                }
                return ( theValue );

        } else {
                //if we are here, must be an ie checkbox, or nn with a one-element checkbox")
                if ( navigator.appName == "Microsoft Internet Explorer" ) {
                        //ie. return some data so we can validate on the server;
                        return ("can't validate on client")
                }
                //nn one-element checkbox, see if its checked ...
                if (theField.checked ) {
                        return ( theField.value );
                } else {
                        return ( "" );
                }
        }
}
function CheckMailAddress(){
var mail=document.Contact.EMailAddress.value;
if(mail == "")
   {
           alert("Bitte geben Sie Ihre Email Adresse ein !");
           document.Contact.EMailAddress.focus();
       return false;
   } else
   {
       var erg  = mail.search(/.+@..+\...+/);
       if(erg==-1)
       {
                    alert("Bitte geben Sie eine funktionierende Email Adresse ein");
                    document.Contact.EMailAddress.focus();
          return false;
       }
       var erg = mail.search(/\s/);
       if(erg!=-1)
       {
                    alert("Bitte geben Sie eine funktionierende Email Adresse ein");

          document.Contact.EMailAddress.focus();
          return false;
       }
   }
   return true;
   }
function textCounter(field, maxlimit) {
        if (field.value.length > maxlimit)
         return true;
        else
         return false;
}
function Validate()
{
   var v=""
   v=Std_getFieldValue(document.Contact.Query,"text");
   if(v =="" )   {
   	        alert("Bitte geben Sie eine Nachricht ein");
              document.Contact.Query.focus();
        return false;
   }
	if (textCounter(document.Contact.Query, 1000)) {
			            alert("Bitte geben Sie weniger als 1000 Zeichen ein");
                  	document.Contact.Query.focus();
            return false;
   }
   v=Std_getFieldValue(document.Contact.ProductDescription,"select");
   if(v =="Bitte wählen" )   {
              alert("Bitte wählen Sie einen Empfänger aus");

        document.Contact.ProductDescription.focus();
        return false;
   }
   v=Std_getFieldValue(document.Contact.Title,"select");
   if(v =="Bitte wählen" )   {
              alert("Bitte wählen Sie eine Anrede aus");

        document.Contact.Title.focus();
        return false;
   }
   v=Std_getFieldValue(document.Contact.FirstName,"text");
   if(v =="" )   {
   	        alert("Bitte geben Sie Ihren Vornamen ein");

        document.Contact.FirstName.focus();
        return false;
   }
   v=Std_getFieldValue(document.Contact.LastName,"text");
   if(v =="" )   {
   	        alert("Bitte geben Sie Ihren Nachnamen ein");

        document.Contact.LastName.focus();
        return false;
   }
 	v=Std_getFieldValue(document.Contact.Street,"text");
   if(v =="" )   {
   	        alert("Bitte geben Sie Ihre Anschrift ein");

        document.Contact.Street.focus();
        return false;
   }
   v=Std_getFieldValue(document.Contact.PostalCode,"text");
      if(v =="" )   {
		alert("Bitte geben Sie Ihre PLZ ein");

	   document.Contact.PostalCode.focus();
	   return false;
   }
   v=Std_getFieldValue(document.Contact.City,"text");
      if(v =="" )   {
      	        alert("Bitte geben Sie Ihren Ort ein");

           document.Contact.City.focus();
           return false;
   }
 /*	v=Std_getFieldValue(document.Contact.Country,"select");
   if(v =="Bitte wählen" )   {
              alert("Bitte wählen Sie ein Land aus");

        document.Contact.Country.focus();
        return false;
   }*/
  /*
  v=Std_getFieldValue(document.Contact.Phone,"text");
  if(v =="" )   {
		alert("Bitte geben Sie Ihre Telefonnummer ein");

	   document.Contact.Phone.focus();
	   return false;
   }
   */
  if (CheckMailAddress()== false) {
          return false;
        }
  v=document.Contact.LegalInstruction.checked;
  if(!v)   {
              alert("Bitte bestätigen Sie, dass Sie den rechtlichen Hinweis gelesen haben");

        document.Contact.LegalInstruction.focus();
        return false;
   }

  document.forms['Contact'].submit();
  
  //location.href="kontakt2.php";
}

function setInquiryType(selObj) {
	document.Contact.InquiryType.value = selObj.options[selObj.selectedIndex].value;
}