function HTTP()
{
	this.toString = function() { return "HTTP"; }
	
	this.status = function(_status)
	{
		switch(_status)
		{
			case 200:
				return "ok";
				break;
			case 304:
				return "ok";
				break;
			default:
				return "error";
		}
	}
}


function Ajax()
{
	this.toString = function() { return "Ajax"; }
	this.http = new HTTP();
	
	this.uiWaitMethod;
	this.uiClearWaitMethod;
	this.data = null;
	this.method = "GET";
	this.URL = '';
	this.TimeoutID = '';
	
	this.setRequestHeader = function(headerKey, headerValue){
    if (!this.request)  return;
    this.request.setRequestHeader(headerKey, headerValue);
	}
	
	this.makeRequest = function(_method, _url, _callbackMethod, _data)
	{
		this.request = (window.XMLHttpRequest)? new XMLHttpRequest(): new ActiveXObject("MSXML2.XMLHTTP"); 
		/*
      try { _r = new XMLHttpRequest(); }
      catch (e) { try { _r = new ActiveXObject('Msxml2.XMLHTTP'); }
      catch (e) { try { _r = new ActiveXObject('Microsoft.XMLHTTP'); }
      catch (e) { _r = null; }}}
		*/
		this.method = _method;
		this.URL = _url;
		this.data = _data;
		
		this.request.onreadystatechange = _callbackMethod;
								
		if (typeof(this.uiWaitMethod)!="undefined") this.uiWaitMethod();
		this.request.open(this.method, this.URL, true);
		
		if (_method.toUpperCase() == "POST")
		{
			this.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			this.request.send(this.data);
		}
		else
		{
			this.request.send(null);
		}
	}
	
	this.checkReadyState = function()
	{
		switch(this.request.readyState)
		{
			case 4:
				if (typeof(this.uiClearWaitMethod)!="undefined") this.uiClearWaitMethod();
				if((typeof(this.TimeoutID)!= 'undefined') && this.TimeoutID!='')
					clearTimeout(this.TimeoutID);
				return this.http.status(this.request.status);
				break;
			default:
				return "wait"
		}
	}
	
	this.constantCheck = function(_delay, _callbackMethod)
	{	
		setTimeout(_callbackMethod, _delay);
	}
}


