Validating numeric values in javascript