var tabSet = new Object();

tabSet.showTab = function (element)
{
  // Find Parent and then turn off all divs
  var tabs = element.parentNode;
  var theTabs = tabs.getElementsByTagName('a');
  for (var j = 0; j < theTabs.length; j++)
  {
    // Unset the image and hide the data
    var Images = theTabs[j].getElementsByTagName('img');
    Images[0].src = "/images/" + theTabs[j].rel + "-off.gif";
    hideDiv(theTabs[j].rel);
  }

  showDiv(element.rel);
  var Images = element.getElementsByTagName('img');
  Images[0].src = "/images/" + element.rel + "-on.gif";


  return false;
}

tabSet.setup = function ()
{
  var allTabs = document.getElementsByTagName('div');

  for (var i = 0; i < allTabs.length; i++)
  {
    var tabs = allTabs[i];

    if (tabs.getAttribute('class') == 'tabs' || tabs.getAttribute('className') == 'tabs')
	  {
      // Find the tab buttons and give them an onClick
      var theTabs = tabs.getElementsByTagName('a');
	    for (var j = 0; j < theTabs.length; j++)
	    {
	      if (j == 0)
	        tabSet.showTab(theTabs[j]);
		    theTabs[j].onclick = function () { tabSet.showTab(this); }
	    }
	  }
  }
}

event.observe(window, 'load', tabSet.setup);
