// JavaScript Document
var flag=0; 
var temp=0;
var temp2=0;
var temp3=0;
var temp4=0;

function checkStatus(num){
	switch(num){
		case 1:
			if(flag){
				flag = 0;
				document.location.href="quickfacts.html";
			} else { 
				alert("All questions have not been answered correctly");
			}
			break;
		case 2:
			if(flag){
				flag = 0;
				document.location.href="success.html";
			} else { 
				alert("All questions have not been answered correctly");
			}
			break;
		case 3:
			if(flag){
				flag = 0;
				document.location.href="expectations.html";
			} else { 
				alert("All questions have not been answered correctly");
			}
			break;
		case 4:
			if(flag){
				flag = 0;
				document.location.href="kris.html";
			} else { 
				alert("All questions have not been answered correctly");
			}
			break;
		case 5:
			if(flag){
				flag = 0;
				document.location.href="alerts.html";
			} else { 
				alert("All questions have not been answered correctly");
			}
			break;
		case 6:
			if(flag){
				flag = 0;
				document.location.href="collegelife.html";
			} else { 
				alert("All questions have not been answered correctly");
			}
			break;
		case 7:
			if(flag){
				flag = 0;
				document.location.href="publications.html";
			} else { 
				alert("All questions have not been answered correctly");
			}
			break;
	}
	
}

function webAddress(){
	var val = "";
	document.getElementById("answer1").innerHTML="";
	val = document.question1.address.value; 
	for (var i=0; i<document.question1.address.length; i++){
		if (document.question1.address[i].checked){
			val = document.question1.address[i].value
		}
	}

	if(val=="B"){
		document.getElementById("answer1").innerHTML="That is correct";
		flag = 1;
	} else {
		document.getElementById("answer1").innerHTML="That is incorrect";
	}

	/*if((val=="www.kellogg.edu")||(val=="http://www.kellogg.edu")){
		document.getElementById("answer1").innerHTML="That is correct";
		flag=1;
	} else 
		if (val==""){
			document.getElementById("answer1").innerHTML="Please enter an answer here";
		}
		else {
		document.getElementById("answer1").innerHTML="That is incorrect";
	}*/
}


function quickFacts(){
	var val = ""; 
	var val2 = "";
	for (var i=0; i<document.question2.webAccess.length; i++){
		if (document.question2.webAccess[i].checked){
			val = document.question2.webAccess[i].value
		}
	}
	for (var i=0; i<document.question2.campuses.length; i++){
		if (document.question2.campuses[i].checked){
			val2 = document.question2.campuses[i].value
		}
	}	
	if(val=="True"){
		document.getElementById("answer2").innerHTML="That is correct";
		temp = 1;
	} else {
		document.getElementById("answer2").innerHTML="That is incorrect";
		temp = 0;
	}
	if(val2=="True"){
		document.getElementById("answer3").innerHTML="That is correct";
		temp2 = 1;
	} else {
		document.getElementById("answer3").innerHTML="That is incorrect";
		temp = 0;
	}
	if(temp && temp2){
		flag=1;
	}
}



function studentSuccess(){
	var val = ""; 
	var val2 = "";
	var val3 = "";
	for (var i=0; i<document.question4.aid.length; i++){
		if (document.question4.aid[i].checked){
			val = document.question4.aid[i].value
		}
	}
	//val2 = document.question4.test.value
	for (var i=0; i<document.question4.test.length; i++){
		if (document.question4.test[i].checked){
			val2 = document.question4.test[i].value
		}
	}
	
	for (var i=0; i<document.question4.steps.length; i++){
		if (document.question4.steps[i].checked){
			val3 = document.question4.steps[i].value
		}
	}	
	if(val=="True"){
		document.getElementById("answer4").innerHTML="That is correct";
		temp = 1;
	} else {
		document.getElementById("answer4").innerHTML="That is incorrect";
		temp = 0;
	}
	if(val2=="A"){
		document.getElementById("answer5").innerHTML="That is correct";
		temp2 = 1;
	} else {
		document.getElementById("answer5").innerHTML="That is incorrect";
		temp2= 0;
	}
	if(val3=="C"){
		document.getElementById("answer6").innerHTML="That is correct";
		temp3 = 1;
	} else {
		document.getElementById("answer6").innerHTML="That is incorrect";
		temp3 = 0;
	}
	if(temp && temp2 && temp3){
		flag=1;
	}
	
}



