added trim() support for oldIE, fixed some templates