//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//	AJAX PART
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

function createRequestObject() {
	var http_request = null;
	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');
		}
	} else if (window.ActiveXObject) { // IE
					http_request = new ActiveXObject("Microsoft.XMLHTTP");
					return http_request;
		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	return http_request;
}
var http = null; //createRequestObject();

function sendRequest(action,params,requestHandlerURL) {
    http = createRequestObject();
    http.open('GET', requestHandlerURL+"?command="+action+"&"+params,true);
    http.onreadystatechange = handleResponse;
    http.send(randomFragment);
}

function sendPostRequest(action,params,requestHandlerURL) {
	http = createRequestObject();
    http.open('POST', requestHandlerURL,true);
    http.onreadystatechange = handleResponse;
    http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');    
    http.send("command="+action+"&"+params);
}

function handleResponse() {
    if(http.readyState == 4){
	        var response = http.responseText;
    	    eval(response);
    }
}