
var vCurUserLogon = "User";
var vCurUserLevel = 0;
var appLoaded = false;
var vTicker = 0;

var vCRLF = "\r";

var vTestTotalCorrect = 0;
var	vTestTotalWrong = 0;
var ExitButton;
var BackButton;
var NextButton;

var vLoadTime = new Date().getTime();
var vThisModule = 0;
var vCurScreenID;

// These variables hold the open states of the support windows
var vGTOPHelpWinOpen = false;
var vGTOPSummaryWinOpen = false;
var vGTOPGlossaryWinOpen = false;
var vGTOPRefWinOpen = false;
var vGTOPAnswerWinOpen = false;
var vGTOPScriptWinOpen = false;
var vGTOPCompletedTestWinOpen = false;
var vGTOPCompletedUnitWinOpen = false;

window.onresize = captureResize;

function captureResize(e){
	if (document.layers){
		top.window.resizeTo(800,600);
	}else{
		top.window.resizeTo(800,600);
	}
	top.window.moveTo(0,0);		
}

function convertLevel(vLevel) {

	// 2 June - converts the Lingurama Level to a working number
	if (vLevel == '0.5') {
		return 1
	}
	if (vLevel == '0.75') {
		return 2
	}
	if (vLevel == '1.0') {
		return 3
	}
	if (vLevel == '1.25') {
		return 4
	}
	if (vLevel == '1.50') {
		return 5
	}
	if (vLevel == '1.5') {
		return 5
	}
	if (vLevel == '1.75') {
		return 6
	}
	if ((vLevel == '1') || (vLevel == 1)) {
		return 1
	}
	if ((vLevel == '2') || (vLevel == 2)) {
		return 2
	}
	if ((vLevel == '3') || (vLevel == 3)) {
		return 3
	}
	if ((vLevel == '4') || (vLevel == 4)) {
		return 4
	}
	if ((vLevel == '5') || (vLevel == 5)) {
		return 5
	}
	if ((vLevel == '6') || (vLevel == 6)) {
		return 6
	}

}
function getModule() {

	// as the course is opened it is passed a paramater of the module as a paramater string
	// the courseware parses this so it knows which first screen to display

	if (vThisModule == 0) {
		vLoc = "'" + window.location + "'";
		temp = vLoc.split("?");
		vThisModule = temp[1];
	} // end if

} // getModule()
var FrameSetTimerID;
function loadApplication() {

	if (appLoaded == false) {
		getModule();
		appLoaded = true;
		setDebugLevel();
		runErrorChecks();
		//initLMS();
//		loadFrameset();
//		loadFirstFrame();

		//delay the loading of the initial frame to fix cd issue
		FrameSetTimerID = setInterval("loadFrameset()",1000);

	} // end if

} // loadApplication()

function setDebugLevel() {

	if (top.vConfigDebugLevel != 0){
		alert(top.vConfigDebugLoadMessage)
	} // end if

} // setDebugLevel()

function runErrorChecks() {

	var errorString = "";

	errorString += verifyWinMediaPlayer64();
	errorString += verifyWinMediaPlayer7();
	errorString += verifyFlash4();
	errorString += verifyFlash5();
	errorString += verifyReal7();
	errorString += verifyReal8();
	errorString += verify640ScreenRes();
	errorString += verify800ScreenRes();
	errorString += verify1024ScreenRes();
	errorString += verify8BitColor();
	errorString += verify16BitColor();
	errorString += verifyJavaSupported();
	errorString += verifyCookiesSupported();
	errorString += verifyBrowser();
	errorString += verifyBrowserVersion();

	if (errorString !="") {
		alert(errorString)
		top.window.close();
	} // end if

} // runErrorChecks()

function verifyBrowserVersion() {

	if (parseInt(navigator.appVersion) < 4) {
		return top.vConfigIncorrectBroswerVersion + " " + (navigator.appVersion) + "\r";
	} else {
		return "";
	}
}

function verifyBrowser() {

	if (document.layers) {
		return top.vConfigUnSupportedBrowser + "\r";
	} else {
		return "";
	}
}

function verifyWinMediaPlayer64() {
	return "";
} // verifyWinMediaPlayer64()

function verifyWinMediaPlayer7() {
	return "";
} // verifyWinMediaPlayer7()

function verifyFlash4() {
	return "";
} // verifyFlash4()

function verifyFlash5() {
	return "";
} // verifyFlash5()

function verifyReal7() {
	return "";
} // verifyReal7()

function verifyReal8() {
	return "";
} // verifyReal8()

function verify640ScreenRes() {
		
	if (screen.height < 600 || screen.width < 800) {
		return top.vConfigIncorrectScreenRes + "\r";
	} else {
		return "";
	}

} // verify640ScreenRes()

function verify800ScreenRes() {
	return "";
} // verify800ScreenRes()

function verify1024ScreenRes() {
	return "";
} // verify1024ScreenRes()

function verify8BitColor() {
	return "";
} // verify8BitColor()

function verify16BitColor() {

	if (screen.colorDepth < 16)  {
		return top.vConfigIncorrectColourDepth + "\r";
	} else {
		return "";
	}
		
} // verify16BitColor()

function verifyJavaSupported() {

	if (!navigator.javaEnabled()) {
		return top.vConfigJavaNotEnabled + "\r";
	} else {
		return "";
	}

	return "";
} // verifyJavaSupported()

function verifyCookiesSupported() {

	if (!navigator.cookieEnabled) {
		return vConfigCookiesNotEnabled + "\r";
	} else {
		return "";
	}

} // verifyCookiesSupported()

function preloadImages() {

	vImgList = top.vConfigImagesToPreload;
	vNbrImages = vConfigImagesToPreload.length;
	vDir = top.vConfigMediaIfaceRoot;

	for (h=0;h<vNbrImages;h++) {
		vImg = vDir + vImgList[h];
		vImgHTML = '<IMG SRC="' + vImg.toLowerCase() + '" WIDTH="10" HEIGHT="20">';
		vLayer = "P" + h;
		updateFrameLayer("Invisib",vLayer,vImgHTML);
	} // end for

} // preloadImages()

function initLMS() {

	return;

} // initLMS()

function RelatedUnits() {
		
	ReferenceW = top.vRelatedWindowWidth;
	ReferenceH = top.vRelatedWindowHeight;

	isModal = top.vConfigModalWindow;

	vRelURL = "../related/" + top.vConfigCourseNbr + top.vThisModule + ".html"

	if (isModal == "true"){
		winAtts = "dialogHeight: " + ReferenceH  + "px; dialogWidth: " + ReferenceW  + "px; dialogTop: 0px; dialogLeft: 0px; edge: Raised; center: Yes; help: no; resizable: no; status: no;"			
	}else{
		winAtts = "toolbar=0,menubar=0,scrollbars=0,resizable=0,status=1,location=0,directories=0,copyhistory=0,height=" + ReferenceH + ",width=" + ReferenceW + ",left=0,top=0";
	}

	if (isModal == "true"){
		RefWindow = window.showModalDialog(vRelURL,"RelWindow",winAtts)			
	} else {
		RefWindow = window.open(vRelURL,"RelWindow",winAtts)
	} // end if

} // end RelatedUnits()

function LinkRelatedUnit(vCID) {

	temp = vCID.split(",")
	vCourseID = temp[0];
	vModuleID = temp[1];

	curLogon = top.vCurUserLogon
	curLevel = top.vCurUserLevel
	vLoc = "../course" + vCourseID + "/frm_set" + vModuleID + ".html?" + vModuleID + "?"
	//Change25apr to width and height
	if (top.vConfigRelatedUnitsLinkNewWindow == "true") {
		winStats='toolbar=no,'
		winStats+='location=no,'
		winStats+='directories=no,'
		winStats+='menubar=no,'
 		winStats+='scrollbars=no,'
		winStats+='status=no,'
		winStats+='width=' + top.vConfigNewWindowWidth + ','
		winStats+='height=' + top.vConfigNewWindowHeight + ','
		vLeft=0;
		vRight=0;
		vWinName="cware" + top.vConfigCourseNbr + vModuleID;

		if (navigator.appName.indexOf("Microsoft")>=0) {
			winStats+=',left=' + vLeft + ',top=' + vRight // + '
		}else{
			winStats+=',screenX=" + vLeft + ",screenY=" + vRight + "'
		}

		vWinName=window.open(vLoc,"",winStats);
	} else {
		top.window.location = vLoc;
	} // end if
} // end LinkRelatedUnit()

function IE4Catch() {

	// 19 July: MD
	// Do Not remove this - IE 4 can mess up some paramater strings - this is a fail safe.
	if (! top.vThisModule) {
		// then we are running IE 4 and need to catch
		// we know the frameset number - so we parse this out.
		temp = "'" + top.window.location + "'"
		tempS = temp.split("frm_set")
		top.vThisModule = tempS[1].charAt(0)
		return true;
	} else {
		return false;
	} // end if
}

var ContentTimerID;
var HeadTimerID;
var FunctionTimerID;
var NavTimerID;
var vFrameCounter = 0;
var vGUnitMap;		// the name of the Unit Map screen is now declared here as loadFirstFrame() is no longer called to address the cd issue.

function loadFrameset() {
//	IE4Catch(); 	// 19 July: MD: Do Not remove this
//	// load the frames
//	top.Content.location = "frm_content.html";  

//	vFrameCounter ++;
//	ContentTimerID = setInterval("loadFrameset1()",1000);
	if(appLoaded == true){

		if (vFrameCounter == 0) {
		clearInterval(FrameSetTimerID);


		IE4Catch(); 	// 19 July: MD: Do Not remove this
		// load the frames
		//top.Content.location = "frm_content.html";  

		vGUnitMap = 1 + "_u" + top.vThisModule + "map"
		top.Content.location = vGUnitMap + ".html";

		vFrameCounter ++;
		ContentTimerID = setInterval("loadFrameset1()",1000);

		}//endif
	}//endif


} // end loadFrameset()

function loadFrameset1() {

	if (vFrameCounter == 1) {
		clearInterval(ContentTimerID);
		top.Head.location = "frm_head" + top.vThisModule + ".html";

		vFrameCounter ++;
		HeadTimerID = setInterval("loadFrameset2()",1000);
	}

} // end loadFrameset1()

function loadFrameset2() {

	if (vFrameCounter == 2) {
		clearInterval(HeadTimerID);
		if (vNbrExercises_practice > 6) {
			top.FunctionBar.location = "frm_function_lrg.html";
		} else {
			top.FunctionBar.location = "frm_function.html";
		}
		vFrameCounter ++;
		FunctionTimerID = setInterval("loadFrameset3()",1000);
	}

} // end loadFrameset2()

function loadFrameset3() {

	if (vFrameCounter == 3) {
		clearInterval(FunctionTimerID);
		//top.Nav.location = "frm_nav.html";
		top.Invisib.location = "audio_player.html"

		vFrameCounter ++;
		NavTimerID = setInterval("loadFrameset4()",1000);
	}
} // end loadFrameset3()

function loadFrameset4() {

	if (vFrameCounter == 4) {
		clearInterval(NavTimerID);
		// MD: 14 Oct - toggled the load order of this frame with the one aboves
		//top.Invisib.location = "audio_player.html"
		top.Nav.location = "frm_nav.html";
		vFrameCounter ++;
	}

	// initInterfacePlugins();

	// MD: 14 Oct: Load Frameset
	//loadFirstFrame()
} // loadFrameset4()

function initContentWindow() {

//	setTimeout('initContentWindow()', top.vConfigLoadingToggleSpeed);
//	if (vTicker == 0) {
//		vTicker++;
//		top.updateFrameLayer("Content","LoadingBar",top.vConfigLoadingText1);
//	} else {
//		vTicker = 0;
//		top.updateFrameLayer("Content","LoadingBar",top.vConfigLoadingText2);
//	} // end if
	return;

} // initContentWindow()

function initFunctionBar() {

	var vInitHTML;

	vMediaDir = "media/iface/"
	var vSection;
	var vInitHTML = "";

	initFunctionBar_sub("Meaning",top.vNbrExercises_meaning,10)
	initFunctionBar_sub("Accuracy",top.vNbrExercises_accuracy,10)
	initFunctionBar_sub("Practice",top.vNbrExercises_practice,10)
	initFunctionBar_sub("Review",top.vNbrExercises_review,10)
	initFunctionBar_sub("Listening",top.vNbrExercises_listening,10)
	initFunctionBar_sub("Speaking",top.vNbrExercises_speaking,10)
	initFunctionBar_sub("Test",1,10)	// NOTE: Lingurama have asked for the test to be limited to a single exercise top.vNbrExercises_test
	grey_AllSectionNamesOnNavBar();

	return;

} // initFunctionBar()

function showSectionRollover(vSection) {

	if (top.vConfigApplyRolloverHiding == "true") {
		hideSectionRollover();
	}

	vImg = "<IMG BORDER=0 WIDTH=" + top.vConfigRolloverWidth + " HEIGHT=" + top.vConfigRolloverHeight + " SRC='media/iface/rollovers/" + top.vThisModule + "_" + vSection.toLowerCase() + "_roll.gif'>";

	vSection = vSection + "rollover"

	top.updateFrameLayer("FunctionBar",vSection,vImg);
	showFrameLayer("FunctionBar",vSection)

}

function hideSectionRollover() {

	vImg = "media/iface/rollovers/" + top.vThisModule + "_" + vSection + ".gif"

	hideFrameLayer("FunctionBar","Meaningrollover")
	hideFrameLayer("FunctionBar","Accuracyrollover")
	hideFrameLayer("FunctionBar","Practicerollover")
	hideFrameLayer("FunctionBar","Reviewrollover")
	hideFrameLayer("FunctionBar","Listeningrollover")
	hideFrameLayer("FunctionBar","Speakingrollover")
	hideFrameLayer("FunctionBar","Testrollover")


}
function initFunctionBarIfNotTest() {
	// May 20 - this function added as the test has an exit confirmation,
	// and we do not want the bar initializing unless this is the test
	if (getCurrentExercise(top.vCurScreenID) != "test") {
		initFunctionBar()
	}
}
function initFunctionBar_sub(vSection,vCount,vBlueCount) {

	// Show the Blue version of the Exercise Name
	vInitHTML = '<A HREF=JavaScript:top.LinkScreen("' + vSection + '100") onmouseout=JavaScript:top.hideSectionRollover() onmouseover=JavaScript:top.showSectionRollover("' + vSection + '")>'
	vInitHTML += '<IMG BORDER=0 HEIGHT=28 WIDTH=106 SRC="media/iface/' + vSection.toLowerCase() + '.gif"></A><BR>'
	top.updateFrameLayer("FunctionBar",vSection,vInitHTML);

	vInitHTML = ""
	for (i=1; i<(vCount+ 1); i++) {
		vALink = '<A HREF=JavaScript:top.initFunctionBarIfNotTest();top.LinkScreen("' + vSection + i + '00")>'
		if (vBlueCount == i) {
			imgPreFix = "bl_"
		} else {
			imgPreFix = "gr_"
		} // end if
		vInitHTML += vALink + '<IMG BORDER=0 ID="' + vSection + i + '" NAME="' + vSection + i + '" HEIGHT=12 WIDTH=7 SRC="' + vMediaDir + imgPreFix + i + '.gif">' + '</A>';
		vInitHTML += " ";
	} // end for

	vSection = vSection + "Nbrs"
	top.updateFrameLayer("FunctionBar",vSection,vInitHTML);

} // initFunctionBar_sub()

function greyFunctionBar(whatEx){

	// called as a user jumps between exercises

	if (whatEx == "meaning") {
		thisEx = "Meaning"
	}
	if (whatEx == "accuracy") {
		thisEx = "Accuracy"
	}
	if (whatEx == "practice") {
		thisEx = "Practice"
	}
	if (whatEx == "review") {
		thisEx = "Review"
	}
	if (whatEx == "listening") {
		thisEx = "Listening"
	}
	if (whatEx == "speaking") {
		thisEx = "Speaking"
	}
	if (whatEx == "test") {
		thisEx = "Test"
	}

	// Ling - they only want a single ex in the test
	if (thisEx != "Test"){
		eval("nbrExs = top.vNbrExercises_" + whatEx)
		initFunctionBar_sub(thisEx,nbrExs,10)
	} else {
		nbrExs = 1
		initFunctionBar_sub(thisEx,nbrExs,10)
	}

} // greyFunctionBar()

function SetFunctionBar(vCurScreenID) {

	f5recover();

	vCurEx = getCurrentExercise(vCurScreenID);
	vScreenID = getScreenIDInt(vCurScreenID,vCurEx);

	thisEx = vCurEx;
	eval("nbrExs = top.vNbrExercises_" + thisEx)

	if (vCurEx == "meaning") {
		thisEx = "Meaning"
	}
	if (vCurEx == "accuracy") {
		thisEx = "Accuracy"
	}
	if (vCurEx == "practice") {
		thisEx = "Practice"
	}
	if (vCurEx == "review") {
		thisEx = "Review"
	}
	if (vCurEx == "listening") {
		thisEx = "Listening"
	}
	if (vCurEx == "speaking") {
		thisEx = "Speaking"
	}
	if (vCurEx == "test") {
		thisEx = "Test"
	}

	//grey_AllSectionNamesOnNavBar()
	switch(vScreenID.charAt(0)) {
	case "1":	// 100
		greyFunctionBar(vCurEx)
		initFunctionBar_sub(thisEx,nbrExs,1)
		break;
	case "2":
		greyFunctionBar(vCurEx)
		initFunctionBar_sub(thisEx,nbrExs,2)
		break;
	case "3":
		greyFunctionBar(vCurEx)
		initFunctionBar_sub(thisEx,nbrExs,3)
		break;
	case "4":
		greyFunctionBar(vCurEx)
		initFunctionBar_sub(thisEx,nbrExs,4)
		break;
	case "5":
		greyFunctionBar(vCurEx)
		initFunctionBar_sub(thisEx,nbrExs,5)
		break;
	case "6":
		greyFunctionBar(vCurEx)
		initFunctionBar_sub(thisEx,nbrExs,6)
		break;
	case "7":
		greyFunctionBar(vCurEx)
		initFunctionBar_sub(thisEx,nbrExs,7)
		break;
	case "8":
		greyFunctionBar(vCurEx)
		initFunctionBar_sub(thisEx,nbrExs,8)
		break;
	}

} // FunctionBar_HighlightCurrentExercise()

function grey_AllSectionNamesOnNavBar() {

	vSectionWidth = 106; // the width of the navigation frame
		
	vSection = "Meaning"
	vInitHTML = '<A HREF=JavaScript:top.LinkScreen("' + vSection + '100") onmouseout=JavaScript:top.hideSectionRollover() onmouseover=JavaScript:top.showSectionRollover("' + vSection + '")>'
	vInitHTML += '<IMG BORDER=0 HEIGHT=28 WIDTH='+vSectionWidth+' SRC="media/iface/gr_' + vSection.toLowerCase() + '.gif"></A><BR>'
	top.updateFrameLayer("FunctionBar",vSection,vInitHTML);

	vSection = "Accuracy"
	//'vInitHTML = '<A HREF=JavaScript:top.LinkScreen("' + vSection + '100")>'
	vInitHTML = '<A HREF=JavaScript:top.LinkScreen("' + vSection + '100") onmouseout=JavaScript:top.hideSectionRollover() onmouseover=JavaScript:top.showSectionRollover("' + vSection + '")>'
	vInitHTML += '<IMG BORDER=0 HEIGHT=28 WIDTH='+vSectionWidth+' SRC="media/iface/gr_' + vSection.toLowerCase() + '.gif"></A><BR>'
	top.updateFrameLayer("FunctionBar",vSection,vInitHTML);

	vSection = "Practice"
	//vInitHTML = '<A HREF=JavaScript:top.LinkScreen("' + vSection + '100")>'
	vInitHTML = '<A HREF=JavaScript:top.LinkScreen("' + vSection + '100") onmouseout=JavaScript:top.hideSectionRollover() onmouseover=JavaScript:top.showSectionRollover("' + vSection + '")>'
	vInitHTML += '<IMG BORDER=0 HEIGHT=28 WIDTH='+vSectionWidth+' SRC="media/iface/gr_' + vSection.toLowerCase() + '.gif"></A><BR>'
	top.updateFrameLayer("FunctionBar",vSection,vInitHTML);

	vSection = "Review"
	//vInitHTML = '<A HREF=JavaScript:top.LinkScreen("' + vSection + '100")>'
	vInitHTML = '<A HREF=JavaScript:top.LinkScreen("' + vSection + '100") onmouseout=JavaScript:top.hideSectionRollover() onmouseover=JavaScript:top.showSectionRollover("' + vSection + '")>'
	vInitHTML += '<IMG BORDER=0 HEIGHT=28 WIDTH='+vSectionWidth+' SRC="media/iface/gr_' + vSection.toLowerCase() + '.gif"></A><BR>'
	top.updateFrameLayer("FunctionBar",vSection,vInitHTML);

	vSection = "Listening"
	//vInitHTML = '<A HREF=JavaScript:top.LinkScreen("' + vSection + '100")>'
	vInitHTML = '<A HREF=JavaScript:top.LinkScreen("' + vSection + '100") onmouseout=JavaScript:top.hideSectionRollover() onmouseover=JavaScript:top.showSectionRollover("' + vSection + '")>'
	vInitHTML += '<IMG BORDER=0 HEIGHT=28 WIDTH='+vSectionWidth+' SRC="media/iface/gr_' + vSection.toLowerCase() + '.gif"></A><BR>'
	top.updateFrameLayer("FunctionBar",vSection,vInitHTML);

	vSection = "Speaking"
	//vInitHTML = '<A HREF=JavaScript:top.LinkScreen("' + vSection + '100")>'
	vInitHTML = '<A HREF=JavaScript:top.LinkScreen("' + vSection + '100") onmouseout=JavaScript:top.hideSectionRollover() onmouseover=JavaScript:top.showSectionRollover("' + vSection + '")>'
	vInitHTML += '<IMG BORDER=0 HEIGHT=28 WIDTH='+vSectionWidth+' SRC="media/iface/gr_' + vSection.toLowerCase() + '.gif"></A><BR>'
	top.updateFrameLayer("FunctionBar",vSection,vInitHTML);

	vSection = "Test"
	//vInitHTML = '<A HREF=JavaScript:top.LinkScreen("' + vSection + '100")>'
	vInitHTML = '<A HREF=JavaScript:top.LinkScreen("' + vSection + '100") onmouseout=JavaScript:top.hideSectionRollover() onmouseover=JavaScript:top.showSectionRollover("' + vSection + '")>'
	vInitHTML += '<IMG BORDER=0 HEIGHT=28 WIDTH='+vSectionWidth+' SRC="media/iface/gr_' + vSection.toLowerCase() + '.gif"></A><BR>'
	top.updateFrameLayer("FunctionBar",vSection,vInitHTML);

} // grey_AllSectionNamesOnNavBar()

