// Written by: Marc Hollins & Debbie Whitcomb
// Last Updated: April 25, 2003

// $Author:  $ 
// $Revision:  $ 

function removeName(el, name) {
  var i, curList, newList;

  if (el.className == null) { return; }

  // Remove the given class name from the element's className property.
  newList = new Array();
  curList = el.className.split(" ");
  for (i = 0; i < curList.length; i++) {
    if (curList[i] != name) {
      newList.push(curList[i]);
    }
  el.className = newList.join(" ");
  }
}

function SelectTab(tabId) {
  var elem, tabelem;
  var elList, i, row;

  tabelem = (document.getElementById) ? document.getElementById(tabId) :
           ((document.all) ? document.all[tabId] : null);
						 
  if (tabelem == null) { return; }
	
  if (tabelem.parentNode.id == "tabArea1") { 
    row = 1; 
  } else {
    row = 2; 
  }

  // remove all active tabs.
  elList = document.getElementsByTagName("A");
  for (i = 0; i < elList.length; i++) {
    removeName(elList[i], "activeTab");
    if (row==1) {
      if (elList[i].parentNode.id == "tabArea2") {
        elList[i].style.paddingBottom = 22;
      } else {
 	      elList[i].style.paddingBottom = 2;
      }
    } else {
      if (elList[i].parentNode.id == "tabArea1") {
        elList[i].style.paddingBottom = 22;
      } else {
        elList[i].style.paddingBottom = 2;
      }
    }
  }

  if (row==1) {
    elem = (document.getElementById) ? document.getElementById("tabArea1") : 
          ((document.all) ? document.all["tabArea1"] : null);
    elem.style.top = 40;
    elem.style.zIndex = 104;
    elem = (document.getElementById) ? document.getElementById("tabArea2") : 
          ((document.all) ? document.all["tabArea2"] : null);
    elem.style.top = 20;
    elem.style.zIndex = 102;
  } else {
    elem = (document.getElementById) ? document.getElementById("tabArea1") : 
          ((document.all) ? document.all["tabArea1"] : null);
    elem.style.top = 20;
    elem.style.zIndex = 102;
    elem = (document.getElementById) ? document.getElementById("tabArea2") : 
          ((document.all) ? document.all["tabArea2"] : null);
    elem.style.top = 40;
    elem.style.zIndex = 104;
  }
	
  tabelem.className += " activeTab";
  tabelem.style.paddingBottom = 6;
  tabelem.blur();	
}

