Moved bindings to prevent Multiple Image bug (issue 3)

Moved jQuery bindings outside loops and multiple function calls to prevent the Doble Image bug.