escape single quotes that may occur in titles

Found that apostraphes in a title were causing a JS syntax error. This addresses that problem.