function checkIE() {
    var isIE = false;

    if (!window.XMLHttpRequest) {
        isIE = true;
    }
    if ((window.navigator.appName).toLowerCase() == 'microsoft internet explorer') //checking for Ie7
    {
        var version = window.navigator.appVersion;
        var version1;
        if (version.indexOf("MSIE") != -1) {
            version1 = version.substring((version.indexOf("MSIE") + 4), version.length);
            version1 = version1.substring(0, 2);
            if (parseInt(version1) == 7 || parseInt(version1) == 6) {
                isIE = true;
            }
        }
    }
    return isIE;
}

function TxtEntered(obj) {
    if (document.getElementById(obj).value.replace(/^\s+|\s+$/, '') == '')
    { return false }
    else return true
}

XMLHTTP = function() {
    if (checkIE() == true) {
        this.xmlHttpClient = new ActiveXObject("MSXML2.XMLHTTP");
        if (this.xmlHttpClient == null) {
            this.xmlHttpClient = new ActiveXObject("Microsoft.XMLHTTP");
        }
    }
    else {
        this.xmlHttpClient = new XMLHttpRequest();
    }
    this.SendGETRequest = function(url, handler) {
        var post_data = null;
        if (arguments[2] != null) {
            post_data = arguments[2];
        }
        if (checkIE() == true) {
            this.xmlHttpClient.open("POST", url, true);
            this.xmlHttpClient.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        }
        else {
            this.xmlHttpClient.open("GET", url, true);
            this.xmlHttpClient.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
            this.xmlHttpClient.setRequestHeader("Content-length", 0);
        }

        this.xmlHttpClient.onreadystatechange = handler;
        this.xmlHttpClient.send(post_data);
    }

    //Spell checker
    this.SendSpellCheckerGETRequest = function(url, data, handler1) {
        var post_data = null;

        if (arguments[2] != null) {
            post_data = arguments[2];
        }
        this.xmlHttpClient.open("POST", url, true);
        this.xmlHttpClient.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        this.xmlHttpClient.onreadystatechange = handler1;
        this.xmlHttpClient.send("text=" + data);
    }
    return this;
}

/*----------------- Validate Inregers------------*/
function IsValidInteger(event) {
    if (navigator.appName == "Microsoft Internet Explorer") {
        if (!((window.event.keyCode >= 48) && (window.event.keyCode <= 57))) {
            window.event.keyCode = null;
        }
    }
    else {
        if (!((event.which >= 48) && (event.which <= 57) || (event.which == 8) || (event.keyCode == 46) || (event.which == 37) || (event.keyCode == 9))) {
            event.preventDefault();
        }
    }
}

function setDropdownValue(Ddl, setValue) {
    var length = Ddl.length;
    var intIndex = 0;
    try {
        for (intIndex = 0; intIndex <= length - 1; intIndex++) {

            if ((Ddl.options[intIndex].value == setValue) || (Ddl.options[intIndex].innerHTML == setValue)) {
                Ddl.options[intIndex].selected = true;
                return true;
            }
        }
        return false;
    }
    catch (err) {
        return false;
    }
}

function Trim(sString) {
    while (sString.substring(0, 1) == ' ') {
        sString = sString.substring(1, sString.length)
    }
    while (sString.substring(sString.length - 1, sString.length) == ' ') {
        sString = sString.substring(0, sString.length - 1);
    }
    return sString;
}

function RemoveHTML(strText) {
    var regEx = /<[^>]*>/g;
    return strText.replace(regEx, "");
}

function ValidateEmail(mail) {
    var valid = true
    var v1 = mail.split('@')
    if (v1.length != 2) {
        valid = false
    }
    else {
        var v2 = v1[1].split('.')
        if (v2.length < 2) {
            valid = false
        }

        if (Trim(v1[0]) == "" || Trim(v2[0]) == "" || Trim(v2[1]) == "") {
            valid = false
        }
    }
    return valid
}

function addComma(obj) {
    document.getElementById(obj).innerHTML += ", "
}

