/**
 * Add a function to the onload event of the window
 * @param {Object} func
 */
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

function initJuniorSelection(selectedTeammate) {
	if (window.location.hash != "") {
		var tmp = window.location.hash;
		selectedTeammate = tmp.substring(1, tmp.length);
	}
	showJuniorTeammate(selectedTeammate);	
}

function showJuniorTeammate(name) {
	//document.getElementById("teammateImg").src="/juniorsTeam/members/img/"+name+".jpg";
	document.getElementById("profileDiv").innerHTML = "<div class='extraspecial' align='center'>" + unescape(name) + "</div>" + getContent("/juniorsTeam/members/html/"+name+".html");
	var currHash = window.location.hash.substring(1, window.location.hash.length);
	if (currHash != name) {
		window.location.hash = name;
	}
}

/**
 * Men's team init selection
 * @param {Object} selectedTeammate
 */
function initMenSelection(selectedTeammate) {
	if (window.location.hash != "") {
		var tmp = window.location.hash;
		selectedTeammate = tmp.substring(1, tmp.length);
	}
	showMenTeammate(selectedTeammate);	
}

/**
 * Men's team show teammate
 * @param {Object} name
 */
function showMenTeammate(name) {
	//document.getElementById("teammateImg").src="/mensTeam/members/img/"+name+".jpg";
	document.getElementById("profileDiv").innerHTML = "<div class='extraspecial' align='center'>" + unescape(name) + "</div>" + getContent("/mensTeam/members/html/"+name+".html");
	var currHash = window.location.hash.substring(1, window.location.hash.length);
	if (currHash != name) {
		window.location.hash = name;
	}
}

/**
 * Women's team init selection
 * @param {Object} selectedTeammate
 */
function initWomenSelection(selectedTeammate) {
	if (window.location.hash != "") {
		var tmp = window.location.hash;
		selectedTeammate = tmp.substring(1, tmp.length);
	}
	showWomenTeammate(selectedTeammate);	
}

/**
 * Women's team show teammate
 * @param {Object} name
 */
function showWomenTeammate(name) {
	//document.getElementById("teammateImg").src="/images/profiles/"+name+".jpg";
	document.getElementById("profileDiv").innerHTML = "<div class='extraspecial' align='center'>" + unescape(name) + "</div>" + getContent("/womensTeam/members/html/"+name+".html");
	var currHash = window.location.hash.substring(1, window.location.hash.length);
	if (currHash != name) {
		window.location.hash = name;
	}
}