/*------------Navigation ---------------------*/
/* IE 6 Browser Detection: */
function isExplorer6() {
	var appVer = navigator.appVersion;
	appVer = appVer.split(';');
	if(appVer[1] == ' MSIE 6.0') {
		return true;
	}else {return false;}				
}
var ie6=isExplorer6();

/* Navigation rollovers:*/
	function switchImg(name){
		if(ie6){
			document.getElementById(name).src="Pieces/"+name+"_active_ie.png";
		}else{
			document.getElementById(name).src="Pieces/"+name+"_active.png";
		}
	}
	function switchImgOut(name){
	document.getElementById(name).src="Pieces/"+name+".png";
	}

/*------------Videos ---------------------*/
/*Videos popups*/
	function open_window(url, width, height){
				window.open(url, 'popup', 'width='+width+',height='+height+',scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no');
			}

/*Videos blocks "more" & "prev"*/
	function nextVideo(block, question, video){
		document.getElementById("video"+block+"_"+question+"_"+(video)).style.display="none";
		document.getElementById("video"+block+"_"+question+"_"+(video+1)).style.display="block";
	}
			
	function prevVideo(block, question, video){
		document.getElementById("video"+block+"_"+question+"_"+(video)).style.display="none";
		document.getElementById("video"+block+"_"+question+"_"+(video-1)).style.display="block";
	}




/*------------Quiz ---------------------*/
// for displaying each questions
	function nextQuestion(num){
		document.getElementById("quiz"+num).style.display="none";
		document.getElementById("quiz"+(num+1)).style.display="block";
	}
			
	function prevQuestion(num){
		document.getElementById("quiz"+num).style.display="none";
		document.getElementById("quiz"+(num-1)).style.display="block";
	}
		
	function resetQuiz(){
		score = Array(0, 0, 0, 0, 0, 0, 0);
		}
	/*
	## [0] => Bradley
	## [1] => Chadbourne
	## [2] => Entrepeneurial
	## [3] => International
	## [4] => Multicultural
	## [5] => Women
	## [6] => Fun
	*/
	var com = Array("blcScore", "crcScore", "erlcScore", "ilcScore", "mlcScore", "wiseScore", "funScore");
	var score = Array(0, 0, 0, 0, 0, 0, 0);

	/*
	## Loops through radios and counts the score for each
	## id="qquestion-option-point[-point...]" is the correct form for input ids
	## the extra q is intentional
	*/
	function countScore() {
		score = Array(0, 0, 0, 0, 0, 0, 0);
		responses = document.getElementById("questionList").getElementsByTagName("input");
		j = responses.length;
		for(var i = 0; i < j; i++) {
			if(responses[i].checked) {
				tempid = responses[i].id.replace(/[^0-9]|\-/, "");
				info = tempid.split("-");
				k = info.length;
				for(var m = 2; m < k; m++) {
					score[info[m]]++;
				}
			}
		}
		displayScore();
	}
	
	/*
	## Loop through score[] and chuck the score in the scoreboard
	*/
	function displayScore() {
		j = score.length;
		for(var i = 0; i < j; i++) {
			if(document.getElementById(com[i]) != null) {
				document.getElementById(com[i]).innerHTML = score[i];
			}
		}
	}