Javascript function for validating radio buttons