// support code for tabbed product descriptions V2.01
var pids = new Array();
var panes = new Array();

function swaptabs(ulid, seq){
  // make tab active class
  var litems = document.getElementById('ul_' + ulid).getElementsByTagName('li');
  for (var i=0; i<litems.length; i++)
    {
    litems[i].id = (i == seq) ? 'tab-current' : '';
    }
  // hide other panes (siblings)
  // make pane visible
  paneId = 'pane_' + ulid + '_' + seq;
  for (var con in panes) {
  if (panes[con][paneId] != null) { // tab and pane are members of this container
      var pane = document.getElementById(paneId);
      pane.style.display = "block";
      var container = document.getElementById(con);
      for (var i in panes[con]) {
        var pane = panes[con][i];
        if (pane == undefined) continue;
        if (pane.id == paneId) continue;
        pane.style.display = "none"
      }
    }
  }
  return false;
}

function setupPanes(Id) {
  // go through the DOM, find each tab-container
  // set up the panes array with named panes
  // find the max height, set tab-panes to that height
  var containerId = 'cont_' + Id;
  panes[containerId] = new Array();
  var maxHeight = 0; var maxWidth = 0;
  var container = document.getElementById(containerId);
  var paneContainer = container.getElementsByTagName("div")[0];
  var paneList = paneContainer.childNodes;
  for (var i=0; i < paneList.length; i++ ) {
    var pane = paneList[i];
    if (pane.nodeType != 1) continue;
    if (pane.offsetHeight > maxHeight) maxHeight = pane.offsetHeight;
    if (pane.offsetWidth  > maxWidth ) maxWidth  = pane.offsetWidth;
    panes[containerId][pane.id] = pane;
    pane.style.display = "none";
  }
    paneContainer.style.height = maxHeight + "px";
    paneContainer.style.width  = maxWidth + "px";
    // activate first tab
    swaptabs(Id, 0);
}

function setallpanes(){
// called on page load - set up all tab containers
  for ( var i=0; i<pids.length; i++ )
    {
    setupPanes(pids[i]); 
    }
}