/*

Demondrae.com
Default JavaScript File

By: Matthew Kilgore, Kilgore Studios
Copyright 2009

*/


function showHiddenBio() {
	var paras = document.getElementById("hiddenBio").getElementsByTagName("p");
	
	for (var x = 0; x < paras.length; x++) {
		paras[x].className = "";
	} // for
}

function hijackBioLink() {
	if (!document.getElementById("showBio")) {
		return false;
	} // if
	
	var theLink = document.getElementById("showBio");
	
	theLink.onclick = function() {
		this.parentNode.className = "hide";
		this.href = "#";
		showHiddenBio();
		return false;
	};
}

function OpenPlayer() {
	try {
		window.open("mediaplayer.html#player", "mediaplayer", "width=200, height=200");
	} catch(e) {
	alert("The media player failed to launch. You may have a popup blocker running that prevents the window from opening. Disable your popup blocker and try again.");
	}
}

function HiJackPlayerLink() {
	var playerLink;
	var allLinks = document.getElementsByTagName("a");
	
	for (var x = 0; x < allLinks.length; x++) {
		if (allLinks[x].getAttribute("rel") == "mediaplayer") {
			playerLink = allLinks[x];
		}
	}
	
	playerLink.onclick = function() {
		OpenPlayer();
		return false;
	};
}
	

// This should be at the end of the file.
// All onload events should be placed in this function.
window.onload = function() {
	// Place Onload Events Here
	hijackBioLink();
	HiJackPlayerLink();
}
