function TabManager() {
  this.tabIdArray  = new Array();
  this.leftArray   = new Array();
  this.targetArray = new Array();
  this.pushDefault = -300;
  this.loLightLeft = -20;
  this.hiLightLeft = 0;
  this.moveValue   = 4;

  this.addTab = function(id) {
    this.tabIdArray.push(id);
    this.leftArray.push(this.pushDefault);
    this.targetArray.push(this.loLightLeft);
  }

  this.highlightTab = function(myName, id) {
    var i = this.getIndex(id);

    if (i >= 0) {
      this.targetArray[i] = this.hiLightLeft;
      this.moveTab(myName, id);
    }
  }

  this.unHighlightTab = function(myName, id) {
    var i = this.getIndex(id);

    if (i >= 0) {
      this.targetArray[i] = this.loLightLeft;
      this.moveTab(myName, id);
    }
  }

  this.moveTab = function(myName, id) {
    var e = document.getElementById(id);
    var i = this.getIndex(id);

    if (e && (i >= 0)) {
      var targetLeft = this.targetArray[i];

      if (!e.style.left) {
        e.style.left = this.leftArray[i] + "px";
      }

      var leftValue = parseInt(e.style.left);

      if (leftValue < targetLeft) {
        leftValue += this.moveValue;
      } else if (leftValue > targetLeft) {
        leftValue -= this.moveValue;
      } else {
        // alert("leftValue = " + leftValue + ", left = " + e.style.left);
      }

      e.style.left = leftValue + "px";
      this.leftArray[i] = leftValue;

      if (leftValue != targetLeft) {
        setTimeout(myName + ".moveTab('" + myName + "','" + id + "')", 10);
      }
    }
  }

  this.getIndex = function(id) {
    for (var i = 0; i < this.tabIdArray.length; i++) {
      if (this.tabIdArray[i] == id) {
        return i;
      }
    }
    return -1;
  }

  this.unHighlightAllTabs = function(myName) {
    for (var i = 0; i < this.tabIdArray.length; i++) {
      setTimeout(myName + ".unHighlightTab('" + myName + "','" + this.tabIdArray[i] + "')", 500 * i);
    }
  }
}