Sigel.ProductImageBox = (function(){
  // the constructor
  var f = function(){
    var that = this;
    
    Seadragon.Config.imagePath = "/images/dzi/";
    this.viewer = new Seadragon.Viewer("dzi_container");
    if(Sigel.dzi && Sigel.dzi[0]){
      this.viewer.openDzi(Sigel.dzi[0]); 
      this.currentImageId = 0;
    }
    
    $('.produkt_prev_bottom a').each(function(){
      var $this = $(this);
      $this.click(function(){
        that.showImage($(this).children('img').attr('id'));
        return false;
      });
    });
  };
  
  f.prototype = {
    showImage: function(imgId){
      if (imgId !== this.currentImageId) {
        this.viewer.openDzi(Sigel.dzi[imgId]);
        this.currentImageId = imgId;
      }
    }
  }

  return f;
  
  
}());

$(function(){
  new Sigel.ProductImageBox;
});




















