// JavaScript Document
function PopUp(heading, text) {
	var bgcolor 		= "#D6DDE7";	
	var xwidth  		= 400;
	var yheight 		= 300;
	var xyscrollbars  	= 1;
	
	// open  window
	vindow = window.open("", "Window", "resizable=0,toolbar=0,location=0,status=1,menubar=0,scrollbars=" + xyscrollbars + ",copyhistory=0,width=" + xwidth + ",height=" + yheight);
   	//vindow.moveTo(((screen.width/2)-170),((screen.height/2)-150))
	vindow.document.open();
	vindow.document.writeln("<html><head><title>" + heading + "</title>");
	vindow.document.writeln("</head><body bgcolor='#ffffff' text='#000000' link='#0000ff' vlink='#800080' alink='#ff3333'><!--#include file='../../../template/header.htm'-->");
	vindow.document.writeln("<style>");
	vindow.document.writeln(".heading {font-family: Arial, Helvetica, sans-serif; font-size: 12pt; font-weight: bold;   color: #000000;}");
	vindow.document.writeln(".text  {font-family: Arial, Helvetica, sans-serif; font-size: 10pt; font-weight: normal; color: #000000;}");
	vindow.document.writeln("</style>");
	vindow.document.writeln("<div class='heading'><p>" + heading + "</p></div>");	
	vindow.document.writeln("<div class='text' ><p>" + text + "</p><p><a href='javascript:self.close()'>Close Window</a></p></div></body></html>");
	vindow.document.close();
	// bring it to the front
	vindow.focus();
}

function newPopUp(strURL,strType,strHeight,strWidth,location) {
	// override
//	strHeight = 600;
//	strWidth = 600;
//	strType = "console";

	if(location == null)
		location = 'newWin';
	else if(location == 'helpWindows') {
		strHeight = 500;
		strWidth = 700;		
	}

	var strOptions="";
	if (strType=="console") strOptions="resizable,height="+strHeight+",width="+strWidth;
	if (strType=="fixed") strOptions="status,height="+strHeight+",width="+strWidth;
	if (strType=="elastic") strOptions="toolbar,menubar,scrollbars,resizable,location,height="+strHeight+",width="+strWidth;
	window.open(strURL, location, strOptions);
}


function checkAnswer (formObj) {
	curr_tries++;	// increment now since it starts at zero
	//alert(num_tries);
	// if we're past the max number of tries do NOTHING
	if (( curr_tries > num_tries ) || (gotthis == true)) {
		alert( "You have completed this question." );
		return;
	}
	

	// Check all the radio buttons that are called 'radioButton'
	radioObject = formObj.radiobutton
	value = null
	for (i= 0; i < radioObject.length; i++){
		if (radioObject[i].checked) {
			value = radioObject[i].value
			break 
		}
	}

	if (value == CorrectChoice) {
		gotthis = true;
		w = window.open("","questionResponse","resizable=0,toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,copyhistory=0,width=380,height=250");
	    //w.moveTo(((screen.width/2)-170),((screen.height/2)-150));
		w.focus();
		w.document.open();
		w.document.writeln("<html><head><title>Question Response Correct</title></head>");
		w.document.writeln("</head><body bgcolor='#ffffff' text='#000000' link='#0000ff' vlink='#800080' alink='#ff3333'><!--#include file='../../../template/header.htm'-->");
		w.document.writeln(CorrectFeedback);
	    w.document.writeln("<form name='form2' method='post' action='javascript:self.close()'>");
		w.document.writeln("<div align='right'>");
		w.document.writeln("<input type='submit' name='Submit' value='Close Window'>");
		w.document.writeln("</div>");
		w.document.writeln("</form>");
		w.document.writeln("</body></html>");

	} else {
		gotthis = false;
		w = window.open("","questionResponse","resizable=0,toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,copyhistory=0,width=380,height=250");
	    //w.moveTo(((screen.width/2)-170),((screen.height/2)-150));
		w.focus();
		w.document.open();
		w.document.writeln("<html><head><title>Question Response Incorrect</title></head>");
		w.document.writeln("</head><body bgcolor='#ffffff' text='#000000' link='#0000ff' vlink='#800080' alink='#ff3333'><!--#include file='../../../template/header.htm'-->");
		w.document.writeln(eval("incorrectFeedback" + curr_tries));
	    w.document.writeln("<form name='form2' method='post' action='javascript:self.close()'>");
		w.document.writeln("<div align='right'>");
		w.document.writeln("<input type='submit' name='Submit' value='Close Window'>");
		w.document.writeln("</div>");
		w.document.writeln("</form>");
		w.document.writeln("</body></html>");
	}
	return false;  
}


