var req;
var url="lcp.php";

function Initialize()
{
	try {
	    req=new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e){
	    try	{
		 req=new ActiveXObject("Microsoft.XMLHTTP");
	    }
	    catch(oc){
		req=null;
	    }
	}
	if(!req&&typeof XMLHttpRequest!="undefined") {
		req=new XMLHttpRequest();
	}
}

function SendQuery(request,method,callbackFunction,cache) {
	Initialize();
	if ( (req!=null) ) {		
		req.onreadystatechange = function()	{
	    		if (req.readyState == 4){
		       	    	if (req.status == 200){ // only if "OK"
			   		eval(callbackFunction);
			   	}
			}
		}
	};
	if ( cache==0 ){
		request += "&rand="+Math.random()*1000;
	}
	// Use POST or GET method , default is GET
	if ( method == 'POST' ){
		req.open("POST", url, true);
		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		req.send(request);
	}
	else {						
		req.open("GET",url+"?"+request, true);
		req.send(null);
	}
}
