	/*
	 *
	 *  Ajax Class
	 * 
	 */
	function Ajax() {
	
	}

	/*
	* load
	*/
	Ajax.load = function(request) {
		var xmlHttp;
		if (window.XMLHttpRequest) {
			xmlHttp = new XMLHttpRequest();
		} else if (window.ActiveXObject) {
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}

		url = request.url
		var paramsList = request.params
		var params = ""
		for (var i=0;i<paramsList.length;i=i+2) {
			params += paramsList[i] + "=" + paramsList[i+1] + "&"
		}
		if (params!="") params = params.substring(0,params.length-1)

		params = params + "&" + Math.random(1)
		if (request.method.toUpperCase()==Ajax.METHOD_POST) {

			xmlHttp.open("POST", url, true);
			//Send the proper header information along with the request
			xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			xmlHttp.setRequestHeader("Content-length", params.length);
			xmlHttp.setRequestHeader("Connection", "close");	
		} else {
			if (params!="") url += "?" + params

			xmlHttp.open("GET", url, true);
		}

		xmlHttp.onreadystatechange =  function () {
			if (xmlHttp.readyState == 4) {
				if (xmlHttp.status == 200) {
					
				    var response;
					if (request.responseType==Ajax.RESPONSE_TYPE_JSON) {
						response = xmlHttp.responseText // return JSON
					} else {
						if (request.returnJSON) {
							 // Convert the xml response to JSON
						//	 response = xmlToJson.parser(xmlHttp.responseText);
					//	alert("dfg");
						
						response = XMLObjectifier.xmlToJSON(xmlHttp.responseXML);  
						//alert(response);
					//	alert("xxxxxxxxxxxxx");
//Using xml objectifier
//<script language="javascript">
  //var root = XMLObjectifier.xmlToJSON(xml_dom_object); //Converts xml dom object to JSON
  //var xml_doc = XMLObjectifier.textToXML(xml_string);  //Converts xml string to xml dom
//</script>

						} else {
							response = xmlHttp.responseXML // return XML
						}					
					}
					request.callback.apply(this,new Array(response, request.callbackParams))
				}
			}
		};
		xmlHttp.send(params);
	}
	/*
	*  Ajax Constant
	*/

	Ajax.METHOD_POST		 = "POST"
	Ajax.METHOD_GET			 = "GET"

	Ajax.RESPONSE_TYPE_XML   = "xml"
	Ajax.RESPONSE_TYPE_JSON  = "json"