function checkAnswer_mfb (formObj) {

	curr_tries++;	// increment now since it starts at zero
	//alert(num_tries);
	// if we're past the max number of tries do NOTHING
	if (( curr_tries > num_tries ) || (gotthis == true)) {
		alert( "You have completed this question." );
		return;
	}
	

	// Check all the radio buttons that are called 'radioButton'
	radioObject = formObj.radiobutton
	value = null
	for (i= 0; i < radioObject.length; i++){
		if (radioObject[i].checked) {
			value = radioObject[i].value;
			break; 
		}
	}

	if (value == CorrectChoice) {
		gotthis = true;
		w = window.open("","questionResponse","resizable=0,toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,copyhistory=0,width=420,height=350");
	    //w.moveTo(((screen.width/2)-170),((screen.height/2)-150));
		w.focus();
		w.document.open();
		w.document.writeln("<html><head><title>Question Response Correct</title></head>");
		w.document.writeln("</head><body bgcolor='#ffffff' text='#000000' link='#0000ff' vlink='#800080' alink='#ff3333'><!--#include file='../../../template/header.htm'-->");
		w.document.writeln(CorrectFeedback);
	    w.document.writeln("<form name='form2' method='post' action='javascript:self.close()'>");
		w.document.writeln("<div align='right'>");
		w.document.writeln("<input type='submit' name='Submit' value='Close Window'>");
		w.document.writeln("</div>");
		w.document.writeln("</form>");
		w.document.writeln("</body></html>");
	} else {
		gotthis = false;
		w = window.open("","questionResponse","resizable=0,toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,copyhistory=0,width=380,height=250");
	    //w.moveTo(((screen.width/2)-170),((screen.height/2)-150));
		w.focus();
		w.document.open();
		w.document.writeln("<html><head><title>Question Response Incorrect</title></head>");
		w.document.writeln("</head><body bgcolor='#ffffff' text='#000000' link='#0000ff' vlink='#800080' alink='#ff3333'><!--#include file='../../../template/header.htm'-->");		w.document.writeln(eval("incorrectFeedback" + value));
	    w.document.writeln("<form name='form2' method='post' action='javascript:self.close()'>");
		w.document.writeln("<div align='right'>");
		w.document.writeln("<input type='submit' name='Submit' value='Close Window'>");
		w.document.writeln("</div>");
		w.document.writeln("</form>");
		w.document.writeln("</body></html>");
	}
	return false;  
}


