function Connector() {

	var xmlreq = false;
	if (window.XMLHttpRequest) {
		xmlreq = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		try {
			xmlreq = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e1) {
			try {
				xmlreq = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e2) {
			}
		}
	}
	return xmlreq;

}

var http = new Array();

function AjaxGet(id, url, callback_function, params){

	http[id] = Connector();

	if ('undefined' == typeof(http[id])){
		alert('Sorry, but your web browser does not support Ajax\nPlease, update your browser with latest version');
		return;
	}

	http[id].onreadystatechange = function() {
		if (http[id].readyState == 4) {
			if (http[id].status == 200) {

				if (http[id].responseText != ''){
					var output  = eval("(" + http[id].responseText + ")");
					callback_function(output);
				}
			}
		}
	}

	if ('undefined' != typeof(params)){
		str = '';	
		for (key in params){
			str += key + '=' + params[key] + '&';
			
		}
		str = str.substr(0,(str.length - 1));
		http[id].open('POST', url, true);
		http[id].setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
		http[id].send(str);
	}else{

		http[id].open('GET', url, true);
		http[id].send(null);
	}	
}

function AjaxJS(id, url, callback_function, params){

	http[id] = Connector();

	if ('undefined' == typeof(http[id])){
		alert('Sorry, but your web browser does not support Ajax\nPlease, update your browser with latest version');
		return;
	}

	http[id].onreadystatechange = function() {
		if (http[id].readyState == 4) {
			if (http[id].status == 200) {
				if (http[id].responseText != ''){					
					IncludeJS(url, http[id].responseText, callback_function, params);
				}
			}
		}
	}
}

 function IncludeJS(sId, fileUrl, source, callback_function, params) { 
 	if ( ( source != null ) && ( !document.getElementById( sId ) ) ) {
		var oHead = document.getElementsByTagName('HEAD').item(0);
		var oScript = document.createElement( "script" );
		oScript.language = "javascript";
		oScript.type = "text/javascript";		
		oScript.text = source;
		oHead.appendChild( oScript );
		
		callback_function(params);
 	} 
 } 
		

