
//------------------Dreamweaver scripts------------------
function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

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.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);
  if(!x && document.getElementById) x=document.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];}
}

function MM_popupMsg(msg) { //v1.0
  alert(msg);
}

function MM_controlSound(x, _sndObj, sndFile) { //v3.0
  var i, method = "", sndObj = eval(_sndObj);
  if (sndObj != null) {
    if (navigator.appName == 'Netscape') method = "play";
    else {
      if (window.MM_WMP == null) {
        window.MM_WMP = false;
        for(i in sndObj) if (i == "ActiveMovie") {
          window.MM_WMP = true; break;
      } }
      if (window.MM_WMP) method = "play";
      else if (sndObj.FileName) method = "run";
  } }
  if (method) eval(_sndObj+"."+method+"()");
  else window.location = sndFile;
}

//------------------Custom scripts------------------

function s_right() {
	MM_controlSound('play','document.soundright','../../s_right.wav')
}

function s_wrong() {
	MM_controlSound('play','document.soundwrong','../../s_wrong.wav')
}

function PlayMe() {
	Player.Stop();
	Player.CurrentPosition = 0.0;
	Player.Play();
}

function openWin(theURL,name,properties) {
	window.open(theURL,name,properties);
}

function openShowText() {
	var theURL = "scripts/" + parent.scriptpage;
	window.open(theURL,'script','menubar=no,toolbar=no,scrollbars=yes,resizable=no,width=320,height=300,left=10,top=10')
}

function openShowText2(URL) { // this is for popup windows
	var theURL = "../../scripts/" + URL;
	window.open(theURL,'script','menubar=no,toolbar=no,scrollbars=yes,resizable=no,width=320,height=300,left=10,top=10')
}

function openShowText3(URL) { // this is for popup windows for intro (only 1 level down)
	var theURL = "../scripts/" + URL;
	window.open(theURL,'script','menubar=no,toolbar=no,scrollbars=no,resizable=no,width=350,height=350,left=30,top=40')
}

function openReviewWin(theURL) {
	window.open(theURL,'review','menubar=no,toolbar=no,scrollbars=no,resizable=no,width=600,height=450,left=100,top=25')
}

function openLevel1Win(theURL) {
	window.open(theURL,'level1win','menubar=no,toolbar=no,scrollbars=no,resizable=no,width=600,height=470,left=80,top=30')
}

function openLevel2Win(theURL) {
	window.open(theURL,'level2win','menubar=no,toolbar=no,scrollbars=no,resizable=no,width=600,height=470,left=95,top=45')
}

function openChart(theURL) {
	window.open(theURL,'chart','menubar=no,toolbar=yes,scrollbars=yes,resizable=yes,width=680,height=400,left=40,top=40')
}

function Visit(srcTag)
{
   srcTag.className = "LinkVisited";
}


/******************************************************************************
*** Description:  Final Practice Global Functions
*** Programmer:  DMS
*** Created:  4/6/03
*** Notes:  Moved to global javascript file on 4/8/03
******************************************************************************/
/******************************************************************************
*** Name:  PlaceCorrect();
*** Programmer:  DMS
*** Created:  4/7/03
*** Argument(s):  none
*** Return Value(s):  none
*** Description:  Places the "Correct Arrow" next to the correct answer of each
***               question.
******************************************************************************/
function PlaceCorrect()
{
	switch(strCorrectAnswer)
	{
		case "a":
			correcta.src = "images/572_FP_correct.jpg";
			correcta.style.visibility = "visible";
			break;
		case "b":
			correctb.src = "images/572_FP_correct.jpg";
			correctb.style.visibility = "visible";
			break;
		case "c":
			correctc.src = "images/572_FP_correct.jpg";
			correctc.style.visibility = "visible";
			break;
		case "d":
			correctd.src = "images/572_FP_correct.jpg";
			correctd.style.visibility = "visible";
			break;
	}
}

/********************************************************************************
*** Name:  PlaceChoice();
*** Programmer:  DMS
*** Created:  4/7/03
*** Argument(s):  integer representing the index number of the question whose
***               choice is to be shown
*** Return Value(s):  none
*** Description:  Places the "Choice Arrow" next to the students' answer for each
***               question.  If the question was skipped, then this arrow will not
***               be shown.
********************************************************************************/
function PlaceChoice(intIndex)
{
	switch(parent.FP_Answers[intIndex])
	{
		case "a":
			correcta.src = "images/572_FP_choice.jpg";
			correcta.style.visibility = "visible";
			break;
		case "b":
			correctb.src = "images/572_FP_choice.jpg";
			correctb.style.visibility = "visible";
			break;
		case "c":
			correctc.src = "images/572_FP_choice.jpg";
			correctc.style.visibility = "visible";
			break;
		case "d":
			correctd.src = "images/572_FP_choice.jpg";
			correctd.style.visibility = "visible";
			break;
	}
}

/*********************************************************************************
*** Name:  SetupRemedMode();
*** Programmer:  DMS
*** Created:  4/7/03
*** Argument(s):  integer representing the index number of the question whose
***               remed is being handled
*** Return Value(s):  none
*** Description:  Places the "Choice Arrow" next to the students' answer for each
***               question.  If the question was skipped, then this arrow will not
***               be shown.
*********************************************************************************/
function SetupRemedMode(intIndex)
{
	// strMode = "r" if in remed mode, otherwise it = "n" for normal mode
	if(parent.strMode == "r")
	{
		PlaceCorrect();
		PlaceChoice(intIndex);				
		MM_showHideLayers('ButtonLayer','','show','ReturnLayer','','show','DisableQuestion','','show');
		navforward.src = "../images/layout/layout_nav_forward-dis.jpg";
		navback.src = "../images/layout/layout_nav_back-dis.jpg";
	}
}

function SetButton(strSource)
{
	switch(strSource)
	{
		case "a":
			a.src='../images/buttonsquiz/A_Yellow.jpg'
			b.src='../images/buttonsquiz/B.jpg'
			c.src='../images/buttonsquiz/C.jpg'
			d.src='../images/buttonsquiz/D.jpg'
			break;
		case "b":
			a.src='../images/buttonsquiz/A.jpg'
			b.src='../images/buttonsquiz/B_Yellow.jpg'
			c.src='../images/buttonsquiz/C.jpg'
			d.src='../images/buttonsquiz/D.jpg'
			break;
		case "c":
			a.src='../images/buttonsquiz/A.jpg'
			b.src='../images/buttonsquiz/B.jpg'
			c.src='../images/buttonsquiz/C_Yellow.jpg'
			d.src='../images/buttonsquiz/D.jpg'
			break;
		case "d":
			a.src='../images/buttonsquiz/A.jpg'
			b.src='../images/buttonsquiz/B.jpg'
			c.src='../images/buttonsquiz/C.jpg'
			d.src='../images/buttonsquiz/D_Yellow.jpg'
			break;
	}
}

function ResetFinalPractice()
{
	var intCount;

	parent.Feedback = "";
	parent.RemedList = "";
	parent.FeedbackScore = "";
	parent.strMode = "n"
	parent.totalCorrect = 0;
	parent.totalScore = 0;
	parent.RemedVisited = 0;
			
	for(intCount = 0;intCount < 15; intCount++)
		parent.FP_TopicsMissed[intCount] = "";

	for(intCount = 0;intCount < 91; intCount++)
	{
		parent.FP_Answers[intCount] = "";
		parent.FP_QuestionsMissed[intCount] = "";
	}
}