function ValidPhoneNo(obj, event) {
    var blnSpace;
    var len;
    blnSpace = false;
    var keyval = window.event ? window.event.keyCode : event.which;

    if (!((keyval >= 48) && (keyval <= 57))) {
        if (checkIE() == true) {
            window.event.keyCode = null;
        }
        else {
            if (!((keyval == 0) || (keyval <= 8))) {
                event.preventDefault();
            }
        }
    }
}	

function URLEncode(strString) {
    if (!window.XMLHttpRequest) {
        strString = Replace(strString, "\r\n", "ampltr;" + "BR" + "ampgtr;");
    }
    else {
        strString = Replace(strString, "\n", "ampltr;" + "BR" + "ampgtr;");
    }
    strString = Replace(strString, "&", "amp;");
    strString = Replace(strString, "<", "ampltr;");
    strString = Replace(strString, ">", "ampgtr;");
    return strString;
}

function URLDecode(strString) {
    if (checkIE() == true) {
        strString = Replace(strString, "<BR>", "\r\n");
    }
    else {
        strString = Replace(strString, "<BR>", "\n");
    }
    return strString;
}

function Replace(strMessage, ExistingChar, ReplaceChar) {
    while (strMessage.lastIndexOf(ExistingChar) >= 0) {
        strMessage = strMessage.replace(ExistingChar, ReplaceChar);
    }
    return strMessage;
}

function getDropdownValue(Ddl) {
    var intIndex = Ddl.selectedIndex;
    try {
        return Ddl.options[intIndex].value;
    }
    catch (err) {
        return 0;
    }
}

function getDropdownText(Ddl) {
    var intIndex = Ddl.selectedIndex;
    try {
        return Ddl.options[intIndex].text;
    }
    catch (err) {
        return "";
    }
}

function setDropdownText(Ddl, setText) {
    var length = Ddl.length;
    var intIndex = 0;
    try {
        for (intIndex = 0; intIndex <= length - 1; intIndex++) {
            if ((Ddl.options[intIndex].text == setText) || (Ddl.options[intIndex].innerHTML == setText)) {
                Ddl.options[intIndex].selected = true;
                return true;
            }
        }
        return false;
    }
    catch (err) {
        return false;
    }
}

function getDate(objDate) {
    try {
        var returnDate;

        if (objDate == "") {
            returnDate = ""
        }
        else {
            if (objDate.split("-").length > 2) {
                returnDate = objDate.split("-")[1] + "/" + objDate.split("-")[2].split("T")[0] + "/" + objDate.split("-")[0];
            }
            else {
                returnDate = ""
            }
        }
        return returnDate;
    }
    catch (err) {
        return "";
    }
}

function ValidNumber(obj, event) {
    var keyval = window.event ? window.event.keyCode : event.which;

    if (!((keyval >= 48) && (keyval <= 57))) {
        if (checkIE() == true) {
            window.event.keyCode = null;
        }
        else {
            if (!((keyval == 0) || (keyval <= 8))) {
                event.preventDefault();
            }
        }
    }

}

function IsValidNumber(obj) {
    try {
        var len;
        var loopInd;
        var keyval;

        if (Trim(obj) == "") {
            return false;
        }

        len = Trim(obj).length;

        for (loopInd = 0; loopInd < len; loopInd++) {
            keyval = Trim(obj).charCodeAt(loopInd)
            if (!((keyval >= 48) && (keyval <= 57))) {
                return false;
            }
        }
        return true;
    }
    catch (err) {
        return false;
    }
}

function validExpiry(MonthValue, YealValue) {
    try {
        var ExpDate = new Date();
        var CurrentDate = new Date();
        ExpDate.setDate(1);
        ExpDate.setMonth(MonthValue - 1);
        ExpDate.setFullYear(YealValue);

        ExpDate.setDate(CurrentDate.getDate() + 22);
        CurrentDate.setDate(1);
        CurrentDate.setMonth(CurrentDate.getMonth() + 1);

        if (ExpDate > CurrentDate) {
            return false;
        }
        else {
            return true;
        }
    }
    catch (err) {
        return false;
    }
}

