String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ''); }

var xmlhttp=false;

if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

function callme() {
	var phone=document.getElementById("callnum").value;
	var callname=document.getElementById("callname").value;
	phone=phone.trim();
	callname=callname.trim();
	if(callname.length > 2 && phone.length > 4) {
		//alert(callname);
		xmlhttp.open("GET", "callme.php?callnum=" + phone + "&callname=" + callname ,true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4) {
				bids = xmlhttp.responseText;
				if(bids=="gesendet") {
					
					document.getElementById("callback").innerHTML = '<br><br>Vielen Dank f&uuml;r<br>Ihr Interesse.';
					document.getElementById("callbutton").innerHTML ='';
					
					
				}
			}
		}
		xmlhttp.send(null);
	} else {
		alert("Bitte beide Felder ausfüllen!");
	}
}




