var agt = navigator.userAgent.toLowerCase();
var isIE = (agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1);
var isIE6up = isIE && (agt.indexOf("msie 6.") != -1);
var isEffectsSupported = isIE6up || !isIE; // IE 6+ or anything else
var isSafari = (agt.indexOf('safari') + 1)>0 ? true : false;

/* EFFECTS SUCK AT CROSS BROWSERNESS, KILL THEM */
isEffectsSupported = false;

/* this shouldn't be necessary but what the heck...
   IE5.01 isn't doing what it's supposed to, according
   to the internet.  :( */
function getZeEl(name) {
  if (document.all) {
    return document.all[name];    
  }
  else {
    return $(name);
  }
}

function setLeaderDivs() {
	
  if (getZeEl('w-display')) {
    getZeEl('w-display').style.display = 'none';
  }
  change_board('overall');
  if (getZeEl('wf-display')) {
    getZeEl('wf-display').style.display = 'none';
  }	
  change_friends_board('overall');
}

// which { 'leaders', 'friends' }
// to { 'overall', 'weekly' }
function switchLeaderDiv(which, to) {
  // reset the select box
  /*
  getZeEl(which + '_picker').value = 'overall';
  
  if (which=='leaders') {
    if (to == 'weekly') {
      getZeEl('w-display').style.display = 'block';
      getZeEl('o-display').style.display = 'none';
      change_board('weekly');
    }
    else {
      getZeEl('w-display').style.display = 'none';
      getZeEl('o-display').style.display = 'block';
      change_board('overall');
    }
  }
  else {
    if (to == 'weekly') {
      getZeEl('wf-display').style.display = 'block';
      getZeEl('of-display').style.display = 'none';
      change_friends_board('weekly');
    }
    else {
      getZeEl('wf-display').style.display = 'none';
      getZeEl('of-display').style.display = 'block';
      change_friends_board('overall');
    }
  }
  */
}

function change_friends_board(name) {
  var which;
  
  //if (getZeEl('wf-display').style.display == 'none') {
    which = getZeEl('of-display');
  /*}
  else {
    which = getZeEl('wf-display');
  }
  */
  
  var objface = which.id.substring(0,1)+'f_'+name;
  if (objface == 'wf_weekly') {
    objface = 'wf_overall';
  }
  which.innerHTML = getZeEl(objface).innerHTML;
}

function change_board(name) {
  var which;
  
  //if (getZeEl('w-display').style.display == 'none') {
    which = getZeEl('o-display');
  /*
  }
  else {
    which = getZeEl('w-display');
  }
  */
  
  var objface = which.id.substring(0,1)+'_'+name;
  if (objface == 'w_weekly') {
    objface = 'w_overall';
  }
  which.innerHTML = getZeEl(objface).innerHTML;
  
  /* Do cool fades on the tab contents if effects are supported */
/*	if (isEffectsSupported) {
	  setTimeout("Effect.Fade('"+lastTabName+"-div')", 0);
	  setTimeout("Effect.Appear('"+name+"-div')", 1000);
	}
	else {
    getZeEl(lastTabName+'-div').style.display = 'none';
    getZeEl(name+'-div').style.display = 'inline';
	}*/  
}