function initHeadFrame() {

	// top.updateFrameLayer("Head","MainTitle", top.vConfigCourseName);
	// top.updateFrameLayer("Head","SubTitle", "");

} // initHeadFrame()

function initInterfacePlugins() {

} // initInterfacePlugins()

function getScreenIDInt(vScreenID,vExercise) {

	temp = vScreenID.split("_");
	temp2 = temp[1].split(vExercise);
	return temp2[1]

} // getScreenIDInt(vScreenID)

function getCurrentExercise(vScreenID) {

	temp = vScreenID.split(top.vThisModule)
	vLetter = temp[1].charAt(1)

	switch(vLetter) {
	case "m":
		vResult = "meaning"
		break;
	case "a":
		vResult = "accuracy"
		break;
	case "p":
		vResult = "practice"
		break;
	case "r":
		vResult = "review"
		break;
	case "l":
		vResult = "listening"
		break;
	case "s":
		vResult = "speaking"
		break;
	case "t":
		vResult = "test"
		break;
	default:			
		vResult = "not defined yet: " + vLetter
	}
	return vResult

}

var vGUnitMap;		// the name of the Unit Macp screen
function loadFirstFrame() {

	vGUnitMap = 1 + "_u" + top.vThisModule + "map";
	top.Content.location = vGUnitMap + ".html";

} // loadFirstFrame()

function makeNewButton(vButArray) {

	vDivLayer = vButArray[0];
	vImgName = "img_" + vButArray[0];

	vNormalImg = vButArray[1];
	vRolloverImg = vButArray[2];
	vRolloverALTText = vButArray[3];
	vDisabledImg = vButArray[4];
	vDisabledALTText = vButArray[5];
	vImgWidth = vButArray[6];
	vImgHeight = vButArray[7];

	vParamSeperator = ","

	vMouseClick = '<A HREF=# ';
	vMouseClick += 'onClick=top.doIFaceClick_' + vDivLayer + '("' + vDivLayer + '") ';
	vMouseOver = 'onMouseOver=top.doIFaceButOver("' + vDivLayer + '"); ';

	vMouseOut = 'onMouseOut=top.doIFaceButOut("' + vDivLayer + '") ';
	vMouseOut += ">";

	this.vHTML_Normal = vMouseClick + vMouseOver + vMouseOut + '<IMG ID="' + vImgName + '" NAME="' + vImgName + '" ALT="' + vRolloverALTText + '" BORDER=0 SRC="' + vNormalImg + '" HEIGHT="' + vImgHeight + '" WIDTH="' + vImgWidth + '"></A>';
		
	//this.vHTML_Over = vMouseClick + vMouseOver + vMouseOut + '<IMG ID="' + vImgName + '" NAME="' + vImgName + '" ALT="' + vRolloverALTText + '" BORDER=0 SRC="' + vRolloverImg + '" HEIGHT="' + vImgHeight + '" WIDTH="' + vImgWidth + '"></A>';
	this.vRolloverImg = vRolloverImg;

	//this.vHTML_Over = vMouseClick + vMouseOver + vMouseOut + '<IMG ID="' + vImgName + '" NAME="' + vImgName + '" ALT="' + vRolloverALTText + '" BORDER=0 SRC="' + vRolloverImg + '" HEIGHT="' + vImgHeight + '" WIDTH="' + vImgWidth + '"></A>';
	this.vHTML_Disabled = vMouseClick + vMouseOver + vMouseOut + '<IMG ID="' + vImgName + '" NAME="' + vImgName + '" ALT="' + vDisabledALTText + '" BORDER=0 SRC="' + vDisabledImg + '" HEIGHT="' + vImgHeight + '" WIDTH="' + vImgWidth + '"></A>';
	//this.vHTML_Disabled = '<IMG ID="' + vImgName + '" NAME="' + vImgName + '" ALT="' + vDisabledALTTExt + '" BORDER=0 SRC="' + vDisabledImg + '" HEIGHT="' + vImgHeight + '" WIDTH="' + vImgWidth + '"></A>';

} // makeNewButton()

var vHelpState = "Normal";
var vSummaryState = "Normal";
var vGlossaryState = "Normal";
var vReferenceState = "Normal";
var vCheckState = "Normal";
var vResetState = "Normal";
var vAnswerState = "Normal";
var vScriptState = "Normal";
var vMapState = "Normal";
var vBackState = "Normal";
var vNextState = "Normal";
var vExitState = "Normal";

function doIFaceButOver(vLayer) {		

	eval("thisLayerState = top.v" + vLayer + "State")
		
	eval("vImgName = top.v" + vLayer + "But[0]")
	eval("vImgOver = top.v" + vLayer + "But[2]")
	vImgName = "img_" + vImgName


	if (thisLayerState == "Normal") {
	//	eval("v" + vLayer + "State = 'Over'")
	//	temp = "vOverHTML = " +vLayer + "Button.vHTML_Over"
	//	eval(temp)
	//	updateFrameLayer("Nav",vLayer, vOverHTML);
	//	vLayer.vImgName.src = vImgOver

		// 21 Apr - I rewrote this as an SCR swap rather than a layer re write to try and improve performance
		temp = "vOverImg = " +vLayer + "Button.vRolloverImg"
		eval(temp)
		md = eval("curImgSrc = top.Nav." + vImgName)
		md.src = vOverImg;
	}


} // doIFaceButOver()

function doIFaceButOut(vLayer) {

	eval("thisLayerState = v" + vLayer + "State")

	if (thisLayerState != "Disabled") {
		eval("v" + vLayer + "State = 'Normal'")
		vExitState = "Normal"
		temp = "vOverHTML = " +vLayer + "Button.vHTML_Normal"
		eval(temp)
		updateFrameLayer("Nav",vLayer, vOverHTML);
	}

} // doIFaceButOut()

function initInterfaceButtons() {

	// Create all the Button Objects
	HelpButton = new makeNewButton(top.vHelpBut);
	SummaryButton = new makeNewButton(top.vSummaryBut);
	GlossaryButton = new makeNewButton(top.vGlossaryBut);
	ReferenceButton = new makeNewButton(top.vReferenceBut);
	CheckButton = new makeNewButton(top.vCheckBut);
	ResetButton = new makeNewButton(top.vResetBut);
	AnswerButton = new makeNewButton(top.vAnswerBut);
	MapButton = new makeNewButton(top.vMapBut);
	ScriptButton = new makeNewButton(top.vScriptBut);
	BackButton = new makeNewButton(top.vBackBut);
	NextButton = new makeNewButton(top.vNextBut);
	ExitButton = new makeNewButton(top.vExitBut);

	updateFrameLayer("Nav","Help", top.HelpButton.vHTML_Normal);
	updateFrameLayer("Nav","Summary", top.SummaryButton.vHTML_Normal);
	updateFrameLayer("Nav","Glossary", top.GlossaryButton.vHTML_Normal);
	updateFrameLayer("Nav","Reference", top.ReferenceButton.vHTML_Disabled);
	updateFrameLayer("Nav","Check", top.CheckButton.vHTML_Disabled);
	updateFrameLayer("Nav","Answer", top.AnswerButton.vHTML_Disabled);
	updateFrameLayer("Nav","Reset", top.ResetButton.vHTML_Disabled);
	updateFrameLayer("Nav","Script", top.ScriptButton.vHTML_Disabled);
	updateFrameLayer("Nav","Map", top.MapButton.vHTML_Normal);
	updateFrameLayer("Nav","Back", top.BackButton.vHTML_Disabled);
	updateFrameLayer("Nav","Next", top.NextButton.vHTML_Normal);
	updateFrameLayer("Nav","Exit", top.ExitButton.vHTML_Normal);

	vHelpState = "Normal";
	vSummaryState = "Normal";
	vGlossaryState = "Normal";
	vReferenceState = "Disabled";
	vCheckState = "Disabled";
	vResetState = "Disabled";
	vAnswerState = "Disabled";
	vScriptState = "Disabled";
	vMapState = "Normal";
	vBackState = "Disabled";
	vNextState = "Normal";
	vExitState = "Normal";

} // initInterfaceButtons()

function updateFrameLayer(vFrame,vLayer,vStr) {

	if (document.layers) {
		eval('top.' + vFrame + '.document.' +vLayer+ '.document.write(vStr)');
		eval('top.' + vFrame + '.document.' +vLayer+ '.document.close()');
	} else {
		eval('top.' + vFrame + '.document.all.' +vLayer+ '.innerHTML = vStr');
	} // end if

} // updateFrameLayer()

function updateLayer(vLayer,vStr) {

	if (document.layers) {
		eval('top.Content.document.' +vLayer+ '.document.write(vStr)');
		eval('top.Content.document.' +vLayer+ '.document.close()');
	} else {
		eval('top.Content.document.all.' +vLayer+ '.innerHTML = vStr');
	} // end if

} // updateLayer()

function showFrameLayer(vFrame,vLayer) {

	if (document.layers) {
		eval('top.' + vFrame + '.document.'+vLayer+'.visibility = "visible"');
	} else {
		eval('top.' + vFrame + '.document.all.'+vLayer+'.style.visibility = "visible"');
	} // end if

} // showFrameLayer()

function hideFrameLayer(vFrame,vLayer) {

	if (document.layers) {
		eval('top.' + vFrame + '.document.'+vLayer+'.visibility = "hidden"');
	} else {
		eval('top.' + vFrame + '.document.all.'+vLayer+'.style.visibility = "hidden"');
	} // end if

} // hideFrameLayer()

function showLayer(player) {

	eval('top.Content.document.all.' +player+ '.style.visibility = "visible"');

} // showLayer()

function hideLayer(player) {

	eval('top.Content.document.all.' +player+ '.style.visibility = "hidden"');

} // hideLayer()

function swapImage_green(vID) {

	// request Lingurama 13 Mar - True False to  
	if (top.Content.vGTemplate == "tf001") {
		PlayAudio(1)
	} // end if

	temp = "document.all.imageG" + vID + ".src = 'inline_greencircle.gif'";
	eval(temp);
} // swapImage_green()

function swapImage_red(vID) {

	// request Lingurama 13 Mar - True False to  
	if (top.Content.vGTemplate == "tf001") {
		PlayAudio(0)
	} // end if

	temp = "document.all.imageR" + vID + ".src = 'inline_redcircle.gif'";
	eval(temp);
} // swapImage_red()

var vGtta01NbrCorrect = 0;
var vGtta01NbrWrong = 0;

function DisplayFeedback(vState,vID) {

	vTemplate = top.Content.vGTemplate
	vLayout = top.Content.vGLayout

	temp = vTemplate + "_" + vLayout

	switch(temp) {
	case "p002_2":
		if (vState == 1) {
			updateLayer('GeneralFB',top.Content.vGStdCorrect)
		} else {
			updateLayer('GeneralFB',top.Content.vGStdInCorrect)
		} // end if
		PlayAudio(vState)
		break;

	case "tta01_0":
		if (vState == 1) {
			top.vGtta01NbrCorrect ++;
			//top.vGtta01NbrWrong --;
		} else {
			//top.vGtta01NbrCorrect --;
			top.vGtta01NbrWrong ++;
		} // end if
		break;

	default:
		PlayAudio(vState)
		break;
	}

} // DisplayFeedback()

var vGQuestionCount = 0;	// The number of the questions
var vGScoreArray = new Array()

function removePunctation(vText) {

	// to implement this code just uncomment
	vText = Trim(vText)


	vDoubleSpace = "  ";
	vFullStop = "."; 	// replace this
	vComma = ","; 		// replace this
	vReplace = ""; 		// with this
	vReplace2 = " "; 		// with this
	vAccent = "´"; 		// replace accent (to handle lack of apostrophe on some keyboards, eg Spanish)
	vReplace3 = "'"; 		// with apostrophe

	// temp = "" + vText; // temporary holder
	// temp = removePunctation_sub(temp, vFullStop, vReplace);
	// temp = removePunctation_sub(temp, vComma, vReplace);
	// return temp.toLowerCase()

	//vText = removePunctation_sub(vText, vDoubleSpace, vReplace);
	vText = removePunctation_sub(vText, vFullStop, vReplace);
	vText = removePunctation_sub(vText, vComma, vReplace);
	vText = removePunctation_sub(vText, vDoubleSpace, vReplace2);
	vText = removePunctation_sub(vText, vAccent, vReplace3);
	return vText.toLowerCase()

} // end removePunctation()

function removePunctation_sub(vText, vFindChar, vReplaceChar) {

	while (vText.indexOf(vFindChar)>-1) {
		pos = vText.indexOf(vFindChar);
		vText = "" + (vText.substring(0, pos) + vReplaceChar +  
		vText.substring((pos + vFindChar.length), vText.length));
	}
	return vText
}

