
  var JSGallery = function(JQ, T) {
    var IMG = T.slides_height;
    var n = T.num_slides;
    var jQuery = JQ;
    var dom_main = T.dom_main;
    var dom_thumbs = T.dom_thumbs;
    var current_item = null;
    var prev_item = null;
    var current_thumb = null;
    var prev_thumb = null;
    
    var Load = function(index) {
      jQuery(dom_main).animate({'height' : (IMG[index]+40)+'px'}, 300, null, function() {
        // po dostosowaniu do wysokości:
        current_item = jQuery(dom_main + " div.item").eq(index);
        
        if (prev_item != null) {
          // Jeżeli istnieje element poprzedni, zmień jego CSS:
          prev_item.css({'z-index' : 1, 'display' : 'none'});
        }
        
        // Pokaż aktualny element:
        current_item.css('z-index', 2).fadeIn(200);
        prev_item = current_item;
      });

    }
    
    var ChangeThumb = function(index) {
      if (prev_thumb != null) {
        // Jeżeli istnieje poprzedni element:
        prev_thumb.css('border-color', '#BBBBBB');
      }
      
      // Pobierz element na podstawie indexu oraz zmień wartośći CSS:
      current_thumb = jQuery(dom_thumbs+" li").eq(index).children('a').children('img');
      current_thumb.css('border-color', '#555555');
      prev_thumb = current_thumb;
    }
    
    this.Init = function(index) {
      jQuery(dom_thumbs+" li a").each(function(i) {
        $(this).click(function() {
          GalleryNavigator.switch_gallery(i);
        })
      });
      
      Load(index);
      ChangeThumb(index);
    }
    
    
    this.switch_gallery = function(i) {
      ChangeThumb(i);
      Load(i);
    }
    
    
  }

