Added same changes for 2.5.x as in commit for pull request 589

Added same changes to 2.5.x as in commit https://github.com/joomla/joomla-cms/commit/af510cc3026f783a475b811af4f7d35881e4ac90 for the joomla 3 master branch as per suggestion.

This is still in reference to Peter's original pull request:    https://github.com/joomla/joomla-cms/pull/589

This pull request does the same thing for the 2.5.x branch.  I tested it and it seems to work fine (with the special test plugin), but I encourage someone else to test it too.

See: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=29968