extract javascript to separate file