
<!--

	function showFeedback(n,f) {
		var width = 240, height = 180, scrolling = "no";
		popFeedback(f,width,height,scrolling)
	}


	function showFeedback_mch1(n,c,f1,f2) {
		var width = 240, height = 180, scrolling = "no";
		
		c = c.toString().substring(0,1);
		
		if ((c!="0") && (eval("document.Q" + n + "Form.Q" + n + "Choice[" + (c-1) + "].checked") == true))
			f=f1;
		else
			f=f2;
			
		popFeedback(f,width,height,scrolling)
	}

	function showFeedback_mch2(n,c,flist) {
		var width = 240, height = 180, scrolling = "no";
		var chosen = 0, f = "";
		
		for (i = 1; i < (c+1); i++) {
      		if (eval("document.Q" + n + "Form.Q" + n + "Choice[" + (i-1) + "].checked") == true)
        			chosen = i;
  		}

		var farray = flist.split("|");
		farray[0] = "Please select an answer.";
		f  = farray[chosen];
		
		popFeedback(f,width,height,scrolling)
	}


	function showFeedback_chb2(n,c,p,f1,f2) {
		var width = 240, height = 180, scrolling = "no";
		var parray = p.split("|"), f1array = f1.split("|"), f2array = f2.split("|"), f = "<ol class='numbered'>", score = 0;

		for (i = 0; i < (c); i++) {
      		if (eval("document.Q" + n + "Form.Q" + n + "Choice[" + i + "].checked") == parray[i]) {
				f += "<li>" + f1array[i] + "</li>";
				score += 1;
			}
			else
				f += "<li>" + f2array[i] + "</li>";
  		}

		f += "</ul>" + "<p>You got " + score + " right out of " + c + ".</p>";

		popFeedback(f,width,height,scrolling)
	}


	function showFeedback_chb3(n,c,p,f1,f2) {
		var width = 240, height = 180, scrolling = "no";
		var parray = p.split("|"), correct=0;

		for (i = 0; i < (c); i++) {
      		if (eval("document.Q" + n + "Form.Q" + n + "Choice[" + i + "].checked") != parray[i])
        		correct+= 1;
  		}

		if (correct == 0) f=f1; else f=f2;
		
		popFeedback(f,width,height,scrolling)
	}


	function showFeedback_txt2(n,a,fb) {
		var width = 240, height = 180, scrolling = "no";
		
		var f = "<table width=100%><tr><td class='feedback-text'>You answered:</td><td class='feedback-text'>" + eval("document.Q" + n + "Form.Q" + n + "TextEntry.value") + "</td></tr>"
		f += "<tr><td class='feedback-text'>The correct answer is:</td><td class='feedback-text'>" + a + "</td></tr></table><br/><br/><p class='feedback-text'>" + fb + "</p>"
		
		popFeedback(f,width,height,scrolling)
	}


	function showFeedback_txt3(n,a,f1,f2) {
		var width = 240, height = 180, scrolling = "no";
		var ans_array = a.split("|"), c = ans_array.length - 1, correct=0;

		for (i = 0; i < (c); i++) {
      		if (trim(eval("document.Q" + n + "Form.Q" + n + "TextEntry.value")).toLowerCase() == trim(ans_array[i]).toLowerCase())
        		correct = 1;
  		}

		if (correct == 0) f=f2; else f=f1;

		popFeedback(f,width,height,scrolling)
	}


	function showFeedback_match2(n,c,p,f1,f2) {
		var width = 240, height = 180, scrolling = "no";
		var parray = p.split("|"), correct=0;

		for (i = 1; i < (c+1); i++) {
      		if ((eval("document.Q" + n + "Form.Q" + n + "Combo" + i + ".selectedIndex")) != parray[i-1])
        		correct+= 1;
  		}

		if (correct == 0) f=f1; else f=f2;
		
		popFeedback(f,width,height,scrolling)
	}


	function showFeedback_gap1(n,a,f) {
		var width = 240, height = 180, scrolling = "no";
		f = a + "<br/><br/>" + f;
		popFeedback(f,width,height,scrolling)
	}


	function showFeedback_gap2(n,g,as,al,f1,f2) {
		var width = 240, height = 180, scrolling = "no";
		var ans_array = al.split("|"), correct=0;

		for (i = 0; i < (g); i++) {
      		if (trim(eval("document.Q" + n + "Form.Q" + n + "TextEntry" + (i+1) + ".value")).toLowerCase() == trim(ans_array[i]).toLowerCase())
        		correct += 1;
  		}

		if (correct == g) f=f1; else f=f2;
		
		as = "You got " + correct + " right out of " + g + "."
		
		f = as + "<br/><br/>" + f;
		popFeedback(f,width,height,scrolling)
	}


	function showFeedback_gap4(n,g,as,al,f1,f2) {
		var width = 240, height = 180, scrolling = "no";
		var ans_array = al.split("|"), correct=0;

		for (i = 0; i < (g); i++) {
      		if (eval("document.Q" + n + "Form.Q" + n + "Combo" + (i+1) + ".options[document.Q" + n + "Form.Q" + n + "Combo" + (i+1) + ".selectedIndex].text") == ans_array[i])
        		correct += 1;
  		}

		if (correct == g) f=f1; else f=f2;
		
		as = "You got " + correct + " right out of " + g + "."
		
		f = as + "<br/><br/>" + f;
		popFeedback(f,width,height,scrolling)
	}


	function trim(s) {
	    while (s.substring(0,1) == ' ') s= s.substring(1,s.length);
	    while (s.substring(s.length-1,s.length) == ' ') s = s.substring(0,s.length-1);
	    return s;
	}


	function popFeedback(popText,myWidth,myHeight,myScroll) {
	
		popText=popText+"<br/><br/>"
		myWidth += Math.round((popText.length - 100)/3);
		if (popText.indexOf("<p") != -1) myWidth=myWidth*1.3;
		if (popText.indexOf("<ol") != -1) myWidth=myWidth*1.4;
		if (popText.indexOf("<ul") != -1) myWidth=myWidth*1.4;
		if (popText.indexOf("<table") != -1) myWidth=myWidth*1.7;
		if (popText.indexOf("<img") != -1) myWidth=640;
		if (myWidth>640) {myWidth=640;myScroll="yes";}
		myHeight = Math.round(myWidth * 3 / 4);
	
		var head1='<html><head><title>Feedback</title><link rel="stylesheet" href="coursegenie_exp.css" type="text/css"/></head>';
		
		var body1='<body bgcolor="#FFFFFF" text="#000000" onBlur="self.focus()"><table width="100%" height="100%" border="0" cellspacing="0" cellpadding="2"><tr> <td align="right" height="4" width="100%"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td height="2" align="left" valign="middle" bgcolor="#CCCCCC"></td></tr></table></td><td align="right" width="80"><a href="javascript://" onClick="self.close(); return false;"><img name="Close" border="0" src="buttons/btn_close_up.gif" width="64" height="21" alt="Close this window"></a></td></tr><tr><td colspan="2" class="feedback-text">';

		var body2='<p class="feedback-text">' + popText + '</p>' ;
		
		var body3='</td></tr><tr> <td align="right" width="100%"><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td height="2" align="left" valign="middle" bgcolor="#CCCCCC"></td></tr></table></td><td align="right" width="80"><a href="javascript://" onClick="self.close(); return false;"><img name="Close" border="0" src="buttons/btn_close_up.gif" width="64" height="21" alt="Close this window"></a></td></tr></table></body></html>'
		
		popWin=window.open("","popupWindow","width="+myWidth+",height="+myHeight+",menubar=no,scrollbars="+myScroll+",resizable=yes");
		popWin.document.write(head1+body1+body2+body3);
		popWin.document.close();  
		popWin.focus();
		return true;
	}

	function winPop1(popText,myWidth,myHeight) {
		var head1="<head><title>courseGenie Popup</title></head>";
		var body1="<body onBlur='self.focus()'>";
		var body2=popText;
		var body3="<img src='foo'/></body>";
		popWin=window.open("","popupWindow","width="+myWidth+",height="+myHeight+",menubar=no");
		popWin.document.write(head1+body1+body2+body3);
		popWin.document.close();  
		popWin.focus();
		return true;
	}

	function winPop2(popUrl,myWidth,myHeight,myScroll) {
		popWin=window.open(""+popUrl,"popupWindow","width="+myWidth+",height="+myHeight+",scrollbars="+myScroll+",menubar=no");
		return true;
	}
	function winPop3(popUrl) {
	 popWin=window.open(popUrl,"linkWindow","scrollbars=yes, menubar=no,toolbar=no,status=no, resizable=yes, width=690, height=520, top=0, left=0");
	}
	
	function winOpen(winUrl) { 
	 popWin=window.open(winUrl,"linkWindow","width=640,height=480,status=yes,toolbar=yes,menubar=yes,resizable=yes,location=yes,scrollbars=yes");
	}

	function MM_openBrWindow(theURL,winName,features) { //v2.0
	  window.open(theURL,winName,features);
	}

	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_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_findObj(n, d) { //v3.0
	  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); 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];}
	}
	function switchFrameSet()
{
	if (parent.framesOn == true) //turn it off
	{
		parent.document.body.cols = "0, *";
		parent.framesOn = false;
	}
	else //turn it on
	{
		parent.document.body.cols = "210, *";
		parent.framesOn = true;
	}
}
	
// -->	
