function cAjax()
{	
	this.ajax = this._create();
}

cAjax.prototype.loadHTML = function(id, url, msg)
{		
	document.getElementById(id).innerHTML = msg;
	this.ajax.onreadystatechange =  function() { 
		if(this.readyState == 4){
			document.getElementById(id).innerHTML = this.responseText;
		}
	}
	this.ajax.open('get', url);
	this.ajax.send(null);
}

cAjax.prototype.get = function(url, hnd){
	this.ajax.onreadystatechange =  function() { 
		if(this.readyState == 4){
			if(this.status == 200){
				if(hnd) hnd.call(this, this.responseText); 
			} else if(this.status == 404) {
				alert("Not Found: "+url);
			} else  {
				//alert("Status: "+this.status);
			} 
		}
	}
	this.ajax.open('get', url);
	this.ajax.send(null);	
}

cAjax.prototype.getEx = function(id, url, hnd, params){
	this.ajax.onreadystatechange =  function() { 
		if(this.readyState == 4){
			if(this.status == 200){
				document.getElementById(id).innerHTML = this.responseText;
				hnd.call(this, params);
			} else if(this.status == 404) {
				alert("Not Found: "+url);
			} else  {
				//alert("Status: "+this.status);
			} 
		}
	}
	this.ajax.open('get', url);
	this.ajax.send(null);
}

cAjax.prototype.post = function(url, vbody, hnd){
	this.ajax.onreadystatechange =  function() 
	{ 
		if(this.readyState == 4){
			if(this.status == 200){
				if(hnd) hnd.call(this, this.responseText); 
			} else {
				alert("Status: "+this.status);
			}
		}
	}
	this.ajax.open('post', url);
	this.ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	this.ajax.send(vbody);	
}

cAjax.prototype._create = function(){
	http = null;		
  	try {http = new XMLHttpRequest();} 
	catch(e) {try {http = new ActiveXObject("Msxml2.XMLHTTP");} 
			  catch(e) {http = new ActiveXObject("Microsoft.XMLHTTP");}}
	return http;
}

