/* ---------------------------- */
/* XMLHTTPRequest Enable 		*/
/* ---------------------------- */
function createObject() {

	var request_type;
	var browser = navigator.appName;
	if(browser == "Microsoft Internet Explorer"){
	request_type = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		request_type = new XMLHttpRequest();
	}
		return request_type;
}

var http = createObject();




function AjaxConnection(url) 
{
   nocache = Math.random();
   this.connect=connect;
   this.uri= url + "&browsernocache ="  + nocache;
} 

function AjaxPostConnection(url) 
{
   this.postconnect=postconnect;
   this.uri= url;
} 



function init_object() {
        var x;
        try {
                x=new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
                try {
                        x=new ActiveXObject("Microsoft.XMLHTTP");
                } catch (oc) {
                        x=null;
                }
        }      
        if(!x && typeof XMLHttpRequest != "undefined")
                x = new XMLHttpRequest();
        if (x)
                return x;
}


function connect(return_func)
        {
                this.x=init_object();
                this.x.open("GET", this.uri,true);
                var self = this;
                this.x.onreadystatechange = function() {
                        if (self.x.readyState != 4)
                                return;
                        eval(return_func + '(self.x.responseText)');
                        delete self.x;
                }
                this.x.setRequestHeader('Content-Type',
                    'application/x-www-form-urlencoded');
                this.x.send('');
                
                
       }




function postconnect(return_func,p)
{

                this.x=init_object();
                this.x.open("POST", this.uri,true);
                var self = this;
                this.x.onreadystatechange = function() {
                        if (self.x.readyState != 4)
                                return;
                        eval(return_func + '(self.x.responseText)');
                        delete self.x;
                }
	      this.x.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	      this.x.setRequestHeader("Content-length", p.length);
	      this.x.setRequestHeader("Connection", "close");
	      this.x.send(p);

}




