/*


Dynamic Application of Functions to DOM
*/
var _debugMode = false;
document.observe('dom:loaded', init);

function init () {
  //for reference shit
  // console.log($$('dt').pluck('innerHTML').join(', '));
  // $$('#head h1')[0].observe('click', function(e) {
  //   $('reference').show();
  // });
  // $('reference').observe('click', function(e) {
  //   e.currentTarget.hide();
  // });
  setCurrentTab();
  
  setNavZIndex();
  
  
}

function setNavZIndex() {
  // setting zindex of tabs to get layering correct
  var li = $$('#navPrimary li:not(.current)');
  var liLength = li.length - 1;
  for (var i = li.length - 1; i >= 0; i--){
    li[i].setStyle({zIndex: liLength - i});
  }
}

function setCurrentTab() {
  var temp = location.pathname.split('/').pop();
  var current = temp.include('term') ? $$('#navPrimary a[href='+ temp +']')[0] : $$('#navPrimary a[href="/"]')[0];
              
  current.up().addClassName('current').innerHTML = current.innerHTML;
}
