// JavaScript Document

var ajaxRequest = function(u, f, m, b, h, s)
{
    this.url      = u;
    this.method   = m || "GET";
    this.body     = b || null;
    this.head     = h || false;
    this.sync     = s || true;
	this.state    = f || function() {};
    this.abortReq = false;
    
	try {
		this.connect = new XMLHttpRequest();
	}catch(e){
		try{
			this.connect = new ActiveXObject("Microsoft.XMLHTTP");
		}catch(e){
			this.connect = false;
		}
	}
    
    this.doRequest = function()
    {
		if(!this.connect){
			alert("no connect");
			return false;
		}
        this.connect.open(this.method,this.url,this.sync);
        if (this.head)
        {
            for (var i=0; i<this.head.length; i+=2)
            {
                this.connect.setRequestHeader(
                    this.head[i],this.head[i+1]
                );
            }
        }
        this.connect.onreadystatechange = this.state;
        (!this.abortReq) ? this.connect.send(this.body) : this.connect.abort();
    }
}
