Solve javascript not executing problem - take 1