function AjaxConnection(){
   this.setOptions=setOptions;
   this.getOptions=getOptions;
   this.connect=connect;
   //this.uri="ajax_service.php";
} 

function setOptions(opt){
   for(i=0;i<opt.length;i++)  
   {
      this.options += "&"+opt[i];
   }
}

function getOptions(){
   return this.options;
}

function connect(return_func){
	with(this){
		x=init_object();
		x.open("POST", uri,true);
		x.onreadystatechange = function() {
				if (x.readyState != 4)
						return;
				eval(return_func + '(x.responseText)');
				delete x;
		}
		x.setRequestHeader('Content-Type',
			'application/x-www-form-urlencoded');
		x.send(options);
	}
}


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;
}

