finished javascript basic validation