var Ajax = {
    init:function() {
        if(window.ActiveXObject){
            try {
                return new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e1) {
                try {
                    return new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e2) {
                    return null;
                }
            }
        } else if(window.XMLHttpRequest){
            return new XMLHttpRequest();
        } else {
            return null;
        }
    },
    request:function(url, options) {
        var obj = Ajax.init();
        
        obj.open(options.method, url);
        obj.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');

        //IE는 onload가 안되.
        obj.onreadystatechange = function () {  
            if(obj.readyState == 4) {
                options.onComplete();
                if (obj.status == 200) { //정상 처리
                    options.onSuccess(obj.responseText);
                } else {
                    options.onFailure();
                }
            }
        }
        
        obj.send(options.parameters);
    },
    updater:function(view, url) {
        var obj = Ajax.init();
        
        obj.open('post', url);
        obj.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8')
        obj.onreadystatechange = function () {
            if(obj.readyState == 4) {
                document.getElementById(view).innerHTML= obj.responseText;
            }
        }
        obj.send('');
    }
};