function getClientHeight() {
    var clientHeight;

    if (window.navigator.appName.toLowerCase() == 'opera') {
        clientHeight = document.body.clientHeight;
    }
    else if (checkIE) {
        clientHeight = document.body.scrollHeight;
    }
    else {
        clientHeight = document.documentElement.clientHeight;
    }
    return clientHeight;
}

function displayDisability(bolValue) {
    try {
        showHideSelectControls(bolValue);
        showHideObjectControls(bolValue);
        if (bolValue) {
            document.getElementById('divDisable').style.width = document.body.scrollWidth + "px";
            var objHeight;
            objHeight = getClientHeight() + parseInt(document.body.scrollTop);
            if (objHeight < 600) {
                objHeight = 600;
            }

            document.getElementById('divDisable').style.height = objHeight + "px";
            var newHeight;
            newHeight = getScrollHeight();
            if (parseInt(document.getElementById('divDisable').style.height) < newHeight) {
                document.getElementById('divDisable').style.height = newHeight + "px";
            }
            document.getElementById('divDisable').style.display = "";
        }
        else {
            document.getElementById('divDisable').style.display = "none";
        }
    }
    catch (err) {
    }
}

function getScrollTop() {
    var sTop = 0;

    if (parseInt(document.body.scrollTop) > 0) {
        sTop = parseInt(document.body.scrollTop);
    }
    else if (parseInt(document.documentElement.scrollTop) > 0) {
        sTop = parseInt(document.documentElement.scrollTop);
    }

    return sTop;
}

function getScrollHeight() {
    var sTop = 0;
    if ((window.navigator.appName).toLowerCase() == 'microsoft internet explorer') {
        if (parseInt(document.body.scrollHeight) > 0) {
            sTop = parseInt(document.body.scrollHeight);
        }
        else if (parseInt(document.documentElement.scrollHeight) > 0) {
            sTop = parseInt(document.documentElement.scrollHeight);
        }
    }
    else {
        if (parseInt(document.documentElement.scrollHeight) > 0) {
            sTop = parseInt(document.documentElement.scrollHeight);
        }
        else if (parseInt(document.body.scrollHeight) > 0) {
            sTop = parseInt(document.body.scrollHeight);
        }
    }
    return sTop;
}

function IsValidUsername(obj) {
    try {
        var len;
        var loopInd;
        var keyval;

        if (Trim(obj) == "") {
            return false;
        }

        len = Trim(obj).length;
        for (loopInd = 0; loopInd < len; loopInd++) {
            keyval = Trim(obj).charCodeAt(loopInd)

            if (((keyval >= 32) && (keyval <= 47)) || ((keyval >= 58) && (keyval <= 64)) || ((keyval >= 91) && (keyval <= 96)) || (keyval >= 123)) {
                return false;
            }
        }
        return true;
    }
    catch (err) {
        return false;
    }
}

function validateDate(object) {
    var value1 = object.value;
    var valid = true;
    var ToDate = new Date();

    var t_date = ToDate.getDate();      // Returns the day of the month
    var t_mon = ToDate.getMonth();      // Returns the month as a digit
    var t_year = ToDate.getFullYear();  // Returns 4 digit year
    ToDate = (t_mon + 1) + "/" + t_date + "/" + t_year;
    var value2 = ToDate
    var date1, date2;
    var month1, month2;
    var year1, year2;

    month1 = value1.substring(0, value1.indexOf("/"));
    if (month1.indexOf("0") == 0) {
        month1 = month1.replace("0", "");
    }
    date1 = value1.substring(value1.indexOf("/") + 1, value1.lastIndexOf("/"));
    if (date1.indexOf("0") == 0) {
        date1 = date1.replace("0", "");
    }
    year1 = value1.substring(value1.lastIndexOf("/") + 1, value1.length);

    month2 = value2.substring(0, value2.indexOf("/"));
    date2 = value2.substring(value2.indexOf("/") + 1, value2.lastIndexOf("/"));
    year2 = value2.substring(value2.lastIndexOf("/") + 1, value2.length);

    if ((parseInt(year2) - parseInt(year1)) < 10) {
        valid = false;
    }
    return valid;
}

function getClientHeight() {
    var clientHeight;

    if (window.navigator.appName.toLowerCase() == 'opera') {
        clientHeight = document.body.clientHeight;
    }
    else {
        clientHeight = document.documentElement.clientHeight;
    }
    return clientHeight;
}

