var random_http_request = false;
var some_func=false;

function get_http(){
	if (random_http_request.readyState == 4) {
		if (random_http_request.status == 200) {
			some_func(random_http_request.responseText);
		} else {
			alert('there was a problem with the ajax request');
		}
	}
}

function call_http(php_to_call, somehttpstr, my_func){
	some_func=my_func;
	someurl = "http://"+document.location.hostname+php_to_call;	
	random_http_request = false;

        if (window.XMLHttpRequest) { 
            random_http_request = new XMLHttpRequest();
            if (random_http_request.overrideMimeType) {
                //random_http_request.overrideMimeType('text/xml');
            }
        } else if (window.ActiveXObject) { 
            try {
                random_http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    random_http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }
        if (!random_http_request) {
            alert('Cannot create an XMLHTTP instance');
            return false;
        }

        random_http_request.onreadystatechange = get_http;
        random_http_request.open('POST', someurl, true);
	random_http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        random_http_request.send(somehttpstr);
}
