added more javascript functionality, to validate the form