function createRequestObject() {
var req;
if(window.XMLHttpRequest){
req = new XMLHttpRequest();
} else if(window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
} else {
alert('هناك خطأ المتصفح لا يدعم الاجاكس ');
}
return req;
}
var http = createRequestObject();
function infosend() {

	var url = document.getElementById('url').value;

    var v = new RegExp();
    v.compile("^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$");
    if (!v.test(url)) {
        alert("ادخل الرابط بشكل صحيح");
        return false;
    }


	var xbutton = document.getElementById('xbutton').value;
	var poststr = "button.php?url=" + url + "&button=" + xbutton + "&random=" + Math.floor(89999999*Math.random()+10000000) ;
    http.open('GET',poststr);
    http.onreadystatechange = handlecomment;
    http.send(null);
}
function handlecomment() {
    if(http.readyState == 4){
        var response = http.responseText;
        document.getElementById('url').value ='http://';
        document.getElementById('buttondiv').innerHTML = response;
    }
}