function displayGapFeedback(vObj, vObjName, vUserAnswer, visCorrect, vThisCorrectList1, vThisCorrectList2, vThisCorrectList3, vThisCorrectList4, vThisCorrectList5, vThisCorrectList6, vThisCorrectList7, vThisCorrectList8, vThisCorrectList9, vThisCorrectList10, vThisCorrectList11, vThisCorrectList12, vThisCorrectList13, vThisCorrectList14, vThisCorrectList15, vThisCorrectList16, vThisCorrectList17, vThisCorrectList18, vThisCorrectList19, vThisCorrectList20) {
	if (top.vConfigTestDebug == "true") {

		vdebug = "Assessed Gap Fill Debugging" + vCRLF + vCRLF
		// vdebug += "This Gap: " + vObjName + vCRLF
		vdebug += "Users Answer: " + vUserAnswer + vCRLF
		vdebug += "Answered Correctly?: " + visCorrect + vCRLF + vCRLF
		
		vdebug += "Alternative Answers" + vCRLF
		vdebug += "Option 1: " + vThisCorrectList1 + vCRLF
		vdebug += "Option 2: " + vThisCorrectList2 + vCRLF
		vdebug += "Option 3: " + vThisCorrectList3 + vCRLF
		vdebug += "Option 4: " + vThisCorrectList4 + vCRLF
		vdebug += "Option 5: " + vThisCorrectList5 + vCRLF
		vdebug += "Option 6: " + vThisCorrectList6 + vCRLF
		vdebug += "Option 7: " + vThisCorrectList7 + vCRLF
		vdebug += "Option 8: " + vThisCorrectList8 + vCRLF
		vdebug += "Option 9: " + vThisCorrectList9 + vCRLF
		vdebug += "Option 10: " + vThisCorrectList10 + vCRLF
		vdebug += "Option 11: " + vThisCorrectList11 + vCRLF
		vdebug += "Option 12: " + vThisCorrectList12 + vCRLF
		vdebug += "Option 13: " + vThisCorrectList13 + vCRLF
		vdebug += "Option 14: " + vThisCorrectList14 + vCRLF
		vdebug += "Option 15: " + vThisCorrectList15 + vCRLF
		vdebug += "Option 16: " + vThisCorrectList16 + vCRLF
		vdebug += "Option 17: " + vThisCorrectList17 + vCRLF
		vdebug += "Option 18: " + vThisCorrectList18 + vCRLF
		vdebug += "Option 19: " + vThisCorrectList19 + vCRLF
		vdebug += "Option 20: " + vThisCorrectList20 + vCRLF

		if (visCorrect == "true") {
			vObj.style.color = "GREEN"
		}else{
			vObj.style.color = "RED"
		}
		alert(vdebug)
		vObj.style.color = "BLUE"
	}

}
function SetTestScore() {

	var vAttemptAll = false;
	var vQuestionCorrect = false;

	vTemplate = top.Content.vGTemplate
	vLayout = top.Content.vGLayout

	var vTestQuestionsCorrect = 0;
	var vTestQuestionsWrong = 0;
	temp = vTemplate + "_" + vLayout

	switch(temp) {
	// For the Dual Choice Templates
	case "tta01_0":
		vData = top.Content.tta01TextHTML2;
		temp = vData.split("TSTGCORRECT")
		nbrCorrectOptions = temp.length
		nbrCorrectOptions --;

		temp = vData.split("TSTRINCORRECT")
		nbrWrongOptions = temp.length
		nbrWrongOptions --;

		vQuestionCorrect = (nbrWrongOptions == top.vGtta01NbrCorrect);
		// MD DALGLISH - DisplayFeedback
		vNbrOptions = (nbrWrongOptions + nbrCorrectOptions)
		nbrCorrectOptions = top.vGtta01NbrCorrect;
		nbrWrongOptions = top.vGtta01NbrWrong;
		nbrWrongOptions = (0 - top.vGtta01NbrWrong);

		vMsg += 'Dual Choice - vNbrOptions: ' + vNbrOptions + "\r"
		vMsg += 'Dual Choice - nbrCorrectOptions: ' + nbrCorrectOptions + "\r"
		vMsg += 'Dual Choice - nbrWrongOptions: ' + nbrWrongOptions + "\r"		

		vTestQuestionsCorrect = (vTestQuestionsCorrect + nbrCorrectOptions);
		vTestQuestionsWrong = (vTestQuestionsWrong + nbrWrongOptions);

		top.vGtta01NbrCorrect = 0;
		top.vGtta01NbrWrong = 0;
		// alert(vMsg);
		vAttemptAll = true;
		
		break;
		
	case "ttb01_0":
		vAttemptAll = true
		vttb01Score = top.vttb01_Scr1
		if (top.vttb01_Scr1 == 1) {
			if (top.vttb01_Scr2 == 1) {
				if (top.vttb01_Scr3 == 1) {
					vQuestionCorrect = true
				} // end if
			} // end if
		} // end if

		msg = "top.vttb01_Scr1: " + top.vttb01_Scr1 + "\r"
		msg += "top.vttb01_Scr2: " + top.vttb01_Scr2 + "\r"
		msg += "top.vttb01_Scr3: " + top.vttb01_Scr3 + "\r"
		msg += "vQuestionCorrect:" + vQuestionCorrect

		// Set the scoring to the global tracking
		if (top.vttb01_Scr1 == 1) {
			vTestQuestionsCorrect ++;
		}else{
			vTestQuestionsWrong ++;
		}
		if (top.vttb01_Scr2 == 1) {
			vTestQuestionsCorrect ++;
		}else{
			vTestQuestionsWrong ++;
		}
		if (top.vttb01_Scr3 == 1) {
			vTestQuestionsCorrect ++;
		}else{
			vTestQuestionsWrong ++;
		}
		break;

	// assessed Gap fill
	case "ttc01_0":
		vIncorrectColour = top.vConfigIncorrectColour;
		vIncorrectStyle = vConfigIncorrectStyle;
		vCorrectColour = top.vConfigCorrectColour;
		vCorrectStyle = top.vConfigCorrectStyle;

		var i = 0;
		var vAnyWrong = false;
		var vCorrectGapCount = 0;
		var vWrongGapCount = 0;
		
		do {
			eval("vThisObject = top.Content.document.all.AssessedInputArea0" + i)
			i ++;
			if (vThisObject) {
				vUserAnswer = removePunctation(vThisObject.value);
					
				vThisCorrect = vThisObject.CORRECT.toLowerCase();
				// vThisCorrect is a list - convert to an array and test
				vThisCorrectList = vThisCorrect.split("|")
				
				if ((vUserAnswer == vThisCorrectList[0]) || (vUserAnswer == vThisCorrectList[1]) || (vUserAnswer == vThisCorrectList[2]) || (vUserAnswer == vThisCorrectList[3]) || (vUserAnswer == vThisCorrectList[4]) || (vUserAnswer == vThisCorrectList[5]) || (vUserAnswer == vThisCorrectList[6]) || (vUserAnswer == vThisCorrectList[7]) || (vUserAnswer == vThisCorrectList[8])|| (vUserAnswer == vThisCorrectList[9]) || (vUserAnswer == vThisCorrectList[10])  || (vUserAnswer == vThisCorrectList[11]) || (vUserAnswer == vThisCorrectList[12]) || (vUserAnswer == vThisCorrectList[13]) || (vUserAnswer == vThisCorrectList[14]) || (vUserAnswer == vThisCorrectList[15]) || (vUserAnswer == vThisCorrectList[16]) || (vUserAnswer == vThisCorrectList[17]) || (vUserAnswer == vThisCorrectList[18]) || (vUserAnswer == vThisCorrectList[19]) || (vUserAnswer == vThisCorrectList[20]) ) {
					// handle correct
					vCorrectGapCount ++;
					visCorrect = "true";	// for the debug only
				} else {
					vAnyWrong = true;
					vWrongGapCount ++;
					visCorrect = "false";	// for the debug only
				} // end if
				displayGapFeedback(vThisObject, vThisObject.id, vUserAnswer, visCorrect, vThisCorrectList[0], vThisCorrectList[1], vThisCorrectList[2], vThisCorrectList[3], vThisCorrectList[4], vThisCorrectList[5], vThisCorrectList[6], vThisCorrectList[7], vThisCorrectList[8], vThisCorrectList[9], vThisCorrectList[10], vThisCorrectList[11], vThisCorrectList[12], vThisCorrectList[13], vThisCorrectList[14], vThisCorrectList[15], vThisCorrectList[16], vThisCorrectList[17], vThisCorrectList[18], vThisCorrectList[19], vThisCorrectList[20])
			} // end if
		} while (vThisObject)

		var i = 0;
		do {
			eval("vThisObject = top.Content.document.all.AssessedInputArea1" + i)
			i ++;
			if (vThisObject) {
				vUserAnswer = removePunctation(vThisObject.value);
				vThisCorrect = vThisObject.CORRECT.toLowerCase();
				// vThisCorrect is a list - convert to an array and test
				vThisCorrectList = vThisCorrect.split("|")

				if ((vUserAnswer == vThisCorrectList[0]) || (vUserAnswer == vThisCorrectList[1]) || (vUserAnswer == vThisCorrectList[2]) || (vUserAnswer == vThisCorrectList[3]) || (vUserAnswer == vThisCorrectList[4]) || (vUserAnswer == vThisCorrectList[5]) || (vUserAnswer == vThisCorrectList[6]) || (vUserAnswer == vThisCorrectList[7]) || (vUserAnswer == vThisCorrectList[8])|| (vUserAnswer == vThisCorrectList[9]) || (vUserAnswer == vThisCorrectList[10])  || (vUserAnswer == vThisCorrectList[11]) || (vUserAnswer == vThisCorrectList[12]) || (vUserAnswer == vThisCorrectList[13]) || (vUserAnswer == vThisCorrectList[14]) || (vUserAnswer == vThisCorrectList[15]) || (vUserAnswer == vThisCorrectList[16]) || (vUserAnswer == vThisCorrectList[17]) || (vUserAnswer == vThisCorrectList[18]) || (vUserAnswer == vThisCorrectList[19]) || (vUserAnswer == vThisCorrectList[20]) ) {
					// handle correct
					vCorrectGapCount ++;
					visCorrect = "true";	// for the debug only
				} else {
					vAnyWrong = true;
					vWrongGapCount ++;
					visCorrect = "false";	// for the debug only
				} // end if
				displayGapFeedback(vThisObject, vThisObject.id, vUserAnswer, visCorrect, vThisCorrectList[0], vThisCorrectList[1], vThisCorrectList[2], vThisCorrectList[3], vThisCorrectList[4], vThisCorrectList[5], vThisCorrectList[6], vThisCorrectList[7], vThisCorrectList[8], vThisCorrectList[9], vThisCorrectList[10], vThisCorrectList[11], vThisCorrectList[12], vThisCorrectList[13], vThisCorrectList[14], vThisCorrectList[15], vThisCorrectList[16], vThisCorrectList[17], vThisCorrectList[18], vThisCorrectList[19], vThisCorrectList[20])
			} // end if
		} while (vThisObject)

		var i = 0;
		do {
			eval("vThisObject = top.Content.document.all.AssessedInputArea2" + i)
			i ++;
			if (vThisObject) {

				vUserAnswer = removePunctation(vThisObject.value);
				vThisCorrect = vThisObject.CORRECT.toLowerCase();
				// vThisCorrect is a list - convert to an array and test
				vThisCorrectList = vThisCorrect.split("|")
				
				if ((vUserAnswer == vThisCorrectList[0]) || (vUserAnswer == vThisCorrectList[1]) || (vUserAnswer == vThisCorrectList[2]) || (vUserAnswer == vThisCorrectList[3]) || (vUserAnswer == vThisCorrectList[4]) || (vUserAnswer == vThisCorrectList[5]) || (vUserAnswer == vThisCorrectList[6]) || (vUserAnswer == vThisCorrectList[7]) || (vUserAnswer == vThisCorrectList[8])|| (vUserAnswer == vThisCorrectList[9]) || (vUserAnswer == vThisCorrectList[10])  || (vUserAnswer == vThisCorrectList[11]) || (vUserAnswer == vThisCorrectList[12]) || (vUserAnswer == vThisCorrectList[13]) || (vUserAnswer == vThisCorrectList[14]) || (vUserAnswer == vThisCorrectList[15]) || (vUserAnswer == vThisCorrectList[16]) || (vUserAnswer == vThisCorrectList[17]) || (vUserAnswer == vThisCorrectList[18]) || (vUserAnswer == vThisCorrectList[19]) || (vUserAnswer == vThisCorrectList[20]) ) {
					// handle correct
					vCorrectGapCount ++;
					visCorrect = "true";	// for the debug only
				} else {
					vAnyWrong = true;
					vWrongGapCount ++;
					visCorrect = "false";	// for the debug only
				} // end if
				displayGapFeedback(vThisObject, vThisObject.id, vUserAnswer, visCorrect, vThisCorrectList[0], vThisCorrectList[1], vThisCorrectList[2], vThisCorrectList[3], vThisCorrectList[4], vThisCorrectList[5], vThisCorrectList[6], vThisCorrectList[7], vThisCorrectList[8], vThisCorrectList[9], vThisCorrectList[10], vThisCorrectList[11], vThisCorrectList[12], vThisCorrectList[13], vThisCorrectList[14], vThisCorrectList[15], vThisCorrectList[16], vThisCorrectList[17], vThisCorrectList[18], vThisCorrectList[19], vThisCorrectList[20])
				
			} // end if
			
		} while (vThisObject)

		var i = 0;
		do {
			eval("vThisObject = top.Content.document.all.AssessedInputArea3" + i)
			i ++;
			if (vThisObject) {

				vUserAnswer = removePunctation(vThisObject.value);
				vThisCorrect = vThisObject.CORRECT.toLowerCase();
				// vThisCorrect is a list - convert to an array and test
				vThisCorrectList = vThisCorrect.split("|")

				if ((vUserAnswer == vThisCorrectList[0]) || (vUserAnswer == vThisCorrectList[1]) || (vUserAnswer == vThisCorrectList[2]) || (vUserAnswer == vThisCorrectList[3]) || (vUserAnswer == vThisCorrectList[4]) || (vUserAnswer == vThisCorrectList[5]) || (vUserAnswer == vThisCorrectList[6]) || (vUserAnswer == vThisCorrectList[7]) || (vUserAnswer == vThisCorrectList[8])|| (vUserAnswer == vThisCorrectList[9]) || (vUserAnswer == vThisCorrectList[10])  || (vUserAnswer == vThisCorrectList[11]) || (vUserAnswer == vThisCorrectList[12]) || (vUserAnswer == vThisCorrectList[13]) || (vUserAnswer == vThisCorrectList[14]) || (vUserAnswer == vThisCorrectList[15]) || (vUserAnswer == vThisCorrectList[16]) || (vUserAnswer == vThisCorrectList[17]) || (vUserAnswer == vThisCorrectList[18]) || (vUserAnswer == vThisCorrectList[19]) || (vUserAnswer == vThisCorrectList[20]) ) {
					// handle correct
					vCorrectGapCount ++;
					visCorrect = "true";	// for the debug only
				} else {
					vAnyWrong = true;
					vWrongGapCount ++;
					visCorrect = "false";	// for the debug only
				} // end if
				displayGapFeedback(vThisObject, vThisObject.id, vUserAnswer, visCorrect, vThisCorrectList[0], vThisCorrectList[1], vThisCorrectList[2], vThisCorrectList[3], vThisCorrectList[4], vThisCorrectList[5], vThisCorrectList[6], vThisCorrectList[7], vThisCorrectList[8], vThisCorrectList[9], vThisCorrectList[10], vThisCorrectList[11], vThisCorrectList[12], vThisCorrectList[13], vThisCorrectList[14], vThisCorrectList[15], vThisCorrectList[16], vThisCorrectList[17], vThisCorrectList[18], vThisCorrectList[19], vThisCorrectList[20])

			} // end if
		} while (vThisObject)

		var i = 0;
		do {
			eval("vThisObject = top.Content.document.all.AssessedInputArea4" + i)
			i ++;
			if (vThisObject) {

				vUserAnswer = removePunctation(vThisObject.value);
				vThisCorrect = vThisObject.CORRECT.toLowerCase();
				// vThisCorrect is a list - convert to an array and test
				vThisCorrectList = vThisCorrect.split("|")
				
				if ((vUserAnswer == vThisCorrectList[0]) || (vUserAnswer == vThisCorrectList[1]) || (vUserAnswer == vThisCorrectList[2]) || (vUserAnswer == vThisCorrectList[3]) || (vUserAnswer == vThisCorrectList[4]) || (vUserAnswer == vThisCorrectList[5]) || (vUserAnswer == vThisCorrectList[6]) || (vUserAnswer == vThisCorrectList[7]) || (vUserAnswer == vThisCorrectList[8])|| (vUserAnswer == vThisCorrectList[9]) || (vUserAnswer == vThisCorrectList[10])  || (vUserAnswer == vThisCorrectList[11]) || (vUserAnswer == vThisCorrectList[12]) || (vUserAnswer == vThisCorrectList[13]) || (vUserAnswer == vThisCorrectList[14]) || (vUserAnswer == vThisCorrectList[15]) || (vUserAnswer == vThisCorrectList[16]) || (vUserAnswer == vThisCorrectList[17]) || (vUserAnswer == vThisCorrectList[18]) || (vUserAnswer == vThisCorrectList[19]) || (vUserAnswer == vThisCorrectList[20]) ) {
					// handle correct
					vCorrectGapCount ++;
					visCorrect = "true";	// for the debug only
				} else {
					vAnyWrong = true;
					vWrongGapCount ++;
					visCorrect = "false";	// for the debug only
				} // end if
				displayGapFeedback(vThisObject, vThisObject.id, vUserAnswer, visCorrect, vThisCorrectList[0], vThisCorrectList[1], vThisCorrectList[2], vThisCorrectList[3], vThisCorrectList[4], vThisCorrectList[5], vThisCorrectList[6], vThisCorrectList[7], vThisCorrectList[8], vThisCorrectList[9], vThisCorrectList[10], vThisCorrectList[11], vThisCorrectList[12], vThisCorrectList[13], vThisCorrectList[14], vThisCorrectList[15], vThisCorrectList[16], vThisCorrectList[17], vThisCorrectList[18], vThisCorrectList[19], vThisCorrectList[20])
			} // end if
		} while (vThisObject)
		
		var i = 0;
		do {
			eval("vThisObject = top.Content.document.all.AssessedInputArea5" + i)
			i ++;
			if (vThisObject) {

				vUserAnswer = removePunctation(vThisObject.value);
				vThisCorrect = vThisObject.CORRECT.toLowerCase();
				// vThisCorrect is a list - convert to an array and test
				vThisCorrectList = vThisCorrect.split("|")
				
				if ((vUserAnswer == vThisCorrectList[0]) || (vUserAnswer == vThisCorrectList[1]) || (vUserAnswer == vThisCorrectList[2]) || (vUserAnswer == vThisCorrectList[3]) || (vUserAnswer == vThisCorrectList[4]) || (vUserAnswer == vThisCorrectList[5]) || (vUserAnswer == vThisCorrectList[6]) || (vUserAnswer == vThisCorrectList[7]) || (vUserAnswer == vThisCorrectList[8])|| (vUserAnswer == vThisCorrectList[9]) || (vUserAnswer == vThisCorrectList[10])  || (vUserAnswer == vThisCorrectList[11]) || (vUserAnswer == vThisCorrectList[12]) || (vUserAnswer == vThisCorrectList[13]) || (vUserAnswer == vThisCorrectList[14]) || (vUserAnswer == vThisCorrectList[15]) || (vUserAnswer == vThisCorrectList[16]) || (vUserAnswer == vThisCorrectList[17]) || (vUserAnswer == vThisCorrectList[18]) || (vUserAnswer == vThisCorrectList[19]) || (vUserAnswer == vThisCorrectList[20]) ) {
					// handle correct
					vCorrectGapCount ++;
					visCorrect = "true";	// for the debug only
				} else {
					vAnyWrong = true;
					vWrongGapCount ++;
					visCorrect = "false";	// for the debug only
				} // end if
				displayGapFeedback(vThisObject, vThisObject.id, vUserAnswer, visCorrect, vThisCorrectList[0], vThisCorrectList[1], vThisCorrectList[2], vThisCorrectList[3], vThisCorrectList[4], vThisCorrectList[5], vThisCorrectList[6], vThisCorrectList[7], vThisCorrectList[8], vThisCorrectList[9], vThisCorrectList[10], vThisCorrectList[11], vThisCorrectList[12], vThisCorrectList[13], vThisCorrectList[14], vThisCorrectList[15], vThisCorrectList[16], vThisCorrectList[17], vThisCorrectList[18], vThisCorrectList[19], vThisCorrectList[20])
			} // end if
		} while (vThisObject)
		
		if (vAnyWrong == false) {
			vQuestionCorrect = true	
		} // end if
		msg = "vQuestionCorrect:" + vQuestionCorrect
		vAttemptAll = true

		vTestQuestionsCorrect = vCorrectGapCount;
		vTestQuestionsWrong = vWrongGapCount;
	}

	// alert(msg)
	if (vAttemptAll == true) {
		top.vGQuestionCount ++; 	// Increment the count of the questions
		top.vGScoreArray[top.vGQuestionCount] = vQuestionCorrect

		// set the scoring in the global tracking
		top.vTestTotalCorrect = top.vTestTotalCorrect + vTestQuestionsCorrect
		top.vTestTotalWrong = top.vTestTotalWrong + vTestQuestionsWrong

		if (top.vConfigTestDebug == "true") {
			vTstMsg = "Testing Debug" + vCRLF + vCRLF
			vTstMsg += "Screens Served so Far: " + top.vGQuestionCount + vCRLF
			vTstMsg += "Questions Served so Far: " + (top.vTestTotalCorrect + top.vTestTotalWrong) + vCRLF
			vTstMsg += "Questions Correct so Far: " + top.vTestTotalCorrect + vCRLF
			vTstMsg += "Questions Wrong so Far: " + top.vTestTotalWrong + vCRLF+ vCRLF

			vTstMsg += "Last Question Screen Passed? : " + top.vGScoreArray[top.vGQuestionCount] + vCRLF
			vTstMsg += "Screen History:" + vCRLF + vCRLF
			for (h=1;h < (top.vGQuestionCount + 1);h++) {
				vTstMsg += "Question " + h + ": " + top.vGScoreArray[h] + vCRLF
			}
			alert(vTstMsg)
		}
		return vAttemptAll	// OK to move to the next question
	} else {
		return vAttemptAll	// block the move to the next question
	} // end if

}

/******************************************************************
	Start of the module map functions
******************************************************************/
function initModuleMap() {

	vtemp = "'" + top.window.location + "'"
	vSplitResult = vtemp.split("Student_ID")
	
	if (vSplitResult[1]) {
		// coming from the welcome screen
		// Collect the paramaters passed in and set the user name and level

		vtemp = "'" + vSplitResult[1]
		vData = vtemp.split("&")
		vLogon = vData[0].split("=")
		vLevel = vData[1].split("=")

		top.vCurUserLogon = vLogon[1];
		top.vCurUserLevel = vLevel[1].charAt(0);
	
		vCurUserLogon = vLogon[1];
		vCurUserLevel = vLevel[1].charAt(0);

		top.setStudentLevelToCookie(top.vCurUserLogon, top.vCurUserLevel)
	} else {
	
		top.vCurUserLevel = top.getStudentLevelFromCookie();
		top.vCurUserLogon = getStudentNameFromCookie();
	}

	// Debug Code for Alma
	if (vEnableTrackingDebug == "true") {
		document.all.alma.style.visibility = "visible";
		vMsg = "debug" + vCRLF;
		vMsg += "User Name: "  + top.vCurUserLogon + vCRLF;
		vMsg += "Note: showing the debug link to open the course complete screen"
		alert(vMsg)
	}

	// Returning to the Module Map - set the buttons
	if (top.vCurUserLevel > 0) {
		feimg.src = "media/map/fe_ac.gif";
	}
	if (top.vCurUserLevel > 1) {
		byeimg.src = "media/map/bye_ac.gif";
	}
	if (top.vCurUserLevel > 2) {
		dyeimg.src = "media/map/dye_ac.gif";
	}
	if (top.vCurUserLevel > 3) {
		syeimg.src = "media/map/sye_ac.gif";
	}
	if (top.vCurUserLevel > 4) {
		pieimg.src = "media/map/pie_ac.gif";
	}
	if (top.vCurUserLevel > 5) {
		eyeimg.src = "media/map/eye_ac.gif";
	}


}
var ModTimerID;

function _openModule(c_id, m_id){

	temp = "openModule(" + c_id + ", " + m_id + ")"
	ModTimerID = setInterval(temp,1500);

}

function openModule(c_id, m_id) {

	curLogon = top.vCurUserLogon
	curLevel = top.vCurUserLevel

	// 21 June - added a section to handle the previous units.
	var c_path = "../course" + c_id + "/"
	c_path += "frm_set" + m_id + ".html?" + m_id + "?Student_ID=" + top.vCurUserLogon + "&LevelNo=" + top.vCurUserLevel;

	// MDalglish LinkRelatedUnit()
	// 21 June - handle the difference between units
	if ((c_id == top.vCurUserLevel) || (c_id < top.vCurUserLevel)) {
		top.window.location = c_path
	} else {
		vTemp = c_id + "," + m_id
		LinkRelatedUnit(vTemp)
	}

	top.setStudentLevelToCookie(curLogon, curLevel)
	top.vCurUserLogon = curLogon
	top.vCurUserLevel = curLevel
	
}

function rolloverimg(vImage,vOverImage) {

	vImage.src = vOverImage;

}

function click_exit() {

	if (confirm(vConfigExitConfirmation) == true) {
		top.window.close()
	} // end if
}

function click_help() {

	var vHelpURL = "../help/" + vHelpMenu;
	winAtts = "toolbar=0,menubar=0,scrollbars=1,resizable=1,status=1,location=0,directories=0,copyhistory=0,height=" + vHelpWindowHeight + ",width=" + vHelpWindowWidth + ",left=0,top=0";

	HelpWindow = window.open(vHelpURL,"HelpWindow",winAtts)

}

function moduleLink(vID) {

	// this is called from the module map

	if ((vID == top.vCurUserLevel) || (vID < top.vCurUserLevel)) {
		temp = top.vCurUserLevel
		vLink = "../course" + vID + "/modulemap.html?Student_ID=" + top.vCurUserLogon + "&LevelNo=" + top.vCurUserLevel
		top.window.location = vLink;
		setStudentLevelToCookie(top.vCurUserLogon, temp)
	} else {
		// alert('Access Locked')
		return;
	}
}
/******************************************************************
	Start of the cookie functions
******************************************************************/

