// JavaScript Document
// This file tends to have stuff written strictly with this application in mind.
// changeContent changes which panels are visible (Live or On-demand, Questions or Slides)
function changeContent(oldSel,newSel) {
	if(newSel == 'prerecord' || newSel == 'live') {
		/**
		*Pause current stream
		*/
		if(newSel == 'prerecord' && $f('live').isPlaying()) {
			controlPlayer.play();
		}else if (newSel == 'live' && $f('live').isPaused()){
			controlPlayer.play();
		}
		document.getElementById(oldSel).style.visibility = "hidden";
		document.getElementById(newSel).style.visibility = "visible";
	   }else{
		// visibility and display do the same thing for most browsers, but some versions of IE don't.
		// this is only necessary for the slides/questions boxes.
		document.getElementById(oldSel).style.display = "none";
		document.getElementById(oldSel).style.visibility = "hidden";
	 	document.getElementById(newSel).style.display = "block";
	 	document.getElementById(newSel).style.visibility = "visible";
	   }
}
function changeSelection(oldSel,newSel) {
	// changes Tab highlighting, and called changeSelection
	var oldTab = oldSel+'Tab';
	var newTab = newSel+'Tab';
	 document.getElementById(oldTab).style.backgroundColor = '#999';
	 document.getElementById(newTab).style.backgroundColor = '#BBB';
	 changeContent(oldSel,newSel);
	 return true;
}
// Toggles the visibility fo the help layer and hides the flash video box
function toggleHelp() {
	var visibility = document.getElementById("helpDiv").style.display;
	if(visibility == "none" || visibility == "") {
		document.getElementById("fade").style.display = "block";
		document.getElementById("helpDiv").style.display= "block";
		$f().hide();
	}else{
		document.getElementById("fade").style.display = "none";
		document.getElementById("helpDiv").style.display = "none";
		$f().show();
	}
}
// var step is the troubleshooting step they are on
// function lower() increments step and updates the troubleshoot text.
var step = 0;
function lower() {
	if(step <= 0) {
		step++;
		document.getElementById("troubleshoot").innerHTML = "Is it still not playing well? Click again to listen to just the audio.";
		controlPlayer.clip('lowHCCH','low');
	}else if(step == 1) {
		step++;
		document.getElementById("troubleshoot").innerHTML = "Prefer one of the previous settings? You can use the colored words above to select that you liked most."
		controlPlayer.clip('audioHCCH','audio');
	}else if(step >= 2) {
	}
}
