
function JoaraAjax(){ 
	window.XmlHttp = this; 
	this.XmlHttp        = null; 
	this.Method        = 'GET'; 
	this.Parameters= new Array(0); 
	this.Action        = window.location.href; 
	this.DataType    = "Text"; 

	this.onLoad                = null; 
	this.onComplete        = null; 
	this.onError                = null; 

	this.addParam    = function(Name, Value){this.Parameters[Name] = Value;} 
	this.getParam    = function(Name){return this.Parameters[Name];} 
	this.addValue    = function(Name, Value){this.Values[Name] = Value;} 
	this.getValue    = function(Name){return this.Values[Name];} 
	this.getStatus = function(){ 
			var eventValue = this.XmlHttp.readyState; 
			var Events = ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete']; 
			return Events[eventValue]; 
	} 
	 
	this.submit = function(){ 
			if(this.XmlHttp != null) this.XmlHttp = null; 

			if(window.ActiveXObject){ 
					try{this.XmlHttp = new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{this.XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}    } 
			}else if(window.XMLHttpRequest){ 
					this.XmlHttp = new XMLHttpRequest(); 
			} 

			if(this.XmlHttp == null){ 
					if(this.onError != null && typeof(this.onError) == "function") this.onError(1, "Not install."); 
					return false; 
			} 
			var TYPE        = "text/xml"; 
			var URI            = this.Action; 
			var Entry = "", QUERY_STRING    = ""; 
			var QUERYS    = new Array(0); 
			for(var Name in this.Parameters){Entry=Name+"="+encodeURIComponent(this.Parameters[Name]);QUERYS.push(Entry);} 
			QUERY_STRING = QUERYS.join("&"); 


			if(this.Method.toUpperCase() == 'POST'){ 
					TYPE = "application/x-www-form-urlencoded;"; 
					this.XmlHttp.open("POST",URI, true); 
			}else{ 
					if(URI.indexOf("?") === -1) URI += "?" + QUERY_STRING; else URI += "&" + QUERY_STRING; 
					this.XmlHttp.open("GET",URI, true); 
					QUERY_STRING = ""; 
			} 

			this.XmlHttp.setRequestHeader("Content-type", TYPE); 
			this.XmlHttp.setRequestHeader("Cache-Control", "no-cache"); 
			this.XmlHttp.setRequestHeader("Pragma", "no-cache"); 
			this.XmlHttp.send(QUERY_STRING); 
			this.XmlHttp.onreadystatechange = function(){ 
					oXmlHttp = XmlHttp.XmlHttp; 
					if(oXmlHttp.readyState == 4){ 
							if(oXmlHttp.status == 200 && XmlHttp.onComplete != null && typeof(XmlHttp.onComplete) == "function"){ 
									switch(XmlHttp.DataType.toUpperCase()){ 
											case "XML":window.XmlHttp.onComplete(oXmlHttp.responseXML);break; 
											default:window.XmlHttp.onComplete(oXmlHttp.responseText);break; 
									} 

							}else{ 
									if(XmlHttp.onError != null && typeof(XmlHttp.onError) == "function") XmlHttp.onError(oXmlHttp.status, oXmlHttp.statusText); 
							} 
					}else if(XmlHttp.onLoad != null && typeof(XmlHttp.onLoad) == "function" ){ 
							XmlHttp.onLoad(oXmlHttp.readyState); 
					} 
			} 
	} 
} 
