
   var http_request = false;
   function makePOSTRequest(url, parameters) {
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
		document.getElementById('ImpForm').innerHTML = "";
		document.getElementById('ImpText').innerHTML = "<p>Cannot create XMLHTTP instance.</p>";
         return false;
      }
      
      http_request.onreadystatechange = alertContents;
      http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(parameters);

   }

   function alertContents() {
		document.getElementById('ImpForm').innerHTML = "";
		document.getElementById('ImpText').innerHTML = "<p>Vielen Dank für Ihre Anfrage<br/>Wir werden diese so rasch wie m&ouml;glich bearbeiten</p>";
      // if (http_request.readyState == 4) {
      //          if (http_request.status == 200) {
      //             result = http_request.responseText;
      //             document.getElementById('ImpForm').innerHTML = "";
      //             document.getElementById('ImpText').innerHTML = "<p>Vielen Dank für Ihre Anfrage<br/>Wir werden diese so rasch wie m&ouml;glich bearbeiten</p>";
      //          } else {
      // 			document.getElementById('ImpForm').innerHTML = "";
      //             document.getElementById('ImpText').innerHTML = "<p>There was a problem with the request.</p>";
      //          }
      //       }
   }
   
   function getFormContact(obj) {
      var poststr = "Prename=" + encodeURI( document.getElementById("Prename").value ) +
                    "&Name=" + encodeURI( document.getElementById("Name").value ) +
					"&Mail=" + encodeURI( document.getElementById("Mail").value ) +
					"&Company=" + encodeURI( document.getElementById("Company").value ) + 
					"&Phone=" + encodeURI( document.getElementById("Phone").value ) +  
					"&PLZ=" + encodeURI( document.getElementById("PLZ").value ) + 
					"&City=" + encodeURI( document.getElementById("City").value ) + 
					"&Address=" + encodeURI( document.getElementById("Address").value ) + 
					"&Allgemein=" + encodeURI( document.getElementById("Allgemein").checked ) + 
					"&Offerte=" + encodeURI( document.getElementById("Offerte").checked ) + 
					"&Fehler=" + encodeURI( document.getElementById("Fehler").checked ) + 
					"&Meinungen=" + encodeURI( document.getElementById("Meinungen").checked ) + 
					"&Comment=" + encodeURI( document.getElementById("Comment").value );
      makePOSTRequest('mail.php', poststr);
   }

	function getFormMitmachen(obj) {
      var poststr = "Prename=" + encodeURI( document.getElementById("Prename").value ) +
                    "&Name=" + encodeURI( document.getElementById("Name").value ) +
					"&Mail=" + encodeURI( document.getElementById("Mail").value ) +
					"&Company=" + encodeURI( document.getElementById("Company").value ) + 
					"&Phone=" + encodeURI( document.getElementById("Phone").value ) +  
					"&PLZ=" + encodeURI( document.getElementById("PLZ").value ) + 
					"&City=" + encodeURI( document.getElementById("City").value ) + 
					"&Address=" + encodeURI( document.getElementById("Address").value ) + 
					"&Comment=" + encodeURI( document.getElementById("Comment").value );
      makePOSTRequest('mail.php', poststr);
   }

	function chkFormularContact(obj)
	{
		var correct = true;
		
	if(document.contactform.Prename.value == "")  {
		document.getElementById('Name_label').style.color = "red";
	   correct = false;
	  }
	 if(document.contactform.Name.value == "")  {
		document.getElementById('Name_label').style.color = "red";
	   correct = false;
	  }
	 if(document.contactform.Mail.value == "") {
		document.getElementById('Mail_label').style.color = "red";
	   correct = false;
	  }
	  if(document.contactform.Mail.value.indexOf('@') == -1) {
		document.getElementById('Mail_label').style.color = "red";
	  correct = false;
	 }
	if(document.contactform.Comment.value == "") {
		document.getElementById('Comment_label').style.color = "red";
	   correct = false;
	  }
	
	if(correct == true) {
		getFormContact(obj);
	}
	else {
		document.getElementById('ImpText').innerHTML = "<p style=\"color: red;\">bitte f&uuml;llen Sie alle ben&ouml;tigten Felder aus</p>";
		return false;
	}
	
	}
	
	function chkFormularMitmachen(obj)
	{
		var correct = true;
		
	if(document.contactform.Prename.value == "")  {
	   	document.getElementById('Name_label').style.color = "red";
	   correct = false;
	  }
	 if(document.contactform.Name.value == "")  {
	   	document.getElementById('Name_label').style.color = "red";
	   correct = false;
	  }
	 if(document.contactform.Mail.value == "") {
	   	document.getElementById('Mail_label').style.color = "red";
	   correct = false;
	  }
	  if(document.contactform.Mail.value.indexOf('@') == -1) {
	   	document.getElementById('Mail_label').style.color = "red";
	   correct = false;
	 }
	if(document.contactform.Company.value == "") {
	   	document.getElementById('Company_label').style.color = "red";
	   correct = false;
	  }
	if(document.contactform.Phone.value == "") {
	   	document.getElementById('Phone_label').style.color = "red";
	   correct = false;
	  }
	if(document.contactform.Address.value == "") {
	   	document.getElementById('Address_label').style.color = "red";
	   correct = false;
	  }
	if(document.contactform.PLZ.value == "") {
	   	document.getElementById('City_label').style.color = "red";
	   correct = false;
	  }
	if(document.contactform.City.value == "") {
	   	document.getElementById('City_label').style.color = "red";
	   correct = false;
	  }
	if(document.contactform.Comment.value == "") {
	   	document.getElementById('Comment_label').style.color = "red";
	   correct = false;
	  }
	
	if(correct == true) {
		getFormMitmachen(obj);
	}
	else {
		document.getElementById('ImpText').innerHTML = "<p style=\"color: red;\">bitte f&uuml;llen Sie alle ben&ouml;tigten Felder aus</p>";
		return false;
	}
	
	}
