Solve javascript not executing problem - take 2