function requestURL(url, method, send, call_back_fn, params)
{
	var request = null;
	
	call_back_fn = call_back_fn || function() {};
	send = send || null;
	
	request = new ajax(url, method, send, call_back_fn, params);
}

////////////////////////////
// Connecting functions   
////////////////////////////
function ajax(url, method, send, call_back_fn, params)
{
	this.params = params || {};
	
	var header;
	
	this.call_back_fn = call_back_fn;
	this.call_back_params = this.params.callBackParams || {};
	this.async = this.params.async || true;
	this.ref = 'ajax_' + Math.floor(Math.random() * 10000000);
	
	eval(this.ref+'=this;');
	
	this.http = this.createRequestObject();
	this.loading = false;
	
	if(this.loading) {
		return true;
	}
	
	this.loading = true;
	
	if(method == 'GET') {
		header = 'text/xml';
	}
	else if(method == 'POST') {
		header = 'application/x-www-form-urlencoded; charset=UTF-8';
	}
	
	try {
    this.http.open(method, url+'&rnd='+Math.random(), this.async);
		this.http.setRequestHeader('Content-Type', header);
		if(method == 'POST') {
			this.http.setRequestHeader('Content-length', send.length);
			this.http.setRequestHeader('Connection', 'close');
		}
		eval('this.http.onreadystatechange = function() { '+this.ref+'.handleResponse(); }');
		this.http.send(send);
	}
	catch(ex) { }
}

ajax.prototype.createRequestObject = function() {
	var xmlhttp;
	try {
  	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  }
  catch(e) {
    try {
    	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch(e) {
    	xmlhttp = null;
    }
  }
  if(!xmlhttp&&typeof XMLHttpRequest!="undefined") {
  	xmlhttp = new XMLHttpRequest();
  }
	return  xmlhttp;
}

ajax.prototype.handleResponse = function()
{
	try {
    if((this.http.readyState == 4) && (this.http.status == 200)) {
			this.loading = false;
			
    	if(this.params.textCallBack) {
    		this.call_back_fn(this.http.responseText, this.call_back_params);
    	}
    	else {
    		this.call_back_fn(this.http.responseXML.documentElement, this.call_back_params);
    	}
		}
  }
	catch(ex) { }
}