document.write("<script type=\"text/javascript\" src=\"./scripts/HTTP.js\"></script>");

function createXMLHttpRequest() {
   try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}
   try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {}
   try { return new XMLHttpRequest(); } catch(e) {}
   alert("XMLHttpRequest not supported");
   return null;
 }

 
function Ajax()
{
	this.toString = function() { return "Ajax"; }
	this.http = new HTTP();

	this.makeRequest = function(_method, _url, _callbackMethod)
	{
        var xmlurl = _url + ".xml";
        this.request = createXMLHttpRequest();
        this.request.onreadystatechange = _callbackMethod;
        this.request.open(_method, xmlurl, true);
        try {this.request.send(null);} catch(e) {alert("Problem requesting Content  from the server. "+"\n  Click OK.");}		
	}
	


    this.checkReadyState = function(_id, _1, _2, _3)
	{
		switch(this.request.readyState)
		{
			case 1:			
				document.getElementById(_id).innerHTML =_1+"<br> ReadyState:" + this.request.readyState;
				break;
			case 2:
				document.getElementById(_id).innerHTML = _1+"<br> ReadyState:" + this.request.readyState;	
				break;
			case 3:
				document.getElementById(_id).innerHTML = _1+"<br> ReadyState:" + this.request.readyState;			
				break;
			case 4:
				document.getElementById(_id).innerHTML = _1;	
				return "OK";
			default:
			    alert("error fetching data!"
                +"\n\nreadyState:"+this.request.readyState
                +"\nheaders: "+this.request.getAllResponseHeaders());
				
		}
	} 
}