//
// Copyright (c) 2000-2001 by experITy
//       All Rights Reserved
//

function Number_onChange(field)
{
    field.value = Number_Format(field.value);
}



function Number_Format(strInput)
{
    if(strInput.length ==0)
        return strInput;
    return strInput * 1;
}


function Number_onInput(inputChar, field, bPositive, bInt)
{
    var strInput = field.value;
    var blnReturnVal = true;
    if( (inputChar < 48 || inputChar > 57) &&   // not a number
        ((!bInt && inputChar!= 46) || bInt) &&  // not a "." when not a integer field       
        ((!bPositive && inputChar!= 45) || bPositive))// If not "-" when not a positive field
    {
        blnReturnVal = false;
    }
    else if ( (inputChar == 46 && strInput.indexOf(".", 0) > -1) || // found "." already
         (inputChar == 45 && strInput.length > 0) )    // "-" only allow at the beginning
    {
        blnReturnVal = false;
    }
    return blnReturnVal;
}
