var ajax = {}; 
ajax.Landlove = {}; 
// url : register.php, params : GET | POST, 
// callback : function name, method : id=userid&pwd=pwd, divID : out (<div id='out'></div>) 
ajax.Landlove.REQ = function(url, params, callback, method, divID) 
{ 
    this.url        = url; 
    this.params        = params; 
    this.callback    = callback; 
    this.method        = method; 
    this.divID        = divID; 
    this.send(); 
} 

ajax.Landlove.REQ.prototype = { 
    getXMLHttpRequest: function() 
    { 
        if (window.ActiveXObject) 
        { 
            try { 
                return new ActiveXObject("Msxml2.XMLHTTP"); 
            } 
            catch(e){ 
                try { 
                    return new ActiveXObject("Microsoft.XMLHTTP"); 
                } catch(e1) { 
                    return null; 
                } 
            } 
        } else if (window.XMLHttpRequest) { 
            return new XMLHttpRequest(); 
        } else { 
            return null; 
        } 
    }, 
     
    send: function() 
    { 
        this.req = this.getXMLHttpRequest(); 
         
        // method 
        var apmMethod = this.method ? this.method : 'GET'; 
        if (apmMethod != 'GET' && apmMethod != 'POST') { 
            apmMethod = 'GET'; 
        } 
         
        // params 
        var apmParams = (this.params == null || this.params == '') ? null : this.params; 
         
        // file url 
        var apmUrl = this.url; 
        if (apmMethod == 'GET' && apmParams != null) { 
            apmUrl = apmUrl + "?" + apmParams; 
        } 
         
        // run 
        this.req.open(apmMethod, apmUrl, true); 
        this.req.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' ); 
         
        var request = this; 
        this.req.onreadystatechange = function() { 
            request.processReq.call(request); 
        } 
         
        this.req.send(apmMethod == 'POST' ? apmParams : null); 
    }, 

    // error msg || loading... msg Ãâ·Â 
    processReq : function() 
    {         
        var loadmsg = ''; 
        var ermsg    = ''; 
        var errormsg= ''; 
         
        // only if req shows "loaded" 
        if (this.req.readyState ==1 || this.req.readyState ==2 || this.req.readyState ==3) 
        { 
			loadmsg += "<table border=0 width='500' height='500' cellspacing=2 cellpadding=0 bgcolor=#e3e3e3><tr><td align=center>1231231231231231231"; 
            //loadmsg += "<font size=-1>loading ....</font><br><img src='/images/bar_loading.gif'>"; 
            loadmsg += "</td></tr></table>"; 
			//loadmsg += "<div style='width:90%; text-align:center'>"; 
            //loadmsg += "</div>"
            //this.printMsg(loadmsg); 
        } 
         
        else if (this.req.readyState == 4) 
        {             
            // only if "OK" 
            if (this.req.status == 200) 
            { 
                // ¿ÜºÎ ÇÔ¼ö È£Ãâ 
                this.callback(this.req); 
            } 
            else 
            {                 
                if(this.req.status == 403) ermsg = 'Á¢±Ù°ÅºÎ'; 
                else if(this.req.status == 404) ermsg = 'ÆäÀÌÁö¸¦ Ã£À» ¼ö ¾ø½À´Ï´Ù.'; 
                else if(this.req.status == 500) ermsg = '¼­¹ö ¿À·ù ¹ß»ý'; 
                 
                errormsg += "There was a problem retrieving the XML data:\n" + this.req.status + " : " +ermsg +"\n"; 
                errormsg += "Press KEY : F5 (refresh)"; 

                this.printMsg(errormsg); 
            } 
        } 

        // 0 ÀÏ¶§ 
        else 
        { 
            errormsg += "There was a problem retrieving the 'XMLHttpRequest Object' : "+this.req.status; 
            this.printMsg(errormsg); 
        } 
    }, 

    // div id Ãâ·Â 
    printMsg : function(msg) 
    { 
        var output = document.getElementById(this.divID); 

        output.innerHTML = msg.replace("/\n/g",''); 
    } 
} 