
function ForceNumbersOnly(myfield, e, dec)
{
    var key;
    var keychar;

    if (window.event)
    {
        key = window.event.keyCode;
    }
    else if (e)
    {
        key = e.which;
    }
    else
    {
        return true;
    }
    if(key != 46 && key != 45 && key > 31 && (key < 48 || key > 57))
    {
        return false;
    }
    else
    {
        return true;
    }
}

function RemoveNonNumeric(myfield)
{
    var re = /[^0-9\.\-]/g;
    if(re.test(myfield.value))
    {
        myfield.value = myfield.value.replace(re, '');
        myfield.value = myfield.value.replace(/\./, '');
    }
}

function AlphaNum(string2check)
{
	// allow ONLY alphanumeric keys, no symbols or punctuation
	// this can be altered for any "checkOK" string you desire
	var checkOK = "_-ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
	var checkStr = string2check;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
		break;
		if (j == checkOK.length)
		{
			allValid = false;
			break;
		}
	}
	if (!allValid)
	{
		return (false);
	}
	else
	{
		return (true);
	}

}