function showHideSelectControls(obj) {
    var len = document.getElementsByTagName("select").length;
    var intLoop = 0;

    if (obj == false) {
        for (intLoop = 0; intLoop < len; intLoop++) {
            document.getElementsByTagName("select")[intLoop].style.visibility = "visible";
        }
    }
    else {
        for (intLoop = 0; intLoop < len; intLoop++) {
            document.getElementsByTagName("select")[intLoop].style.visibility = "hidden";
        }
    }
}

function showHideObjectControls(obj) {
    var len = document.getElementsByTagName("object").length;
    var intLoop = 0;

    if (obj == false) {
        for (intLoop = 0; intLoop < len; intLoop++) {
            document.getElementsByTagName("object")[intLoop].style.visibility = "visible";
        }
    }
    else {
        for (intLoop = 0; intLoop < len; intLoop++) {
            document.getElementsByTagName("object")[intLoop].style.visibility = "hidden";
        }
    }
}

function ChkValidZipWithException(objectC, objectZ) {
    if (objectC.toLowerCase() == '') {
        return false;
    }
    else if (objectC.toLowerCase() != 'united states' && objectC.toLowerCase() != 'usa' && objectC.toLowerCase() != 'us' && objectC.toLowerCase() != 'uk' && objectC.toLowerCase() != 'canada' && objectC.toLowerCase() != 'france' && objectC.toLowerCase() != 'belgium' && objectC.toLowerCase() != 'spain') {
        return true;
    }
    else if (objectZ.toLowerCase() == '') {
        return false;
    }
    else {
        return true;
    }
}

function ChkValidZip(object) {
    reZip = new RegExp(/(^\d{5}$)|(^\d{5}-\d{4}$)/);
    return reZip.test(object);
}

function ChkValidPhone(object) {
    var myRegxp = /^(\+|-|\s|\d)+$/;
    return myRegxp.test(object);
}

function ValidatePhoneNo(event) {
    var blnSpace;
    var len;
    blnSpace = false;
    var keyval = window.event ? window.event.keyCode : event.which;

    if (!((keyval >= 48) && (keyval <= 57))) {
        if (checkIE() == true) {
            window.event.keyCode = null;
        }
        else {
            if (!((keyval == 0) || (keyval <= 8))) {
                event.preventDefault();
            }
        }
    }
}

function setPopUpPoistion(popUpId) {
    var divHeight = 300;
    var divWidth = 200;

    if (parseInt(document.getElementById(popUpId).style.heigh) > 0) {
        divHeight = parseInt(document.getElementById(popUpId).style.heigh);
    }
    else if (parseInt(document.getElementById(popUpId).offsetHeight) > 0) {
        divHeight = parseInt(document.getElementById(popUpId).offsetHeight);
    }

    if (parseInt(document.getElementById(popUpId).style.width) > 0) {
        divWidth = parseInt(document.getElementById(popUpId).style.width);
    }

    document.getElementById(popUpId).style.top = ((screen.availHeight - divHeight) / 2 + getScrollTop() - 70) + "px";

    document.getElementById(popUpId).style.left = ((screen.availWidth - divWidth) / 2 + document.documentElement.scrollLeft) + "px";
}

function getScrollTop() {
    var scrollTop;

    //	if(window.navigator.appName.toLowerCase()=='opera')
    //	{
    //		scrollTop=document.body.scrollTop;
    //	}
    //	else
    //	{
    //		scrollTop=document.documentElement.scrollTop;
    //	}
    if (document.body.scrollTop == 0) {
        scrollTop = document.documentElement.scrollTop;
    }
    else {
        scrollTop = document.body.scrollTop;
    }
    return scrollTop;
}