function getFromCookie() {
		
	var vID = 'Lingurama' + top.vConfigCourseNbr;
	return GetCookie(vID);

}

function setStudentLevelToCookie(vUserName, vLevel) {

	if (isIE4()) {
		if (vUserName) {
			top.opener.userName = vUserName;
		}
		top.opener.userLevel = vLevel;
		return;

	} else {
		var vID = 'LinguramaLevel';
		var exp = new Date();
		var expOneYear = exp.getTime() + (365 * 24 * 60 * 60 * 1000);
		exp.setTime(expOneYear);
		SetCookie(vID, vLevel, null, null, null, null);

		var vID = 'LinguramaName';
		SetCookie(vID, vUserName, null, null, null, null);
	}
}

function isIE4() {
	return false; // (parseInt(navigator.appVersion) == 4)
}

function getStudentLevelFromCookie() {
	// COOKIEMD 		top.opener.userName = vUserName;
	if (isIE4()) {
		vLevel = top.opener.userLevel;
		if ((! vLevel) || (vLevel == null)) {
			return 0
		} else {
			return vLevel;
		}
	} else {
		var vID = 'LinguramaLevel';
		return GetCookie(vID);
	}
}
function getStudentNameFromCookie() {
	var vID = 'LinguramaName';
	return GetCookie(vID);
}
function setToCookie(vValue) {
	var vID = 'Lingurama' + top.vConfigCourseNbr;

	var exp = new Date();
	var expOneYear = exp.getTime() + (365 * 24 * 60 * 60 * 1000);
	exp.setTime(expOneYear);

	SetCookie(vID, vValue, exp, null, null, null);
}

function SetCookie(name, value, expires, path, domain, secure) {

document.cookie = name + "=" + escape(value) +  
((expires) ? "; expires=" + expires.toGMTString() : " ") +  
((path) ? "; path=" + path : " ") +  
((domain) ? "; domain=" + domain : " ")  +  
((secure) ? "; secure=" + secure : " ") ;

}

function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break;  
  }
  return "";
}

/******************************************************************
	Start Functions to handle trp looking at the source via right mouse down
******************************************************************/
function blockRightMouseClick() {

//	if (top.vConfigDebugLevel == 0){
//		initMouseHandler();
//	} // end if

} // blockRightMouseClick()

function initMouseHandler() {

	if (document.layers) {
		document.captureEvents(Event.MOUSEDOWN);
	} else {
		document.oncontextmenu = contextmenuhandler;
	} // end if

	document.onmousedown = mousedown;

} // initMouseHandler()

function contextmenuhandler() {

	return false;

} // contextmenuhandler()

function mousedown(evt) {

	var btncode = (document.layers) ? evt.which : null;  

	if (!document.layers) {
		btncode = event.button;
	}

	if (document.layers) {
		if (btncode == 3) {	// right mouse....
			return false;			
		} else {
			routeEvent(evt);		
		}
	} else {
		if (btncode == 2) {
			alert(top.vConfigRightClickBlockMsg);
			event.cancelBubble = false;
			event.returnValue = false;
			return;
		} else {
			return;
		}
	}

} // mousedown

function f5recover() {

	// as the courseware variables can be "damaged" with hitting the F5 key this function manages it for us

	if (top.vConfigApplyRefreshProtection == "true") {
		if (top.vThisModule == 0) {
			top.vThisModule = getFromCookie();
		}else{
			setToCookie(top.vThisModule);
		}
	}

	// 2 June - added protection for User Names going a miss
	if (top.vCurUserLogon == "User") {
		top.vCurUserLogon = getStudentNameFromCookie();
	}
} // end f5recover()

/******************************************************************
	Template Frame Work Functions
******************************************************************/
function initScreen() {

	f5recover();		

	// just to be careful on the setting of the level.
	if (top.Content.vGTemplate.toLowerCase() == "unmap") {
		temp = top.window.location
		temp = "'" + temp + "'"
		temp2 = temp.split("LevelNo=")
		
			if (temp2[1]) {
				// this is the normal way
				top.vCurUserLevel = temp2[1].charAt(0);
			} else {
				
				// this the the IE 4 recover way
				sTemp = temp.split('/course');

				if (sTemp[1].charAt(0) < top.getStudentLevelFromCookie()) {
					top.vCurUserLevel = top.getStudentLevelFromCookie()
				} else {
					top.vCurUserLevel = sTemp[1].charAt(0)
				}
				
			}
			
		 	// 19 July: MD: Do Not remove this
		top.setStudentLevelToCookie(top.vCurUserLogon, top.vCurUserLevel)
	}

	if (top.Content.vGTemplate.toLowerCase() != "unmap") {
		if (top.Content.vGTemplate.toLowerCase() != "ttext") {
			updateFrameLayer("Content","ScreenTitle", top.Content.vGScreenTitle);
		}
	}

	// set the page counter
	if (top.Content.vGTemplate.toLowerCase() != "unmap") {
		//if (top.Content.vGTemplate.toLowerCase() != "ttent") {
			if (top.Content.vGTemplate.toLowerCase() != "ttc01") {
				if (top.Content.vGTemplate.toLowerCase() != "ttb01") {
					if (top.Content.vGTemplate.toLowerCase() != "tta01") {
						if (top.Content.vGTemplate.toLowerCase() != "ttext") {
							updateFrameLayer("Content","ScreenCounter", "<P align=right CLASS=mdScreenCounter><B>" + top.Content.vGPageCount + "</B></P>");
							top.Invisib.stopPlayer();	// 19 Apr - stop the audio player
						} // end if
					} // end if
				} // end if
			} // end if
		//} // end if
	} // end if

	// once all the page elements have been called them we can init this template
	temp = top.Content.vGTemplate.toLowerCase() + "_init()"
	eval(temp);

	// remember the current screen ID
	top.vCurScreenID = top.Content.vGPgID
	vCurScreenID = top.Content.vGPgID

	if (top.Content.vGTemplate.toLowerCase() != "unmap") {
		// set the correct colouring on the left hand nav bar
		SetFunctionBar(top.vCurScreenID);
		
		// set the navigation buttons
		initScreen_setNavButtons()
		
		if (top.Content.vGTemplate.toLowerCase() == "ttext") {
			// MMD: Aug 21 - the interface buttons are disabled
			initScreen_setDisableNav();
		}
	}

	// Update the display to tell the user that the screen is loaded
	vTemp = new Date().getTime();

	vMsg = top.vConfigLoadedStatusMsg + top.Content.vGPgID + " (load time = " + ((vTemp - vLoadTime)/1000) + " seconds)";
	window.status = vMsg;

	blockRightMouseClick()
	closeOpenWindows()

//	updateLayer("Popup","CURSOR")
//	hourCursorTimerID = setInterval("cancelHoursCursor()",3000);

} // initScreen()

var hourCursorTimerID

function cancelHoursCursor() {
//	alert('cancel cursor')
//	updateLayer("Popup","")
//	clearInterval(hourCursorTimerID);
}
function unmap_init() {

	// 15 Apr: New code to allow the related buttons to be set to visible or not

	var isVis;
	eval("isVis = top.vConfigU" + top.vThisModule)

	if (isVis == "visible") {
		showFrameLayer("Content","NextUnits")
	} else {
		hideFrameLayer("Content","NextUnits")
	}

	temp = "'" + top.window.location + "'";
	temp1 = temp.split("=")
	temp2 = temp1[1].split("&")
	
	top.vCurUserLogon = temp2[0]
	vCurUserLogon = temp2[0]
}

function initScreen_setNavButtons() {

	// called from initScreen()

	buttonArray = top.Content.vGButStates.split(",")

	// 0 var vHelpState = "Normal";
	// 1 var vSummaryState = "Normal";
	// 2 var vGlossaryState = "Normal";
	// 3 var vReferenceState = "Normal";
	// 4 var vCheckState = "Normal";
	// 5 var vResetState = "Normal";
	// 6 var vAnswerState = "Normal";
	// 7 var vScriptState = "Normal";
	// 8 var vMapState = "Normal";
	// 9 var vBackState = "Normal";
	// 10 var vNextState = "Normal";
	// 11 var vExitState = "Normal";


	vTemplate = top.Content.vGTemplate

	if ((vTemplate == "ttext") || (vTemplate == "ttc01") || (vTemplate == "ttb01") || (vTemplate == "tta01")) {
		buttonArray[9] = 1
	}

	if ((vReferenceState == "Normal") && (buttonArray[3] == 1)) {
		vReferenceState = "Disabled";
		updateFrameLayer("Nav","Reference", top.ReferenceButton.vHTML_Disabled);
	}
	if ((vReferenceState == "Disabled") && (buttonArray[3] == 0)) {
		vReferenceState = "Normal";
		updateFrameLayer("Nav","Reference", top.ReferenceButton.vHTML_Normal);
	}
	if ((vCheckState == "Normal") && (buttonArray[4] == 1)) {
		vCheckState = "Disabled";
		updateFrameLayer("Nav","Check", top.CheckButton.vHTML_Disabled);
	}
	if ((vCheckState == "Disabled") && (buttonArray[4] == 0)) {
		vCheckState = "Normal";
		updateFrameLayer("Nav","Check", top.CheckButton.vHTML_Normal);
	}
	if ((vResetState == "Normal") && (buttonArray[5] == 1)) {
		vResetState = "Disabled";
		updateFrameLayer("Nav","Reset", top.ResetButton.vHTML_Disabled);
	}
	if ((vResetState == "Disabled") && (buttonArray[5] == 0)) {
		vResetState = "Normal";
		updateFrameLayer("Nav","Reset", top.ResetButton.vHTML_Normal);
	}

	if ((vAnswerState == "Normal") && (buttonArray[6] == 1)) {
		vAnswerState = "Disabled";
		updateFrameLayer("Nav","Answer", top.AnswerButton.vHTML_Disabled);
	}
	if ((vAnswerState == "Disabled") && (buttonArray[6] == 0)) {
		vAnswerState = "Normal";
		updateFrameLayer("Nav","Answer", top.AnswerButton.vHTML_Normal);		
	}

	if ((vScriptState == "Normal") && (buttonArray[7] == 1)) {
		vScriptState = "Disabled";
		updateFrameLayer("Nav","Script", top.ScriptButton.vHTML_Disabled);
	}
	if ((vScriptState == "Disabled") && (buttonArray[7] == 0)) {
		vScriptState = "Normal";
		updateFrameLayer("Nav","Script", top.ScriptButton.vHTML_Normal);		
	}

	if (vBackState == "Over") {
		vBackState = "Normal";
		updateFrameLayer("Nav","Back", top.BackButton.vHTML_Normal);
	}

	if ((vBackState == "Normal") && (buttonArray[9] == 1)) {
		vBackState = "Disabled";
		updateFrameLayer("Nav","Back", top.BackButton.vHTML_Disabled);
	}
	if ((vBackState == "Disabled") && (buttonArray[9] == 0)) {
		vBackState = "Normal";
		updateFrameLayer("Nav","Back", top.BackButton.vHTML_Normal);		
	}

	if ((vNextState == "Normal") && (buttonArray[10] == 1)) {
		vNextState = "Disabled";
		updateFrameLayer("Nav","Next", top.NextButton.vHTML_Disabled);
	}
	if ((vNextState == "Disabled") && (buttonArray[10] == 0)) {
		vNextState = "Normal";
		updateFrameLayer("Nav","Next", top.NextButton.vHTML_Normal);
	}

	updateFrameLayer("Nav","Exit", top.ExitButton.vHTML_Normal);
	updateFrameLayer("Nav","Map", top.MapButton.vHTML_Normal);
	updateFrameLayer("Nav","Help", top.HelpButton.vHTML_Normal);
	updateFrameLayer("Nav","Glossary", top.GlossaryButton.vHTML_Normal);
	updateFrameLayer("Nav","Summary", top.SummaryButton.vHTML_Normal);

} // initScreen_setNavButtons()

function initScreen_setDisableNav() {

	buttonArray = top.Content.vGButStates.split(",")
	vTemplate = top.Content.vGTemplate

	if ((vReferenceState == "Normal")) {
		vReferenceState = "Disabled";
		updateFrameLayer("Nav","Reference", top.ReferenceButton.vHTML_Disabled);
	}
	if ((vCheckState == "Normal")) {
		vCheckState = "Disabled";
		updateFrameLayer("Nav","Check", top.CheckButton.vHTML_Disabled);
	}
	if ((vResetState == "Normal")) {
		vResetState = "Disabled";
		updateFrameLayer("Nav","Reset", top.ResetButton.vHTML_Disabled);
	}
	if ((vAnswerState == "Normal")) {
		vAnswerState = "Disabled";
		updateFrameLayer("Nav","Answer", top.AnswerButton.vHTML_Disabled);
	}
	if ((vScriptState == "Normal")) {
		vScriptState = "Disabled";
		updateFrameLayer("Nav","Script", top.ScriptButton.vHTML_Disabled);
	}
	if ((vBackState == "Normal")) {
		vBackState = "Disabled";
		updateFrameLayer("Nav","Back", top.BackButton.vHTML_Disabled);
	}
	if ((vNextState == "Normal")) {
		vNextState = "Disabled";
		updateFrameLayer("Nav","Next", top.NextButton.vHTML_Disabled);
	}
	updateFrameLayer("Nav","Exit", top.ExitButton.vHTML_Disabled);
	updateFrameLayer("Nav","Map", top.MapButton.vHTML_Disabled);
	updateFrameLayer("Nav","Help", top.HelpButton.vHTML_Disabled);
	updateFrameLayer("Nav","Glossary", top.GlossaryButton.vHTML_Disabled);
	updateFrameLayer("Nav","Summary", top.SummaryButton.vHTML_Disabled);

} // initScreen_setDisableNav()
function closeOpenWindows() {

	if (top.vConfigAutoCloseWindow == "true"){
	if (vGTOPHelpWinOpen == true) {
		HelpWindow.close();
	}
	if (vGTOPSummaryWinOpen == true) {
		SummaryWindow.close();
	}
	if (vGTOPGlossaryWinOpen == true) {
		GlossaryWindow.close();
	}
	if (vGTOPRefWinOpen == true) {
		RefWindow.close();
	}
	if (vGTOPAnswerWinOpen == true) {
		AnswerWindow.close();
	}
	if (vGTOPScriptWinOpen == true) {
		ScriptWindow.close();
	}
	}

}

function doIFaceClick_Help(vLayer) {

	var isNorm;
	eval("isNorm = v" + vLayer + "State")
	if (isNorm != "Disabled") {
		var vHelpURL = "../help/" + top.vHelpMenu;
		winAtts = "toolbar=0,menubar=0,scrollbars=1,resizable=1,status=1,location=0,directories=0,copyhistory=0,height=" + vHelpWindowHeight + ",width=" + vHelpWindowWidth + ",left=0,top=0";

		// Updated Code to handle the window focus issues
		if (!top.vGTOPHelpWinOpen){
			top.vGTOPHelpWinOpen = true;
			HelpWindow = window.open(vHelpURL,"HelpWindow",winAtts)
			return;
		}
		if (!HelpWindow || HelpWindow.closed){
			top.vGTOPHelpWinOpen = true;
			HelpWindow = window.open(vHelpURL,"HelpWindow",winAtts)
		}else{
			HelpWindow.focus();		
		}
	}

} // doIFaceClick_Help()

function doIFaceClick_Summary(vLayer) {

	var isNorm;
	eval("isNorm = v" + vLayer + "State")
	if (isNorm != "Disabled") {
		var vSummaryURL = "../summary/" + top.vConfigCourseNbr  + "_" + top.vThisModule + "summary.html";
		winAtts = "toolbar=0,menubar=0,scrollbars=1,resizable=1,status=1,location=0,directories=0,copyhistory=0,height=" + vSummaryWindowHeight + ",width=" + vSummaryWindowWidth + ",left=0,top=0";

		// Updated Code to handle the window focus issues
		if (!top.vGTOPSummaryWinOpen){
			top.vGTOPSummaryWinOpen = true;
			SummaryWindow = window.open(vSummaryURL,"SummaryWindow",winAtts)
			return;
		}
		if (!SummaryWindow || SummaryWindow.closed){
			top.vGTOPSummaryWinOpen = true;
			SummaryWindow = window.open(vSummaryURL,"SummaryWindow",winAtts)
		}else{
			SummaryWindow.focus();
		}
	}

} // doIFaceClick_Summary()

function doIFaceClick_Glossary(vLayer) {

	// May 20th updated to have elements controled via the config files
	var isNorm;
	eval("isNorm = v" + vLayer + "State")
	if (isNorm != "Disabled") {
		vURL = top.vConfigDictionaryURL;

		// Updated Code to handle the window focus issues
		if (!top.vGTOPGlossaryWinOpen){
			top.vGTOPGlossaryWinOpen = true;
			GlossaryWindow = window.open(vURL,"dictionary","scrollbars=" + top.vConfigDictionaryScrollBars + ",status=" + top.vConfigDictionaryStatus + ",height=" + top.vConfigDictionaryHeight + ",width=" + top.vConfigDictionaryWidth + ",left=0,top=0,resizable=yes")
			return;
		}
		if (!GlossaryWindow || GlossaryWindow.closed){
			top.vGTOPGlossaryWinOpen = true;
			GlossaryWindow = window.open(vURL,"dictionary","scrollbars=" + top.vConfigDictionaryScrollBars + ",status=" + top.vConfigDictionaryStatus + ",height=" + top.vConfigDictionaryHeight + ",width=" + top.vConfigDictionaryWidth + ",left=0,top=0,resizable=yes")
		}else{
			GlossaryWindow.focus();
		}
	}

} // doIFaceClick_Glossary()

function doIFaceClick_Reference(vLayer) {

	var isNorm;
	eval("isNorm = v" + vLayer + "State")
	if (isNorm != "Disabled") {
		vDataArray = top.Content.vGPopUpWindows.split("|")
		AnswerW = vDataArray[0];
		AnswerH = vDataArray[1];
		AnswerURL = vDataArray[2];
		ReferenceW = vDataArray[3];
		ReferenceH = vDataArray[4];
		ReferenceURL = vDataArray[5];
		ScriptW = vDataArray[6];
		ScriptH = vDataArray[7];
		ScriptURL = vDataArray[8];

		var vAnswerURL = "../reference/" + ReferenceURL;

		winAtts = "toolbar=0,menubar=0,scrollbars=0,resizable=0,status=1,location=0,directories=0,copyhistory=0,height=" + ReferenceH + ",width=" + ReferenceW + ",left=0,top=0";

		// Updated Code to handle the window focus issues
		if (!top.vGTOPRefWinOpen){
			top.vGTOPRefWinOpen = true;
			RefWindow = window.open(vAnswerURL,"RefWindow",winAtts)
			return;
		}
		if (!RefWindow || RefWindow.closed){
			top.vGTOPRefWinOpen = true;
			RefWindow = window.open(vAnswerURL,"RefWindow",winAtts)
		}else{
			RefWindow.focus();
		}
	}

} // doIFaceClick_Reference()

function doIFaceClick_Check(vLayer) {

	var isNorm;
	eval("isNorm = v" + vLayer + "State")
	if (isNorm != "Disabled") {
		vTemplate = top.Content.vGTemplate
		vLayout = top.Content.vGLayout

		temp = vTemplate + "_" + vLayout

		switch(temp) {
		case "p004_0":
			p004Answer()
			break;
		case "p003_1":
			showLayer('p003TextArea2')
			break;
		case "iq002_0":
			iq002Answer()
			break;
		case "iq006_0":
			iq006_Answer()
			break;
		case "iq005_0":
			iq005_Answer()
			break;
		//case "p001_0":
		//	P001Answer()
		//	break;
		case "p002_2":
			p002_2Answer()
			break;

		default:
			alert('Check not supported on this template')
			break;
		}
	}

} // doIFaceClick_Check()

function doIFaceClick_Reset(vLayer) {

	// if this is the Ordering or Matching template call the template specific functions
	// else reload the screen

	var isNorm;
	eval("isNorm = v" + vLayer + "State")
	if (isNorm != "Disabled") {

		vGTemplate = top.Content.vGTemplate

		if ((vGTemplate == 'iq005') || (vGTemplate == 'iq006')) {
			if (vGTemplate == 'iq005') {
				iq005_Restart()
			} // end if
			if (vGTemplate == 'iq006') {
				iq006_Restart()
			} // end if
		} else {
			var vURL = top.Content.vGPgID.toLowerCase();
			doNavToURL(vURL);
		} // end if
	}

} // doIFaceClick_Reset()

