function getXmlHttpRequestObject() {
 if (window.XMLHttpRequest) {
    return new XMLHttpRequest(); //Mozilla, Safari ...
 } else if (window.ActiveXObject) {
    return new ActiveXObject("Microsoft.XMLHTTP"); //IE
 } else {
    alert("Your browser doesn't support the XmlHttpRequest object.");
 }
}


var receiveReq = getXmlHttpRequestObject();



function makeRequest(url, param) {
 if (receiveReq.readyState == 4 || receiveReq.readyState == 0) {
   receiveReq.open("POST", url, true);
   receiveReq.onreadystatechange = updatePage; 
   receiveReq.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   receiveReq.setRequestHeader("Content-length", param.length);
   receiveReq.setRequestHeader("Connection", "close");
   receiveReq.send(param);
 }   
}


function updatePage() {
 if (receiveReq.readyState == 4) {
   document.getElementById('result').innerHTML = receiveReq.responseText;
   img = document.getElementById('imgCaptcha'); 
   img.src = '/scripts/emails/genimage.php?' + Math.random();
 }
}


function makeRequest2(url, param) {
 if (receiveReq.readyState == 4 || receiveReq.readyState == 0) {
   receiveReq.open("POST", url, true);
   receiveReq.onreadystatechange = updatePage2; 
   receiveReq.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   receiveReq.setRequestHeader("Content-length", param.length);
   receiveReq.setRequestHeader("Connection", "close");
   receiveReq.send(param);
 }   
}


function updatePage2() {
 if (receiveReq.readyState == 4) {
   document.getElementById('result2').innerHTML = receiveReq.responseText;
   img = document.getElementById('imgCaptcha2'); 
   img.src = '/scripts/emails/genimage.php?' + Math.random();
 }
}




function getParam_server(theForm) {
	var url = '/scripts/emails/sendMail_server.php';
	var postStr = theForm.txtCaptcha.name + "=" + encodeURIComponent( theForm.txtCaptcha.value ) + 
	"&" + theForm.Name.name + "=" + encodeURIComponent( theForm.Name.value ) + 
	"&" + theForm.Firma.name + "=" + encodeURIComponent( theForm.Firma.value ) +
	"&" + theForm.Email.name + "=" + encodeURIComponent( theForm.Email.value ) +
	"&" + theForm.Telefon.name + "=" + encodeURIComponent( theForm.Telefon.value ) +
	"&" + theForm.besttime.name + "=" + encodeURIComponent( theForm.besttime.value ) +
	"&" + theForm.Plan.name + "=" + encodeURIComponent( theForm.Plan.value ) +
	"&" + theForm.os.name + "=" + encodeURIComponent( theForm.os.value ) +
	"&" + theForm.aufmerksam.name + "=" + encodeURIComponent( theForm.aufmerksam.value ) +
	"&" + theForm.bemerkungen.name + "=" + encodeURIComponent( theForm.bemerkungen.value );

	if (theForm.firewall.checked==true)
	  	postStr = postStr + "&" + theForm.firewall.name + "=" + encodeURIComponent( theForm.firewall.value );

	if (theForm.loadbalancing.checked==true)
	  	postStr = postStr + "&" + theForm.loadbalancing.name + "=" + encodeURIComponent( theForm.loadbalancing.value );

	if (theForm.Datenbanken.checked==true)
  		postStr = postStr + "&" + theForm.Datenbanken.name + "=" + encodeURIComponent( theForm.Datenbanken.value );

	if (theForm.backup.checked==true)
  		postStr = postStr + "&" + theForm.backup.name + "=" + encodeURIComponent( theForm.backup.value );

	if (theForm.Administrationsoberflaeche.checked==true)
  		postStr = postStr + "&" + theForm.Administrationsoberflaeche.name + "=" + encodeURIComponent( theForm.Administrationsoberflaeche.value );
 	makeRequest(url, postStr);
}


