I am trying to find a way to trim spaces from the start and end of the title string. I was using this, but it doesn\'t seem to be working:
title = title.repl
ECMAScript 5 supports trim and this has been implemented in Firefox.
trim
trim - MDC