changing java script code for the new ui