

/* mediaplayer functions */



function controlMedia(id) {

	

	// reset all controller states

	pauseAll(id);

	

	var controller = document.getElementById(id);

	

	var action = (controller.className=="pause") ? "play" : "pause";

	

	//alert(action);

	

	controller.className = action;

	

	// switch controller state	

	switchState(id);

	

	var src = (action=="play") ? controller.getAttribute("rel") + controller.getAttribute("rev") : "";

	//var src = controller.getAttribute("rev");

	

	var type = controller.getAttribute("type");

	

	// load media into Flash container

	var mediaContainer = getFlashObject("mediaContainer");



	mediaContainer.SetVariable("action",action);

	mediaContainer.SetVariable("type",type);

	mediaContainer.SetVariable("file",src);

	

	//if (action=="play") mediaContainer.playMedia(src);

	//else mediaContainer.pauseResume();

	//mediaContainer.TCallFrame("_root",1);

	

}





function switchState(id) {

	

	var className = document.getElementById(id).className;

	var state = (className=="play") ? "pause" : "play";

	className = state;

}





function pauseAll(id) {

	var aAnchors = document.getElementById("playlist").getElementsByTagName("a");

	for (var i=0; i<aAnchors.length; i++) {

		if (aAnchors[i].id!=id && aAnchors[i].getAttribute("type")!="pdf") aAnchors[i].className="pause";

	}

	

}





function getFlashObject(movieName) {

	if (window.document[movieName]) {

		return window.document[movieName];

	}

	

	if (navigator.appName.indexOf("Microsoft Internet")==-1) {

		if (document.embeds && document.embeds[movieName])

			return document.embeds[movieName]; 

	} else { // if (navigator.appName.indexOf("Microsoft Internet")!=-1)

		return document.getElementById(movieName);

	}

}