function checkAnswerMc (formObj) {	


	
	curr_tries++;	// increment now since it starts at zero
	
	//alert(num_tries);
	// if we're past the max number of tries do NOTHING
	if (( curr_tries > num_tries ) || (gotthis == true)) {
		alert( "You have completed this question." );
		return;
	}

	
	
	// Check all the radio buttons that are called 'radioButton'
	radioObject = formObj.radiobutton
	value = null
	for (i= 0; i < radioObject.length; i++){
		if (radioObject[i].checked) {
			value = radioObject[i].value
			break 
		}
	}


	if (value == CorrectChoice) {
		gotthis = true;
		w = window.open("","questionResponse","resizable=0,toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,copyhistory=0,width=520,height=550");
	    //w.moveTo(((screen.width/2)-170),((screen.height/2)-150));
		w.focus();
		w.document.open();
		w.document.writeln("<html><head><title>Question Response Correct</title></head>");
		w.document.writeln("</head><body bgcolor='#ffffff' text='#000000' link='#0000ff' vlink='#800080' alink='#ff3333'><!--#include file='../../../template/header.htm'-->");
		w.document.writeln(CorrectFeedback);
	    w.document.writeln("<form name='form2' method='post' action='javascript:self.close()'>");
		w.document.writeln("<div align='right'>");
		w.document.writeln("<input type='submit' name='Submit' value='Close Window'>");
		w.document.writeln("</div>");
		w.document.writeln("</form>");
		w.document.writeln("</body></html>");
	} else if (value == 2)  {
		gotthis = false;
		w = window.open("","questionResponse","resizable=0,toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,copyhistory=0,width=480,height=450");
	    //w.moveTo(((screen.width/2)-170),((screen.height/2)-150));
		w.focus();
		w.document.open();
		w.document.writeln("<html><head><title>Question Response Incorrect</title></head>");
		w.document.writeln("</head><body bgcolor='#ffffff' text='#000000' link='#0000ff' vlink='#800080' alink='#ff3333'><!--#include file='../../../template/header.htm'-->");
		w.document.writeln(incorrectFeedback1);
	    w.document.writeln("<form name='form2' method='post' action='javascript:self.close()'>");
		w.document.writeln("<div align='right'>");
		w.document.writeln("<input type='submit' name='Submit' value='Close Window'>");
		w.document.writeln("</div>");
		w.document.writeln("</form>");
		w.document.writeln("</body></html>");
	}else if (value == 3)  {
			gotthis = false;
		w = window.open("","questionResponse","resizable=0,toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,copyhistory=0,width=480,height=450");
	    //w.moveTo(((screen.width/2)-170),((screen.height/2)-150));
		w.focus();
		w.document.open();
		w.document.writeln("<html><head><title>Question Response Incorrect</title></head>");
		w.document.writeln("</head><body bgcolor='#ffffff' text='#000000' link='#0000ff' vlink='#800080' alink='#ff3333'><!--#include file='../../../template/header.htm'-->");
		w.document.writeln(incorrectFeedback2);
	    w.document.writeln("<form name='form2' method='post' action='javascript:self.close()'>");
		w.document.writeln("<div align='right'>");
		w.document.writeln("<input type='submit' name='Submit' value='Close Window'>");
		w.document.writeln("</div>");
		w.document.writeln("</form>");
		w.document.writeln("</body></html>");
	}
	return false;  
}


function checkAnswerMc20 (formObj) {

	curr_tries++;	// increment now since it starts at zero
	//alert(num_tries);
	// if we're past the max number of tries do NOTHING
	if (( curr_tries > num_tries ) || (gotthis == true)) {
		alert( "You have completed this question." );
		return;
	}
	

	// Check all the radio buttons that are called 'radioButton'
	radioObject = formObj.radiobutton
	value = null
	for (i= 0; i < radioObject.length; i++){
		if (radioObject[i].checked) {
			value = radioObject[i].value;
			break; 
		}
	}

	if (value == CorrectChoice) {
		gotthis = true;
		w = window.open("","questionResponse","resizable=0,toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,copyhistory=0,width=520,height=550");
	    //w.moveTo(((screen.width/2)-170),((screen.height/2)-150));
		w.focus();
		w.document.open();
		w.document.writeln("<html><head><title>Question Response Correct</title></head>");
		w.document.writeln("</head><body bgcolor='#ffffff' text='#000000' link='#0000ff' vlink='#800080' alink='#ff3333'><!--#include file='../../../template/header.htm'-->");
		w.document.writeln(CorrectFeedback);
	    w.document.writeln("<form name='form2' method='post' action='javascript:self.close()'>");
		w.document.writeln("<div align='right'>");
		w.document.writeln("<input type='submit' name='Submit' value='Close Window'>");
		w.document.writeln("</div>");
		w.document.writeln("</form>");
		w.document.writeln("</body></html>");
	} else if (value == 1)  {
		gotthis = false;
		w = window.open("","questionResponse","resizable=0,toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,copyhistory=0,width=480,height=550");
	    //w.moveTo(((screen.width/2)-170),((screen.height/2)-150));
		w.focus();
		w.document.open();
		w.document.writeln("<html><head><title>Question Response Incorrect</title></head>");
		w.document.writeln("</head><body bgcolor='#ffffff' text='#000000' link='#0000ff' vlink='#800080' alink='#ff3333'><!--#include file='../../../template/header.htm'-->");
		w.document.writeln(incorrectFeedback1);
	    w.document.writeln("<form name='form2' method='post' action='javascript:self.close()'>");
		w.document.writeln("<div align='right'>");
		w.document.writeln("<input type='submit' name='Submit' value='Close Window'>");
		w.document.writeln("</div>");
		w.document.writeln("</form>");
		w.document.writeln("</body></html>");
	}else if (value == 3)  {
			gotthis = false;
		w = window.open("","questionResponse","resizable=0,toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,copyhistory=0,width=480,height=550");
	    //w.moveTo(((screen.width/2)-170),((screen.height/2)-150));
		w.focus();
		w.document.open();
		w.document.writeln("<html><head><title>Question Response Incorrect</title></head>");
		w.document.writeln("</head><body bgcolor='#ffffff' text='#000000' link='#0000ff' vlink='#800080' alink='#ff3333'><!--#include file='../../../template/header.htm'-->");
		w.document.writeln(incorrectFeedback2);
	    w.document.writeln("<form name='form2' method='post' action='javascript:self.close()'>");
		w.document.writeln("<div align='right'>");
		w.document.writeln("<input type='submit' name='Submit' value='Close Window'>");
		w.document.writeln("</div>");
		w.document.writeln("</form>");
		w.document.writeln("</body></html>");
	}
	return false;  
}





