
//Round#4.3
function fnKeyPress(ctl) {
    if (event.keyCode == 13)
        return false;
    else
        return true;
}

// This method is added by Jailani on Oct 26, 2005
function getLanguage() {
    // Sample cookie : 'name1=val1; name2=val2'
    var ckie = document.cookie + "";
    var allckie = ckie.split(';');
    var count, crumb, appckie;

    for (count = 0; count < allckie.length; count++) {
        crumb = allckie[count] + "";
        appckie = crumb.split('=');

        if (appckie.length >= 1) {
            var culTemp = appckie[0].toUpperCase() + "";
            var cul, theCul = "ULTUR";

            // cul = culTemp.substr(1, 7) ; // remove the space infront of ' Culture' string

            if (culTemp.indexOf(theCul) >= 0) {
                // alert(appckie[1]) ;
                return (appckie[1]);
            }
        }
    }
}



function TrimString(valueToTrim) {
    if (valueToTrim == 'undefined')
        return "";

    if (valueToTrim == "")
        return "";

    if (valueToTrim.length < 1)
        return "";

    valueToTrim = RTrimString(valueToTrim);
    valueToTrim = LTrimString(valueToTrim);
    if (valueToTrim == "")
        return "";
    else
        return valueToTrim;
}

function RTrimString(VALUE) {
    var w_space = String.fromCharCode(32);
    var v_length = VALUE.length;
    var strTemp = "";

    if (v_length < 0)
        return "";

    var iTemp = v_length - 1;

    while (iTemp > -1) {
        if (VALUE.charAt(iTemp) != w_space) {
            strTemp = VALUE.substring(0, iTemp + 1);
            break;
        }
        iTemp = iTemp - 1;
    } // while

    return strTemp;
}

function LTrimString(VALUE) {
    var w_space = String.fromCharCode(32);
    if (v_length < 1)
        return "";

    var v_length = VALUE.length;
    var strTemp = "";

    var iTemp = 0;

    while (iTemp < v_length) {
        if (VALUE.charAt(iTemp) != w_space) {
            strTemp = VALUE.substring(iTemp, v_length);
            break;
        }

        iTemp = iTemp + 1;
    } // while

    return strTemp;
}

function fnIsNumeric(strString) {
    var strValidChars = "0123456789"; // "0123456789.-";
    var strChar;
    var blnResult = true;

    if (strString.length == 0) return false;

    //  test strString consists of valid characters listed above
    for (i = 0; i < strString.length && blnResult == true; i++) {
        strChar = strString.charAt(i);
        if (strValidChars.indexOf(strChar) == -1) {
            blnResult = false;
        }
    }

    return blnResult;
}