function validateMMDDYYYYDate(object) {
    var minYear = 1900;
    var maxYear = 2100;
    var seperator = "/";
    var validDate = false;

    if (Trim(object) != "") {
        var dateParts = object.split("/");

        if (dateParts.length == 3) {
            var month = parseInt(dateParts[0]);
            var day = parseInt(dateParts[1]);
            var year = parseInt(dateParts[2]);

            if (month != NaN && day != NaN && year != NaN) {
                if (year >= minYear && year <= maxYear) {
                    if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) {
                        if (day <= 31) {
                            validDate = true;
                        }
                    }
                    else if (month == 4 || month == 6 || month == 9 || month == 10) {
                        if (day <= 30) {
                            validDate = true;
                        }
                    }
                    else {
                        if (year % 4 == 0) {
                            if (day <= 29) {
                                validDate = true;
                            }
                        }
                        else {
                            if (day <= 28) {
                                validDate = true;
                            }
                        }
                    }
                }
            }
        }
    }
    return validDate;
}


function ChkValidEmail(object) {
    var myRegxp = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/
    return myRegxp.test(object);
}

/*Added for applying error color in posting pages */
function changeColorToError(obj) {
    document.getElementById(obj).style.color = '#FF0000';
}

function changeColorToRemovError(obj) {
    document.getElementById(obj).style.color = '#065A9C';
}
/*   End    */

function ShowError(obj) {

    var Label = document.getElementById(obj.getAttribute("label"));
    Label.style.color = "#FF0000";

}
function RemoveError(obj) {
    var Label = document.getElementById(obj.getAttribute("label"));
    Label.style.color = "#065A9C";
}




function showRollover(object, childType) {
    if (object.getElementsByTagName(childType)[0].style.display == 'none') {
        object.getElementsByTagName(childType)[0].style.visibility = 'hidden';
        object.getElementsByTagName(childType)[0].style.display = '';

        var offsetTop = 0;
        offsetTop = parseFloat(object.offsetTop);
        object.getElementsByTagName(childType)[0].style.left = "200px";
        object.getElementsByTagName(childType)[0].style.top = 10 + "px";
        // alert(object.getElementsByTagName("DIV")[0].offsetTop)
        if ((parseFloat(object.offsetTop) + parseFloat(object.getElementsByTagName(childType)[0].offsetHeight)) > (getClientHeight() + getScrollTop())) {
            //alert(offsetTop - parseFloat(object.getElementsByTagName("SPAN")[0].offsetHeight) )
            //alert( parseFloat(object.offsetTop) - parseFloat(object.getElementsByTagName("SPAN")[0].offsetHeight));
            object.getElementsByTagName(childType)[0].style.top = -parseFloat(object.getElementsByTagName(childType)[0].offsetHeight) + 'px'; // (offsetTop - parseFloat(object.getElementsByTagName("SPAN")[0].offsetHeight) - getClientHeight()) + 'px';
        }
        else {//alert(offsetTop)
            //object.getElementsByTagName("DIV")[0].style.top = offsetTop + "px";
        }
        //alert(parseFloat(getOffsetTop(object.getElementsByTagName("SPAN")[0])))
        object.getElementsByTagName(childType)[0].style.visibility = 'visible';
    }
}

function getOffsetTop(object) {
    var offsettop = object.offsetTop;

    while (object.parentNode != null && object.parentNode.tagName.toLowerCase() != "body") {
        object = object.parentNode;
        if (object.tagName.toLowerCase() != "tr")
            offsettop += object.offsetTop;
    }

    return offsettop;
}

function hideRollover(object, childType) {
    object.getElementsByTagName(childType)[0].style.display = 'none';
}






function getClientWidth() {
    var clientWidth;

    if (window.navigator.appName.toLowerCase() == 'opera') {
        clientWidth = document.body.clientWidth;
    }
    else {
        clientWidth = document.documentElement.clientWidth;
    }

    return clientWidth;
}


function ChkValidURL(object) {
    /*var myRegxp = /http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- ./?%&=]*)?/

    return myRegxp.test(object);*/

    return isValidURL(object.replace(/^\s+|\s+$/, ''));
}


function isUrl(s) {
    var regexp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
    return regexp.test(s);
}


