xAjax={bw:new Object()};xAjax.createHttpRequest=function(){if(window.XMLHttpRequest){return new XMLHttpRequest()}else{if(window.ActiveXObject){try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(c){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(b){return null}}}else{return null}}};var a,ua=navigator.userAgent;xAjax.bw.safari=((a=ua.split("AppleWebKit/")[1])?a.split(".")[0]:0)>=124;xAjax.bw.konqueror=((a=ua.split("Konqueror/")[1])?a.split(";")[0]:0)>=3.3;xAjax.bw.mozes=((a=ua.split("Gecko/")[1])?a.split(" ")[0]:0)>=20011128;xAjax.bw.opera=(!!window.opera)&&(window.XMLHttpRequest);xAjax.bw.msie=(!!window.ActiveXObject)?(!window.XMLHttpRequest||!!xAjax.createHttpRequest()):false;delete a,ua;xAjax.DEFAULT_HEADERS=[{name:"Content-Type",value:"application/x-www-form-urlencoded; charset=UTF-8"}];xAjax.browserCheck=function(){return this.bw.safari||this.bw.conqueror||this.bw.mozes||this.bw.opera||this.bw.msie};xAjax.getRequest=function(c,b,g,j,d,f,i){var e=xAjax.createHttpRequest();if(e==null){return null}var h=new xAjax.RequestManager(e,c,b,g,f,i);if(j){h.addListener("load",j)}if(typeof d=="boolean"){(d)?h.sendAsync():h.sendSync()}return h};xAjax.sendRequest=function(k,g,b,c,d,i,f,j){var e=xAjax.createHttpRequest();if(e==null){return null}if(typeof d!="boolean"){d=true}if(i){c+=(c.indexOf("?")==-1)?"?":"&";c+="t="+(new Date()).getTime()}var h=xAjax.getRequest(c,b,g,k,d,f,j);if(!h){return null}return h.request};xAjax.RequestManager=function(g,e,j,h,c,d){this.request=g;this.url=e;this.method=j;this.user=c;this.password=d;this.listeners={};this.headers=[];var b=xAjax.DEFAULT_HEADERS;for(var f=0;f<b.length;f++){this.headers.push(xBase.clone(b[f]))}this.data=this._uriEncode(h);if(j.toLowerCase()=="get"){this.url+=(e.indexOf("?")==-1)?"?":"&";this.url+=this.data}};xAjax.RequestManager.prototype={sendSync:function(){this._send(false)},sendAsync:function(){this._send(true)},_send:function(c){this.request.open(this.method,this.url,c,this.user,this.password);var b=xAjax.bw.opera;var g=xAjax.bw.safari;var f=xAjax.bw.mozes;var e=this,d=this.request;if(b||g||f){d.onload=function(){e.onload(d)}}else{d.onreadystatechange=function(){if(d.readyState==4){e.onload(d)}}}this._setHeaders();this.request.send(this.data)},setRequestHeader:function(d,f){var c=-1,b=d.toLowerCase();for(var e=0;this.headers.length;e++){if(this.headers[e].name.toLowerCase()==b){c=e;break}}if(c==-1){this.headers.push({name:d,value:f})}else{this.headers[c]={name:d,value:f}}},_setHeaders:function(){try{var c;for(var b=0;b<this.headers.length;b++){c=this.headers[b];this.request.setRequestHeader(c.name,c.value)}}catch(d){throw new Error("ヘッダ設定失敗 ("+d.message+")");return false}return true},addListener:function(b,c){this.listeners[b]=c},_uriEncode:function(c){if(typeof c=="string"){return c}var d=[];for(var b in c){d.push(encodeURIComponent(b)+"="+encodeURIComponent(c[b]))}return d.join("&")},onload:function(b){if(typeof this.listeners.load=="function"){this.listeners.load(b)}this.destroy()},destroy:function(){this.listeners={};this.request=null},toString:function(){return"[object xAjax.RequestManager]"}};
