//<script language="javascript">

function Common_XmlHttp_Post2(strTargetASP, strData)
{   
    var strReturn = "";
    var oXmlHttp;
    if (window.XMLHttpRequest)
    {
        oXmlHttp = new XMLHttpRequest();
        if (oXmlHttp.overrideMimeType)
            oXmlHttp.overrideMimeType('text/text');
    }
    else if (window.ActiveXObject) 
    {
        try
        {
            oXmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            try
            {
                oXmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e)
            {}
        }
    }
    
    if (!oXmlHttp)
    {
        alert('Giving up :( Cannot create an XMLHTTP instance');
        return false;
    }
    
    oXmlHttp.open("POST", strTargetASP, false);  // un-async.
	oXmlHttp.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded");		    
    oXmlHttp.send(strData);    

    if (oXmlHttp.readyState == 4) {
        if (oXmlHttp.status == 200) {
            strReturn = oXmlHttp.responseText;
        }
        else 
        {
            alert('There was a problem with the request.');
        }
    }

    return (strReturn);
}

function Common_XmlHttp_Post(strTargetASP, strData)
{   
    var strReturn = "";
    var oXmlHttp = new ActiveXObject("MICROSOFT.XMLHTTP");       
    oXmlHttp.open("POST", strTargetASP, false);  // un-async.

	oXmlHttp.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded");		    
	    
    oXmlHttp.send(strData);    
    if (oXmlHttp.status != "200")
    {
        alert("Error : " + oXmlHttp.status + " = " + oXmlHttp.statusText);      
    }
    else   
       strReturn = oXmlHttp.responseText;

    return (strReturn);
}

//</script>

function check_Numeric(objCheck, bShowMsg)
{
    
    if (objCheck.value != "")
    {
        var value = objCheck.value;
        value = value.toUpperCase();        
        for (var i=0; i<value.length; i++)
        {
            var ch = value.substring(i, i+1);
            if ((ch < '0' || ch > '9'))
            {
                //var strMsg = getCheckErrorMsg(strName, JST_ERRMSG_NUMERIC, bShowMsg);
               alert(bShowMsg);
                objCheck.focus();   
                return (false);
            }    
        }        
    }    
    return (true);
} 

function check_Email(objCheck)
{    
    // cut email by '<>'
    var result = true;    
    var value = objCheck.value;    
    var nIndex1 = value.indexOf('<');
    var nIndex2 = value.indexOf('>');
    if ((nIndex1 >= 0 && nIndex2 < 0) ||
        (nIndex1 < 0 && nIndex2 >= 0))
    {    
        result = false;
    }
    else
    {    
        if (nIndex1 >= 0 && nIndex2 >= 0)
            value = value.substring(nIndex1+1, nIndex2);
        if (value.length <= 2)
            result = false;
    }                    
    
    if (result == true)
    {   
        // check duplicated '@' && position of '@' '.'
        nIndex1 = value.indexOf('@');
        var posA = value.lastIndexOf('@');
        var posDot = value.lastIndexOf('.');
        if (nIndex1 != posA)
        {
            result = false;
        }    
        else if (posA <= 0 || posDot <= 0 || posA >= posDot)
        {
            result = false;        
        }
        else
        {
            // check invalid char
            var strExcept = " <>()[],;:\"";
            for (var i=0; i<strExcept.length; i++)
            {                    
                if (value.indexOf(strExcept.substring(i,i+1)) >= 0)
                {
                    result = false;    
                    break;
                }    
            }                             
        }
    }    
    
    if (result == false)
        objCheck.focus();

    return (result);
} 


function Common_String_Trim(strString) 
{
    if (strString != null && strString.length > 0)
    {    
        strString = strString.replace(/^\s*/,""); //strip leading
        strString = strString.replace(/\s+$/,""); //strip trailing
    }
    return (strString);
}