Gallery now outputs useful ajax code.