Added support for IE<9 browsers by checking for trim support in String prototype