Optimize index.js and add style consistency

Declared all jQuery objects once where needed instead of diving into the DOM multiple times for the same object.

Added style consistency between variable declarations, if/else statements and functions.
Merge pull request #130 from jillesme/master

Optimize index.js and add style consistency
Fixes variable image width bug

closes #95
 - added onload event listeners to images
Merge pull request #132 from jeremija/image-width-fix

Fixed bug where image width changes on refresh
Merge remote-tracking branch 'upstream/master'