js code for action tab switching