var msxmls = new Array ("Msxml2.XMLHTTP.3.0", "Microsoft.XMLHTTP" )

function createRequestObject(){
	var browser=navigator.appName;
	if(window.XMLHttpRequest){return new XMLHttpRequest();} // Mozilla, Safari, ...
	else if(window.ActiveXObject){for(var n in msxmls){try{return new ActiveXObject(msxmls[n]);}catch(e){}}} // IE
	return false;
}

function HTTPsend(fCallBack, u, d, additional_id){
	var xmlhttp=createRequestObject();
	if(xmlhttp){
		if(u.indexOf('?')>-1){u+='&';}else{u+='?';}u+='rnd='+Math.ceil(Math.random()*10000);

		xmlhttp.open("POST", u);
		xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlhttp.onreadystatechange=function(){
			if(xmlhttp.readyState==4){
				try{
					if(xmlhttp.status==200){
						text=xmlhttp.responseText;
						if(additional_id)
							eval(fCallBack+"(text, additional_id)");
						else
							eval(fCallBack+"(text)");
						xmlhttp=null;
						try{CollectGarbage();}catch(e){}
					}else{
						//alert(xmlhttp.status+" HTTP Error: "+xmlhttp.statusText+"\n\nPlease check yout connection and try again.");
						xmlhttp=null;
					}
				}catch(e){
					//alert("HTTP Error: Unknown\n\nPlease check yout connection and try again.");
					xmlhttp=null;
				}
			}
		}
		xmlhttp.send(d);
		return true;
	}
}
