//------cpXML---------------------------
cpXML = function(target){
	target.xmlNext='';
	target.xmlResult='';
	target.xmlNextParams=null;
	target.xmlHttp = null;

	if (typeof XMLHttpRequest != 'undefined') { try  {target.xmlHttp = new XMLHttpRequest(); } catch(e) {} }
	if (!target.xmlHttp) { try { target.xmlHttp  = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { target.xmlHttp  = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { target.xmlHttp  = null;} } }

	target.xmlAction=function(url,params){
		if (target.xmlHttp) {
			var self=target;
		    target.xmlHttp.onreadystatechange = function () {
				if (self.xmlHttp.readyState == 4 && self.xmlHttp.status == 200) {
					self.xmlResult=self.xmlHttp.responseText;
					self.xmlNext(self.xmlNextParams);
		        }
		    }		    
			if(params==null) {
				target.xmlHttp.open('GET', url, true);
				target.xmlHttp.send(null);
			}
			else {
				var paramstr='';
				for(var i in params) 
					if(paramstr=='') paramstr+=i+'='+params[i];
					else paramstr+='&'+i+'='+params[i];
				target.xmlHttp.open('POST', url, true);
				target.xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
				target.xmlHttp.setRequestHeader("Content-length", paramstr.length);
				target.xmlHttp.setRequestHeader("Connection", "close");
				target.xmlHttp.send(paramstr);
			}
		}
	}
}
