added js for getting the right buttons to show