Adding some basic support for IE7. Rewriting attr method for better consistency with jquery