function doIFaceClick_Answer(vLayer) {

	var isNorm;
	eval("isNorm = v" + vLayer + "State")
	if (isNorm != "Disabled") {

		vTemplate = top.Content.vGTemplate
		vLayout = top.Content.vGLayout

		temp = vTemplate + "_" + vLayout

		switch(temp) {
		case "p003_1":
			showLayer('p003TextArea2')
			break;

		default:

			vDataArray = top.Content.vGPopUpWindows.split("|")
			AnswerW = vDataArray[0];
			AnswerH = vDataArray[1];
			AnswerURL = vDataArray[2];
			ReferenceW = vDataArray[3];
			ReferenceH = vDataArray[4];
			ReferenceURL = vDataArray[5];
			ScriptW = vDataArray[6];
			ScriptH = vDataArray[7];
			ScriptURL = vDataArray[8];

			var vAnswerURL = "../answers/" + AnswerURL;
			winAtts = "toolbar=0,menubar=0,scrollbars=0,resizable=0,status=1,location=0,directories=0,copyhistory=0,height=" + AnswerH + ",width=" + AnswerW + ",left=0,top=0";

			// Updated Code to handle the window focus issues
			if (!top.vGTOPAnswerWinOpen){
				top.vGTOPAnswerWinOpen = true;
				AnswerWindow = window.open(vAnswerURL,"AnswerWindow",winAtts)
				return;
			}
			if (!AnswerWindow || AnswerWindow.closed){
				top.vGTOPAnswerWinOpen = true;
				AnswerWindow = window.open(vAnswerURL,"AnswerWindow",winAtts)
			}else{
				AnswerWindow.focus();
			}

			break;
		}
	}

} // doIFaceClick_Answer()

function doIFaceClick_Script(vLayer) {

	var isNorm;
	eval("isNorm = v" + vLayer + "State")
	if (isNorm != "Disabled") {

		vDataArray = top.Content.vGPopUpWindows.split("|")
		AnswerW = vDataArray[0];
		AnswerH = vDataArray[1];
		AnswerURL = vDataArray[2];
		ReferenceW = vDataArray[3];
		ReferenceH = vDataArray[4];
		ReferenceURL = vDataArray[5];
		ScriptW = vDataArray[6];
		ScriptH = vDataArray[7];
		ScriptURL = vDataArray[8];

		var vAnswerURL = "../scripts/" + ScriptURL;
		winAtts = "toolbar=0,menubar=0,scrollbars=0,resizable=0,status=1,location=0,directories=0,copyhistory=0,height=" + ScriptH + ",width=" + ScriptW + ",left=0,top=0";

		// Updated Code to handle the window focus issues
		if (!top.vGTOPScriptWinOpen){
			top.vGTOPScriptWinOpen = true;
			ScriptWindow = window.open(vAnswerURL,"ScriptWindow",winAtts)
			return;
		}
		if (!ScriptWindow || ScriptWindow.closed){
			top.vGTOPScriptWinOpen = true;
			ScriptWindow = window.open(vAnswerURL,"ScriptWindow",winAtts)
		}else{
			ScriptWindow.focus();
		}
	}

} // doIFaceClick_Script()
function doIFaceClick_Map(vLayer) {

	var isNorm;
	eval("isNorm = v" + vLayer + "State")
	if (isNorm != "Disabled") {

		// if the is the unit map screen go to the mod map
		// else go to the unit map
		if ((top.Content.vGTemplate.toLowerCase() == "unmap") || (top.Content.vGTemplate.toLowerCase() == "ttext")) {
			confirmLevelThenGotoModMap()
		} else {
			if (getCurrentExercise(top.vCurScreenID) == "test") {
				vPass = "false"
				vLeaveTest = "false"
				if (top.vCurScreenID =='1_test100') { vPass = "true" }
				if (top.vCurScreenID =='2_test100') { vPass = "true" }
				if (top.vCurScreenID =='3_test100') { vPass = "true" }
				if (top.vCurScreenID =='4_test100') { vPass = "true" }
				if (top.vCurScreenID =='5_test100') { vPass = "true" }
				if (top.vCurScreenID =='6_test100') { vPass = "true" }
				
				if (vPass == "false") {
					vLeaveTest = "false"
					vResult = confirm(top.vConfigLeaveTestConfirmation)

					if (vResult == true) {
						vLeaveTest = "true"
					} else {
						return;
					}
				} else {
					vLeaveTest = "true"
				}
			} else {
				vLeaveTest = "true"
			} // end if
		
			if (vLeaveTest = "true") {
				vBackState = "Disabled";
				updateFrameLayer("Nav","Back", top.BackButton.vHTML_Disabled);

				vNextState = "Normal";
				top.updateFrameLayer("Nav","Next", top.NextButton.vHTML_Normal);
				
				// May 25th Ling Request for the Map button to goto the Map screen
				if (top.vConfigMaptoUnit == "true") {
					confirmLevelThenGotoModMap()
				} else {
					confirmLevelThenGotoModMap()
				}
	
			}
		}
	}

} // doIFaceClick_Map()

function doIFaceClick_Exit(vLayer){
	var isNorm;
	eval("isNorm = v" + vLayer + "State")
	if (isNorm != "Disabled") {

		if (confirm(top.vConfigExitConfirmation) == true) {
			top.window.close()
		} // end if
	}

} // doIFaceClick_Exit()

function doIFaceClick_Next(vLayer){

	var isNorm;
	eval("isNorm = v" + vLayer + "State")
	if (isNorm != "Disabled") {

		var vURL = top.Content.vGNxtPG.toLowerCase();
		var ThisEx = getCurrentExercise(top.vCurScreenID)
		doJumpNextEx = false;
		var okToLoadNextScreen = true;		// in the test you can be prevented from loading the next screen

		// if a test question update the score array
		vGTemplate = top.Content.vGTemplate
		
		// 14 Mar: The requirement has been changed to test  
		//if ((vGTemplate == "tta01") || (vGTemplate == "ttb01") || (vGTemplate == "ttc01")) {
		//	okToLoadNextScreen = SetTestScore()
		//} // end if

		if (vGTemplate == "ttext") {
			//top.window.location = "modulemap.html"
			confirmLevelThenGotoModMap();
		}
		if ((vGTemplate == "tta01") || (vGTemplate == "ttb01") || (vGTemplate == "ttc01")) {
			vMsg = top.vConfirmGoToNextQuestion
			okToLoadNextScreen = confirm(vMsg)
			if (okToLoadNextScreen == true) {
				// if the user goes to the next screen then save the score for this screen
				SetTestScore()
			}
		} // end if

		if (okToLoadNextScreen == true) {
			if (vURL == top.vThisModule + "_" + ThisEx + "0") {
				doJumpNextEx = true;
			} // end if

			if (doJumpNextEx == true) {
				greyFunctionBar(ThisEx);
				vURL = findNextEx(ThisEx);
			} // end if

			if (vURL != "0"){
				setWindowLoadingStatus(vURL);
				doNavToURL(vURL);
				if (doJumpNextEx == true) {
					top.grey_AllSectionNamesOnNavBar();
				} // end if
			} // end if
		} // end if
	}

} // doIFaceClick_Next()

function doIFaceClick_Back(vLayer){

	var isNorm;
	eval("isNorm = v" + vLayer + "State")
	if (isNorm != "Disabled") {

		var vURL = top.Content.vGPrvPG.toLowerCase();
		var ThisEx = getCurrentExercise(top.vCurScreenID)
		
		doJumpPrevEx = false;
		if (vURL == top.vThisModule + "_" + ThisEx + "0") {
			doJumpPrevEx = true;
		} // end if

		if (doJumpPrevEx == true) {
			greyFunctionBar(ThisEx);
			grey_AllSectionNamesOnNavBar();
			vURL = findPrevEx(ThisEx);
		} // end if

		if (vURL != "0"){
			setWindowLoadingStatus(vURL);
			doNavToURL(vURL);
		} // end if
	}

} // doIFaceClick_Back()

function findPrevEx(ThisEx) {

	switch(ThisEx) {
	case "meaning":
		vResult = top.vThisModule + "_meaning" + top.vExLastScreen_meaning;
		break;
	case "accuracy":
		vResult = top.vThisModule + "_meaning" + top.vExLastScreen_meaning;
		break;
	case "practice":
		vResult = top.vThisModule + "_accuracy" + top.vExLastScreen_accuracy;
		break;
	case "review":
		vResult = top.vThisModule + "_practice" + top.vExLastScreen_practice;
		break;
	case "listening":
		vResult = top.vThisModule + "_review" + top.vExLastScreen_review;
		break;
	case "speaking":
		vResult = top.vThisModule + "_listening" + top.vExLastScreen_listening;
		break;
	case "t":
		vResult = top.vThisModule + "_speaking" + top.vExLastScreen_speaking;
		break;
	case "test":
		vResult = top.vThisModule + "_speaking" + top.vExLastScreen_speaking;
		break;
	default:
		vResult = "not defined yet: " + vLetter
	}

	return vResult

}

function findNextEx(ThisEx) {

	switch(ThisEx) {
	case "meaning":
		vResult = top.vThisModule + "_accuracy100"
		break;
	case "accuracy":
		vResult = top.vThisModule + "_practice100"
		break;
	case "practice":
		vResult = top.vThisModule + "_review100"
		break;
	case "review":
		vResult = top.vThisModule + "_listening100"
		break;
	case "listening":
		vResult = top.vThisModule + "_speaking100"
		break;
	case "speaking":
		vResult = top.vThisModule + "_test100"
		break;
	case "t":
		vResult = top.vThisModule + "_test100"
		break;
	default:
		vResult = "not defined yet: " + vLetter
	}
	return vResult

}

var IESubVersion = 1000;
	
function BrowserLocal(pIn) {

	if (IESubVersion == 1000) {
	//	vVer = navigator.appVersion
	//	vData = vVer.split(";")
	//	vData2 = vData[1].split(".")
	//	IESubVersion = vData2[1];
		
		vVersion = navigator.appVersion;
		temp = vVersion.split(";");
		IESubVersion = 0
		if (temp[1] == " MSIE 5.5") {
			 // Define this is the correct version IE
			IESubVersion = 5
		}
		if (temp[1] == " MSIE 6.0") {//apply the ie5.5 hotwords fix to ie 6.0

			 // Define this is the correct version IE
			IESubVersion = 5
		}

	}


	if (IESubVersion == 5) {
		return "a" + pIn
	} else {
		return pIn
	} // end if
} // BrowserLocal
function doNavToURL(vURL){

	vURL = BrowserLocal(vURL)
	top.Content.location = vURL.toLowerCase() + ".html";

} // doNavToURL()

function setWindowLoadingStatus(vURL){

	vLoadTime = new Date().getTime();

	vMsg = top.vConfigLoadingStatusMsg + vURL;
	window.status = vMsg;

} // setWindowLoadingStatus()

function LinkScreen(vScreen) {

	// This function called when a user clicks on part of the sign post nav bar
	//top.grey_AllSectionNamesOnNavBar();
	//initFunctionBar()

	vScreen = top.vThisModule + "_" + vScreen.toLowerCase()
	if (getCurrentExercise(top.vCurScreenID) == "test") {
		vPass = "false"
		if (top.vCurScreenID =='1_test100') { vPass = "true" }
		if (top.vCurScreenID =='2_test100') { vPass = "true" }
		if (top.vCurScreenID =='3_test100') { vPass = "true" }
		if (top.vCurScreenID =='4_test100') { vPass = "true" }
		if (top.vCurScreenID =='5_test100') { vPass = "true" }
		if (top.vCurScreenID =='6_test100') { vPass = "true" }
		
		if (vPass == "false") {
			vResult = confirm(top.vConfigLeaveTestConfirmation)
			if (vResult == true) {
				initFunctionBar()
				doNavToURL(vScreen)
			}
		} else {
			initFunctionBar()
			doNavToURL(vScreen)	
		}
	} else {
		initFunctionBar()
		doNavToURL(vScreen)
	} // end if


} // LinkScreen()

/******************************************************************
	Pan Template Functions
******************************************************************/
function ShowHotword(vWord) {

	alert(vWord)

} // ShowHotword()

function PlayAudio(vFile){

	if (vFile == 0) {
		vFile = top.vConfigWrongSound
	}
	if (vFile == 1) {
		vFile = top.vConfigRightSound
	}

	// MD: 15 Apr - Added functionality to control if the correct / incorrect sounds should override main audio
	if (top.vConfigEnableSmartAudio == "true") {
		if ((vFile == top.vConfigWrongSound) || (vFile == top.vConfigRightSound)) {
			vPlayState = top.Invisib.vPlugIn.PlayState;
			if ((vPlayState == 1) || (vPlayState == 2) || (vPlayState == 3)){
				// do nothing audio playing
			} else {
				top.Invisib.playAudio(vFile);
			}
		} else {
			top.Invisib.playAudio(vFile);
		}
	} else {
		top.Invisib.playAudio(vFile);
	}

} // PlayAudio()

function swapImage_blackI(vID,vParent) {

	eval("isBlack = document.all.imageBI" + vID + ".src")
	ShowingBlack = isBlack.split("inline_blackcircle")

	if (ShowingBlack[1]) {
		temp = "document.all.imageBI" + vID + ".src = 'media/inline_emptycircle.gif'";
		temp1 = "top.Incorrect_" + vParent + "--"
	} else {
		temp = "document.all.imageBI" + vID + ".src = 'media/inline_blackcircle.gif'";
		temp1 = "top.Incorrect_" + vParent + "++"
	}
	eval(temp)
	eval(temp1);

} // swapImage_blackI()

function swapImage_blackC(vID,vParent) {

	eval("isBlack = document.all.imageBC" + vID + ".src")
	ShowingBlack = isBlack.split("inline_blackcircle")

	if (ShowingBlack[1]) {
		temp = "document.all.imageBC" + vID + ".src = 'media/inline_emptycircle.gif'";
		temp1 = "top.Correct_" + vParent + "--"
	} else {
		temp = "document.all.imageBC" + vID + ".src = 'media/inline_blackcircle.gif'";
		temp1 = "top.Correct_" + vParent + "++"
	}

	eval(temp)
	eval(temp1);

} // swapImage_blackC()

// This is a function to verify if the Flash Movie can call the JavaScript Engine
function JumpScreen(vID) {

	alert('Been asked to Jump by a Flash movie to:' + vID)

}

/******************************************************************
	Template Functions
******************************************************************/
function sys00_init() {

}

function fl001_init() {

	// 16 Apr - added to help Flash Load
	if (top.vConfigFlashUseImage != "none") {
		vData = top.vConfigFlashUseImage;
		vData = '<IMG BORDER=0 SRC="media/' + vData + '" HEIGHT=' + top.vConfigFlashImageH +' WIDTH=' + top.vConfigFlashImageW + ' ALT=' + vData + '>';
		vLayer = 'fl001FlashImageLoad';
		if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }
	}

	if (top.Content.vGLayout != '2'){

		vData = top.Content.fl001TextHTML;
		vLayer = 'fl001TextArea1';
		if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

		vData = top.Content.fl001Text2HTML;
		vLayer = 'fl001TextArea2';
		if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }
	}

	vData = "media/" + top.Content.fl001FlashFileName;
	vLayer = 'fl001FlashArea';

	if (top.Content.vGLayout == '0'){
		vLayerWidthOnThisTemplate = 350;
		vLayerHeightOnThisTemplate = 335;
	}
	if (top.Content.vGLayout == '1'){
		vLayerWidthOnThisTemplate = 629;
		//vLayerHeightOnThisTemplate = 315;
		vLayerHeightOnThisTemplate = 364;	// May 1st new size of flash area			
	}
	if (top.Content.vGLayout == '2'){
		vLayerWidthOnThisTemplate = 629;
		vLayerHeightOnThisTemplate = 403;	//May 3rd edit to new size.was 370;
	}
	if (top.Content.vGLayout == '4'){
		vLayerWidthOnThisTemplate = 629;
		vLayerHeightOnThisTemplate = 383;	//May 3rd edit to new size.was 335;
	}

	vFullData = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0" WIDTH=' + vLayerWidthOnThisTemplate + ' HEIGHT=' + vLayerHeightOnThisTemplate + '><PARAM NAME=movie VALUE="' + vData + '"><PARAM NAME=play VALUE=true><PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=#FFFFFF><EMBED src="' + vData + '" quality=high play=true bgcolor=#FFFFFF WIDTH=' + vLayerWidthOnThisTemplate + ' HEIGHT=' + vLayerHeightOnThisTemplate + ' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED></OBJECT>'

	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vFullData) }

} // fl001_init()

function p001_init() {

	vData = top.Content.p001TextHTML1;
	vLayer = 'P001TextArea1';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.p001TextHTML2;
	vLayer = 'P001TextArea2';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	//if (top.Content.vGLayout == '0'){
	//	hideLayer('P001TextArea1')
	//}
	if ((top.Content.vGLayout == '0')) {
		vData = top.Content.p001ImageFileName;
		vData = '<IMG BORDER=0 SRC="media/' + vData + '" HEIGHT=328 WIDTH=629>';
		vLayer = 'p001ImageArea';
		if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }
	}
	if ((top.Content.vGLayout == '1')) {
		vData = top.Content.p001ImageFileName;
		vData = '<IMG BORDER=0 SRC="media/' + vData + '" HEIGHT=336 WIDTH=629>';
		vLayer = 'p001ImageArea';
		if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }
	}

} // p001_init()

function tta01_init() {

	top.vGtta01NbrCorrect = 0;
	top.vGtta01NbrWrong = 0;

	vData = top.Content.tta01TextHTML1;
	vLayer = 'tta01TextArea1';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.tta01TextHTML2;
	vLayer = 'tta01TextArea2';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.tta01ImageFileName;
	vData = '<IMG BORDER=0 SRC="media/' + vData + '" HEIGHT=336 WIDTH=629>';
	vLayer = 'tta01ImageArea';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }


} // tta01_init()

var vttb01_Scr1 = 0;
var vttb01_Scr2 = 0;
var vttb01_Scr3 = 0;

function ttb01_init() {

	vData = top.Content.ttb01TextHTML1;
	vLayer = 'ttb01TextArea1';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.ttb01TextHTML2;
	vLayer = 'ttb01TextArea2';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.ttb01TextHTML3;
	vLayer = 'ttb01TextArea3';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.ttb01TextHTML4;
	vLayer = 'ttb01TextArea4';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.ttb01TextHTML5;
	vLayer = 'ttb01TextArea5';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.ttb01TextHTML6;
	vLayer = 'ttb01TextArea6';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.ttb01ImageFileName;
	vData = '<IMG BORDER=0 SRC="media/' + vData + '" HEIGHT=336 WIDTH=629>';
	vLayer = 'ttb01ImageArea';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	top.vttb01_Scr1 = 0;
	top.vttb01_Scr2 = 0;
	top.vttb01_Scr3 = 0;

} // ttb01_init()

function ttb01ScoreDown(vID) {

	if (vID == 1) {
		if (top.vttb01_Scr1 == 1) {
			top.vttb01_Scr1 = 0
		} // end if
	} // end if

	if (vID == 2) {
		if (top.vttb01_Scr2 == 1) {
			top.vttb01_Scr2 = 0
		} // end if
	} // end if

	if (vID == 3) {
		if (top.vttb01_Scr3 == 1) {
			top.vttb01_Scr3 = 0
		} // end if
	} // end if

} // ttb01ScoreDown()

function ttb01ScoreUp(vID) {

	if (vID == 1) {
		if (top.vttb01_Scr1 == 0) {
			top.vttb01_Scr1 = 1
		} // end if
	} // end if

	if (vID == 2) {
		if (top.vttb01_Scr2 == 0) {
			top.vttb01_Scr2 = 1
		} // end if
	} // end if

	if (vID == 3) {
		if (top.vttb01_Scr3 == 0) {
			top.vttb01_Scr3 = 1
		} // end if
	} // end if

} // ttb01ScoreUp()

function resetTest() {
	
	vTestTotalCorrect = 0;
	vTestTotalWrong = 0;
	
	vGQuestionCount = 0;
	
}
function ttent_init() {

	resetTest();
	vData = top.Content.ttentTextHTML1;
	vLayer = 'ttentTextArea1';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }
	hideLayer('ttentTextArea1')

	vData = top.Content.ttentTextHTML2;
	vLayer = 'ttentTextArea2';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }
	hideLayer('ttentTextArea2')

	vData = top.Content.ttentImageFileName;
	vData = '<IMG BORDER=0 SRC="media/' + vData + '" HEIGHT=412 WIDTH=629>';
	vLayer = 'ttentImageArea';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }


} // ttent_init()

