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){  // IE 
        try {
            reqHttp =  new XMLHttpRequest();
        } catch (e) {
            reqHttp =  null;
        }
    }
    if (reqHttp == null) errorMessage();   //XMLHttpRequest 
    return reqHttp;
}

function errorMessage() {               
    alert("Unsupported browser"); 
}

function openSendStatus(getPost, urlFileAppl, trueFalse, sendData, cbFunction) {
    var xmlHttp = newXMLHttpRequest(); 
   	xmlHttp.open(getPost, urlFileAppl, trueFalse); 
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4) {
            if (xmlHttp.status == 200) {   
                cbFunction(xmlHttp); 
            } else {
                exceptionControl(xmlHttp);   
            }
        }
    }
    var conType = "application/x-www-form-urlencoded; charset=UTF-8";
    xmlHttp.setRequestHeader("Content-Type", conType);
    xmlHttp.send(sendData);  
}

function exceptionControl(xmlHttp) {
    var exceptShow = "Status code: " + xmlHttp.status;
    exceptShow += ",  Finished abnormally.";
    //alert(exceptShow);
}