function isValidURL(url) {
    var RegExp = /^(([\w]+:)?\/\/)?(([\d\w]|%[a-fA-f\d]{2,2})+(:([\d\w]|%[a-fA-f\d]{2,2})+)?@)?([\d\w][-\d\w]{0,253}[\d\w]\.)+[\w]{2,4}(:[\d]+)?(\/([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)*(\?(&?([-+_~.\d\w]|%[a-fA-f\d]{2,2})=?)*)?(#([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)?$/;
    if (RegExp.test(url)) {
        return true;
    } else {
        return false;
    }
}

function checkUrl(theUrl) {
    if (theUrl.match(/^(http|ftp)\:\/\/\w+([\.\-]\w+)*\.\w{2,4}(\:\d+)*([\/\.\-\?\&\%\#\=]\w+)*\/?$/i) ||
     theUrl.match(/^mailto\:\w+([\.\-]\w+)*\@\w+([\.\-]\w+)*\.\w{2,4}$/i)) {
        return true;
    } else {
        alert("Wrong address.");
        return false;
    }
}

function validarURL(valor) {
    if (/^w+([.-]?w+)*.w+([.-]?w+)*(.w{2,3})+$/.test(valor)) {
        return (true)
    } else {
        return (false);
    }
}


function validAttachment(strFileName, isImg, isDoc) {
    var NameParts;
    NameParts = strFileName.split('.');
    var isValid = true;
    var extn = strFileName.split('.')[NameParts.length - 1].toLowerCase()
    if (isImg) {
        if (extn == 'gif' || extn == 'jpeg' || extn == 'jpg' || extn == 'bmp' || extn == 'png') {
            isValid = true;
        }
        else {
            isValid = false;
        }
    }

    if (isDoc && isValid == false) {
        if (extn == 'doc' || extn == 'txt' || extn == 'pdf' || extn == 'docx' || extn == 'rtf') {
            isValid = true;
        }
        else {
            isValid = false;
        }
    }

    return isValid;
}

//Sojanya Tripathi
function CheckEmailId(object) {
    //var myRegxp = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/
    //var myRegxp = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/
    var myRegxp = /^\w+([-+.-]\w+)*@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/
    return myRegxp.test(object);
}
//Sojanya - start - 1st Feb. 2010
function DateAdd(ItemType, DateToWorkOn, ValueToBeAdded) {
    switch (ItemType) {
        //date portion         
        case 'd': //add days
            DateToWorkOn.setDate(DateToWorkOn.getDate() + ValueToBeAdded)
            break;
        case 'm': //add months
            DateToWorkOn.setMonth(DateToWorkOn.getMonth() + ValueToBeAdded)
            break;
        case 'y': //add years
            DateToWorkOn.setYear(DateToWorkOn.getFullYear() + ValueToBeAdded)
            break;
        //time portion         
        case 'h': //add days
            DateToWorkOn.setHours(DateToWorkOn.getHours() + ValueToBeAdded)
            break;
        case 'n': //add minutes
            DateToWorkOn.setMinutes(DateToWorkOn.getMinutes() + ValueToBeAdded)
            break;
        case 's': //add seconds
            DateToWorkOn.setSeconds(DateToWorkOn.getSeconds() + ValueToBeAdded)
            break;
    }
    return DateToWorkOn;
}
//Sojanya - end - 1st Feb. 2010

//Sojanya - start - 1st Apr. 2010
function calOnKey_SetApostrophe(id) {
    var strSubject = document.getElementById(id).value.toString();
    if (strSubject.indexOf("'") >= 0) {
        for (var i = 65; i <= 90; i++) {
            strSubject = strSubject.replace("'" + String.fromCharCode(i), "'" + String.fromCharCode(i).toLowerCase());
        }
    }
    document.getElementById(id).value = strSubject;
}
//Sojanya - end - 1st Apr. 2010

//21 Apr. 2010 - starts
function IsValidFloat(value) {
    try {
        var len;
        var loopInd;
        var keyval;

        if (Trim(value) == "") {
            return false;
        }

        len = Trim(value).length;

        for (loopInd = 0; loopInd < len; loopInd++) {
            keyval = Trim(value).charCodeAt(loopInd);
            if (!(((keyval >= 48) && (keyval <= 57)) || (keyval == 46))) {
                return false;
            }
        }
        return true;
    }
    catch (err) {
        return false;
    }
}
//21 Apr. 2010 - ends