function getParam_sales(theForm) {
	var url = '/scripts/emails/sendMail_sales.php';
	var postStr = theForm.txtCaptcha.name + "=" + encodeURIComponent( theForm.txtCaptcha.value ) + 
	"&" + theForm.Vorname.name + "=" + encodeURIComponent( theForm.Vorname.value ) + 
	"&" + theForm.Nachname.name + "=" + encodeURIComponent( theForm.Nachname.value ) +
	"&" + theForm.Email.name + "=" + encodeURIComponent( theForm.Email.value ) +
	"&" + theForm.Telefon.name + "=" + encodeURIComponent( theForm.Telefon.value ) +
	"&" + theForm.Firma.name + "=" + encodeURIComponent( theForm.Firma.value ) +
	"&" + theForm.Kontaktart.name + "=" + encodeURIComponent( theForm.Kontaktart.value ) +
	"&" + theForm.Kontaktzeit.name + "=" + encodeURIComponent( theForm.Kontaktzeit.value ) +
	"&" + theForm.Bereich.name + "=" + encodeURIComponent( theForm.Bereich.value ) +
	"&" + theForm.Thema.name + "=" + encodeURIComponent( theForm.Thema.value ) +
	"&" + theForm.Frage.name + "=" + encodeURIComponent( theForm.Frage.value );

 	makeRequest(url, postStr);
}


function getParam_corporate(theForm) {
	var url = '/scripts/emails/sendMail_corporate.php';
	var postStr = theForm.txtCaptcha.name + "=" + encodeURIComponent( theForm.txtCaptcha.value ) + 
	"&" + theForm.Abteilung.name + "=" + encodeURIComponent( theForm.Abteilung.value ) +
	"&" + theForm.Vorname.name + "=" + encodeURIComponent( theForm.Vorname.value ) + 
	"&" + theForm.Nachname.name + "=" + encodeURIComponent( theForm.Nachname.value ) +
	"&" + theForm.Email.name + "=" + encodeURIComponent( theForm.Email.value ) +
	"&" + theForm.Telefon.name + "=" + encodeURIComponent( theForm.Telefon.value ) +
	"&" + theForm.Firma.name + "=" + encodeURIComponent( theForm.Firma.value ) +
	"&" + theForm.Message.name + "=" + encodeURIComponent( theForm.Message.value );

 	makeRequest2(url, postStr);
}


function makeRequest3(url, param) {
 if (receiveReq.readyState == 4 || receiveReq.readyState == 0) {
   receiveReq.open("POST", url, true);
   receiveReq.onreadystatechange = updatePage3; 
   receiveReq.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   receiveReq.setRequestHeader("Content-length", param.length);
   receiveReq.setRequestHeader("Connection", "close");
   receiveReq.send(param);
 }   
}


function updatePage3() {
 if (receiveReq.readyState == 4) {
   document.getElementById('result3').innerHTML = receiveReq.responseText;
   img = document.getElementById('imgCaptcha3'); 
   img.src = '/scripts/emails/genimage.php?' + Math.random();
 }
}

function getParam_frm(theForm) {
	var url = '/scripts/emails/sendMail_ds.php';
	var postStr = theForm.txtCaptcha.name + "=" + encodeURIComponent( theForm.txtCaptcha.value ) + 
	"&" + theForm.Name.name + "=" + encodeURIComponent( theForm.Name.value ) +
	"&" + theForm.Firma.name + "=" + encodeURIComponent( theForm.Firma.value ) + 
	"&" + theForm.Email.name + "=" + encodeURIComponent( theForm.Email.value ) +
	"&" + theForm.Telefon.name + "=" + encodeURIComponent( theForm.Telefon.value ) +
	"&" + theForm.besttime.name + "=" + encodeURIComponent( theForm.besttime.value ) +
	"&" + theForm.serverplan.name + "=" + encodeURIComponent( theForm.serverplan.value );


 	makeRequest3(url, postStr);
}



