/*
 * Project gallery
 * 
 * 2007 - Magic Wand
 */
ns('MagicWand.Gallery');

ns.MagicWand.Gallery.ProjectGallery = function(id, view_place, name_place) {
  this.name_place = name_place;

  ns.MagicWand.Gallery.ProjectGallery.superclass.constructor.call(this, id, view_place);  
}

ns.utils.extend(ns.MagicWand.Gallery.ProjectGallery, ns.MagicWand.Gallery.BaseGallery, {
  
  _init: function() {
    ns.MagicWand.Gallery.ProjectGallery.superclass._init.call(this);
    this._bindFullView();
  },
  
  _bindFullView: function() {
    $(this.view_place).click(function() {
      var src = this.src.replace(/mid\//, '');
      largeImg(src, this.getAttribute('title'));
    });
  },
  
  activate: function(id) {
    ns.MagicWand.Gallery.ProjectGallery.superclass.activate.apply(this, arguments);
    var image_name = $('#' + id).attr('alt');
    this.setImageName(image_name);
  },
  
  previewSrcToView: function(src) {
    return src.replace(/preview\//, 'mid/');
  },
  
  setImageName: function(name) {
    $(this.name_place).html(name);
  }
    
});

