/***************************************************

  This file handles all the ajax scripting handles

***************************************************/

var call = {
   req:false,
   reqType:"POST",
	reqForm:null,
   reqUrl:null,
   reqArr: new Array(),
	reqStr:null,
	reqId:null,
	reqHead:null,
	returnValue:null,
	clearText:"",	
	callBack:"",
	xml:null,
	debug:function(str){
	    alert(str);
	},
	// Initialize our object to use later
	init:function(){
	    try {
	        this.req = new ActiveXObject("Msxml2.XMLHTTP");
	    } catch (e) {
	        try {
	            this.req = new ActiveXObject("Microsoft.XMLHTTP");
	        } catch (ea) {
	            this.req = null;
	        }
	    }
	    if (!this.req && typeof XMLHttpRequest != "undefined") {
	        this.req = new XMLHttpRequest();
	    }
	    if (!this.req) {
	        this.debug("Could not load the XMLHttpRequest");
	    }
	    return this.req;
	},
	parse:function() {											   
		this.reqUrl = (this.reqUrl == null) ? this.reqForm.action : this.reqUrl ;
		this.reqType = this.reqForm.method;
		this.reqStr = "";
		for(var a=0;a<this.reqForm.elements.length;a++) {
		 	this.reqStr += (this.reqForm.elements[a].name != "") ? this.reqForm.elements[a].name + "=" + this.reqForm.elements[a].value + "&" : "" ;
		} 
		this.reqStr.substr(0,this.reqStr.length-1);
	},
	doCall:function() {
		//this.clear(); 
		this.parse();
	    var el = document.getElementById(this.reqId);
	    var objXml = this.init();
	    //this.debug(objXml);
	    //this.debug(this.reqType + " " + this.reqUrl + " " + this.reqStr);
	    objXml.open(this.reqType,this.reqUrl,true); 
		if (this.reqType.toLowerCase() == "post") { 
			objXml.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
			objXml.send(this.reqStr);
			//this.debug("posting");
		}
	    objXml.onreadystatechange = function() {
	    	if (objXml.readyState == 4) {
			    
				//alert(objXml.responseText);
			   	output.obj = eval('(' + objXml.responseText + ')' );
				
				output.write();
				//alert(json.L);
				/*NEW 
			    if (this.callBack == "") {
	        	   el.innerHTML = objXml.responseText;
				} else {
				   //this.clear();
				   this.xml = objXml.responseXML;
				   eval(this.callBack + "()");
				} */
				return true;
	        }
	    }
	    //el.style.display = "block";
	},
	clear:function(){ 
		try {
		 	var el = document.getElementById(this.reqId);
			el.innerHTML = this.clearText;
		} catch (e) {
		 	//
		}
	},
	empty:function(){ 
		try {
		 	var el = document.getElementById(this.reqId);	
			el.innerHTML = "";
		} catch (e) {
		 	//
		}
	}
}



