// JavaScript Document


//  archiveInfo (2009-11-13)
//  this object make big yellow titles on archive and e-shop page


function archiveInfo() {
  var self = this;
  this.imgWidth = 156;
  this.maxWidth = (this.imgWidth*2+12*2);
  this.tableElem = null;
  //
  this.init = function() {
    self.tableElem = dojo.byId('archivetable');
    if (!self.tableElem) return false;
    freeElemsRemover(self.tableElem);
    dojo.query('table.archive a').forEach(function(node,index){
      dojo.connect(node,"onmouseover",self.show);
      dojo.connect(node,"onmouseout",self.hide);
      node.archiveInfoIndex = index;
    });
  };
  //
  this.show = function(e,thisElem) {
    if (!thisElem) thisElem = this;
    var actualBox = thisElem.getElementsByTagName('b')[0];
    if (thisElem.parentNode.className == 'rightpart') {
      if (thisElem.parentNode.previousSibling) {
        var nextElem = thisElem.parentNode.previousSibling.getElementsByTagName('a')[0];
        if (nextElem) {
          dojo.animateProperty({node:nextElem,properties:{opacity:0}}).play();
        }
      }
      dojo.animateProperty({node:actualBox,properties:{width:self.maxWidth,left:-self.maxWidth+self.imgWidth}}).play();
    } else {
      if (thisElem.parentNode.nextSibling) {
        var nextElem = thisElem.parentNode.nextSibling.getElementsByTagName('a')[0];
        if (nextElem) {
          dojo.animateProperty({node:nextElem,properties:{opacity:0}}).play();
        }
      }
      dojo.animateProperty({node:actualBox,properties:{width:self.maxWidth,left:0}}).play();
    }
  };
  //
  this.hide = function(e,thisElem) {
    if (!thisElem) thisElem = this;
    var actualBox = thisElem.getElementsByTagName('b')[0];
    if (thisElem.parentNode.className == 'rightpart') {
      if (thisElem.parentNode.previousSibling) {
        var nextElem = thisElem.parentNode.previousSibling.getElementsByTagName('a')[0];
        if (nextElem) {
          dojo.animateProperty({node:nextElem,properties:{opacity:1}}).play();
        }
      }
      dojo.animateProperty({node:actualBox,properties:{width:0,left:self.imgWidth}}).play();
    } else {
      if (thisElem.parentNode.nextSibling) {
        var nextElem = thisElem.parentNode.nextSibling.getElementsByTagName('a')[0];
        if (nextElem) {
          dojo.animateProperty({node:nextElem,properties:{opacity:1}}).play();
        }
      }
      dojo.animateProperty({node:actualBox,properties:{width:0,left:0}}).play();
    }
  };
  //
  return self.init();
}


// end of document