function ttext_init() {

	// MMD: Aug 21 - the interface buttons are disabled
	// initScreen_setDisableNav();
	vData = top.Content.ttextTextHTML1;
	vLayer = 'ttextTextArea1';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.ttextTextHTML2;
	vLayer = 'ttextTextArea2';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	// Commented Out 17 May
	//vData = top.Content.ttextImageFileName;
	//vData = '<IMG BORDER=0 SRC="media/' + vData + '" HEIGHT=227 WIDTH=436>';
	//vLayer = 'ttextImageArea';
	//if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	// Added New 17 May
	// vData = top.Content.ttentImageFileName;
	vData = top.Content.ttextImageFileName
	
	vData = '<IMG BORDER=0 SRC="media/' + vData + '" HEIGHT=412 WIDTH=629>';
	vLayer = 'ttextImageArea';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }
	vData = "<B><CENTER><FONT COLOR=BLUE SIZE=4>" + computeScore(true) + "</FONT></B></CENTER>"
	vLayer = 'ttextScore';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	if (vThisModule == 5) {
		// this is the last assessment in the module
		// check to see if you should increase the Lingurama Level
		// *** need to compare this to a level and decide to increase?
		// alert(top.getStudentLevelFromCookie())
	}

	// call to check the users level
	ContentTimerID = setInterval("checkUserLevel()",1000);

} // ttext_init()

function checkUserLevel() {

	clearInterval(ContentTimerID);
	if (vEnableTracking == "true") {	
		var vURL = vGetLevelURL + "?Student_ID=" + top.vCurUserLogon
		if (vEnableTrackingDebug == "true") {
			vMsg = "debug" + vCRLF
			vMsg += "About to collect the user level from to this URL:" + vURL;
			alert(vMsg)
		}
		top.frmLMS.location = vURL;
	} else {
		initScreen_setNavButtons();
	} // end if

} // end checkUserLevel()

function computeScore(vRetAsStr) {

	// this function returns the score for the test.  If vRetAsStr is true then the return value has the percent symbol added

	var vNbrQuestionsCorrect = 0;
	var vPercent;
	var vRoundPercentage = true;		// if true then round the percentage

	vMDTotalQuestions = (top.vTestTotalCorrect + top.vTestTotalWrong)
	vMDPercent = ((top.vTestTotalCorrect / vMDTotalQuestions) * 100)
	vMDPercent = Math.round(vMDPercent)

	saveScoreToLMS(vMDPercent)

	// Reset everything incase they have a second attempt
	// MD: 25 May 2001
	if (top.Content.vGTemplate.toLowerCase() != "ttent") {
		for (h=1;h < (top.vGQuestionCount + 1);h++) {
			top.vGScoreArray[h] = false
		}
	}
	resetTest();

	if (vRetAsStr == true) {
		return (vMDPercent + "%")
	} else {
		return vMDPercent
	} // end if

} // end computeScore()

/******************************************************************
	Start of the LMS functions
******************************************************************/
function SetStudentLevel(vLevel) {

	if (top.vEnableTracking == "true") {
		if (top.vEnableTrackingDebug == "true") {
			alert("Alma LMS tells us to set user level to " + vLevel)
		} // end if
		
		top.vCurUserLevel = convertLevel(vLevel);
		vCurUserLevel = convertLevel(vLevel);
		setStudentLevelToCookie(vCurUserLogon, vLevel)
		initScreen_setNavButtons()
	}

}

function confirmLevelThenGotoModMap() {

	// 23 June - Lingurama changed the definition of the map button
	// if now functions based on level
	
	var vLevel = top.vCurUserLevel
	if ((vLevel == "") || (vLevel == null)) {
		vLevel = vCurUserLevel;
	} // end if

	var userID = top.vCurUserLogon
	if ((userID == "") || (userID == null)) {
		userID = vCurUserLogon;
	} // end if
	if ((userID == "") || (userID == null)) {
		userID = getStudentNameFromCookie();
	} // end if

	vURL = "../course" + convertLevel(top.getStudentLevelFromCookie()) + "/modulemap.html" + "?Student_ID=" + userID + "&LevelNo=" + vLevel
	top.window.location = vURL
}

function openUnitIndex() {
	var vURL = vCompletedUnitURL + "?Student_ID=" + top.vCurUserLogon;
	winAtts = "toolbar=0,menubar=0,scrollbars=1,resizable=1,status=1,location=0,directories=0,copyhistory=0,height=" + vCompletedUnitWindowHeight + ",width=" + vCompletedUnitWindowWidth + ",left=0,top=0";

	if (vEnableTrackingDebug == "true") {
		vMsg = "debug" + vCRLF
		vMsg += "Opening completed unit window on this URL:" + vURL
		alert(vMsg)
	}
		
	// Updated Code to handle the window focus issues
	if (!top.vGTOPCompletedUnitWinOpen){
		top.vGTOPCompletedUnitWinOpen = true;
		CompleteUnitWindow = window.open(vURL,"CompleteUnitWindow",winAtts)
		return;
	}
	if (!CompleteUnitWindow || CompleteUnitWindow.closed){
		top.vGTOPCompletedUnitWinOpen = true;
		CompleteUnitWindow = window.open(vURL,"CompleteUnitWindow",winAtts)
	}else{
		CompleteUnitWindow.focus();
	}

}

function openCompletedTests() {

	if (vEnableTracking == "true") {

		var vURL = vCompletedTestURL + "?Student_ID=" + top.vCurUserLogon;
		winAtts = "toolbar=0,menubar=0,scrollbars=1,resizable=1,status=1,location=0,directories=0,copyhistory=0,height=" + vCompletedTestWindowHeight + ",width=" + vCompletedTestWindowWidth + ",left=0,top=0";

		if (vEnableTrackingDebug == "true") {
			vMsg = "debug" + vCRLF
			vMsg += "Opening completed test window on this URL:" + vURL
			alert(vMsg)
		}
		
		// Updated Code to handle the window focus issues
		if (!top.vGTOPCompletedTestWinOpen){
			top.vGTOPCompletedTestWinOpen = true;
			CompleteWindow = window.open(vURL,"CompleteWindow",winAtts)
			return;
		}
		if (!CompleteWindow || CompleteWindow.closed){
			top.vGTOPCompletedTestWinOpen = true;
			CompleteWindow = window.open(vURL,"CompleteWindow",winAtts)
		}else{
			CompleteWindow.focus();
		}
	}
}

function saveScoreToLMS(vScore) {

	if (vEnableTracking == "true") {
		var userID = top.vCurUserLogon
		if ((userID == "") || (userID == null)) {
			userID = vCurUserLogon;
		} // end if
		if ((userID == "") || (userID == null)) {
			userID = getStudentNameFromCookie();
		} // end if

		var vURL = vSaveScoreURL + "?Student_ID=" + userID + "&Course_ID=" + getUniqueModuleID() + "&Score=" + vScore

		if (vEnableTrackingDebug == "true") {
			vMsg = "debug" + vCRLF
			vMsg += "About to save the score to this URL:" + vURL;
			alert(vMsg)
		}
		top.frmLMS.location = vURL;
	}
}

function getUniqueModuleID() {

	if ((top.vConfigCourseNbr == "1") || (top.vConfigCourseNbr == 1)) {
		if (top.vThisModule == "1") { vResult = 1 };
		if (top.vThisModule == "2") { vResult = 2 };
		if (top.vThisModule == "3") { vResult = 3 };
		if (top.vThisModule == "4") { vResult = 4 };
		if (top.vThisModule == "5") { vResult = 5 };
	}
	if ((top.vConfigCourseNbr == "2") || (top.vConfigCourseNbr == 2)) {
		if (top.vThisModule == "1") { vResult = 6 };
		if (top.vThisModule == "2") { vResult = 7 };
		if (top.vThisModule == "3") { vResult = 8 };
		if (top.vThisModule == "4") { vResult = 9 };
		if (top.vThisModule == "5") { vResult = 10 };
	}
	if ((top.vConfigCourseNbr == "3") || (top.vConfigCourseNbr == 3)) {
		if (top.vThisModule == "1") { vResult = 11 };
		if (top.vThisModule == "2") { vResult = 12 };
		if (top.vThisModule == "3") { vResult = 13 };
		if (top.vThisModule == "4") { vResult = 14 };
		if (top.vThisModule == "5") { vResult = 15 };
	}
	if ((top.vConfigCourseNbr == "4") || (top.vConfigCourseNbr == 4)) {
		if (top.vThisModule == "1") { vResult = 16 };
		if (top.vThisModule == "2") { vResult = 17 };
		if (top.vThisModule == "3") { vResult = 18 };
		if (top.vThisModule == "4") { vResult = 19 };
		if (top.vThisModule == "5") { vResult = 20 };
	}
	if ((top.vConfigCourseNbr == "5") || (top.vConfigCourseNbr == 5)) {
		if (top.vThisModule == "1") { vResult = 21 };
		if (top.vThisModule == "2") { vResult = 22 };
		if (top.vThisModule == "3") { vResult = 23 };
		if (top.vThisModule == "4") { vResult = 24 };
		if (top.vThisModule == "5") { vResult = 25 };
	}
	if ((top.vConfigCourseNbr == "6") || (top.vConfigCourseNbr == 6)) {
		if (top.vThisModule == "1") { vResult = 26 };
		if (top.vThisModule == "2") { vResult = 27 };
		if (top.vThisModule == "3") { vResult = 28 };
		if (top.vThisModule == "4") { vResult = 29 };
		if (top.vThisModule == "5") { vResult = 30 };
	}

	return vResult;

}

function ttsub_init() {

	vData = top.Content.ttsubTextHTML1;
	vLayer = 'ttsubTextArea1';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.ttsubTextHTML2;
	vLayer = 'ttsubTextArea2';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.ttsubImageFileName;
	vData = '<IMG BORDER=0 SRC="media/' + vData + '" HEIGHT=336 WIDTH=629>';
	vLayer = 'ttsubImageArea';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

} // ttsub_init()


function P001Answer() {

	alert('this will open the answer window to compare')

}

function p002_init() {

	vData = top.Content.p002HTML1;
	vLayer = 'p002TextArea1';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.p002ImageFileName;

	if (top.Content.vGLayout == '0'){
		vData = '<IMG BORDER=0 SRC="media/' + vData + '" HEIGHT=350 WIDTH=335>';
	}
	if (top.Content.vGLayout == '1'){
		vData = '<IMG BORDER=0 SRC="media/' + vData + '" HEIGHT=350 WIDTH=335>';
	}
	if (top.Content.vGLayout == '2'){
		//hideLayer('p002TextArea1')
		//hideLayer('p002TextArea2')
		vData = '<IMG BORDER=0 SRC="media/' + vData + '" HEIGHT=338 WIDTH=635>';
	}
	if (top.Content.vGLayout == '3'){
		vData = '<IMG BORDER=0 SRC="media/' + vData + '" HEIGHT=325 WIDTH=629>';
	}
		

	if (top.Content.vGLayout != '4'){
		vLayer = 'p002ImageArea';
		if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

		hideLayer('p002TextArea1')
	}

	vData = top.Content.p002HTML2;
	vLayer = 'p002TextArea2';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	if (top.Content.vGLayout == '4'){
		vData = top.Content.p002HTML3;
		vLayer = 'p002TextArea3';
		if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }
	}


} // p002_init()

function Trim(str) {
	return RTrim(LTrim(str));
}

function LTrim(str) {

	var whitespace = new String(" \t\n\r");
	var s = new String(str);
	if (whitespace.indexOf(s.charAt(0)) != -1) {
         
	var j=0, i = s.length;
	while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
        	j++;
                    s = s.substring(j, i);
	}
	return s;
}

function RTrim(str) {

	var whitespace = new String(" \t\n\r");
	var s = new String(str);
	if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
        	var i = s.length - 1;       // Get length of string
		while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
                        i--;
	                    s = s.substring(0, i+1);
                }

                return s;
         
}

function p002_2Answer() {

	var i = 0;
	var vAnyWrong = false;
	var vFeedbackLayer = "p002Feedback";

	do {
		eval("vThisObject = top.Content.document.all.AssessedInputArea" + i)
		i ++;
		if (vThisObject) {
			vUserAnswer = removePunctation(vThisObject.value);
			vThisCorrect = vThisObject.CORRECT.toLowerCase();
			if (vUserAnswer == vThisCorrect) {
				vThisObject.style.color = "blue"
			} else {
				vThisObject.style.color = top.vConfigIncorrectColour;
				vAnyWrong = true;
			} // end if
		} // end if
	} while (vThisObject)

	if (vAnyWrong == true) {
		updateLayer(vFeedbackLayer,top.frameset_vDefaultInCorrectText)
	} else {
		updateLayer(vFeedbackLayer,top.frameset_vDefaultCorrectText)			
	} // end if
	showLayer(vFeedbackLayer)

} // p002_2Answer()

function p003_init() {

	vData = top.Content.p003TextHTML1;
	vLayer = 'p003TextArea1';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.p003TextHTML2;
	vLayer = 'p003TextArea2';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.p003TextHTML3;
	vLayer = 'p003TextArea3';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.p003TextHTML4;
	vLayer = 'p003TextArea4';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	if (top.Content.vGLayout == '1'){
		// hideLayer('p003ImageArea');
		hideLayer('p003TextArea2');
		//hideLayer('placeholder')
	} else {
		vData = top.Content.p003ImageFileName;
		vData = '<IMG BORDER=0 SRC=media/' + vData + '>';
		vLayer = 'p003ImageArea';
		if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }
	}

} // p003_init()

function p003Answer() {

	showLayer('p003TextArea2');

} // p003Answer()

function p004_init() {

	if (top.Content.vGLayout == "0") {

		vData = top.Content.p004Text1HTML;
		vLayer = 'P004TextArea1';
		if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

		// TOP LEFT
		vData = top.Content.p004Text2HTML;
		vLayer = 'P004TextArea2';
		if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }
		vData = top.Content.p004Text3HTML;
		vLayer = 'P004TextArea3';
		if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

		// TOP RIGHT
		vData = top.Content.p004Text9HTML;
		vLayer = 'P004TextArea9';
		if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }
		vData = top.Content.p004Text10HTML;
		vLayer = 'P004TextArea10';
		if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }


		// BOTTOM LEFT
		vData = top.Content.p004Text4HTML;
		vLayer = 'P004TextArea4'
		if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }
		vData = top.Content.p004Text5HTML;
		vLayer = 'P004TextArea5';
		if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

		// NOTHING
		vData = top.Content.p004Text6HTML;
		vLayer = 'P004TextArea6';
		if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

		// BOTTOM RIGHT
		vData = top.Content.p004Text7HTML;
		vLayer = 'P004TextArea7';
		if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }
		vData = top.Content.p004Text8HTML;
		vLayer = 'P004TextArea8';
		if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }



		top.Incorrect_P004TextArea3 = 0;
		top.Incorrect_P004TextArea5 = 0;
		top.Incorrect_P004TextArea8 = 0;
		top.Incorrect_P004TextArea10 = 0;
		top.Correct_P004TextArea3 = 0;
		top.Correct_P004TextArea5 = 0;
		top.Correct_P004TextArea8 = 0;
		top.Correct_P004TextArea10 = 0;
	} else {
		vData = top.Content.p004Text1HTML;
		vLayer = 'P004TextArea1';
		if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

		vData = top.Content.p004Text2HTML;
		vLayer = 'P004TextArea2';
		if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

		vData = top.Content.p004Text3HTML;
		vLayer = 'P004TextArea3';
		if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

		vData = top.Content.p004Text4HTML;
		vLayer = 'P004TextArea4';
		if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

		vData = top.Content.p004Text5HTML;
		vLayer = 'P004TextArea5';
		if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

		vData = top.Content.p004Text6HTML;
		vLayer = 'P004TextArea6';
		if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }
	}


	top.vP004Score1 = 0; // 1 = correct, 0 = incorrect
	top.vP004Score2 = 0
	top.vP004Score3 = 0
	top.vP004Score4 = 0

} // p004_init()

var vP004Score1 = 0; // 1 = correct, 0 = incorrect
var vP004Score2 = 0
var vP004Score3 = 0
var vP004Score4 = 0
function P004ScoreDown(vID) {
	// this is the new radio button code

	if (vID == 1) {
		if (top.vP004Score1 == 1) {
			top.vP004Score1 = 0
		} // end if
	} // end if

	if (vID == 2) {
		if (top.vP004Score2 == 1) {
			top.vP004Score2 = 0
		} // end if
	} // end if

	if (vID == 3) {
		if (top.vP004Score3 == 1) {
			top.vP004Score3 = 0
		} // end if
	} // end if

	if (vID == 4) {
		if (top.vP004Score4 == 1) {
			top.vP004Score4 = 0
		} // end if
	} // end if

} // P004ScoreDown(vID)

function P004ScoreUp(vID) {
	// this is the new radio button code

	if (vID == 1) {
		if (top.vP004Score1 == 0) {
			top.vP004Score1 = 1
		} // end if
	} // end if

	if (vID == 2) {
		if (top.vP004Score2 == 0) {
			top.vP004Score2 = 1
		} // end if
	} // end if

	if (vID == 3) {
		if (top.vP004Score3 == 0) {
			top.vP004Score3 = 1
		} // end if
	} // end if

	if (vID == 4) {
		if (top.vP004Score4 == 0) {
			top.vP004Score4 = 1
		} // end if
	} // end if

} // P004ScoreUp(vID)

function p004Answer() {

	vScore = 0;
	vHTML = "<P CLASS=RINCORRECT><B>The following are incorrect: "
	vHTMLGood = top.Content.vGStdCorrect;
	vCorrCnt = 0;

	if (top.vP004Score1 == 1) {
		vScore++;
	} else {
		if (vCorrCnt == 0) {
			vHTML += "1";
			vCorrCnt++;
		} else {
			vHTML += ", 1"
		}
	} // end if

	if (top.vP004Score4 == 1) {
		vScore++;
	} else {
		if (vCorrCnt == 0) {
			vHTML += "2";
			vCorrCnt++;
		} else {
			vHTML += ", 2"
		}
	} // end if


	// 18 Mar - swapped this about due to Lingurama requirement on scoring
	if (top.vP004Score2 == 1) {
		vScore++;
	} else {
		if (vCorrCnt == 0) {
			vHTML += "3";
			vCorrCnt++;
		} else {
			vHTML += ", 3"
		}
	} // end if

	if (top.vP004Score3 == 1) {
		vScore++;
	} else {
		if (vCorrCnt == 0) {
			vHTML += "4";
			vCorrCnt++;
		} else {
			vHTML += ", 4"
		}
	} // end if

	if (vScore == 4) {
		vOUT = vHTMLGood
	} else {
		vOUT = vHTML + ".</B></P>"
	} // end if

	showLayer('P004TextArea6')
	updateLayer('P004TextArea6',vOUT) //vHTML

} // p004Answer()

function iq001_init() {

	vData = top.Content.vGPrompt;
	vLayer = 'ScreenPrompt';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.iq001ImageArea;

	if (top.Content.vGLayout == "0") {
		vData = '<IMG BORDER=0 SRC="media/' + vData + '" HEIGHT=344 WIDTH=335>';
	}
	if (top.Content.vGLayout == "1") {
		vData = '<IMG BORDER=0 SRC="media/' + vData + '" HEIGHT=323 WIDTH=640>';
	}

	vLayer = 'iq001ImageArea';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.iq001_TextAboveSpeechBubble;
	vLayer = 'iq001TextAboveSpeechBubble';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.iq001_QuestionPreText;
	vLayer = 'iq001QuestionPreText';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.iq001_SpeechBubleText;
	vLayer = 'iq001SpeechBubleText';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	// Lingurama need this removed as part of the Big Font Solution
	vData = top.Content.iq001_Option1;
	//vData = '<A HREF="#" ONCLICK="iq001Feedback(1)"' + vData + '</A>'
	vLayer = 'iq001Option1';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	//vReplace = '<A ID=ii'+i+' NAME=ii'+i+' HREF=JavaScript:DisplayFeedback(0,'+i+') CLASS=RINCORRECT>'
	vData = top.Content.iq001_Option2;
	//vData = '<A HREF="#" ONCLICK="iq001Feedback(2)"' + vData + '</A>'
	vLayer = 'iq001Option2';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.iq001_Option3;
	//vData = '<A HREF="#" ONCLICK="iq001Feedback(3)"' + vData + '</A>'
	vLayer = 'iq001Option3';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.iq001_Feedback1;
	vLayer = 'iq001Feedback1';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.iq001_Feedback2;
	vLayer = 'iq001Feedback2';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.iq001_Feedback3;
	vLayer = 'iq001Feedback3';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	hideLayer('iq001Feedback1');
	hideLayer('iq001Feedback2');
	hideLayer('iq001Feedback3');

} // iq001_init()

function nullf(){
}
function ShowDetails(vLayerID,vAudio) {
	iq001Feedback(vLayerID,vAudio)
}
function iq001Feedback(vLayerID,vAudio) {

	hideLayer('iq001Feedback1');
	hideLayer('iq001Feedback2');
	hideLayer('iq001Feedback3');

	vLayerID = "iq001Feedback" + vLayerID;
	showLayer(vLayerID)
	PlayAudio(vAudio)

} // iq001Feedback()

