Javascript validate name field function