function getXMLHttpRequest() {
	var xmlHttp = false;
	if (window.ActiveXObject) {
		try {
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try {
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e1) {
				xmlHttp = false;
			}
		}
	} else if (window.XMLHttpRequest) {
		xmlHttp = new XMLHttpRequest();
	}
	
	return xmlHttp;
}

function sendRequest(pUrl, pParams, pCallback, pMethod) {

    var url = '';

	// validation check
    if ( pUrl == undefined || pUrl == '' ) {
    	return;
    }
    else {
        if ( pParams == undefined || pParams == '' ) {
        	url = pUrl;
        }
        else {
        	if ( pParams.indexOf('?') > 0 ) {
        		pParams = pParams.replace(eval("/?/gi"), "");
        	}
    		url = pUrl + "?" + pParams;
        }
    }
    if ( pMethod == undefined || pMethod == '' || (pMethod.toUpperCase() != 'GET' && pMethod.toUpperCase() != 'POST') ) {
	    pMethod = 'GET';
    }
    else {
    	pMethod = pMethod.toUpperCase();
    }

	xmlHttp = getXMLHttpRequest();
	if (!xmlHttp) alert("Error initializing XMLHttpRequest!");
    xmlHttp.open(pMethod, url, true);
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;charset=EUC-KR');
    xmlHttp.onreadystatechange = pCallback;
    xmlHttp.send(pMethod == 'POST' ? pParams : null);
}

function sendMultiRequest(pUrl, pParams, pCallback, pMethod, pXmlHttp) {

    var url = '';

	// validation check
    if ( pUrl == undefined || pUrl == '' ) {
    	return;
    }
    else {
        if ( pParams == undefined || pParams == '' ) {
        	url = pUrl;
        }
        else {
        	if ( pParams.indexOf('?') > 0 ) {
        		pParams = pParams.replace(eval("/?/gi"), "");
        	}
    		url = pUrl + "?" + pParams;
        }
    }
    if ( pMethod == undefined || pMethod == '' || (pMethod.toUpperCase() != 'GET' && pMethod.toUpperCase() != 'POST') ) {
	    pMethod = 'GET';
    }
    else {
    	pMethod = pMethod.toUpperCase();
    }

	//pXmlHttp = getXMLHttpRequest();
	if (!pXmlHttp) alert("Error initializing XMLHttpRequest!");
    pXmlHttp.open(pMethod, url, true);
	pXmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;charset=EUC-KR');
    pXmlHttp.onreadystatechange = pCallback;
    pXmlHttp.send(pMethod == 'POST' ? pParams : null);
}

function sendRequestSync(pUrl, pParams, pMethod) {

    var url = '';

	// validation check
    if ( pUrl == undefined || pUrl == '' ) {
    	return;
    }
    else {
        if ( pParams == undefined || pParams == '' ) {
        	url = pUrl;
        }
        else {
        	if ( pParams.indexOf('?') > 0 ) {
        		pParams = pParams.replace(eval("/?/gi"), "");
        	}
    		url = pUrl + "?" + pParams;
        }
    }
    if ( pMethod == undefined || pMethod == '' || (pMethod.toUpperCase() != 'GET' && pMethod.toUpperCase() != 'POST') ) {
	    pMethod = 'GET';
    }
    else {
    	pMethod = pMethod.toUpperCase();
    }

	xmlHttp = getXMLHttpRequest();
	if (!xmlHttp) alert("Error initializing XMLHttpRequest!");
    xmlHttp.open(pMethod, url, false);
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;charset=EUC-KR');
    xmlHttp.send(pMethod == 'POST' ? pParams : null);

    return xmlHttp.responseText;
}