function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

activateExternalLinks = function() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i < anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") anchor.target = "_new";
	}
}

addLoadEvent(activateExternalLinks);

function changeNavSet(num) {
	var flashVersion = deconcept.SWFObjectUtil.getPlayerVersion();
	if (flashVersion.major < flashVersionRequired) {
		// show the correct nav if we're not using Flash
		document.getElementById("projects1").style.display = (num == 0) ? "block" : "none";
		document.getElementById("projects2").style.display = (num == 0) ? "none" : "block";
	} else {
		// show the correct nav if we are using Flash
		document.getElementById("projectsFlash1").style.visibility = (num == 0) ? "visible" : "hidden";
		document.getElementById("projectsFlash2").style.visibility = (num == 0) ? "hidden" : "visible";
	}	
	// set the right tab
	document.getElementById("navtab1").className = (num == 0) ? "active" : "";
	document.getElementById("navtab2").className = (num == 0) ? "" : "active";
}

var flashVersionRequired = 6;
