more javascript refactoring, created a function to disable buttons