Added (partly experimental) support for different browsers (e.g. IE 6-9)