A simple javascript validator