Changes way gallerie's are created

- Now created using a prototype so that
  code is not reexecuted each time a gallerie
  is created