// XMLHttpRequest creation
function newXMLHttpRequest() {
    var reqHttp;   
    if (window.ActiveXObject) {	 // IE
        try {
            reqHttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                reqHttp =  new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e1) {               
                reqHttp =  null;
            }
        }
    } else if (window.XMLHttpRequest){  // not IE 
        try {
            reqHttp =  new XMLHttpRequest();
        } catch (e) {
            reqHttp =  null;
        }
    }
    if (reqHttp == null) errorMessage();   //fail XMLHttpRequest creation
    return reqHttp;
}

// not supportable browser
function errorMessage() {               
    alert("This Brower not support."); 
}

// readyState and status check
function openSendStatus(getPost, urlFileAppl, trueFalse, sendData) {
    var xmlHttp = newXMLHttpRequest();            //XMLHttpRequest creaction
   	xmlHttp.open(getPost, urlFileAppl, trueFalse); //send method,URL,recieve method
    xmlHttp.onreadystatechange = function() {    // status monitoring
        if (xmlHttp.readyState == 4) {                 //complete
            if (xmlHttp.status == 200) {                //result recieve success
                mainControl(xmlHttp);                   //main process
            } else {
                exceptionControl(xmlHttp);            //exception process
            }
        }
    }
    var conType = "application/x-www-form-urlencoded; charset=UTF-8";
    xmlHttp.setRequestHeader("Content-Type", conType);
    xmlHttp.send(sendData);                          //process the recieved data
}

// exception (status != 200)
function exceptionControl(xmlHttp) {
    var exceptShow = "Status Code: " + xmlHttp.status;
    exceptShow += ",  Terminated by some problems.";
    //alert(exceptShow);
    //alert("An error occurred during communicate with the server-side.\n Plase try again!");
}