function MA_toggleChoice( number, id ) {
	
	var current = userArray[number];
	
	if ( current == 'true' ) {
		current = 'false';
	} else {
		current = 'true';
	}
	//alert( "Setting " + number + " to " + current );
	userArray[number] = current;
}



function checkAnswerMa (formObj) {
curr_tries++;
	if (( curr_tries > num_tries ) || (gotthis == true)) {
		alert( "You have completed this question." );
		return;
	}
	
	var score = 0;
	for ( var i=1; i<num_questions+1; i++ ) {
	
		//alert ("[ " + i + "] Comparing answer " + answerArray[i] + " to " +  userArray[i] );
	
		if ( answerArray[i] == userArray[i] ) {
		score++;
		} 
	}// End For Loop
	
		if ( score == num_questions ) {		
			curr_tries += 10;
			gotCorrect();			
		} else {
			gotIncorrect();
		}
		
}


function gotCorrect() {
			gotthis = true;
			w = window.open("","questionResponse","resizable=0,toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,copyhistory=0,width=380,height=250");
			//w.moveTo(((screen.width/2)-170),((screen.height/2)-150));
			w.focus();
			w.document.open();
			w.document.writeln("<html><head><title>Question Response Correct</title></head>");
			w.document.writeln("</head><body bgcolor='#ffffff' text='#000000' link='#0000ff' vlink='#800080' alink='#ff3333'><!--#include file='../../../template/header.htm'-->");
			w.document.writeln(CorrectFeedback);
			w.document.writeln("<form name='form2' method='post' action='javascript:self.close()'>");
			w.document.writeln("<div align='right'>");
			w.document.writeln("<input type='submit' name='Submit' value='Close Window'>");
			w.document.writeln("</div>");
			w.document.writeln("</form>");
			w.document.writeln("</body></html>");
}

function gotIncorrect() {
			gotthis = false;
			w = window.open("","questionResponse","resizable=0,toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,copyhistory=0,width=380,height=250");
			//w.moveTo(((screen.width/2)-170),((screen.height/2)-150));
			w.focus();
			w.document.open();
			w.document.writeln("<html><head><title>Question Response Incorrect</title></head>");
			w.document.writeln("</head><body bgcolor='#ffffff' text='#000000' link='#0000ff' vlink='#800080' alink='#ff3333'><!--#include file='../../../template/header.htm'-->");
			w.document.writeln(eval("incorrectFeedback" + curr_tries));
			w.document.writeln("<form name='form2' method='post' action='javascript:self.close()'>");
			w.document.writeln("<div align='right'>");
			w.document.writeln("<input type='submit' name='Submit' value='Close Window'>");
			w.document.writeln("</div>");
			w.document.writeln("</form>");
			w.document.writeln("</body></html>");
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