function iq002_init() {

	vData = top.Content.iq002HTML1;
	vLayer = 'iq002TextArea1';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.iq002ImageFileName;
	vData = '<IMG BORDER=0 SRC="media/' + vData + '" HEIGHT=310 WIDTH=640>';
	vLayer = 'iq002ImageArea';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.iq002HTML2;
	vLayer = 'iq002TextArea2';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }
	if (top.Content.vGLayout == "0") {
		hideLayer('iq002TextArea1')
	}
} // iq002_init()

function iq002Answer() {

	vIncorrectColour = top.vConfigIncorrectColour;
	vIncorrectStyle = top.vConfigIncorrectStyle;
	vCorrectColour = top.vConfigCorrectColour;
	vCorrectStyle = top.vConfigCorrectStyle;

	var i = 0;
	var vAnyWrong = false;
	var NbrAssessedInputTypes = 6;
	// 1 Aug 2001 - put this into a nested loop - taking 7 KB off file size.	
	for (h=0;h<NbrAssessedInputTypes;h++) {
		i = 0;
		do {
			eval("vThisObject = top.Content.document.all.AssessedInputArea" + h + i)
			i ++;
			if (vThisObject) {

				vUserAnswer = removePunctation(vThisObject.value);
				vThisCorrect = vThisObject.CORRECT.toLowerCase();
				// vThisCorrect is a list - convert to an array and test
				vThisCorrectList = vThisCorrect.split("|")

				if ((vUserAnswer == vThisCorrectList[0]) || (vUserAnswer == vThisCorrectList[1]) || (vUserAnswer == vThisCorrectList[2]) || (vUserAnswer == vThisCorrectList[3]) || (vUserAnswer == vThisCorrectList[4]) || (vUserAnswer == vThisCorrectList[5]) || (vUserAnswer == vThisCorrectList[6]) || (vUserAnswer == vThisCorrectList[7]) || (vUserAnswer == vThisCorrectList[8])|| (vUserAnswer == vThisCorrectList[9]) || (vUserAnswer == vThisCorrectList[10])  || (vUserAnswer == vThisCorrectList[11]) || (vUserAnswer == vThisCorrectList[12]) || (vUserAnswer == vThisCorrectList[13]) || (vUserAnswer == vThisCorrectList[14]) || (vUserAnswer == vThisCorrectList[15]) || (vUserAnswer == vThisCorrectList[16]) || (vUserAnswer == vThisCorrectList[17]) || (vUserAnswer == vThisCorrectList[18]) || (vUserAnswer == vThisCorrectList[19]) || (vUserAnswer == vThisCorrectList[20]) ) {
					vThisObject.style.color = vCorrectColour;
					vThisObject.style.fontStyle = vCorrectStyle;
				} else {
					vThisObject.style.color = vIncorrectColour;
					vThisObject.style.fontStyle = vIncorrectStyle;
					vAnyWrong = true;
				} // end if
			} // end if
		} while (vThisObject)
	}
	
	if (vAnyWrong == true) {
		updateLayer("iq002Feedback",top.Content.vGStdInCorrect)
	} else {
		updateLayer("iq002Feedback",top.Content.vGStdCorrect)
	} // end if
	showLayer("iq002Feedback")

} // iq002Answer()

function ttc01_init() {

	vData = top.Content.ttc01HTML1;
	vLayer = 'ttc01TextArea1';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.ttc01ImageFileName;
	vData = '<IMG BORDER=0 SRC="media/' + vData + '" HEIGHT=310 WIDTH=640>';
	vLayer = 'ttc01ImageArea';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.ttc01HTML2;
	vLayer = 'ttc01TextArea2';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }
		
} // ttc01_init()

function ttc01Answer() {

	vIncorrectColour = top.vConfigIncorrectColour;
	vIncorrectStyle = top.vConfigIncorrectStyle;
	vCorrectColour = top.vConfigCorrectColour;
	vCorrectStyle = top.vConfigCorrectStyle;

	var i = 0;
	var vAnyWrong = false;
	do {
		eval("vThisObject = top.Content.document.all.AssessedInputArea0" + i)
		i ++;
		if (vThisObject) {

			vUserAnswer = removePunctation(vThisObject.value);
			vThisCorrect = vThisObject.CORRECT.toLowerCase();
			// vThisCorrect is a list - convert to an array and test
			vThisCorrectList = vThisCorrect.split("|")
				
			if ((vUserAnswer == vThisCorrectList[0]) || (vUserAnswer == vThisCorrectList[1]) || (vUserAnswer == vThisCorrectList[2]) || (vUserAnswer == vThisCorrectList[3]) || (vUserAnswer == vThisCorrectList[4]) || (vUserAnswer == vThisCorrectList[5]) || (vUserAnswer == vThisCorrectList[6]) || (vUserAnswer == vThisCorrectList[7]) || (vUserAnswer == vThisCorrectList[8])|| (vUserAnswer == vThisCorrectList[9]) || (vUserAnswer == vThisCorrectList[10])  || (vUserAnswer == vThisCorrectList[11]) || (vUserAnswer == vThisCorrectList[12]) || (vUserAnswer == vThisCorrectList[13]) || (vUserAnswer == vThisCorrectList[14]) || (vUserAnswer == vThisCorrectList[15]) || (vUserAnswer == vThisCorrectList[16]) || (vUserAnswer == vThisCorrectList[17]) || (vUserAnswer == vThisCorrectList[18]) || (vUserAnswer == vThisCorrectList[19]) || (vUserAnswer == vThisCorrectList[20]) ) {
				vThisObject.style.color = vCorrectColour;
				vThisObject.style.fontStyle = vCorrectStyle;
			} else {
				vThisObject.style.color = vIncorrectColour;
				vThisObject.style.fontStyle = vIncorrectStyle;
				vAnyWrong = true;
			} // end if
		} // end if
	} while (vThisObject)

	var i = 0;
	do {
		eval("vThisObject = top.Content.document.all.AssessedInputArea1" + i)
		i ++;
		if (vThisObject) {

			vUserAnswer = removePunctation(vThisObject.value);
			vThisCorrect = vThisObject.CORRECT.toLowerCase();
			// vThisCorrect is a list - convert to an array and test
			vThisCorrectList = vThisCorrect.split("|")
				
			if ((vUserAnswer == vThisCorrectList[0]) || (vUserAnswer == vThisCorrectList[1]) || (vUserAnswer == vThisCorrectList[2]) || (vUserAnswer == vThisCorrectList[3]) || (vUserAnswer == vThisCorrectList[4]) || (vUserAnswer == vThisCorrectList[5]) || (vUserAnswer == vThisCorrectList[6]) || (vUserAnswer == vThisCorrectList[7]) || (vUserAnswer == vThisCorrectList[8])|| (vUserAnswer == vThisCorrectList[9]) || (vUserAnswer == vThisCorrectList[10])  || (vUserAnswer == vThisCorrectList[11]) || (vUserAnswer == vThisCorrectList[12]) || (vUserAnswer == vThisCorrectList[13]) || (vUserAnswer == vThisCorrectList[14]) || (vUserAnswer == vThisCorrectList[15]) || (vUserAnswer == vThisCorrectList[16]) || (vUserAnswer == vThisCorrectList[17]) || (vUserAnswer == vThisCorrectList[18]) || (vUserAnswer == vThisCorrectList[19]) || (vUserAnswer == vThisCorrectList[20]) ) {
				vThisObject.style.color = vCorrectColour;
				vThisObject.style.fontStyle = vCorrectStyle;
			} else {
				vThisObject.style.color = vIncorrectColour;
				vThisObject.style.fontStyle = vIncorrectStyle;
				vAnyWrong = true;
			} // end if
		} // end if
	} while (vThisObject)

	var i = 0;
	do {
		eval("vThisObject = top.Content.document.all.AssessedInputArea2" + i)
		i ++;
		if (vThisObject) {

			vUserAnswer = removePunctation(vThisObject.value);
			vThisCorrect = vThisObject.CORRECT.toLowerCase();
			// vThisCorrect is a list - convert to an array and test
			vThisCorrectList = vThisCorrect.split("|")
				
			if ((vUserAnswer == vThisCorrectList[0]) || (vUserAnswer == vThisCorrectList[1]) || (vUserAnswer == vThisCorrectList[2]) || (vUserAnswer == vThisCorrectList[3]) || (vUserAnswer == vThisCorrectList[4]) || (vUserAnswer == vThisCorrectList[5]) || (vUserAnswer == vThisCorrectList[6]) || (vUserAnswer == vThisCorrectList[7]) || (vUserAnswer == vThisCorrectList[8])|| (vUserAnswer == vThisCorrectList[9]) || (vUserAnswer == vThisCorrectList[10])  || (vUserAnswer == vThisCorrectList[11]) || (vUserAnswer == vThisCorrectList[12]) || (vUserAnswer == vThisCorrectList[13]) || (vUserAnswer == vThisCorrectList[14]) || (vUserAnswer == vThisCorrectList[15]) || (vUserAnswer == vThisCorrectList[16]) || (vUserAnswer == vThisCorrectList[17]) || (vUserAnswer == vThisCorrectList[18]) || (vUserAnswer == vThisCorrectList[19]) || (vUserAnswer == vThisCorrectList[20]) ) {
				vThisObject.style.color = vCorrectColour;
				vThisObject.style.fontStyle = vCorrectStyle;
			} else {
				vThisObject.style.color = vIncorrectColour;
				vThisObject.style.fontStyle = vIncorrectStyle;
				vAnyWrong = true;
			} // end if
		} // end if
	} while (vThisObject)

	var i = 0;
	do {
		eval("vThisObject = top.Content.document.all.AssessedInputArea3" + i)
		i ++;
		if (vThisObject) {

			vUserAnswer = removePunctation(vThisObject.value);
			vThisCorrect = vThisObject.CORRECT.toLowerCase();
			// vThisCorrect is a list - convert to an array and test
			vThisCorrectList = vThisCorrect.split("|")
				
			if ((vUserAnswer == vThisCorrectList[0]) || (vUserAnswer == vThisCorrectList[1]) || (vUserAnswer == vThisCorrectList[2]) || (vUserAnswer == vThisCorrectList[3]) || (vUserAnswer == vThisCorrectList[4]) || (vUserAnswer == vThisCorrectList[5]) || (vUserAnswer == vThisCorrectList[6]) || (vUserAnswer == vThisCorrectList[7]) || (vUserAnswer == vThisCorrectList[8])|| (vUserAnswer == vThisCorrectList[9]) || (vUserAnswer == vThisCorrectList[10])  || (vUserAnswer == vThisCorrectList[11]) || (vUserAnswer == vThisCorrectList[12]) || (vUserAnswer == vThisCorrectList[13]) || (vUserAnswer == vThisCorrectList[14]) || (vUserAnswer == vThisCorrectList[15]) || (vUserAnswer == vThisCorrectList[16]) || (vUserAnswer == vThisCorrectList[17]) || (vUserAnswer == vThisCorrectList[18]) || (vUserAnswer == vThisCorrectList[19]) || (vUserAnswer == vThisCorrectList[20]) ) {
				vThisObject.style.color = vCorrectColour;
				vThisObject.style.fontStyle = vCorrectStyle;
			} else {
				vThisObject.style.color = vIncorrectColour;
				vThisObject.style.fontStyle = vIncorrectStyle;
				vAnyWrong = true;
			} // end if
		} // end if
	} while (vThisObject)

	var i = 0;
	do {
		eval("vThisObject = top.Content.document.all.AssessedInputArea4" + i)
		i ++;
		if (vThisObject) {

			vUserAnswer = removePunctation(vThisObject.value);
			vThisCorrect = vThisObject.CORRECT.toLowerCase();
			// vThisCorrect is a list - convert to an array and test
			vThisCorrectList = vThisCorrect.split("|")
				
			if ((vUserAnswer == vThisCorrectList[0]) || (vUserAnswer == vThisCorrectList[1]) || (vUserAnswer == vThisCorrectList[2]) || (vUserAnswer == vThisCorrectList[3]) || (vUserAnswer == vThisCorrectList[4]) || (vUserAnswer == vThisCorrectList[5]) || (vUserAnswer == vThisCorrectList[6]) || (vUserAnswer == vThisCorrectList[7]) || (vUserAnswer == vThisCorrectList[8])|| (vUserAnswer == vThisCorrectList[9]) || (vUserAnswer == vThisCorrectList[10])  || (vUserAnswer == vThisCorrectList[11]) || (vUserAnswer == vThisCorrectList[12]) || (vUserAnswer == vThisCorrectList[13]) || (vUserAnswer == vThisCorrectList[14]) || (vUserAnswer == vThisCorrectList[15]) || (vUserAnswer == vThisCorrectList[16]) || (vUserAnswer == vThisCorrectList[17]) || (vUserAnswer == vThisCorrectList[18]) || (vUserAnswer == vThisCorrectList[19]) || (vUserAnswer == vThisCorrectList[20]) ) {
				vThisObject.style.color = vCorrectColour;
				vThisObject.style.fontStyle = vCorrectStyle;
			} else {
				vThisObject.style.color = vIncorrectColour;
				vThisObject.style.fontStyle = vIncorrectStyle;
				vAnyWrong = true;
			} // end if
		} // end if
	} while (vThisObject)

	var i = 0;
	do {
		eval("vThisObject = top.Content.document.all.AssessedInputArea5" + i)
		i ++;
		if (vThisObject) {

			vUserAnswer = removePunctation(vThisObject.value);
			vThisCorrect = vThisObject.CORRECT.toLowerCase();
			// vThisCorrect is a list - convert to an array and test
			vThisCorrectList = vThisCorrect.split("|")
				
			if ((vUserAnswer == vThisCorrectList[0]) || (vUserAnswer == vThisCorrectList[1]) || (vUserAnswer == vThisCorrectList[2]) || (vUserAnswer == vThisCorrectList[3]) || (vUserAnswer == vThisCorrectList[4]) || (vUserAnswer == vThisCorrectList[5]) || (vUserAnswer == vThisCorrectList[6]) || (vUserAnswer == vThisCorrectList[7]) || (vUserAnswer == vThisCorrectList[8])|| (vUserAnswer == vThisCorrectList[9]) || (vUserAnswer == vThisCorrectList[10])  || (vUserAnswer == vThisCorrectList[11]) || (vUserAnswer == vThisCorrectList[12]) || (vUserAnswer == vThisCorrectList[13]) || (vUserAnswer == vThisCorrectList[14]) || (vUserAnswer == vThisCorrectList[15]) || (vUserAnswer == vThisCorrectList[16]) || (vUserAnswer == vThisCorrectList[17]) || (vUserAnswer == vThisCorrectList[18]) || (vUserAnswer == vThisCorrectList[19]) || (vUserAnswer == vThisCorrectList[20]) ) {
				vThisObject.style.color = vCorrectColour;
				vThisObject.style.fontStyle = vCorrectStyle;
			} else {
				vThisObject.style.color = vIncorrectColour;
				vThisObject.style.fontStyle = vIncorrectStyle;
				vAnyWrong = true;
			} // end if
		} // end if
	} while (vThisObject)
	if (vAnyWrong == true) {
		updateLayer("iq002Feedback",top.Content.vGStdInCorrect)
	} else {
		updateLayer("iq002Feedback",top.Content.vGStdCorrect)
	} // end if
	showLayer("iq002Feedback")

} // ttc01Answer()

function iq003_init() {

	vData = top.Content.iq003HTML1;
	vLayer = 'iq003TextArea1';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.iq003ImageFileName;
	vData = '<IMG BORDER=0 SRC="media/' + vData + '" HEIGHT=147 WIDTH=629>';
	vLayer = 'iq003ImageArea';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.iq003HTML2;
	vLayer = 'iq003TextArea2';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

} // iq003_init()

function iq004_init() {

	vData = top.Content.iq004HTML1;
	vLayer = 'iq001Option1';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.iq004HTML2;
	vLayer = 'iq001Option2';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.iq004HTML3;
	vLayer = 'iq001Option3';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.iq004HTML4;
	vLayer = 'iq001Option4';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.iq004HTML5;
	vLayer = 'iq001Option5';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.iq004HTML6;
	vLayer = 'iq001Option6';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.iq004HTML7;
	vLayer = 'iq001Option7';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.iq004HTML8;
	vLayer = 'iq001Option8';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.iq004HTML9;
	vLayer = 'iq001Option9';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.iq004ImageFileName;
	vData = '<IMG BORDER=0 SRC="media/' + vData + '" HEIGHT=289 WIDTH=629>';
	vLayer = 'iq004Image';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.iq004FB1;
	vLayer = 'iq001FB1';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.iq004FB2;
	vLayer = 'iq001FB2';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.iq004FB3;
	vLayer = 'iq001FB3';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.iq004FB4;
	vLayer = 'iq001FB4';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.iq004FB5;
	vLayer = 'iq001FB5';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.iq004FB6;
	vLayer = 'iq001FB6';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.iq004FB7;
	vLayer = 'iq001FB7';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.iq004FB8;
	vLayer = 'iq001FB8';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.iq004FB9;
	vLayer = 'iq001FB9';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

} // iq004_init()

function iq004Answer(vDataLayer,vAudio) {

	vTemp = "iq001FB" + vDataLayer;
	showLayer(vTemp);
	PlayAudio(vAudio);

} // iq004Answer()

function tf001_init() {

	// Init the True False Template

	// Init the 10 options
	for (h=1;h<11;h++) {
		eval("vData = top.Content.tf001HTML" + h)
		eval("vLayer = 'tf001Option" + h + "'")
		if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }
	}

	// Init the 5 feedback
	for (h=1;h<6;h++) {
		eval("vData = top.Content.tf001HTMLFB" + h)
		eval("vLayer = 'tf001FB" + h + "'")
		if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }
	}

	// Init the image
	vData = top.Content.tf001ImageFileName;
	vData = '<IMG BORDER=0 SRC="media/' + vData + '" HEIGHT=339 WIDTH=629>';
	vLayer = 'tf001Image';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.tf001Audio;
	vLayer = 'tf001Audio';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

} // tf001_init()

function showTFLayer(vID) {
	// this function local to the TF001 template
	showLayer("tf001FB" + vID)
}

function tt001_init() {

	vData = top.Content.tt001HeadingTextHTML;
	vLayer = 'tt001TextArea1';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.tt001RubricTextHTML;
	vLayer = 'tt001TextArea2';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.tt001Question1HTML;
	vLayer = 'tt001TextArea3';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.tt001Question2HTML;
	vLayer = 'tt001TextArea4';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.tt001Question3HTML;
	vLayer = 'tt001TextArea5';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.tt001InstructionHTML;
	vLayer = 'tt001TextArea6';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

} // tt001_init()

function tt002_init() {

	vData = top.Content.tt002HeadingTextHTML;
	vLayer = 'tt002TextArea1';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.tt002RubricTextHTML;
	vLayer = 'tt002TextArea2';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.tt002Question1HTML;
	vLayer = 'tt002TextArea3';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.tt002InstructionHTML;
	vLayer = 'tt002TextArea4';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

} // tt002_init()

function tt003_init() {

	vData = top.Content.tt003HeadingTextHTML;
	vLayer = 'tt003TextArea1';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.tt003RubricTextHTML;
	vLayer = 'tt003TextArea2';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.tt003Question1HTML;
	vLayer = 'tt003TextArea3';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.tt003InstructionHTML;
	vLayer = 'tt003TextArea4';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

} // tt003_init()

function tt004_init() {

	vData = top.Content.tt004HeadingTextHTML;
	vLayer = 'tt004TextArea1';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.tt004RubricTextHTML;
	vLayer = 'tt004TextArea2';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.tt004Question1HTML;
	vLayer = 'tt004TextArea3';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.tt004InstructionHTML;
	vLayer = 'tt004TextArea4';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vData = top.Content.tt004Image;
	vData = '<IMG BORDER=0 SRC="media/' + vData + '" HEIGHT=140 WIDTH=629>';
	vLayer = 'tt004ImageArea';
	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

} // tt004_init()

/////////////////////////////
// THIS IS THE ORDERING TEMPLATE CODE
/////////////////////////////
var vGiq006List = new Array()

var viq006Alpha = new Array()
viq006Alpha[0] = "a"
viq006Alpha[1] = "b"
viq006Alpha[2] = "c"
viq006Alpha[3] = "d"
viq006Alpha[4] = "e"
viq006Alpha[5] = "f"
viq006Alpha[6] = "g"
viq006Alpha[7] = "h"

var viq006RandomList = new Array()
var viq006UserInput = new Array()
var viq006RestartList = new Array()
var viq006RestartAlpha  = new Array()
var viq006Answer = new Array()
var viq006ArraySize = 0

