function ajaxFlash() { __loadvars_js_location = "./js/softmeca/"; document.writeln(""); document.writeln(""); document.writeln(""); document.writeln(""); document.writeln(""); document.writeln(""); } function UrlEncode(str, charset) { if(str == '') return ''; try { moviename = (navigator.appName.indexOf("Microsoft") != -1) ? "__ieue__":"__mozue__"; return document.getElementById(moviename).UrlEncode(str); } catch(e){status = 'UrlEncode:';} return encodeURIComponent(str); } function UrlDecode(str, charset) { if(charset) { return decodeURIComponent(str); } return decodeURIComponent(str); } __XMLHttpRequest = function() { if(typeof(XMLHttpRequest) == 'undefined') { try{return new ActiveXObject("Microsoft.XMLHTTP");} catch(e) { e.description = "Microsoft.XMLHTTP »ý¼º ½ÇÆÐ"; throw e; } } return new XMLHttpRequest; }; function LoadVars() { // =================== property =================== // property var obj = this; this.contentType = 'application/x-www-form-urlencoded;'; this.loaded = false; this.httpStatus = 0; this.httpStatusType = ''; this.readyState = 0; this.reqVars = new Array(); this.form = null; var xmlhttp = null; try{xmlhttp = new __XMLHttpRequest();} catch(e){alert("LoadVars:XMLHttpRequest »ý¼º ½ÇÆÐ");} // =================== user define form attribute =================== this.target = null; this.charset = 'EUC-KR'; this.method = 'get'; this.async = true; this.viewSource = false; // =================== user define event handler =================== this.onLoad = function(success){return;}; this.onData = function(src){return;}; this.onHTTPStatus = function(httpStatus){return;}; // =================== event handler =================== this._onLoad = function(success) { this.loaded = true; this.onLoad(success); if(this.form !== null) { var f = this.form; this.__onEvent = Function(f.getAttribute('onLoad')); this.__onEvent(); delete this.__onEvent; } }; this._onData = function(src) { this.onData(src); if(this.form !== null) { var f = this.form; this.__onEvent = Function(f.getAttribute('onData')); this.__onEvent(); delete this.__onEvent; } if(typeof(src) != 'undefined') { this._onLoad(true); this.console(src); } else { this._onLoad(false); } return; };// end function this._onHTTPStatus = function(httpStatus) { this.status = httpStatus; this.httpStatus = httpStatus; if(httpStatus < 100){ this.httpStatusType = "browserError";} else if(httpStatus < 200){ this.httpStatusType = "informational";} else if(httpStatus < 300){ this.httpStatusType = "successful";} else if(httpStatus < 400){ this.httpStatusType = "redirection";} else if(httpStatus < 500){ this.httpStatusType = "clientError";} else if(httpStatus < 600){ this.httpStatusType = "serverError";} this.onHTTPStatus(); if(this.form !== null) { var f = this.form; this.__onEvent = Function(f.getAttribute('onHTTPStatus')); this.__onEvent(); delete this.__onEvent; } this._onData(xmlhttp.responseText); return; };// end function this._onreadystatechange = function() { obj.readyState = xmlhttp.readyState; switch(obj.readyState) { case 0:// XMLHttpRequest °´Ã¼¸¦ »ý¼ºÇÏ¿´Áö¸¸, ÃʱâÈ­µÇÁö ¾Ê¾Ò´Ù. Áï, open() ¸Þ¼Òµå¸¦ ½ÇÇàÇÏÁö ¾ÊÀº »óÅ break; case 1:// XMLHttpRequest °´Ã¼¸¦ »ý¼ºÇÏ¿´°í, open() ¸Þ¼Òµå¸¦ ¼öÇàÇÏ¿´Áö¸¸, send() ¸Þ¼Òµå¸¦ ¼öÇàÇÏÁö ¾ÊÀº »óÅ break; case 2:// send() ¸Þ¼Òµå¸¦ ¼öÇàÇÏ¿´Áö¸¸, ¼­¹ö°¡ 󸮸¦ ÁغñÇϰí ÀÖ´Â »óÅ break; case 3:// 󸮸¦ ¿Ï·áÇÏÁö ¾Ê¾ÒÁö¸¸, ÁøÇà ÁßÀÎ »óÅ break; case 4:// 󸮸¦ ¿Ï·áÇÑ »óÅ obj._onHTTPStatus(xmlhttp.status); break; } return; }; xmlhttp.onreadystatechange = this._onreadystatechange; // =================== method =================== // response this.getAllResponseHeaders = function(){ return xmlhttp.getAllResponseHeaders();}; this.getResponseHeader = function(bstrHeader){ return xmlhttp.getResponseHeader(bstrHeader);}; this.getResponseBody = function(){return xmlhttp.responseBody;}; this.getResponseStream = function(){return xmlhttp.responseStream;}; this.getResponseText = function(){return xmlhttp.responseText;}; this.getResponseXML = function() { // responseXMLÀÌ Á¦´ë·Î µ¿ÀÛÇÏÁö ¾Ê´Â °æ¿ì°¡ ¸¹¾Æ¼­ ÀçÁ¤ÀÇ ÇÑ´Ù. var xmldoc = createDOM(); xmldoc.loadXML(this.getResponseText()); return xmldoc; }; this.setResVar = function(name, value){this.resVars[name] = value;}; this.getResvar = function(name){return this.resVars[name];}; this.getResVars = function(){return this.resVars;}; this.getReqVars = function(){return this.reqVars;}; this.addReqVar = function(name, value) { name = UrlEncode(name, this.charset); value = UrlEncode(value, this.charset); var pair = new Array(); pair[name] = value; this.reqVars.push(pair); }; this.getReqVar = function(name) { name = UrlEncode(name, this.charset); for(var index = this.reqVars.length; index >= 0;index-=1) { for(var key in this.reqVars[index]) { if(key == name) { return UrlDecode(this.reqVars[index][key], this.charset); }//end if }//end for }//end for return null; };// end fucntion // request this.abort = function(){return xmlhttp.abort();}; this.getMethod = function(){return this.method;} ; this.setMethod = function(method){if(typeof(method) != 'undefined'){ this.method = (method === '' ? "get":method.toLowerCase());}}; this.setRequestHeader = function(header, headerValue) { try { xmlhttp.setRequestHeader(header, headerValue); } catch (e) { this.showError(e,"À§Ä¡:LoadVars.setRequestHeader"); } return; };// end function this.open = function(method,url) { try { url = url.split('?'); url[1] = ((url.length == 1) ? '__dummy__=':url[1]+'&__dummy__='); url[1] += Math.random(); this.setMethod(method); xmlhttp.open(this.getMethod(), url.join('?'), this.async); return true; } catch (e) { this.showError(e,"À§Ä¡:LoadVars.open"); return false; } };// end function this.setForm = function(f) { this.form = f; this.viewSource = (f.getAttribute('viewSource') === null) ? false:true; //µð¹ö±ë »ç¿ë¿©ºÎ this.async = (f.getAttribute('async') === null) ? true:f.getAttribute('async'); this.action = (f.action === '' ? location.href:f.action); this.setMethod(f.method.toLowerCase() === "" ? "get":f.method); // ºñȰ¼º ÄÁÆ®·ÑÀÇ °ªÀ» º¸³¾Áö °áÁ¤ var sendDisabled = (f.getAttribute('sendDisabled') === null) ? false:f.getAttribute('sendDisabled'); for(var i = 0; i < f.elements.length; i+=1) { if(f.elements[i].name === '' || typeof(f.elements[i].name) == 'undefine'){ continue;} if(f.elements[i].tagName == 'SELECT') { if(f.elements[i].multiple === true) { for(var index = 0 ; index < f.elements[i].length; index+=1) { if(f.elements[i][index].selected == true) { if(f.elements[i].options[index].value != '' || f.elements[i].options[index].outerHTML.toLowerCase().indexOf('value') != -1) { this.addReqVar(f.elements[i].name, f.elements[i][index].value); } else if(f.elements[i][index].text) { this.addReqVar(f.elements[i].name, f.elements[i][index].text); } }// end if }// end for } else { if(f.elements[i].value != '') { this.addReqVar(f.elements[i].name, f.elements[i].value); } else { var selectedIndex = f.elements[i].selectedIndex; if(f.elements[i].length > 0) { if(f.elements[i].options[selectedIndex].outerHTML.toLowerCase().indexOf('value') != -1) { this.addReqVar(f.elements[i].name, ''); } else { this.addReqVar(f.elements[i].name, f.elements[i][selectedIndex].text); } } }// end if }// end if } else { if((f.elements[i].type == 'checkbox' || f.elements[i].type == 'radio') && !f.elements[i].checked) { continue; } else if( sendDisabled === false && f.elements[i].disabled) { continue; } this.addReqVar(f.elements[i].name, f.elements[i].value); }// end if }// end for var url = this.action.split("?"); if(this.getMethod() == "get") { if(url[0].length > 1) { url[1] = "&" + this._encode(this.getReqVars()); } xmlhttp.open(this.getMethod(), url.join("?"),this.async); return ""; } else { xmlhttp.open(this.getMethod(), url.join("?"),this.async); var body = this._encode(this.getReqVars()); return body; }// end if }; this.send = function(body) { try { if(this.getMethod() == 'post') { this.setRequestHeader("Content-Type", this.contentType); this.setRequestHeader("Content-length", body.length); } else if(body) { alert('get¸Þ¼Òµå·Î postµ¥ÀÌÅ͸¦ º¸³»·Á°í Çß½À´Ï´Ù.'); } this.console(body); xmlhttp.send(body); if(navigator.appName.indexOf("Microsoft") != -1) { // ÀͽºÇÁ·Ñ·¯ ÁøÇàÀ² Ç¥½Ã ¹ö±× ÆÐÄ¡ var str = window.status; window.status = '\n'; window.status = str; } else if(this.async !== true) { this._onreadystatechange();// ¸ðÁú¶ó ȣȯ ÄÚµå } } catch (e) { this.showError(e,"À§Ä¡:LoadVars.send"); } }; this._decode = function(data) { delete(this.resVars); this.resVars = new Array(); var params = data.split("&"); for(var i = 0; i < params.length; i+=1) { var param = params[i].split("="); this.setResVar(param[0],param[1]); } }; this._encode = function(vars) { var params = new Array(); for(var index in vars) { for(var key in vars[index]) { var b = true; for(var name in Array.prototype) { // prototype °É·¯³»±â if(key == name) { b = false; break; } } if(b) { var param = new Array(); param.push(key); param.push(vars[index][key]); params.push(param.join("=")); } } } return params.join("&"); }; this.console = function(str) { if(this.viewSource == true) { var obj = document.getElementById('__LoadVars_CONSOLEWINDOW__'); if(obj == null) { document.body.insertAdjacentHTML('beforeEnd', ''); obj = document.getElementById('__LoadVars_CONSOLEWINDOW__'); } obj.value = obj.value + "\n==========================================================\n" + str; } } this.toString = function(){return this._encode(this.getReqVars());}; this.showError = function(e, text) { //Error //name //message //variable //Backtrace window.status = ("¿À·ù!!, "+text+", ¿¡·¯ÄÚµå:"+e.number+", ¿¡·¯¼³¸í:"+e.description); }; }