Tiled Gallery: Image dimensions to style attribute

Moved image height and width attributes to a style attribute so that jQuery width and height accessors can access them before the image is loaded. Image height and width properties are mangled before rendering, so setting them doesn't make the browser reserve the required space before the image is loaded.
Tiled Gallery: Browser backwards compatibility.

Using jQuery foreach instead of standard foreach for browser backwards compatibility.
Tiled Gallery: Removed unnecessary semicolon.
Tiled Gallery: Fix comment indent.
Tiled Gallery: Fixed margin property.
Tiled Gallery: Got rid of maybeSetAttributes.

Having to set data attributes describing image dimensions manually in JavaScript is troublesome, especially since the code rendering the  HTML template knows the exact dimensions. Original image dimensions are now set to the images and tiled gallery rows and groups in the template, so that the JavaScript resizing logic can use them immediately.