function iq006_init() {

	vData = top.Content.iq006Image1;
	vData = '<IMG BORDER=0 SRC="media/' + vData + '" HEIGHT=326 WIDTH=280>';
	vLayer = 'iq006ImageArea1';
	updateLayer(vLayer,vData)

	vData = top.Content.iq006Image2;
	vData = '<IMG BORDER=0 SRC="media/' + vData + '" HEIGHT=326 WIDTH=280>';
	vLayer = 'iq006ImageArea2';
	updateLayer(vLayer,vData)


	vData = top.Content.iq006Audio;
	vLayer = 'iq006Audio';
	updateLayer(vLayer,vData)

	if (vData.toLowerCase() != "none") { updateLayer(vLayer,vData) }

	vRanLimit = 5
	viq006ArraySize = 0

	// determin the array size by looking for values that are not = none
	// the old code "viq006ArraySize = top.Content.viq006List.length" may not work under NS,  
	for (h=0;h<9;h++) {
		if (top.Content.viq006List[h] != 'none'){
			if (top.Content.viq006List[h] != '</FONT>'){
				viq006ArraySize++
			}
		}
	} // end for
	viq006ArraySize--
		
	for (h=0;h<viq006ArraySize;h++) {
		vGiq006List[h] = top.Content.viq006List[h]
	} // end for

	//Initialise (and Randomise) the Answers.
	for (h=0;h<viq006ArraySize;h++) {
		viq006RandomList[h] = vGiq006List[h]
	} // end for

	for (h=0;h<vRanLimit;h++) {
		for (i=0;i<viq006ArraySize;i++) {
			vRandInt = parseInt((Math.random() * 10),0)
			if ((vRandInt < (viq006ArraySize)) && (vRandInt != 0)) {
				temp = viq006RandomList[i]
				viq006RandomList[i] = viq006RandomList[vRandInt]
				viq006RandomList[vRandInt] = temp
			} //end if
		} // end for
	} // end for

	for (h=0;h<viq006ArraySize;h++) {
		viq006RestartList[h] = viq006RandomList[h]
		viq006RestartAlpha[h] = viq006Alpha[h]
	} // end for

	// init the screen
	iq006_Restart();

} // end iq006_init()

/////Start from here when "Reset" clicked.
function iq006_Restart() {

	updateLayer("GeneralFB", "") // MD: 30 Apr - feedback to reset on clicking the reset button

	vConstMaxNbrOptions = 9

	// Initialise the Right Side
	for (i=0;i<viq006ArraySize;i++) {
		if (vGiq006List[i]){

			// ST What are we initializing here
			viq006RandomList[h] = viq006RestartList[h]
			viq006Alpha[h] = viq006RestartAlpha[h]

			//if (viq006RandomList[i] != "</FONT>") {			
				// Looks like the init of the input areas
				// We may have issues here under NS
				// vHTML =  "<TABLE><TR><TD height=38><INPUT name=TextInput size=1 maxlength=1></INPUT></TD></TR></TABLE>"
			
				vHTML =  '<INPUT name=TextInput size=1 maxlength=1 style="HEIGHT: 22px; WIDTH: 20px"></INPUT>'
				vLayer = "iq006Output" + i
				updateLayer(vLayer, vHTML)
			
				
				// ST What are we initializing here
				vHTML = viq006RandomList[i] + "<BR>"
				vLayer = "iq006List"+i
				updateLayer(vLayer, vHTML)
				
				// ST What are we initializing here
				vHTML = viq006Alpha[i] + ". "
				vLayer = "iq006Alpha"+i
				updateLayer(vLayer, vHTML)
				
				// ST What are we initializing here
				vHTML = [i+1] + ". "
				vLayer = "iq006Number" +i
				updateLayer(vLayer, vHTML)
				
				// ST What are we initializing here
				vHTML = ""
				vLayer = "iq006RightList" +i
				updateLayer(vLayer, vHTML)

				//Look for the position of the first answer and fill in the first input box.
				if (viq006RandomList[i] == vGiq006List[0]){
					vFirstAnswer = viq006Alpha[i]
				} //end if
			//} // end if
		}//end if
	}//end for

	// Initialise the questions
	for (i=1;i<vConstMaxNbrOptions;i++) {
		//if (viq006RandomList[i] != "</FONT>") {
		if (vGiq006List[i]){
			eval("top.Content.document.iq006Output" + i + ".TextInput.value = '';")
		//} // end if
		} // end if
	}//end for

	// Display the first option in the first option area
	top.Content.document.iq006Output0.TextInput.value = vFirstAnswer;

} //end iq006_Restart()

/////////////////////////////


function iq006_Answer() {
//Change25apr to correct colour
		
	vScore = 0
	vCorrectColour = '#00cc33'
	vIncorrectColour = '#CC0033'

	// This is the code to remove double characters entered by the user
	for (i=0;i<viq006ArraySize;i++) {
		eval("vInputAnswerCurrent = top.Content.document.iq006Output" + i + ".TextInput.value.toLowerCase()")
		//vInputAnswerCurrent = e
		for (z=(i+1);z<viq006ArraySize;z++) {
			eval("vInputAnswer = top.Content.document.iq006Output" + z + ".TextInput.value.toLowerCase()")
			if (vInputAnswerCurrent == vInputAnswer) {
				eval("top.Content.document.iq006Output" + z + ".TextInput.value = 'X'")
			}
		} // end for
	} // end for

	for (i=0;i<viq006ArraySize;i++) {
		if (vGiq006List[i]){
			//Assign variable names to the user input values.
			eval("viq006UserInput[i] = top.Content.document.iq006Output" + i + ".TextInput.value.toLowerCase();");
		} //end if

		//Check Input Boxes
		for (h=0;h<viq006ArraySize;h++) {
			if (viq006RandomList[h] == vGiq006List[i]){
				viq006Answer[i] = viq006Alpha[h]
			}//end if
		}//end for

	}//end for

	//Assign correct answers to compare user input with, change font color to green\red if correct\incorrect. Change position in List.

	for (i=0;i<viq006ArraySize;i++) {
		if (viq006UserInput[i] == viq006Answer[i]) {

				vHTML = ""
				vHTML += vGiq006List[i]
				vLayer = "iq006RightList" + i
				updateLayer(vLayer, vHTML)

			if (vGiq006List[i]){

				// ST I have replaced you code with an update layer so easier to ID element
//change25apr to make correct answer bold
				vLayer = "iq006RightList" + i
				vHTML = '<B><FONT COLOR=' + vCorrectColour + '>' + vGiq006List[i] + '</B></FONT>'
				updateLayer(vLayer, vHTML)

				eval("top.Content.document.iq006Output" + i + ".TextInput.value = viq006UserInput[i];");
				vScore++

			}//end if
		}//end if
	}//end for

	outerloop:
	for (i=0;i<viq006ArraySize;i++) {
		innerloop:
		for (h=0;h<viq006ArraySize;h++) {
		 	if ((viq006UserInput[i] != viq006Answer[i]) && (viq006UserInput[i] != viq006Alpha[h])){

					vHTML = ""
					vHTML += ""
					vLayer = "iq006RightList" + i
					updateLayer(vLayer, vHTML)

				if (vGiq006List[i]){
					eval("top.Content.document.all.iq006List" + i +".innerHTML = viq006RandomList[i];");
					eval("top.Content.document.iq006Output" + i +".TextInput.value = '';");
				}//end if

			}//end if
		}//end for
	}//end for

	outerloop:
	for (i=0;i<viq006ArraySize;i++) {
		innerloop:
		for (h=0;h<viq006ArraySize;h++) {
			if ((viq006UserInput[i] != viq006Answer[i]) && (viq006UserInput[i] == viq006Alpha[h])) {
				vHTML = viq006RandomList[h]
				vLayer = "iq006RightList" + i
				updateLayer(vLayer, vHTML)

				if (vGiq006List[i]){

					// ST I have replaced you code with an update layer so easier to ID element
						
					vLayer = "iq006RightList" + i
					// vHTML = '<FONT COLOR=' + vIncorrectColour + '><B><I>' + viq006RandomList[h] + '</B></I></FONT>'
					vHTML = '<P CLASS=RINCORRECT><I><B>' + viq006RandomList[h] + '</I></P>'
					updateLayer(vLayer,vHTML)

					// NEED TO COME BACK TO THIS
					eval("top.Content.document.iq006Output" + i + ".TextInput.value = viq006UserInput[i];");
				}//end if

			}//end if
		}//end for
	}//end for

//Change25apr to bring back feedback
	if(vScore == viq006ArraySize){
		vHTML = top.Content.vGStdCorrect;
		updateLayer("GeneralFB", vHTML)
		
	}else{
		vHTML = top.Content.vGStdInCorrect;
		updateLayer("GeneralFB", vHTML)

	}//end if


}//end iq006_Answer()

/////////////////////////////
// THIS IS THE MATCHING TEMPLATE CODE
/////////////////////////////
var viq005Alpha = new Array()
viq005Alpha[0] = "a"
viq005Alpha[1] = "b"
viq005Alpha[2] = "c"
viq005Alpha[3] = "d"
viq005Alpha[4] = "e"
viq005Alpha[5] = "f"
viq005Alpha[6] = "g"
viq005Alpha[7] = "h"

var viq005FirstAnswer;
var viq005RandomList = new Array()
var viq005UserInput = new Array()
var viq005RestartList = new Array()
var viq005RestartAlpha  = new Array()
var viq005Answer = new Array()

var viq005ArraySize = 0

function iq005_init() {

	vData = top.Content.iq005Image1;
	vData = '<IMG BORDER=0 SRC="media/' + vData + '" HEIGHT=326 WIDTH=290>';
	vLayer = 'iq005ImageArea1';
	updateLayer(vLayer,vData)

	vData = top.Content.iq005Image2;
	vData = '<IMG BORDER=0 SRC="media/' + vData + '" HEIGHT=326 WIDTH=290>';
	vLayer = 'iq005ImageArea2';
	updateLayer(vLayer,vData)

	vData = top.Content.iq005Audio;
	vLayer = 'iq005Audio';
	updateLayer(vLayer,vData)

	vRanLimit = 5
	viq005ArraySize = 0
		
	// determin the array size by looking for values that are not = none
	// the old code "var viq005ArraySize = top.Content.viq005LeftList.length" may not work under NS,  
	for (h=0;h<9;h++) {
		if (top.Content.viq005LeftList[h] != 'none'){
			if (top.Content.viq005LeftList[h] != '</FONT>'){
				viq005ArraySize++
			}
		}
	} // end for
	viq005ArraySize--


	//Initialise (and Randomise) the Answers.

	for (h=0;h<viq005ArraySize;h++) {
		viq005RandomList[h] = top.Content.viq005List[h]
	} // end for

	for (h=0;h<vRanLimit;h++) {
		for (i=0;i<viq005ArraySize;i++) {
			vRandInt = parseInt((Math.random() * 10),0)
			if ((vRandInt < (viq005ArraySize)) && (vRandInt != 0)) {
				temp = viq005RandomList[i]
				viq005RandomList[i] = viq005RandomList[vRandInt]
				viq005RandomList[vRandInt] = temp
			} //end if
		} // end for
	} // end for

	for (h=0;h<viq005ArraySize;h++) {
		viq005RestartList[h] = viq005RandomList[h]
		//viq005RestartAlpha[h] = viq005Alpha[h] // 19Apr Update from ST
	} // end for

	iq005_Restart();

}//end init()


/////Start from here when "Reset" clicked.

function iq005_Restart() {

	updateLayer("GeneralFB", "") // MD: 30 Apr - feedback to reset on clicking the reset button

viq005Alpha[0] = "a";
viq005Alpha[1] = "b";
viq005Alpha[2] = "c";
viq005Alpha[3] = "d";
viq005Alpha[4] = "e";
viq005Alpha[5] = "f";
viq005Alpha[6] = "g";
viq005Alpha[7] = "h";	// 19Apr Update from ST

	for (h=0;h<viq005ArraySize;h++) {
		viq005RandomList[h] = viq005RestartList[h]
		//viq005Alpha[h] = viq005RestartAlpha[h] // 19Apr Update from ST
	} // end for

	for (h=0;h<viq005ArraySize;h++) {
		// 29 May - update from ST - changed from - if (top.Content.viq005List[(h + 1)]){
		if (top.Content.viq005List[(h)]){
			eval("top.Content.document.all.iq005List" + h + ".style.color='BLACK'")
		} // end if

	} // end for

	for (h=0;h<(viq005ArraySize);h++) {
		// initialise the input boxes
		if (top.Content.viq005List[(h)] != 'none'){
		if (top.Content.viq005List[(h)] != '</FONT>') {
			//vHTML = "<TABLE><TR><TD height=38><INPUT name=TextInput" + (h + 1) + " size=1 WIDTH=10 maxlength=1></TD></TR></TABLE>"
			vHTML = '<INPUT name=TextInput' + (h + 1) + ' SIZE=1 maxlength=1 style="HEIGHT: 22px; WIDTH: 20px">'
			updateLayer("iq005Output" + h, vHTML)

			vMDTemp = 'top.Content.document.iq005Output' + h + '.TextInput' + (h+1) + '.value = ""'
			eval(vMDTemp);

		} // end if
		} // end if
	} // end for

//	for (h=0;h<(viq005ArraySize+1);h++) {
//		if (top.Content.viq005List[h] != 'none'){
//			vMDTemp = 'top.Content.document.iq005Output' + h + '.TextInput' + (h+1) + '.value = ""'
//			eval(vMDTemp);
//		} // end if
//	} // end for


	///Initialise the questions
	for (h=0;h<viq005ArraySize;h++) {
		if (top.Content.viq005List[h] != 'none'){
		if (top.Content.viq005List[h] != '</FONT>'){
			vHTML = viq005RandomList[h] + "<BR>"
			updateLayer("iq005List"+h, vHTML)

			vHTML = top.Content.viq005Alpha[h] + ". "
			updateLayer("iq005Alpha"+h, vHTML)

			vHTML = top.Content.viq005LeftList[h] +  "<BR>"
			updateLayer("iq005LeftList"+h, vHTML)
				
			vHTML =  (h+1) + ". "
			updateLayer("iq005Number"+h, vHTML)
		} // end if
		} // end if
	} // end for

	//Look for the position of the first answer and fill in the first input box.
	for (h=0;h<viq005ArraySize;h++) {
		if (viq005RandomList[h] == top.Content.viq005List[0]){
			 viq005FirstAnswer = viq005Alpha[h]
		} //end if
	} //end for

	top.Content.document.iq005Output0.TextInput1.value = top.viq005FirstAnswer;

} // end Restart


/////////////////////////////
function iq005_Answer() {

	// This is the code to remove double characters entered by the user
	for (i=0;i<viq005ArraySize;i++) {
		eval("vInputAnswerCurrent = top.Content.document.iq005Output" + i + ".TextInput"+(i+1)+".value.toLowerCase()")
		//vInputAnswerCurrent = e
		for (z=(i+1);z<viq005ArraySize;z++) {
			eval("vInputAnswer = top.Content.document.iq005Output" + z + ".TextInput"+(z+1)+".value.toLowerCase()")
			if (vInputAnswerCurrent == vInputAnswer) {
				eval("top.Content.document.iq005Output" + z + ".TextInput"+(z+1)+".value = 'X'")
			}
		} // end for
	} // end for

	//Assign variable names to the user input values.
	for (h=0;h<viq005ArraySize;h++) {
		if (top.Content.viq005List[h]){
			eval("viq005UserInput["+h+"] = top.Content.document.iq005Output"+h+".TextInput"+(h+1)+".value.toLowerCase()");
		}
	} // end for

	vScore = 0

	//Assign correct answers to compare user input with, change font color to green\red if correct\incorrect. Change position in List.
	//Check Input Box 1

	for (i=0;i<viq005ArraySize;i++) {
		for (h=0;h<viq005ArraySize;h++) {
			if (viq005RandomList[h] == top.Content.viq005List[i]){
				viq005Answer[i] = viq005Alpha[h]
			}//end if
		}//end for
	}//end for

	for (counter=0;counter<viq005ArraySize;counter++) {
		
	if (viq005UserInput[counter] == viq005Answer[counter]) {

		for (h=0;h<viq005ArraySize;h++) {
			if (viq005RandomList[h] == top.Content.viq005List[counter]){
				vHTML = ""
				vHTML += top.Content.viq005List[counter]
				updateLayer("iq005List"+counter, vHTML)

				vHTML = ""
				vHTML += viq005Alpha[h] + ". "
				updateLayer("iq005Alpha"+counter, vHTML)

				vHTML = ""
				vHTML += viq005RandomList[counter]
				updateLayer("iq005List"+[h], vHTML)

				vHTML = ""
				vHTML += viq005Alpha[counter] + ". "
				updateLayer("iq005Alpha"+[h], vHTML)

				temp = viq005RandomList[counter]
				viq005RandomList[counter] = top.Content.viq005List[counter]
				viq005RandomList[h] = temp

				temp = viq005Alpha[counter]
				viq005Alpha[counter] = viq005Alpha[h]
				viq005Alpha[h] = temp
			}//end if
		}//end for

		if (top.Content.viq005List[counter]){
//Change25apr to font color				
			eval("top.Content.document.all.iq005List"+counter+".style.color='#00cc33'")
			eval("top.Content.document.all.iq005LeftList"+counter+".innerHTML = top.Content.viq005LeftList["+counter+"]")
			eval("top.Content.document.all.iq005List"+counter+".innerHTML = '<B>' + viq005RandomList["+counter+"]");
			eval("top.Content.document.iq005Output"+counter+".TextInput" + (counter+1)+ ".value = viq005UserInput["+counter+"]");
			vScore++
		}//end if


		}else if (viq005UserInput[counter] != viq005Answer[counter]) {

			for (h=0;h<viq005ArraySize;h++){

				if (viq005UserInput[counter] != viq005Alpha[h]){

					if (top.Content.viq005List[counter]){
						eval('top.Content.document.all.iq005List'+counter+'.style.color ="black"')
						eval("top.Content.document.all.iq005LeftList"+counter+".innerHTML = top.Content.viq005LeftList["+counter+"]");
						eval("top.Content.document.all.iq005List"+counter+".innerHTML = viq005RandomList["+counter+"]");
						eval('top.Content.document.iq005Output'+counter+'.TextInput'+(counter+1)+'.value = ""');
					}//end if

				}//end if
			}//end for

			for (h=0;h<viq005ArraySize;h++) {

				if (viq005UserInput[counter] == viq005Alpha[h]) {
					vHTML = viq005RandomList[h]
					updateLayer("iq005List"+counter, vHTML)

					vHTML = viq005Alpha[h] + ". "
					updateLayer("iq005Alpha"+counter, vHTML)

					vHTML = viq005RandomList[counter]
					updateLayer("iq005List"+[h], vHTML)

					vHTML = viq005Alpha[counter] + ". "
					updateLayer("iq005Alpha"+[h], vHTML)

					temp = viq005RandomList[h]
					viq005RandomList[h] = viq005RandomList[counter]
					viq005RandomList[counter] = temp

					temp = viq005Alpha[h]
					viq005Alpha[h] = viq005Alpha[counter]
					viq005Alpha[counter] = temp

					if (top.Content.viq005List[counter]){
						// eval('top.Content.document.all.iq005List'+counter+'.style.color = ' + top.vConfigIncorrectColour)
						// md2temp = 'top.Content.document.all.iq005LeftList' + counter + '.innerHTML = "<P CLASS=RINCORRECT><I>'+top.Content.viq005LeftList[counter]+'</I></P>"'
						// eval(md2temp);
						FBTemp = '<I>' + top.Content.viq005LeftList[counter] + '</I>'
						updateLayer("iq005LeftList" + counter, FBTemp)
							
						// eval('top.Content.document.all.iq005List'+counter+'.innerHTML = "<I>"+viq005RandomList['+counter+']+"</I>"');
						FBTemp = '<P CLASS=RINCORRECT><I><B>'+viq005RandomList[counter]+'</I></P>'
						updateLayer("iq005List" + counter, FBTemp)

						eval('top.Content.document.iq005Output'+counter+'.TextInput'+(counter+1)+'.value = viq005UserInput['+counter+']');
					}//end if

				}//end if
			}//end for
		}//end if
	} // end BIG for loop

//Change25apr to bring back feedback
	if(vScore == viq005ArraySize){
		vHTML = top.Content.vGStdCorrect;
		updateLayer("GeneralFB", vHTML)
		
	}else{
		vHTML = top.Content.vGStdInCorrect;
		updateLayer("GeneralFB", vHTML)

	}//end if

// only execute this code if this screen has the correct number of elements


}//end iq005_Answer()



function nullf(){

}
