/* --- open all external links in a new window */

function externalLinks() {
	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 = "_blank";
		}
	}
}
window.onload = externalLinks; //run function upon page load

/* --- Show Season nav on rollover */

function theSeasons(status) {
	/*for (var i = 1; i < 3; i++) {
		var theLink = document.getElementById('nav-season-' + i);
		var theHref = theLink.getElementsByTagName("A");
		if ((theHref[1].id != 'on') && (theHref[2].id != 'on')) {*/
			document.getElementById('navbar-seasons').style.display = status;
		/*} else {
			alert(theHref[1].id + ' and ' + theHref[2].id);
		}
	}*/
}

/* --- Show Episode subnav on click */

function showEpisodes(season) {
	var theNav = document.getElementById('nav-episodes');
	var theNavButton = theNav.getElementsByTagName("A");
	theNavButton[0].id = 'current';
	for (var i = 1; i < 3; i++) {
		var theLink = document.getElementById('nav-season-' + i);
		var theHref = theLink.getElementsByTagName("A");
		//alert(theHref[0].id);
		var theDiv = document.getElementById('episodes-s' + i);
		if (i == season) {
			theDiv.style.display = '';
			theHref[0].id = 'on';
		} else {
			theDiv.style.display = 'none';
			theHref[0].id = '';
		}
		//alert('the id is ' + theLink.childNodes(0).id);
	}
}

/* --- Show Season Nav & Episode Listings on click */

function showItAll() {
	theSeasons('');
	showEpisodes(2);
}

/* --- Swap & Animate boxes for "Meet The Divas" page */
/* FUNCTION TEMPORARILY DISABLED
//define Arrays
var theDivas = new Array(3);
	theDivas[0] = 'agness';
	theDivas[1] = 'swann';
	theDivas[2] = 'oona';

//call up function
function meetSwap(meetWho) {
	alert('you clicked ' + meetWho);
	for (var i = 0; i < theDivas.length; i++) {
		var theBox = theDivas[i] + '-pinup';			
		if (theDivas[i] != meetWho) { //dim unused cutouts & hide their boxes
			document.getElementById(theBox).className = 'handleOut';
		} else { //highlight selected cutout & animate box
			document.getElementById(theBox).className = 'handleSelected';
		}
	}
}*/