function technology(){
	var val = ""; 
	var val2 = "";
	var val3 = "";
	var val4 = "";
	
	val = document.question7.service.value
	val2 = document.question7.initial.value
	
	for (var i=0; i<document.question7.service.length; i++){
		if (document.question7.service[i].checked){
			val = document.question7.service[i].value
		}
	}
	
	for (var i=0; i<document.question7.initial.length; i++){
		if (document.question7.initial[i].checked){
			val2 = document.question7.initial[i].value
		}
	}
	
	for (var i=0; i<document.question7.change.length; i++){
		if (document.question7.change[i].checked){
			val3 = document.question7.change[i].value
		}
	}
	
	for (var i=0; i<document.question7.account.length; i++){
		if (document.question7.account[i].checked){
			val4 = document.question7.account[i].value
		}
	}	
	if(val=="True"){
		document.getElementById("answer7").innerHTML="That is correct";
		temp = 1;
	} else {
		document.getElementById("answer7").innerHTML="That is incorrect";
		temp = 0;
	}
	
	if(val2=="C"){
		document.getElementById("answer8").innerHTML="That is correct";
		temp2 = 1;
	} else {
		document.getElementById("answer8").innerHTML="That is incorrect";
		temp2 = 0;
	}
	if(val3=="A"){
		document.getElementById("answer9").innerHTML="That is correct";
		temp3 = 1;
	} else {
		document.getElementById("answer9").innerHTML="That is incorrect";
		temp3 = 0;
	}
	
	if(val4=="True"){
		document.getElementById("answer10").innerHTML="That is correct";
		temp4 = 1;
	} else {
		document.getElementById("answer10").innerHTML="That is incorrect";
		temp4 = 0;
	}
		if(temp && temp2 && temp3 && temp4){
			flag=1;
	}
}


function informationSystem(){
	var val = ""; 
	var val2 = "";
	//val = document.question11.registration.value
	
	for (var i=0; i<document.question11.registration.length; i++){
		if (document.question11.registration[i].checked){
			val = document.question11.registration[i].value
		}
	}
	
	for (var i=0; i<document.question11.change.length; i++){
		if (document.question11.change[i].checked){
			val2 = document.question11.change[i].value
		}
	}
	
	if(val=="B"){
		document.getElementById("answer11").innerHTML= "That is correct";
		temp = 1;
	} else {
		document.getElementById("answer11").innerHTML= "That is incorrect";
		temp = 0;
	}
	if(val2=="True"){
		document.getElementById("answer12").innerHTML= "That is correct";
		temp2 = 1;
	} else {
		document.getElementById("answer12").innerHTML= "That is incorrect";
		temp2 = 0;
	}
	if(temp && temp2 ){
			flag=1;
	}
	

	
	
}

function alertingSystem(){
	var val = ""; 
	
	for (var i=0; i<document.question13.messaging.length; i++){
		if (document.question13.messaging[i].checked){
			val = document.question13.messaging[i].value
		}
	}	

	if(val=="A"){
		document.getElementById("answer13").innerHTML="That is correct";
		temp = 1;
	} else {
		document.getElementById("answer13").innerHTML="That is incorrect";
		temp = 0;
	}
	if(temp ){
			flag=1;
	}
	
}

function learningResource(){
	var val = ""; 
	
	for (var i=0; i<document.question14.building.length; i++){
		if (document.question14.building[i].checked){
			val = document.question14.building[i].value
		}
	}	

	if(val=="D"){
		document.getElementById("answer14").innerHTML="That is correct";
		temp = 1;
	} else {
		document.getElementById("answer14").innerHTML="That is incorrect";
		temp = 0;
	}
	if(temp ){
			flag=1;
	}
	
}


function clearAnswers(num){
	var selection = "";
	switch(num){
		case 2:
			selection = "answer"+num;
			document.getElementById(selection).innerHTML="&nbsp;";
			selection = "answer"+(num + 1);
			document.getElementById(selection).innerHTML="&nbsp;";
			break;
		case 4:
			selection = "answer"+num;
			document.getElementById(selection).innerHTML="&nbsp;";
			selection = "answer"+(num + 1);
			document.getElementById(selection).innerHTML="&nbsp;";
			selection = "answer"+(num + 2);
			document.getElementById(selection).innerHTML="&nbsp;";
			break;
		case 7:
			selection = "answer"+num;
			document.getElementById(selection).innerHTML="&nbsp;";
			selection = "answer"+(num + 1);
			document.getElementById(selection).innerHTML="&nbsp;";
			selection = "answer"+(num + 2);
			document.getElementById(selection).innerHTML="&nbsp;";
			selection = "answer"+(num + 3);
			document.getElementById(selection).innerHTML="&nbsp;";
			break;
		case 11:
			selection = "answer"+num;
			document.getElementById(selection).innerHTML="&nbsp;";
			selection = "answer"+(num + 1);
			document.getElementById(selection).innerHTML="&nbsp;";
			break;
		case 13:
			selection = "answer"+num;
			document.getElementById(selection).innerHTML="&nbsp;";
			break;
		case 14:
			selection = "answer"+num;
			document.getElementById(selection).innerHTML="&nbsp;";
			break;
		default:
			selection = "answer"+num;
			document.getElementById(selection).innerHTML="&nbsp;";
	}
	flag=0;
}

