﻿function chkNumeric(objName,specialchr)//comma,period,hyphen)
{
// only allow 0-9 be entered, plus any values passed
// (can be in any order, and don't have to be comma, period, or hyphen)
// if all numbers allow commas, periods, hyphens or whatever,
// just hard code it here and take out the passed parameters
//alert(parseInt(objName.value));

var checkOK = "0123456789" + specialchr;
var checkStr = objName;
//var allValid = true;
//var decPoints = 0;
var allNum = "";


/*for (i = 0;  i < checkStr.value.length;  i++)
{
    ch = checkStr.value.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
        if (ch == checkOK.charAt(j))
            break;
        if (j == checkOK.length)
        {
            allValid = false;
            break;
        }
    if (ch != ",")
    allNum += ch;
}*/


for (i = 0;  i < checkStr.value.length;  i++)
{
    ch = checkStr.value.charAt(i);
    inner=false;
    for (j = 0;  j < checkOK.length;  j++)
    {
        if (ch == checkOK.charAt(j))
        {
            inner=true;
            break;
        }
    }
    if (inner==true)
        allNum +=ch;
}
return(allNum);


}

function trim(str)
{
    return(str.replace(/^\s+|\s+$/, '')); 
}

function checkvalidurl(strUrl)
{
        var RegexUrl = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
        if(RegexUrl.test(strUrl)==true)
            return false;
        else
            return true;
            
}

function checkemail(str)
{
    if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(str))
        error=true;
}
// Sample use