Hook buttons into javascript