if (typeof(ThisPage)=="undefined")
	ThisPage = new MlPage();

isFlv=false;
// if (ThisPage.getCookie("useflv")==1) isFlv=true;
// isFlv=true;  // FOR TESTING


if (ThisPage.getPassedParm("frame") == "no") textNoFrame=true;
	else textNoFrame=false;
var commonDate="092009";
var reflibEnabled=false;
var netlibrary=false;
var coursewareHandler = null;
var isAccessibilityWindow = (self.name.indexOf("acc_question_window") != -1 || self.name.indexOf("access_window") != -1);
var thisCourseDirectory;
var isCustom;
var skinDir;
var isDummies;
var allowCustomization;
var baseStyleDir;
var sharedImageDir;
var refWindow;
var wallpaperCode;
var internetSearchEnabled = true;
var allowAutoSearch;
var unitNum = 0;
var playPageAudio=false;
var lastSide=1;
var useBox = true; //box graphics
var isLoaded=false; // used to prevent pile-ups of keystrokes for navigation
var sidePics = ",sidethnk,side,sideabt,sideabt2,sidedoit,sidehelp,sidenav,sideobj,sidesumm,sidetry,"
var themeNum=parseInt(ThisPage.getPreference(PR_Theme));
var lastKey="";
var hasBeenSubmitted="no";
var isCorrect_tf;
var correctAnswer;
var qCommentUrl;
var simWindow=null; //sim window [object]
var activeXenabled = true;
var showPrintOnly=ThisPage.getPassedParm("printonly");
var isBsv = (crsAcronym.substring(0,2)=="v_" || self.name.indexOf("bsv") != -1);
var embedFrame=(pgTpl=="embedf");
var answersChecked=false; // to display msg that more than one is correct
var inDnoteEditor=(typeof(parent.parent.isDnote) != "undefined") ? true : false;
var printSim=( (typeof(showmeName) != "undefined" && showmeName != "") || pgTpl=="full_exploreit" || pgTpl.indexOf("doitpg") > -1 || pgTpl =="showme_only" ) ? true : false;
// Cliq pic vars
var fullGifName="";
var cliqW="";
var cliqH="";
var coords="";
var tCoords= "";
var cliqMap="";
var numCodeLines=0; // used for automatically numbering code lines
var instructionsShown=false; // click instructions for clickList, exploreit, etc.
var audioIsDone=false; // set to true after audio finishes
if (typeof(isPTest)=="undefined") isPTest=false;
var useJsDat=(typeof(jsDat) != "undefined" && jsDat) ? true : false;
var tfPrefix="";

var keyRegistry = new Object;
keyRegistry["A"] = "a";
keyRegistry["B"] = "b";
keyRegistry["C"] = "c";
keyRegistry["D"] = "d";
keyRegistry["E"] = "e";
keyRegistry["F"] = "f";
keyRegistry["G"] = "g";
keyRegistry["H"] = "h";
keyRegistry["I"] = "i";
keyRegistry["J"] = "j";
keyRegistry["K"] = "k";
keyRegistry["L"] = "l";
keyRegistry["M"] = "m";
keyRegistry["N"] = "n";
keyRegistry["O"] = "o";
keyRegistry["P"] = "p";
keyRegistry["Q"] = "q";
keyRegistry["R"] = "r";
keyRegistry["S"] = "s";
keyRegistry["T"] = "t";
keyRegistry["U"] = "u";
keyRegistry["V"] = "v";
keyRegistry["W"] = "w";
keyRegistry["X"] = "x";
keyRegistry["Y"] = "y";
keyRegistry["Z"] = "z";
// number keys currently don't do anything
keyRegistry["1"] = "1";
keyRegistry["2"] = "2";
keyRegistry["3"] = "3";
keyRegistry["4"] = "4";
keyRegistry["5"] = "5";
keyRegistry["6"] = "6";
keyRegistry["7"] = "7";
keyRegistry["8"] = "8";
keyRegistry["13"] = "enter";
keyRegistry["27"] = "escape";
keyRegistry["37"] = "left";
keyRegistry["39"] = "right";
keyRegistry["45"] = "minus";
keyRegistry["43"] = "plus";


//Set variables from course js file in course.htm
if (parent !=null && typeof(parent.crsTitle) != "undefined")
{
	courseJsWin=parent;
	crsTitle=courseJsWin.crsTitle;
	scoType=courseJsWin.scoType;
	courseHasSims=courseJsWin.courseHasSims;
	saHasSims=courseJsWin.saHasSims;
	saFlashSims=courseJsWin.saFlashSims;
	cQuestions=courseJsWin.cQuestions;
	saQuestions=courseJsWin.saQuestions;
	imageQuestions=courseJsWin.imageQuestions;
	d_crsTitle=courseJsWin.d_crsTitle;
	d_bookIsbn=courseJsWin.d_bookIsbn;
	d_curtain=courseJsWin.d_curtain;
	dummiesPath=courseJsWin.dummiesPath;
	simVersion=courseJsWin.simVersion;
	c_useTheme=courseJsWin.c_useTheme;
	c_sideWidth=courseJsWin.c_sideWidth;
	c_sideIndent=courseJsWin.c_sideIndent;
	c_logoGif=courseJsWin.c_logoGif;
	c_certificateWallpaper=courseJsWin.c_certificateWallpaper;
	c_omitLogoTpls=courseJsWin.c_omitLogoTpls;
	c_spaceBelowLogo=courseJsWin.c_spaceBelowLogo;
	c_logoHeight=courseJsWin.c_logoHeight;
	c_logoWidth=courseJsWin.c_logoWidth;
	ccMail=courseJsWin.ccMail;
	c_useEmailEvaluation=courseJsWin.c_useEmailEvaluation;
	imExerciseKey=courseJsWin.imExerciseKey;
	allowCertificate=courseJsWin.allowCertificate;
	showScores=courseJsWin.showScores;
	showSa=courseJsWin.showSa;
	hasStreamingAudio=courseJsWin.hasStreamingAudio;
	useCourseScoreTemplate=courseJsWin.useCourseScoreTemplate;
	evaluationEmail=courseJsWin.evaluationEmail;
	evaluationBody=courseJsWin.evaluationBody;
	evaluationCc=courseJsWin.evaluationCc
	audioVersion=courseJsWin.audioVersion;
	if (typeof(audioVersion)=="undefined") audioVersion="5";
	if (!isBsv)
	{
		unitTitles=courseJsWin.unitTitles;
		numberOfUnits=courseJsWin.numberOfUnits;
	}
	pgSequence=courseJsWin.pgSequence;
	showGlossary=courseJsWin.showGlossary;
	if (typeof(showGlossary)== "undefined") showGlossary=true;
	c_hideSearch=courseJsWin.c_hideSearch;
	c_useDefaultSkin=courseJsWin.c_useDefaultSkin;
	c_hidePrintButton=courseJsWin.c_hidePrintButton;
	c_verticalCenter=courseJsWin.c_verticalCenter;
	pgCount=courseJsWin.pgCount;
}

function init()
{

	if (isAccessibilityWindow ||
		(window.opener &&  typeof(top.window.opener) != "undefined" && typeof(top.window.opener.coursewareHandler) != "undefined"))
	{
		includeJs(sharedDirectory + "params/params.js");
		var params = null;
		if (typeof(window.opener) == "undefined" || typeof(window.opener.coursewareHandler) == "undefined")
		{
			var URL = window.location.href;
			var input = URL.split("?")[1];
			params = new Params();
			params.loadURLString(input);
			var makeCoursewareHandler = true;
			includeJs(sharedDirectory + "js/courseware.js");
		}
		else
			coursewareHandler = window.opener.coursewareHandler.cloneForContentWindow(self);
	}
	else if(parent.coursewareHandler)
		coursewareHandler = parent.coursewareHandler;

	if (coursewareHandler == null)
	{
		// include cid for building skin dir
		var courseFrameLocation=rootDir + "/course.htm?fullpg=" + escape(location.href);
		if (typeof(crsAcronym) != "undefined" && crsAcronym != "")
			courseFrameLocation += "&acro=" + crsAcronym;
		document.location.replace(courseFrameLocation);
		return;
	}

	if (coursewareHandler != null)
		coursewareHandler.onCoursePageInit();

	if (isScoSa()) includeJs(sharedDirectory +"js/skill.js"); // for js-driven sa
	if (typeof(crsAcronym)=="undefined")
	{
		crsAcronym=ThisPage.getAcro();
		if (crsAcronym=="")
		{
			showError(resStr.error_loadPageAcro);
			crsAcronym="di1";
		}
	}

	// special cases not to show the print sim button.
	if (typeof(crsAcronym) != "undefined" && "excl03,excl04,excl05,excl06,excl07,pwpt01,word09,".indexOf(crsAcronym)>-1) printSim=false;

	// Set allowCertificate=false if site does not allow certificates (set in special_cases.js)
	if (coursewareHandler.siteId != null && typeof(siteIdsNoCertificate) != "undefined" && siteIdsNoCertificate.indexOf("," + coursewareHandler.siteId + ",") > -1) allowCertificate=false;

	thisCourseDirectory = getCoursesDirectory(crsAcronym) + crsAcronym + "/";
	isCustom=(crsAcronym.substring(0,2)=="c_") ? true : false;
	isDummies = (crsAcronym.substring(0,2)=="d_") ? true : false;
	skinDir = ThisPage.getSkinDir(crsAcronym);
	allowCustomization = (!isDummies && !isCustom) ? true: false;
	useNewDesign = (coursewareHandler.useNewDesign && !isAccessibilityWindow) ? true: false;

	//set foobar skinDir
	//if (typeof(coursewareHandler.foobar.skinDir) != "undefined" && coursewareHandler.foobar.skinDir != skinDir) coursewareHandler.foobar.refresh;
	if (coursewareHandler.scoOnly)
	{
		if (currPage.indexOf("001") > -1) prevPage="";
		if (currPage.substring(2,3) != nextPage.substring(2,3)) nextPage="";
	}
	if (useNewDesign && !isBsv && !ThisPage.allowSA(crsAcronym)) useScoresTemplate="scores_course.htm";

	baseStyleDir = localizedSharedDirectory + "images/skins/" + skinDir + "/";
	if (isCustom && typeof(c_useDefaultSkin) == "undefined")
		baseStyleDir=thisCourseDirectory + "skin/";
	if (allowCustomization && typeof(parent.useCustomSkinDir) != "undefined" && parent.useCustomSkinDir)
		baseStyleDir = siteCustomDirectory + ThisPage.getCustomId() + "/";
	sharedImageDir = baseStyleDir + "images/"; //contains shared images, including wallpaper
	refWindow=document.referrer.toLowerCase();

	// Is this a TF course?
	if (typeof(coursewareHandler) !="undefined") isTfCourse=coursewareHandler.isTfCourse;
		else isTfCourse=false;
	if (isTfCourse) tfPrefix="tf_";
	
	if (typeof(pgType)=="undefined")
		pgType="content"; //content, question, pop

	// include crsAcronym.js file if it is not already embedded here or in parent
	if (typeof(AboutLinks)=="undefined" && crsAcronym != "" && !isBsv)
		includeJs(thisCourseDirectory+ crsAcronym+ ".js");
	// Embed page js file if pgJs is defined (e.g., var pgJs="ou041100.js";)
	if (typeof(pgJs) != "undefined") includeJs(thisCourseDirectory + pgJs);
	// Embed swfObject js for video on page
	if (isFlv && pgTpl=="videopg") includeJs("/dpec/shared/js/swfobject.js");


	if (typeof(scoType) == "undefined")
		scoType=resStr.Unit; // Unit or Lesson
	if (isDummies)
		ThisPage.setDummiesValues();

	//******************************* Set Background and Buttons *******************************************
	// Page transitions
	if (typeof(courseFlashActivities) == "undefined" || (courseFlashActivities.indexOf(nextPage.substring(0,nextPage.length-4)) ==-1 && courseFlashActivities.indexOf(prevPage.substring(0,prevPage.length-4)) ==-1) )
	{
		if (ThisPage.getPreference(PR_PageTransitions) == "1") document.write("<meta http-equiv=\"Page-Exit\" content=\"blendTrans(Duration=.2)\">");
			else document.write("<meta http-equiv=\"Page-Exit\" content=\"blendTrans(Duration=.02)\">");
	}
	if (!isAccessibilityWindow) // accessibility SA does not get wallpaper
	{
		// write the stylesheet, based on browser.
		ThisPage.writeCourseStylesheetHtml(skinDir);
		if (typeof(useCourseStyleSheet) != "undefined" && useCourseStyleSheet) document.write("<link rel=\"stylesheet\" href=\"" + thisCourseDirectory + "course_css.css\" type=\"text/css\">");
		// Write a BODY tag with the page color and wallpaper
		if (typeof(pgColor) == "undefined" || pgColor=="") pgColor = "#FFFFFF";
		if (typeof(wallpaper) == "undefined") wallpaper="";
		if(allowCustomization && typeof(parent.wallpaper) != "undefined") wallpaper=parent.wallpaper; //custom wallpaper
		wallpaperCode="";
		bodyProperites = " BGPROPERTIES=FIXED";
		if (typeof(c_bodyProperties) != "undefined") bodyProperites = c_bodyProperties;

		// if the wallpaper is the standard wallpapr.jpg, use the one in shared. if not, get it from the course directory.
		if (wallpaper.indexOf(".") > -1) wallpaperCode=" BACKGROUND=\""+ thisCourseDirectory + wallpaper + "\"" + bodyProperites;
		if (wallpaper.indexOf("/") > -1) wallpaperCode=" BACKGROUND=\""+ wallpaper + "\"" + bodyProperites;
		if (wallpaper == "wallpapr.jpg")
		{
			wallpaperCode=" BACKGROUND=\""+ sharedImageDir + wallpaper + "\"" + bodyProperites;
			if (useNewDesign) wallpaperCode=" BACKGROUND=\""+ sharedImageDir + "wallpapr_mlc.gif\"";
			if (pgTpl=="fs_asmnt_exam" || typeof(untiledWallpaper) != "undefined") wallpaperCode=" BACKGROUND=\""+ sharedImageDir +  "wallpapr_notile.jpg\" style=\"background-repeat: no-repeat;\"";
		}
		if (pgTpl=="scovie") wallpaperCode = wallpaperCode +" onLoad=\"getBullets()\"";
			else if (pgTpl.indexOf("_progress")>-1) wallpaperCode = wallpaperCode +" onload=\"fsLoadProgressiveData()\" onunload=\"hideProgressiveText()\"";
			else if (pgTpl=="task") wallpaperCode = wallpaperCode +" onload=\"initializeTask()\"";
		if (pgTpl.indexOf("fullcode") > -1) wallpaperCode = wallpaperCode +" onLoad=\"repaintDivs()\"";
		if (pgTpl.indexOf("flsize") > -1) wallpaperCode = wallpaperCode +" onLoad=\"loadFlsizePage()\"";
		if (pgTpl.indexOf("full_explore") > -1) wallpaperCode = wallpaperCode +" onLoad=\"loadExploreValues()\"";
		// else if (pgTpl.indexOf("full") > -1) wallpaperCode = wallpaperCode +" onLoad=\"hideFullText()\"";
		if (pgTpl=="doit" || pgTpl=="activity" || pgTpl=="showme") wallpaperCode = wallpaperCode +" onUnload=\"closeWin()\"";
		document.write("<BODY BGCOLOR=\""+ pgColor + "\"" + wallpaperCode +">");
		if (useJsDat) document.write("<iframe id=saveScores style=\"display:none\" height=300 width=600></iframe>");
	}

	if (pgTpl=="cliqvwp") c_scrollToFdbk=true;
	if(!embedFrame) document.write("<span id=\"pgText\">"); // for clipboard copy
	if (!isAccessibilityWindow && typeof(c_verticalCenter) != "undefined" && typeof(noVerticalCenter)=="undefined" && currPage != "video.htm") document.write ("<table height='100%' width='100%' cellpadding=0 cellspacing=0><tr><td valign=center align=left>");

	// Foobar type and Running head
	if (typeof(pgBBar) == "undefined") 	pgBBar="";
	if (pgTpl=="pretest" || pgTpl=="posttest" || isPTest) pgBBar="pretest";
	if (showPrintOnly=="1") pgBBar="printonly";
	if (coursewareHandler.useFsStyle && pgTpl.indexOf("fs_asmnt")>-1) pgBBar="assessment";
	if (coursewareHandler.useFsStyle) omitNotes=true; // remove notes feature from fs style courses.

	// custom comments editor
	if (inDnoteEditor && pgBBar !="bk") pgBBar="pgonly";
	if (typeof(runningHead) == "undefined") runningHead = "";
	if (pgTpl=="congrats" || pgTpl=="mastery") runningHead="You've Reached the End of the Course";
	if (!isDummies && typeof(parent.showCustomButton) != "undefined" && parent.showCustomButton) addButton("custom");

	//******************************* End Background and Button code *******************************************
	//******************************* Embed auto_search js if preference is set *******************************************
	if (typeof(coursewareHandler) != "undefined" && typeof(coursewareHandler.internetSearchEnabled) != "undefined")
		internetSearchEnabled=coursewareHandler.internetSearchEnabled;
	if (coursewareHandler && typeof(coursewareHandler.reflibEnabled) != "undefined")
		reflibEnabled=coursewareHandler.reflibEnabled;
	if (coursewareHandler && typeof(coursewareHandler.netlibrary) != "undefined")
		netlibrary=coursewareHandler.netlibrary;
	noSearchTpls="help,seqdrop,fs_asmnt,fs_asmnt_exam,fsmenu,fs_orientation,actchoice,actmatch,";
	allowAutoSearch=(!embedFrame && pgType != "preferences" && noSearchTpls.indexOf(pgTpl)==-1 && !isAccessibilityWindow && !isBsv  && parseInt(ThisPage.getPreference(PR_AutoSearch)) != 0 && !inDnoteEditor && parent.name.indexOf("quiz") == -1 && typeof(noAutoSearch) == "undefined")? true:false;
	if (allowAutoSearch)
	{
		if (!useNewDesign || typeof(positionAutoSearch) != "undefined" || (pgTpl.indexOf("wpos") == -1 && pgTpl != "clicklist"))
		{
			document.write("<DIV ID=\"overDivFull\" STYLE=\"position:absolute; visibility:hide; z-index:25;\" onClick='closeAutoSearchBox()'></DIV>");
			includeJs(sharedDirectory +"js/overlib_full.js");
			includeJs(sharedDirectory +"js/auto_search.js");
			if (reflibEnabled)
			{
				includeJs(sharedDirectory + "params/params.js");
				includeJs(sharedDirectory + "launchlob/launchlob.js");
			}
		}
	}

	// get the unit number
	if (typeof(currPage) != "undefined")
	{
		unitNum = "0abcdefghijklmnopqrstuvwxyz".indexOf(currPage.substring(2, 3)); //a=1
		if (unitNum==-1) unitNum = 0;
	}
	else if (typeof(pgUnit) != "undefined")
	{
		var whereUnit=pgUnit.indexOf(" ")
		unitNum= parseInt(pgUnit.substring(whereUnit + 1,whereUnit + 3));
		if (isNaN(unitNum)) unitNum = 0;
	}
	if (typeof(parent.themeNum)!="undefined") themeNum=parent.themeNum;
	if (isCustom) themeNum=99;
	if (typeof(c_useTheme)!="undefined") themeNum=c_useTheme;
	if (isDummies) themeNum=10;
	if (isNaN(themeNum)) themeNum=0;

	switch (themeNum)
	{
		case 1: //techno
			numSideGifs=47;
			break;
		case 2: //space
			numSideGifs=38;
			break;
		case 3: //art
			numSideGifs=30;
			break;
		case 4: //textures
			numSideGifs=42;
			break;
		case 5: //nature
			numSideGifs=29;
			break;
		case 9: //none
			numSideGifs=0;
			break;
		case 10: //dummies
			sidePics="";
			break;
		case 99: //custom
			sidePics="";
			break;
		default:
			numSideGifs=48;
	}

	if (useNewDesign)
	{
		themeNum=0;
		numSideGifs=1;
	}

	if (typeof(c_numSideGifs) != "undefined") numSideGifs=c_numSideGifs;
	if (allowCustomization && typeof(parent.numSideGifs)!="undefined" && typeof(parent.embeddedPages) == "undefined")
	{
		useCustomSides=true;
		numSideGifs = parent.numSideGifs;
		themeNum = 0;
	}
	else
		useCustomSides=false;

	if (coursewareHandler && typeof(coursewareHandler.lastSidePicture) != "undefined")
		lastSide=coursewareHandler.lastSidePicture;

//*********************************** Audio ***********************************
	// Streaming Flash Audio
	if (typeof(hasStreamingAudio) == "undefined" ||  typeof(includeAudio) != "undefined")
	{
		if (pgTpl=="flsize_summary" || (typeof(includeAudio) != "undefined" && includeAudio) ) hasStreamingAudio=true;
			else hasStreamingAudio=false;
	}
	if (isSa() || isDummies) hasStreamingAudio=false;

	if (typeof(requiredVersion) == "undefined") // set the flash required version if not set on page
	{
		if (typeof(flashVersion) != "undefined") requiredVersion=flashVersion;
		else if (hasStreamingAudio) requiredVersion="6";
		else requiredVersion=5;
	}
	if (!hasFlash("6")) hasStreamingAudio=false;

	courseSoundDirectory=thisCourseDirectory;
	if (typeof(useSharedAudio) == "undefined" || useSharedAudio)
		sharedSoundDirectory = localizedSharedDirectory + "images/skins/" + skinDir + "/sounds/";
	else sharedSoundDirectory=courseSoundDirectory;

	if (coursewareHandler.fsAudioDirectory != "")
	{
		courseSoundDirectory=thisCourseDirectory + coursewareHandler.fsAudioDirectory + "/";
		sharedSoundDirectory=sharedSoundDirectory + coursewareHandler.fsAudioDirectory + "/";
	}

	// showTextButton=(hasStreamingAudio && (pgTpl.indexOf("flsize") > -1 || pgTpl=="xfull") ) ? true : false;
	// if (useNewDesign && !hasStreamingAudio && pgTpl=="scovie") showTextButton=true;
	showTextButton=false;

	function setPageAudio()
	{
		if (!hasStreamingAudio || (pgTpl == "scovie" && !coursewareHandler.useFsStyle) ) return false;
		var pgOnly=currPage.substring(0, currPage.length-4);
		if (typeof(c_pgNoAudio) != "undefined" && c_pgNoAudio.indexOf(pgOnly) > -1) return false;
		switch (pgTpl)
		{
			case "satakeit":
				if (crsAcronym.substring(0,2)=="l_") replayPrefix="replay_";
					else replayPrefix=""
				if (ThisPage.allowSA()) pgAudio=sharedSoundDirectory + "a_" + replayPrefix + "title_page";
					else pgAudio=sharedSoundDirectory + "a_" + replayPrefix + "title_page_nosa";
				return true;
				break;
			case "courseend":
				if (masterAll==1) pgAudio= sharedSoundDirectory + "a_endofcourse_mastery";
					// IM TEXT TEMPORARILY TURNED OFF else if (coursewareHandler.inInstantMentoring()) pgAudio=sharedSoundDirectory + "a_endofcourse_notmastery_im";
						else pgAudio=sharedSoundDirectory + "a_endofcourse_notmastery";
				return true;
				break
			case "front2":
				pgAudio=sharedSoundDirectory + "a_copyright";
				return true;
				break;
			case "sainstrc":
				pgAudio=sharedSoundDirectory + "a_sainstrc";
				return true;
				break;
			case "satitreq":
				return false;
				break;
			case "scoreend":
			case "scoresa":
				pgAudio=sharedSoundDirectory + "a_scores";
				return true;
				break;
			case "flashvpw":
			case "flashpw":
			case "flsize_sequence":
			case "flsize_scenario":
			case "fsmenu":
			case "task":
				pgAudio=sharedDirectory + "templates/quartersecond";
				return true;
			break;
			case "doitpg":
				if (isTfCourse)
				{
					pgAudio=sharedDirectory + "templates/quartersecond";
					return true;
				}
			break;
			case "fs_asmnt":
				pgAudio=sharedSoundDirectory + "fs_asmnt_intro";
				return true;
			break;
			case "fs_asmnt_exam":
				pgAudio=sharedSoundDirectory + "fs_exam_intro";
				return true;
			break;
			case "videopg":
			case "flsize_slideshow":
			case "flsize_slideshow_text":
			case "flsize_camtasia":
			case "questiontime":
			case "questiontime_q":
				return false;
			break;
			case "pretest":
			case "posttest":
				pgAudio=sharedDirectory + "templates/quartersecond";
				return true;
			break;
			case "mentor_intro":
				pgAudio=sharedSoundDirectory + "a_instant_mentor";
				return true;
			break;
			case "scovie":
				return false;
			break;
			default:
				pgAudio=courseSoundDirectory + "a_" + pgOnly;
				if (location.href.indexOf("intro=0") > -1) pgAudio=sharedDirectory + "templates/quartersecond";
				if (location.href.indexOf("instr=yes") > -1) pgAudio=sharedSoundDirectory + "a_c2c_instructions";
				if(typeof(isCorrect) != "undefined" && typeof(c_fdbkAudio) != "undefined")
				{
					if(isCorrect==1) pgAudio=courseSoundDirectory + "a_" + pgOnly + "_r"; 
						else pgAudio=courseSoundDirectory + "a_" + pgOnly + "_w";
				}
				if (pgBBar=="bk") return false;
					else return true;
		}
	}
	pageHasAudio=setPageAudio();

	if (!hasStreamingAudio && hasFlash("5") && typeof(pgAudio) != "undefined" && pgAudio !="")
	{
		playPageAudio=true;
		addButton("replay,replay," + replayButtonW + ",29," + resStr.replayAudio)
	}

//*********************** End Audio *************************************

	capEvents = (document.captureEvents);
	if (ThisPage.isIE)
	{
		if (capEvents) document.captureEvents(Event.KEYPRESS)
		document.onkeypress = captureKeystrokes;
	}
	else
	{
		document.onkeydown = captureKeystrokes;
	}

	if (!isLoggedOn())
		userId = "";
	else
		userId=ThisPage.getCookie("id").toLowerCase();

	// Set qCommentUrl for TF and ML
	var launchEnv = coursewareHandler.launchEnvironment;
	if (launchEnv == "TF" || launchEnv == "ML")
		qCommentUrl= sharedDirectory + "qeval/qeval.htm";

	if (ThisPage.isIE && ThisPage.browserVersion >= 5.5)
		activeXenabled = ThisPage.hasActiveX();

	//******************************* Show Branding Logo *****************************************//
	omitLogoTpls="scovie,satakeit,preferences,fsmenu,fs_orientation,embed,";
	if (typeof(c_omitLogoTpls) != "undefined") omitLogoTpls= c_omitLogoTpls;
	if (omitLogoTpls.indexOf(pgTpl) == -1 && pgTpl != "help" && pgTpl != "embed" && pgTpl != "fsmenu" && pgTpl != "fs_orientation" && !isAccessibilityWindow)
	{
		if (typeof(c_logoWidth) == "undefined") c_logoWidth=500;
		if (typeof(c_logoHeight) == "undefined") c_logoHeight=27;
		if (typeof(c_spaceBelowLogo) == "undefined") c_spaceBelowLogo=5;
		if (isDummies)
		{
			if (crsTitle.length > 85) document.write("<style>td.TopTitle{ font-size: 8pt;}</style>"); //reduce the title font size for long titles
				else if (crsTitle.length > 65) document.write("<style>td.TopTitle{ font-size: 9pt;}</style>"); //reduce the title font size for long titles
			document.write("<table cellpadding=0 cellspacing=0><tr><td class=\"topTitle\"nowrap><span style='position:absolute; top:5; left:30;'>" + crsTitle + "</span></td></tr></table>");
			document.write("<span style='position:absolute; top:0; left:0;'><IMG src=\"" + sharedImageDir + "dummies_logo.gif\" width=500 height=27 border=0></span><BR><img src='" + sharedImageDir + "spacer.gif' height=5 width=1><BR>");
		}
		else if ((isCustom || typeof(treatLikeCustom) != "undefined") && typeof(c_logoGif) != "undefined")
		{
				if (c_logoGif.indexOf("/") ==  -1) c_logoGif = sharedImageDir + c_logoGif;
				document.write("<span style='position:absolute; top:0; left:0;'><IMG src=\"" + c_logoGif +"\" width=" + c_logoWidth + " height=" + c_logoHeight + " border=0></span><BR><img src='" + sharedImageDir + "spacer.gif' height=" + c_spaceBelowLogo + " width=1><BR>");
		} else if (typeof(parent.logoGif) != "undefined") document.write("<span style='position:absolute; top:0; left:0;'><IMG src=\"" + parent.logoGif +"\" width=" + c_logoWidth + " height=" + c_logoHeight + " border=0></span><BR><img src='" + sharedImageDir + "spacer.gif' height=" + c_spaceBelowLogo + " width=1><BR>");
		if (typeof(parent.useLogoText) != "undefined")
		{
			mlLogo="<div id=logoTextOutter style=\"position:absolute;top:3px;left:8px\">";
			logoTitle=crsTitle;
			if (crsTitle.length >65 || pgTpl=="notes") mlLogo+="<span id=logoText class=\"logoTextTitle\" style=\"font-size:7pt\">" + logoTitle + "</span><br>";
				else mlLogo+="<span id=logoText class=\"logoTextTitle\">" + logoTitle + "</span><br>";
			mlLogo+="</div>";
			document.write(mlLogo);
		}
	}

	//******************************* End Show Branding Logo **********************************//
	noteID="cn_" + crsAcronym + "_" + currPage.substring(0, currPage.length-4);
	if (parent.useCustomNotes) writeCustomNote();
	//******************************* firstc2c page instructions **********************************//
	if (typeof(firstc2c) != "undefined")
	{
		if (ThisPage.getPassedParm("instr") != "")
		{
			firstc2c=false;
			var instr="<CENTER><br><TABLE WIDTH=\"545\" class=\"ntcBox\">";
			instr=instr + "<TR><TD><TABLE CELLPADDING=2 WIDTH=\"535\">";
			instr=instr + "<TR><TD><IMG SRC=\""+ sharedImageDir + "tiponpg.gif\" HEIGHT=75 WIDTH=75>";
			instr=instr + "</TD><TD><HR ALIGN=LEFT class=\"ntcRule\"><div class=\"cWordsWht\">";
			instr=instr + resStr.firstC2c;
			instr=instr + "</div><HR ALIGN=LEFT class=\"ntcRule\"></TD></TR></TABLE></TD></TR></TABLE><BR></CENTER>";
			instr=instr + "<STYLE>font.c2c{font-weight: bold;}</STYLE>"; // bold the c2c line
			document.write(instr);
			// if (typeof(pgAudio) != "undefined") playAudioFile(sharedSoundDirectory + "a_c2c_instructions.mp3")
		}
	}
	//******************************* End firstc2c page instructions **********************************//

	//******************************* Refresh page on window resize **********************************//
	if (!isAccessibilityWindow && pgTpl != "video" && pgTpl != "embed" && pgTpl.indexOf("fs_asmnt") == -1 && !coursewareHandler.is3rdLMS && pgTpl.indexOf("flsize_slideshow")==-1 && pgTpl != "sainstrc")
	{
			origWidth = top.document.body.clientWidth;
			origHeight = top.document.body.clientHeight;
			window.onresize=onWindowResize;
	}
	//******************************* End Refresh page on window resize **********************************//

	// ******************************* For in-house use. Comment out before shipping ***************//
	if (isMLproduction())
	{
		includeJs(thisCourseDirectory + "gifcmnt.js");
		includeJs(sharedDirectory + "inhouse/inhouse.js");
	}

} ////////////////////////// END INIT

//******************************* Refresh the page when the content window is resized **********************//
function onWindowResize()
{
	if (pgType.indexOf("question") != -1 && hasBeenAnswered() || (typeof(noReloadOnResize) != "undefined" && noReloadOnResize) ) return;
	if (top.document.body.clientWidth != origWidth || top.document.body.clientHeight != origHeight)
	{
		origWidth = top.document.body.clientWidth;
		origHeight = top.document.body.clientHeight;
		location.reload();
	}
}

function closeAutoSearchBox()
{
	if (typeof(document.all["overDivFull"]) != "undefined" && document.all["overDivFull"].visibility != "hidden") cClick();
	repaintDivs(self);
}
//************************* Standard functions used in the courses **************************//

function isSa()
{
	if (coursewareHandler.inSkillAssessment) return true;
	if (typeof(inSa) != "undefined" && inSa) return true; // inSa is defined in skill.js
		else return false;
}

function writeNotScored()
{
	// added June08 in BSV, replacing the sentence (This question is not scored.)
}

// gets the unit title from acro.js
function getScoTitle()
{
	if (unitNum != 0 && typeof(unitTitles) != "undefined") return unitTitles[unitNum];
	 else return "";
}

function useName(nameFormat)
{
	var firstName=ThisPage.getCookie("firstname");
	if(firstName != "" && firstName != null)
	{
			var nameText=ThisPage.replaceText(nameFormat, "name", firstName);
			document.write(nameText);
	}
}

function Download(fileToDownLoad,fType)
{
	var siteid = coursewareHandler.siteId.toLowerCase();
	if((siteid == null || siteid == "") && parent.params.get("referrer") != null)
		siteid = ThisPage.getParmFromUrl(parent.params.get("referrer"), "siteid").toLowerCase();
	if(siteid == null || siteid == "")
	{
		var win = parent.window.opener;
		if(win) siteid = win.parent.coursewareHandler.siteId.toLowerCase();
	}
	if (typeof(siteIdsNoSuppliedFiles) != "undefined" && siteIdsNoSuppliedFiles.indexOf("," + siteid + ",") > -1)
	{
		alert("Your training administrator has disabled file downloading.");
		return;
	}
	if (typeof(fType)=="undefined") fType="exe";
	location.href="download/" + fileToDownLoad + "." + fType;
}

function DownLoad(fileToDownLoad,fType) // needed because of cap L used in some cases
{
	if (typeof(fType)=="undefined") fType="exe";
	Download(fileToDownLoad,fType);
}

function LoadIt() //called by the body tag in all non-text question pages
{
	isLoaded=true;
}

function LoadText() //called from footer.js
{
	if (location.href.indexOf("nofocus") < 0)
	{
		if (pgTpl != "fullq")
		{
			var whichBox="text1"
			if (document.form1.startques) whichBox="text" + document.form1.startques.value;
			if (document.form1[whichBox] && document.form1[whichBox].type != "hidden") document.form1[whichBox].focus();
		}
	}
}

function floatWin(destination,winName,winParms)
{
	ThisPage.floatWin(destination,winName, winParms);
}

//************************* Begin Certificate Code *********************************
// open the certificate instruction page
function showCertificate()
{
	if (typeof(isStandalone) != "undefined" && isStandalone)
	{
		var certificatePage = rootDir + "/certificate_standalone.htm?course=" + crsAcronym + "&title=" + escape(crsTitle) + "&fname=" + coursewareHandler.userFirstName + "&lname=" + coursewareHandler.userLastName;
		ThisPage.floatWin(certificatePage,'certificateWin', 'toolbar=no,menubar=yes,resizable=yes,width=500,height=350,scrollbars=yes');
	}
	else
	{
		var certificatePage = sharedDirectory + "certif/certificate_instructions.htm?course=" + crsAcronym + ThisPage.getSkinParm("&");
		if (coursewareHandler.localizationCode !="") certificatePage = sharedDirectory + "certif/certificate_instructions_loc.htm?course=" + crsAcronym;
		if (useJsDat) certificatePage += "&usejs=1";
		location.href=certificatePage;
	}
}

// open the certificate window, passing customid parm as needed
function openCertificate(certStyle)
{
	coursewareHandler.certificateStyle = certStyle;
	coursewareHandler.goPage("certificate");
}

// On scores pages, show the certificate button if they mastered all lessons or mastered all
function showCertButton(mastery,masterAll,totCourse,totBest)
{
	showButton = (masterAll == 1);
	if (typeof(completionRequired) == "undefined") completionRequired=false;
	if ((isBsv || completionRequired) && ThisPage.hasCompletedCourse(crsAcronym)==false) showButton=false;
	if (typeof(allowCertificate) != "undefined" && allowCertificate==false) showButton=false; //hides certif for ecdl and icdl
	if (showButton) sgif('certbut','21','94');
}
//************************* End Certificate Code *********************************

function openExerciseMentor(classKey)
{
	if (classKey.substring(0,1) == "b") classKey=classKey.substring(1,classKey.length);
	var whereSlash=classKey.indexOf("/");
	if (whereSlash > -1) classKey=classKey.substring(0,whereSlash);
	var exerUrl=sharedDirectory + "templates/im_exercise_review.htm?classkey=" + classKey + "&pagekey="+ crsAcronym + "-" + currPage.substring(0, currPage.length-4);
	floatWin(exerUrl, 'imExerWin', 'resizable=yes,width=600,height=350,scrollbars=yes');
}
// *************************** end standard course functions *******************//
//************************* Functions for dynamic page creation **************************//

function showWindowStatus()
{
	if(!isAccessibilityWindow) window.defaultStatus=getStatusText();
}

function getStatusText()
{
	var useStatus="";
	if (typeof(dStatus)=="undefined") dStatus="";
	if (!isSa())
	{
		if (typeof(pgUnit)=="undefined" || typeof(pgNum)=="undefined" || pgBBar.toLowerCase().indexOf("popup") > -1) pgUnit=pgNum="";
		comma=(pgNum=="") ? "" : ",";

		if (pgUnit.indexOf(scoType) != 0)
		{
			var whereSpace=pgUnit.indexOf(" ")
			if (whereSpace > -1) pgUnit = scoType + pgUnit.substring(whereSpace,pgUnit.length)
		}
		useStatus=pgUnit + comma + " " + pgNum;

		if (coursewareHandler.useFsStyle)
		{
			if (isTfCourse && typeof(ScoId) != "undefined" && !coursewareHandler.pt_inTest)
			{
				topicPgNum=coursewareHandler.fsGetTopicPageStatus(ScoId);
				if (topicPgNum !="") useStatus=topicPgNum;
			} else useStatus="Lesson " + coursewareHandler.fsLessonMap[unitNum] + ", " + pgNum;
			if (pgTpl=="fs_asmnt") useStatus=resStr.statusLesson + " " + coursewareHandler.fsLessonMap[unitNum] + ", " + resStr.assessment;
			if (pgTpl=="fs_asmnt_exam") useStatus=""//Lesson " + coursewareHandler.fsLessonMap[unitNum] + ", " + " Assessment";
		}
		if (useNewDesign && coursewareHandler.localizationCode !="")
		{
			useStatus=ThisPage.replaceText(useStatus, "Lesson", resStr.statusLesson);
			useStatus=ThisPage.replaceText(useStatus, "Page", resStr.statusPage);
			useStatus=ThisPage.replaceText(useStatus, "of", resStr.statusOf);
		}
		if (coursewareHandler.scoOnly && pgNum!="") useStatus="P" + pgNum.substring(1,pgNum.length);
		if (useStatus==", " || dStatus != "") useStatus=dStatus;
		if (useNewDesign && useStatus==dStatus) useStatus="";
	}
	//Pre- and Post-test status
	if (pgTpl=="pretest" || pgTpl=="posttest") useStatus="";
	if (isPTest)
	{
		useStatus="Question " + coursewareHandler.pt_currentQuestionNum + " of " + coursewareHandler.pt_numQuestions;
		if (coursewareHandler.pt_type =="Pre") runningHead=resStr.preTitle;
	}

	if (typeof(navBarText) != "undefined") useStatus=navBarText;
	if (pgTpl.indexOf("flsize_slideshow") > -1)
	{
		if (typeof(numSlides) != "undefined") useStatus=useStatus + ", Slide " + currentSlide + " of " + numSlides;
			else useStatus=useStatus + ", Slide " + currentSlide;
	}
	return useStatus;
}

// passed the sim name to write the embed code
function embedSim(simName)
{
	var fullSim=thisCourseDirectory + simName
	if (ThisPage.isIE)
	{
		var simCode= "<OBJECT ID=\"AuthorwareShockwaveControl\" CLASSID=\"CLSID:15B782AF-55D8-11D1-B477-006097098764\"";
		simCode=simCode + " WIDTH=\"607\" HEIGHT=\"440\"";
		simCode=simCode + ">"
		simCode=simCode + "<PARAM NAME=\"SRC\" VALUE=\"" + fullSim + "\">";
		simCode=simCode + "<PARAM NAME=\"PALETTE\" VALUE=\"background\">";
		simCode=simCode + "<PARAM NAME=\"BGCOLOR\" VALUE=\"#000053\">";
		simCode=simCode + "<EMBED WIDTH=\"607\" HEIGHT=\"440\"";
		simCode=simCode + " PALETTE=\"background\"";
		simCode=simCode + " BGCOLOR=\"#000053\"";
		simCode=simCode + " SRC=\""+ fullSim +"\"";
		simCode=simCode + " TYPE=\"application/x-authorware-map\">";
		simCode=simCode + "</EMBED></OBJECT>";
	}
	else
	{
		var simCode="<EMBED WIDTH=\"607\" HEIGHT=\"440\"";
		simCode=simCode + " PALETTE=\"background\"";
		simCode=simCode + " BGCOLOR=\"#000053\"";
		simCode=simCode + " SRC=\""+ fullSim +"\"";
		simCode=simCode + " TYPE=\"application/x-authorware-map\">";
		simCode=simCode + "</EMBED>";
	}
	document.write(simCode);
}

// returns numeric value of sim cookie (1 or 2) or 0.
function excludeSims()
{
	var currentSimCookie = ThisPage.getCookie("noSims");
	if (currentSimCookie == "1" || currentSimCookie == "2") return parseInt(currentSimCookie);
			else return 0;
}

function courseContainsSims()
{
	if (typeof(courseHasSims)=="undefined" || courseHasSims==false) return false;
		else return true;
}

function saContainsSims()
{
	if (typeof(saHasSims)=="undefined" || saHasSims==false) return false;
		else return true;
}

// writes a line to include a js file
function includeJs(jsName)
{
	var js="<SCRIPT Language=\"Javascript\" SRC=\"" + jsName + "\"></S" + "CRIPT>";
	document.write(js);
}

function showError(msg)
{
	alert(msg);
}

// returns true of false based on whether the final feedback is displayed
var isAnswered = false; //scoredata.jsp may reset this after the question has been answered
function hasBeenAnswered()
{
	if (pgTpl=="htldoit") return false;
	if (pgType.indexOf("question") == -1) return true;
	if (typeof(qAnswered) != "undefined") return true; //for use in Accessibility SA
	if(typeof(isCorrect) != "undefined") return true;
	if(typeof(isCorrect_js) != "undefined") return (isCorrect_js != -1);
	return (isAnswered && isCorrect_tf != "0");
}

function isScoSa()
{
	var saMode=false;
	if (useJsDat)
	{
		if (coursewareHandler.inSkillAssessment) saMode=true;
		if (self.name.indexOf("acc_question_window") > -1 && window.opener.parent.coursewareHandler.inSkillAssessment) saMode=true;
	}
	return saMode;
}

function writeQuickRefLinks()
{
	qLinks=""
	for (i=1;i<quickrefTitle.length;i++)
	{
		if (typeof(qrFileName) != "undefined" && qrFileName[i]!=null && qrFileName[i]!="")
			qrFile=qrFileName[i];
		else
			qrFile="quickref_" + ThisPage.replaceText(quickrefTitle[i], " ", "_", false) + ".htm";
		qrFile=thisCourseDirectory + qrFile.toLowerCase();
		qLinks+="<a href=\"javascript:coursewareHandler.floatWin('" + qrFile + "', 'quickref" + i + "','resizable=yes,menubar=yes,toolbar=no,width=680,height=500,scrollbars=yes,status=no')\">";
		qLinks+= quickrefTitle[i] + "</a> " + quickrefDescription[i] + "<br><br>";
	}
	document.write(qLinks);
}

function qrLink(linkWords,qrFile)
{
	lnk="<a href=\"javascript:coursewareHandler.floatWin('" + getCoursesDirectory(crsAcronym) + crsAcronym + "/" + qrFile + "', 'quickref','resizable=yes,menubar=yes,toolbar=no,width=680,height=500,scrollbars=yes,status=no')\">" + linkWords + "</a> ";
	document.write(lnk);
}
function openQr(qrFile)
{
	fullFile=getCoursesDirectory(crsAcronym) + crsAcronym + "/" + qrFile;
	coursewareHandler.floatWin(fullFile, 'quickref','resizable=yes,menubar=yes,toolbar=no,width=680,height=500,scrollbars=yes,status=no');
}

// ********************** Write Shared Gifs ******************************//

function GetButton(gifName, gHeight, gWidth)
{
	var anchorCode="<a href=\"javascript:submitQuestion()\">";
	var endAnchor="</a><img src=\"" + sharedImageDir + "checking_answer.gif\" WIDTH=1 HEIGHT=1>";
	var imageParms = " name=\"done\" ALT=\"" + resStr.accSubmit + "\"";
	var imgCode=anchorCode +"<IMG SRC=\"" + sharedImageDir + gifName +".gif\" HEIGHT=" + gHeight + " WIDTH=" + gWidth + " border=0" + imageParms + ">" + endAnchor;
	if (isAccessibilityWindow)
	{
		imgCode=anchorCode + resStr.accSubmit + endAnchor;
		gifName=""; //i.e., don't write the image;
	}
	else
		imgCode=anchorCode +"<IMG SRC=\"" + sharedImageDir + gifName +".gif\" HEIGHT=" + gHeight + " WIDTH=" + gWidth + " border=0" + imageParms + ">" + endAnchor;

	return imgCode;
}

function sgif(gifName, gHeight, gWidth,imageParms,returnCode)
{
	if (textNoFrame) return;
	var anchorCode="";
	var endAnchor="";
	newStyles="";
	if (typeof(imageParms) == "undefined") imageParms="";
	for (i=1;i<=sharedGifSizes.count;i++)
	{
		if (sharedGifSizes.gifs[i].name==gifName)
		{
			gHeight=sharedGifSizes.gifs[i].height;
			gWidth=sharedGifSizes.gifs[i].width;
		}
	}
	switch (gifName)
	{
		case "done":
			if (pgType.indexOf("question")>-1)
			{
				anchorCode="<a href=\"javascript:submitQuestion()\">";
				endAnchor="</a>"
				if (!isAccessibilityWindow) mouseCode=" onMouseover=\"buttonRollover('done','done',true)\" onMouseout=\"buttonRollover('done','done',false)\" STYLE=\"cursor:default;\"";
					else mouseCode="";
				endAnchor=endAnchor + "<img src=\"" + sharedImageDir + "checking_answer.gif\" WIDTH=1 HEIGHT=1>";
				imageParms = mouseCode + " name=\"done\" ALT=\"" + resStr.submitAnswer + "\"";
				if (isAccessibilityWindow)
				{
					imgCode=anchorCode + resStr.accSubmit + endAnchor;
					document.write (imgCode);
					gifName=""; //i.e., don't write the image;
				}
			}
			break;
		case "doitbut2":
			mouseCode=" onMouseover=\"buttonRollover('doit','doitbut2',true)\" onMouseout=\"buttonRollover('doit','doitbut2',false)\" STYLE=\"cursor:default;\"";
			imageParms = mouseCode + " name=\"doit\" ALT=\"" + resStr.viewSim + "\"";
			break;
		case "decpointbut":
			mouseCode=" onMouseover=\"buttonRollover('decpoint','decpointbut',true)\" onMouseout=\"buttonRollover('decpoint','decpointbut',false)\" STYLE=\"cursor:default;\"";
			imageParms = mouseCode + " name=\"decpoint\" ALT=\"" + resStr.viewSim + "\"";
			break;
		case "showmebut":
			mouseCode=" onMouseover=\"buttonRollover('showme','showmebut',true)\" onMouseout=\"buttonRollover('showme','showmebut',false)\" STYLE=\"cursor:default;\"";
			imageParms = mouseCode + " name=\"showme\" ALT=\"" + resStr.viewSim + "\"";
			break;
		case "thinkit":
			if (isPTest)
			{
				var RH="<span class=clabel>" + coursewareHandler.pt_type + "-test: " + resStr.Question + " " + coursewareHandler.pt_currentQuestionNum + " " + resStr.Of + " " + coursewareHandler.pt_numQuestions +"</span><BR>";
				document.write(RH);
				gifName="";
			}
			if (isAccessibilityWindow)
			{
				if(isSa() && typeof(qNum) != "undefined") // && typeof(qTotal) != "undefined")
				{
					if (useJsDat) qTotal=ThisPage.getPassedParm("qtotal");
					var saRH="<B>" + resStr.Question + " " + qNum + " " + resStr.Of + " " + qTotal +"</B><BR>";
					document.write(saRH);
				}
				gifName="";
			}
			break;
		case "sidethnk":
		case "sidedoit":
			if (isSa()) gifName="sidesa";
			if (isAccessibilityWindow) gifName="";
			if (isPTest)
			{
				gifName="pretest_side";
				gWidth="66";
				gHeight="64";
			}
			break;
		case "backcour_img":
			//show the exit button in instructions if in sa required mode
			if (coursewareHandler.inToolMode == false) // || ThisPage.crsMode != "mlie")
			{
				gifName="exitbut_img";
				gWidth="49";
			}
			break;
		case "certbut":
				anchorCode="<a href=\"javascript:showCertificate()\" onMouseover=\"self.status='" + resStr.printCert + "'; return true;\">";
				endAnchor="</a>";
				mouseCode=" onMouseover=\"buttonRollover('certbut','certbut',true)\" onMouseout=\"buttonRollover('certbut','certbut',false)\" STYLE=\"cursor:default;\"";
				imageParms = " name=\"certbut\" ALT=\"" + resStr.printCert + "\"" + mouseCode;
			break;
		case "sidetry2":
			if (themeNum != 0 && themeNum != 99) gifName="sidetry2_" + themeNum.toString();
			if ( (useNewDesign || themeNum==9) && typeof(useSideImages)=="undefined") gifName=""; // March06 -- eliminate sidetry2
			break;
	}
// Exercise grading
	if (pgTpl=="tryit" && coursewareHandler && coursewareHandler.inInstantMentoring())
	{
		if (gifName.substring(0,4)=="exer"
			&& typeof(coursewareHandler.instantMentorClassKey) != "undefined"
			&& coursewareHandler.instantMentorClassKey != "")
				endAnchor="<br><br><a href=\'javascript:openExerciseMentor(\"" + coursewareHandler.instantMentorClassKey + "\")'>" + resStr.imExerciseLink;
	}
	//select a side gif
	if (sidePics.indexOf("," + gifName+",") > -1 && pgTpl!="htldoit")
	{
		if (themeNum==9) gifName="";
		else
		{
			if (gifName=="sidethnk" && coursewareHandler && typeof(coursewareHandler.lastSidePicture) != "undefined") // randomize for questions only on first load
			{
				if (!document.form1.tries) coursewareHandler.lastSidePicture = Math.round(Math.random() * (numSideGifs - 1)) + 1; //randomize on first load
				gifNumber=coursewareHandler.lastSidePicture;
			}
			else
			{
				gifNumber = Math.round(Math.random() * (numSideGifs - 1)) + 1;
				if (numSideGifs > 1) while (gifNumber==lastSide) {gifNumber = Math.round(Math.random() * (numSideGifs - 1)) + 1};
				if (coursewareHandler && typeof(coursewareHandler.lastSidePicture)!="undefined") coursewareHandler.lastSidePicture=gifNumber;
			}
			if(gifNumber == 0) gifNumber = 1;
			if(gifNumber < 10) gifName= "side" + themeNum.toString() + "0" + gifNumber;
				else gifName="side" + themeNum.toString() + gifNumber;
		}
	}
	imageDir = sharedImageDir;

	if (gifName.indexOf("side") > -1)
	{
		if (isCustom && typeof(c_useDefaultSkin) == "undefined") imageDir = thisCourseDirectory + "skin/images/";
			else imageDir = sharedDirectory + "images/skins/" + skinDir + "/images/"; // don't use localized dir for side images
		if (gHeight == "280") gHeight="300"; //fixes inconsistent sizes.
		if (typeof(c_sideWidth) != "undefined") gWidth=c_sideWidth;
		if (typeof(c_sideIndent) != "undefined") endAnchor = "</TD><TD WIDTH=" + c_sideIndent + ">&nbsp;</TD>";
		if (useCustomSides) //customized side gifs with anchors
		{
			imageDir = siteCustomDirectory + ThisPage.getCustomId() + "/images/";
			if (typeof(parent.useSideAnchors) != "undefined" && parent.useSideAnchors)
			{
				anchorCode="<A HREF=\"" + parent.getAnchorURL(gifName) + "\" target=\"_blank\" border=no>";
				endAnchor="</a>";
			}
		}

		if (!isSa() && typeof(useSideImages) != "undefined" && useSideImages)
		{
			thisSide="";
			if (pgTpl=="mc" || pgTpl=="mc2" || pgTpl=="mctf" || pgTpl=="mcyn") thisSide="sideques";
			if (pgTpl=="tryit") thisSide="sidetryit";
			if (thisSide!="")
			{
				gifName=thisSide;
				imageDir=thisCourseDirectory;
				useCustomSides=true;
				endAnchor = "</TD><TD WIDTH=12>&nbsp;</TD>";
			}
		}
	}

	if (!useCustomSides && useNewDesign && gifName!="" && (sidePics + ",sasidein,sidetry2,sidesa,sasidesh,sidelast,").indexOf("," + gifName +",") > -1 && pgTpl!="htldoit") gifName = "spacer";

	imgCode=anchorCode +"<IMG SRC=\"" + imageDir + gifName +".gif\" HEIGHT=" + gHeight + " WIDTH=" + gWidth + " border=0" + imageParms + ">" + endAnchor;

	if (useNewDesign) // offset title pic
	{
		titlePics="decpoint,aboutun,acctop,certitle,ceus,ciscoobj,doit,exer1,exer2,exer3,exer4,exer5,exer6,exer7,exer8,exer9,exer10,exer11,exer12,mcsaobj,mcseobj,obj,sainstr,sascrtit,showme,summary,term,think,thinkit,welcome,"
		if (gifName!="" && titlePics.indexOf(gifName + ",") > -1)
		{
			if (gifName.substring(0,4)=="exer")
				titleText=ThisPage.replaceText(resStr.exer,"<num>",gifName.substring(4,6));
			else
				titleText=eval("resStr."+ gifName) + "<br>";
			imgCode="<span class=titleText>" + titleText + "</span>" + endAnchor;
		}
		noPicIndentPages="actcliq,ceus,textent_drop,acthtml,textentcode,cliqcode,cliqnp,textentnp,mctfp,mcvp,cliqwp,cliqvwp,tryit,cliqvwp1,cliqwp1,textp,textvp,textwp,mcp,mc2vp,mctfvp,mcynvp,mcynp,wcques,cwques,mccode,mc2code,textentp,"
		if (!useCustomSides && titlePics.indexOf(gifName + ",") > -1 && noPicIndentPages.indexOf(pgTpl + ",") == -1 && pgTpl.indexOf("full") == -1)
			imgCode = "<div id=\"sgifDiv \" style=\"display:inline;position:relative;left:-50px;\">" + imgCode + "</div>" + endAnchor;
	}
	if (gifName != "")
	{
		if (typeof(returnCode) != "undefined") return imgCode;
			else document.write (imgCode);
	}
}

// writes a gif, including an image map name
function mapGif(gifName, gHeight, gWidth, mapName)
{
	imgCode="<IMG SRC=\""+sharedImageDir + gifName +".gif\" HEIGHT=" + gHeight + " WIDTH=" + gWidth + " border=0 ISMAP USEMAP=\"#"+ mapName +".map\">";
	document.write (imgCode);
}

function menuArrow(returnText)
{
	var style = "<span style=\"font-family:wingdings;font-size:9pt;\">&#224;</span>";
	if (ThisPage.isIE)
	{
		if (typeof(returnText) != "undefined")
			return style;
		document.write(style);
	}
	else
		sgif('menuarrow');
}

function macromediaTM()
{
	if (typeof(dynamicCd) != "undefined" && dynamicCd)
	{
		flashLogo="<img src=\"" + sharedImageDir + "flash_logo.gif\" height=28 width=100>";
		flashTmText="This product contains Macromedia Flash<sup style=\"font-size:7pt;\">TM</sup> Player software by Macromedia, Inc., Copyright &copy; 1995-2003 Macromedia, Inc. All rights reserved. Macromedia and Flash are trademarks of Macromedia, Inc.";
		document.write("<br>" + flashLogo + "<br>" + flashTmText + "<br>")
	}
}

function writeSeriesTitle()
{
	ThisPage.writeSeriesTitle();
}

function writeCourseTitle()
{
	ThisPage.writeCourseTitle();
}

// ************************************************** Box graphics **********************************
function boxPicBegin(w,h)
{
	if (useBox)
	{
		var hPlus10=h + 10;
		var wPlus10=w + 10;
		var boxbg=thisCourseDirectory + "wallpapr.jpg";
		var beginCode="<table width=\"" + wPlus10 +"\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" height=\"" + hPlus10 + "\" background=\"" + boxbg + "\">\n";
		beginCode=beginCode+"<tr><td width=\"10\" height=\"10\"><img src=\"" + sharedImageDir + "pb_nw.gif\" width=\"10\" height=\"10\"></td>\n";
		beginCode=beginCode+"<td width=\"" + w + "\" height=\"10\"><img src=\"" + sharedImageDir + "pb_n.gif\" width=\"" + w + "\" height=\"10\"></td>\n";
		beginCode=beginCode+"<td width=\"10\" height=\"10\"><img src=\"" + sharedImageDir + "pb_ne.gif\" width=\"10\" height=\"10\"></td></tr>\n";
		beginCode=beginCode+"<tr><td width = \"10\" height=\"" + h + "\"><img src=\"" + sharedImageDir + "pb_w.gif\" width=\"10\" height=\"" + h + "\"></td>\n";
		beginCode=beginCode+"<td width=\"" + w + "\" height=\"" + h + "\">\n";
		beginCode=beginCode+"<div align=\"center\">"
		document.write(beginCode);
	}
}

function boxPicEnd(w,h)
{
	if (useBox)
	{
		var hPlus10=h + 10;
		var wPlus10=w + 10;
		var wMinus=w - 20;
		var endCode="</div>\n";
		endCode=endCode+"</td><td width = \"10\" height=\"" + h + "\"><img src=\"" + sharedImageDir + "pb_e.gif\" width=\"10\" height=\"" + h + "\"></td>\n";
		endCode=endCode+"</tr><tr><td width=\"10\" height=\"10\"><img src=\"" + sharedImageDir + "pb_sw.gif\" width=\"10\" height=\"10\"></td>\n";
		endCode=endCode+"<td width=\"" + w + "\" height=\"10\"><img src=\"" + sharedImageDir + "pb_s.gif\" width=\"" + w + "\" height=\"10\"></td>\n";
		endCode=endCode+"<td width=\"10\" height=\"10\"><img src=\"" + sharedImageDir + "pb_se.gif\" width=\"10\" height=\"10\"></td>\n";
		endCode=endCode+"</tr></table>\n";
		document.write(endCode);
	}
}
// **************************************** End Box graphics **********************************
//******************************* Preload Code *******************************************
// this preloads the next page in the frame of course.htm named preload_frame
function preloadPage()
{
	if (isSa()) return;
	preloadImages();
}

// Called by footer.js to preload images and flash;
function preloadImages()
{
	if (typeof(pgPreload) == "undefined") pgPreload="";
	if (pgPreload != "")
	{
		var preloadArray = pgPreload.split(",");
		var preloadCode=""
	
		for (var i=0; i < preloadArray.length; i++)
		{
			var imageName=preloadArray[i];
			if (imageName.indexOf(".swf") > -1)
			{
				if (!hasFlash() && nextPage.indexOf("001.htm") == -1)
				{
						altType=".gif";
						if (typeof(useJpgForFlashAlt) != "undefined" && useJpgForFlashAlt) altType=".jpg";
						preloadCode=preloadCode+"<img src=\"" + thisCourseDirectory + imageName.substring(0,imageName.length-4) + altType + "\" WIDTH=1 HEIGHT=1>"
				}
				// turned off till we figure flash preloading out
				/*
				imageName=imageName.substring(0, imageName.length-4);
				document.write ("<span class=\"invisible\">");
				insertFlash(imageName,"2","2","#FFFFFF",false,true); //path now added in insertFlash
				document.write ("</span>");
				*/
			} else preloadCode=preloadCode+"<img src=\"" + thisCourseDirectory + imageName + "\" WIDTH=1 HEIGHT=1>"
		}
		if (preloadCode != "") document.write("<span class=\"invisible\">" + preloadCode + "</span>");
	}
}

//******************************* End Preload Code *******************************************

//******************************* Flash and Audio Code *****************************************//
function hasFlash(reqVer)
{
	if (typeof(reqVer) == "undefined") reqVer=requiredVersion;
	if (typeof(requiresFlash) != "undefined" && requiresFlash==true) return true; // course on Flash that requires flash
 	if (typeof(parent.detectFlash) != "undefined") return parent.detectFlash(reqVer);
		else return false;
}

function addButton(buttonCode)
{
	if (typeof(customButton)=="undefined") customButton="";
	if (customButton == "scores;") customButton="scores"; //anomaly in scripting
	if (customButton != "") customButton = customButton + ";" + buttonCode;
		else customButton= buttonCode;
}

var tfScenarioSwf="";
function insertFlash()
{
	if (typeof(argUseBox) == "undefined") argUseBox=useBox;
	isPreload=false;
	returnCode=false;
	f_Id="";
	// if arguments are passed, use them: insertFlash(fName, fWidth, fHeight, fBgcolor, useBox, isPreloadplay,returnCode)
	if(insertFlash.arguments.length >= 4)
	{
		fName=insertFlash.arguments[0];
		f_Width=insertFlash.arguments[1];
		f_Height=insertFlash.arguments[2];
		fBgcolor=insertFlash.arguments[3];
		if (typeof(insertFlash.arguments[4]) != "undefined") argUseBox=(insertFlash.arguments[4]==true);
		if (typeof(insertFlash.arguments[5]) != "undefined") isPreload=(insertFlash.arguments[5]==true);
		if (typeof(insertFlash.arguments[6]) != "undefined") returnCode=(insertFlash.arguments[6]==true);
		if (typeof(insertFlash.arguments[7]) != "undefined") f_Id=insertFlash.arguments[7];
	}
	// f_Width is used here so that audioplayer's size does not interfere with dynamic size of main flash image
	if (typeof(f_Width)== "undefined") f_Width=fWidth;
	if (typeof(f_Height)== "undefined") f_Height=fHeight;
	
	var beginBox="";
	var endBox="";
	if (useBox && argUseBox)
	{
			beginBox="<script>boxPicBegin(" + f_Width +"," + f_Height + ");</sc"+ "ript>";
			endBox="<script>boxPicEnd(" + f_Width +"," + f_Height + ");</sc" + "ript>";
	}
	var requireUnbrandedGif= (fName.substring(0,2)=="d_" && !isDummies) ? true : false;
	var flashDir = thisCourseDirectory;
	if (fName.substring(0,2)=="s_") flashDir=sharedImageDir;
	if (isTfCourse && tfScenarioSwf=="")
	{
		if (fName.substring(fName.length-2,fName.length)=="_o")
		{
			tfScenarioSwf=fName;
			fName="objective_tf";
			flashDir=rootDir + "/shared/templates/";
		} else if (fName.substring(fName.length-2,fName.length)=="_s")
		{
			tfScenarioSwf=fName;
		 	fName="summary_tf";
			flashDir=rootDir + "/shared/templates/";
		}
	}
	if (fName.indexOf("/")>-1) flashDir=""; //don't use course dir if name contains slash.
	if (pgTpl.indexOf("flash") > -1 && ThisPage.getPreference(PR_PageAudio) == "0") requireUnbrandedGif=true;
	if (hasFlash() && !requireUnbrandedGif)
	{
		var fParms="";
		if (isPreload)
		{
			flashID="flashpreload";
			fParms="?playAudio=0";
		}
		else
		{
			flashID="movie";
			if (fName.indexOf("audioplayer") > -1) flashID="audioplayer";
			if (f_Id != "") flashID=f_Id;
			if (fName.substring(0,2)=="r_") addButton("replay,replay," + replayButtonW + ",29," + resStr.replayAnimation);
			if (pgTpl.indexOf("flash") > -1) fParms="?pageaudio=" + courseSoundDirectory + "a_" + currPage.substring(0, currPage.length-4) + ".mp3";
		}

		if (typeof(fQuality) == "undefined") fQuality="autolow";
		fileType = ".swf";
		if (flashID=="audioplayer" && (hasStreamingAudio || audioVersion=="6")) fileType = ".mp3";
		var imageCode=beginBox + "<OBJECT CLASSID=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\""
		imageCode=imageCode + " ID=\"" + flashID + "\" WIDTH=\"" + f_Width + "\" HEIGHT=\"" + f_Height+"\"";
		imageCode=imageCode + " codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=" + requiredVersion + ",0,0,0\"";
		imageCode=imageCode + ">"
		imageCode=imageCode + "<PARAM NAME=\"movie\" VALUE=\"" + flashDir + fName + fileType + fParms +"\">";
		imageCode=imageCode + "<PARAM NAME=menu VALUE=false>";
		imageCode=imageCode + "<PARAM NAME=\"QUALITY\" VALUE=\"" +fQuality + "\">";
		imageCode=imageCode + "<PARAM NAME=\"BGCOLOR\" VALUE=" + fBgcolor + ">";
		imageCode=imageCode + "<PARAM NAME=\"wmode\" VALUE=\"transparent\">";
		imageCode=imageCode + "<EMBED SRC=\"" + flashDir + fName +fileType + fParms +"\" WIDTH=\"" + f_Width + "\" HEIGHT=\"" + f_Height +"\" QUALITY=\"" +fQuality +"\"";
		imageCode=imageCode + " NAME=\"" + flashID + "\"";
		imageCode=imageCode + " ID=\"" + flashID + "\""; // Added for Firefox.
		imageCode=imageCode + " WMODE=\"transparent\" bgcolor=\"" + fBgcolor + "\"";
		imageCode=imageCode + " menu=false swLiveConnect=TRUE";
		imageCode=imageCode + " TYPE=\"application/x-shockwave-flash\">";
		imageCode=imageCode + "</EMBED></OBJECT>";
		imageCode=imageCode + endBox;
	}
	else if (typeof(noAlternateGifs) != "undefined" && noAlternateGifs)
	{
		var imageCode="";
		if (pgTpl != "videopg")
		{
			imageCode= "<A HREF=\"javascript:openFlashDownloadPage();\">";
			imageCode=imageCode + "<IMG SRC=\"" + sharedImageDir + "flash_download.gif\" BORDER=0 WIDTH=100 HEIGHT=70></A>"
		}
	}
	else
	{
		var imageCode="";
		altType=".gif";
		if (typeof(useJpgForFlashAlt) != "undefined" && useJpgForFlashAlt) altType=".jpg";
		if (typeof(useAltImage) == "undefined" || useAltImage != false)
		{
			imageCode=beginBox + "<A HREF=\"javascript:goNext()\" onMouseover=\"self.status=";
			imageCode=imageCode + "'" + resStr.goNext +"'; return true;\">";
			if (pgTpl=="decision_point_dhtml") imageCode=beginBox;
			imageCode=imageCode + "<IMG SRC=\"" + flashDir + fName + altType + "\"";
			imageCode=imageCode + " WIDTH=" + f_Width + " HEIGHT=" + f_Height + " BORDER=0></A>";
			imageCode=imageCode + endBox;
		}
	}
	if (returnCode) return imageCode;
		else document.write(imageCode);
}

// this function is called by flash when clicked
function goNext()
{
	coursewareHandler.onImageClick("next");
}

// this function is called by flash on flszie_slideshow pages
function goPrevious()
{
	coursewareHandler.onImageClick("prev");
}

function insertPageFlash()
{
	if (hasFlash("6") && ThisPage.getPreference(PR_PageAudio) != "0") insertFlash();
}

// FireFox triggers the onload event before the scovie is loaded, so for FireFox, getBullets now calls getBullets2 after a half-second delay. 
function getBullets()
{
	if (!ThisPage.isIE) t=setTimeout("getBullets2()",500)
		else getBullets2();
}
function getBullets2()
{
	if (window.document.scomovie)
	{
		if (typeof(resStr.inThis) != "undefined") inThis=resStr.inThis;
		window.document.scomovie.SetVariable("_root.scoTitle.title", scoTitle);
		window.document.scomovie.SetVariable("_root.courseTitle.title", crsTitle.substring(crsTitle.indexOf(":")+1, crsTitle.length) );
		window.document.scomovie.SetVariable("_root.inThis.lesson", inThis);
		window.document.scomovie.SetVariable("_root.bullet1.bullet", obj1);
		window.document.scomovie.SetVariable("_root.bullet2.bullet", obj2);
		window.document.scomovie.SetVariable("_root.bullet3.bullet", obj3);
		window.document.scomovie.SetVariable("_root.bullet4.bullet", obj4);
		window.document.scomovie.SetVariable("_root.bullet5.bullet", obj5);
		if (typeof(pgMusic) == "undefined") pgMusic="m_scomusic.swf";
		scomusic=thisCourseDirectory + pgMusic //+ ".swf";
		window.document.scomovie.SetVariable("_root.seriesAudio.audioFile", scomusic);
		if (coursewareHandler.fsAudioDirectory != "") window.document.scomovie.SetVariable("_root.audioDirectory", courseSoundDirectory);

		if (typeof(d_curtain)=="undefined") d_curtain=true;
		if (!isDummies || d_curtain==false)
		{
			window.document.scomovie.GotoFrame(3);
			window.document.scomovie.Play();
		}
	}
	else if (!ThisPage.isIE)
	{
		t=setTimeout("getBullets()",500)
		return;
	}
}

function flsizeLoadFlashParms()
{
	if (pgTpl.indexOf("flsize_slideshow") > -1)
	{
		loadFlashSlideData();
		return;
	}
	if (typeof(window.document.movie) == "undefined") return;

	if (typeof(flashText) != "undefined" && flashText[1] != "") window.document.movie.Rewind(); // force flsize swfs to wait for text

	// turn off audio
	if (ThisPage.getPreference(PR_PageAudio) == "0") window.document.movie.SetVariable("_root.audio", "0");
		else window.document.movie.SetVariable("_root.audio", "1");
	// Pass text strings. For flsize_summary pages, pass lesson title and objectives.
	if (pgTpl=="flsize_summary" && (typeof(flashText) == "undefined" || flashText[1]=="") )
	{
		if (typeof(unitTitles) != "undefined") window.document.movie.SetVariable("_root.lessonTitle", unitTitles[unitNum]);
		summaryText="";
		if (typeof(objectives) != "undefined" && objectives[unitNum] != null)
		{
			objs=objectives[unitNum].split("|");
			for (i=0;i<objs.length;i++)
			{
				summaryText += objs[i] + "<br><br>";
			}
			window.document.movie.SetVariable("_root.text1", summaryText);
		}
		return;
	}
// for FS only?
	if (typeof(useScenarioText)!="undefined" && useScenarioText)
	{
		for (i=1;i<13;i++)
		{
			obj=document.getElementById("scenarioText" + i);
			if (obj != null) flashText[i]=obj.innerHTML;
		}
	}

	if (typeof(flashText) == "undefined" || flashText[1]=="") return;

	numText=0;
	for (i=1;i<flashText.length;i++)
	{
			if (flashText[i] != "undefined" && flashText[i] !=null && flashText[i] !="")
			{
				window.document.movie.SetVariable("_root.text" + i, flashText[i]);
 				numText++;
			}
	}
	// Pass audio values for TF objectives and summaries
	if (	isTfCourse && tfScenarioSwf != "")
	{
		objAudio="";
		for (i = 1; i < flashText.length; i ++)
		{
			objAudio+=courseSoundDirectory + "a_" + tfScenarioSwf +"_" + i + ".mp3|";
		}
		objAudio=objAudio.substring(0,objAudio.length-1); // delete terminal |
		window.document.movie.setVariable("objectiveA", objAudio);
	}

	window.document.movie.SetVariable("_root.numBullets", numText);
	window.document.movie.Play();
}

function flashKeyPress(key)
{
	executeKey(key.toLowerCase());
}

function replayFlash(fName)
{
	if (fName=="audioplayer" && (pgTpl.indexOf("act") > -1 || playBeep) )
	{
		playAudioFile(pgAudio + ".mp3");
		return;
	}
	fObj=window.document[fName]
	if (typeof(fObj)!="undefined")
	{
		fObj.Rewind();
		fObj.Play();
	}
	if (pgTpl != "doitpg" && pgTpl.indexOf("questiontime")==-1) self.focus(); //return focus to page for keystrokes to work
}

function playAudio()
{
	if (typeof(window.document.audioplayer) == "undefined") return;
	window.document.audioplayer.SetVariable("_root.playaudio", 1);
	window.document.audioplayer.Rewind();
	window.document.audioplayer.Play();
	if (!coursewareHandler.useFsStyle) self.focus(); //return focus to page for keystrokes to work
}

function stopAudio()
{
	if (typeof(window.document.audioplayer) != "undefined")
	{
		window.document.audioplayer.SetVariable("_root.playaudio", 0);
		window.document.audioplayer.Rewind();
		if (pgTpl != "doitpg" && pgTpl.indexOf("questiontime")==-1) self.focus(); //return focus to page for keystrokes to work
	}
}

function playAudioFile(filename)
{
	if (typeof(window.document.audioplayer) == "undefined") return;
	if ( (pgTpl=="explore" || pgTpl=="explorev") && filename.indexOf("_",4) != -1) return; // old explore its -- don't play audio
	if (ThisPage.isIE) window.document.audioplayer.Stop();
		else window.document.audioplayer.Rewind();
	window.document.audioplayer.SetVariable("_root.pageaudio", filename);
	playAudio();
}

flashAudioNum=1;
function flashPlayAudio(filename)
{
	if (ThisPage.getPreference(PR_PageAudio) == "0") return;
/* Use this code for closed captioning
	flashAudioNum=filename.substring(filename.length-2,filename.length);
	if (flashAudioNum.charAt(0)=="_") flashAudioNum=flashAudioNum.charAt(1);
	if (pgTpl=="flsize_scenario" || pgTpl=="flsize_sequence")
	{
		showClosedCaption(flashAudioNum);
	}
*/
	filename=thisCourseDirectory + filename + ".mp3";
	playAudioFile(filename);
}

// called in footer.js if pauseAudio (seconds to delay) is defined
function delayAudio(aplayer)
{
	clearTimeout(audioTmr)
	obj=document.getElementById("audioSpan");
	if (obj != null) obj.innerHTML=insertFlash(audioPlayer,"2","2","#FFFFFF",false,false,true);
}

function showClosedCaption(audioNum)
{
	return; // Turned off for March06
	if(document.getElementById("scenarioText")==null) return;
	for (i=1;i<25;i++)
	{
		obj=document.getElementById("scenarioText" + i);
		if (obj != null)
		{
			if (audioNum=="none" || (i != audioNum && audioNum != "all") ) obj.style.display="none";
				else  obj.style.display="block";
		}
	}
}


clicklistAutoPlay=false;
clicklistCurrentNum=0; // also used for clickpic
function clicklistAutoToggle()
{
	clicklistAutoPlay=!clicklistAutoPlay;
	obj=document.getElementById("autobut");
	if (clicklistAutoPlay)
	{
		audioIsDone=false;
		obj.src=sharedImageDir + "autoplay_off.gif";
		showClickListContent(clicklistCurrentNum+1);
	} else obj.src=sharedImageDir + "autoplay.gif";
}

playBeep=false;
function audioDone()
{
	if (audioIsDone) return;
	playBeep=coursewareHandler.useFsStyle || (typeof(playPageBeep) != "undefined" && playPageBeep);
	if (typeof(pgAction) != "undefined" && pgAction != "9") playBeep=false;
	if (pgTpl.indexOf("explore") > -1) playBeep=false;
	if (pgTpl=="fsmenu") return;
	if (typeof(pgAction) != "undefined" && pgAction=="4") coursewareHandler.goPage("next");
	if (pgTpl=="decision_point_dhtml") actAudioDone();
	if (pgTpl=="decision_point" && typeof(actDPAudioDone) != "undefined") actDPAudioDone();
	if ( ( typeof(useKeywordAudio) != "undefined" && useKeywordAudio) && (pgTpl=="actmatch" || pgTpl=="actimage" || pgTpl=="actfull") )
	{
		if (currentTry==1) playAudioFile(courseSoundDirectory + "a_" + currPage.substring(0,currPage.length-4) + "_choice_" + getKeywordOriginalNumber(choice[clueOrder[currentTry]]) + ".mp3"); //a_mfb003_choice_1.mp3
		audioIsDone=true;
	}
	if (pgTpl=="task" || pgTpl=="actquiz" || pgTpl == "activityonpg" || (pgTpl.indexOf("act") >-1 && !actChoiceSubmitted) ) return;
	if (pgTpl.indexOf("clickpic") > -1 && typeof("clickCoords") != "undefined" && clicklistCurrentNum < clickCoords.length-1) return;
	if (pgTpl=="clicklist" && clicklistCurrentNum < bulletItem.length-1)
	{
		if (clicklistAutoPlay)
		{
			clicklistCurrentNum++;
			showClickListContent(clicklistCurrentNum);
			audioIsDone=false;
		}
		return;
	}
	if (coursewareHandler.useFsStyle && coursewareHandler.fsAssessmentCompletesLesson)
	{
		if (currPage.indexOf("001") >-1 && coursewareHandler.fsAssessmentMap[unitNum] != null && coursewareHandler.fsAssessmentMap[unitNum] != "undefined")
		{
			if (coursewareHandler.fsLessonIsComplete(coursewareHandler.getScoNum(ScoId)) != 1)
			{
				fsAssessmentPage=coursewareHandler.fsAssessmentMap[unitNum];
				fsShowPrompt("pretest");
			}
		}
	}
	if (pgTpl.indexOf("fs_asmnt")>-1 && qIsAnswered) submitAssessmentQuestion();
	if (pgTpl.indexOf("_progress")>-1)
	{
			fsShowText();
			return;
	}

	audioIsDone=true;
	if (playBeep && (pgTpl == "scovie" || pgAudio.indexOf("second")==-1) && pgTpl.indexOf("fs_asmnt") == -1) playEndOfPageSound();
}

endOfPageSoundPlayed=false;
function playEndOfPageSound()
{
	if (endOfPageSoundPlayed) return;
	if (typeof(autoNext)!="undefined" && autoNext)
	{
		coursewareHandler.goPage("next"); // for auto pilot
		return;
	}
	playAudioFile(sharedSoundDirectory + "a_eop_beep.mp3");
	if (typeof(animateNextButton) != "undefined") highlightNextButton();
	
	endOfPageSoundPlayed=true;
}

function highlightNextButton()
{
	if (typeof(animateNextButton) == "undefined") return;
	obj=parent.frames[1].document.getElementById("forwardoff");
	if (obj != null)
		obj.src=rootDir + "/shared/images/buttons/forward_beep.gif";
}

function simAudioDone()
{
	playEndOfPageSound();
}

function endOfFlash(fType)
{
	playEndOfPageSound();
}

function resetNextButton()
{
	if (typeof(animateNextButton) == "undefined" || typeof(parent.frames[1]) == "undefined") return;
	obj=parent.frames[1].document.getElementById("forwardoff");
	if (obj != null)
		obj.src=rootDir + "/shared/images/buttons/forward.gif"
}

// Used for IE6 in FS courses
function audioplayer_DoFSCommand(command, args)
{
	if (command == "call_audioDone") audioDone();
}


currentAudioNum=1;
function fsShowText(obj)
{
	currentAudioNum++;
	audioIsDone=true;
	obj=document.getElementById("progressText" + currentAudioNum)
	if (obj!=null)
	{
		audioIsDone=false;
		playAudioFile(courseSoundDirectory + "a_" + currPage.substring(0,currPage.length-4) + "_" + currentAudioNum + ".mp3");
		obj.style.display="inline"; 
		if (typeof(useProgressiveImages) != "undefined" && useProgressiveImages)
		{
			nextImage=pgImage.substring(0,pgImage.indexOf("_") + 1) + currentAudioNum + pgImage.substring(pgImage.length-4, pgImage.length);
			fsFadeImg("simPic", nextImage)
		} else if (typeof(window.document.movie)!="undefined" && currentAudioNum < slideImages.length && slideImages[currentAudioNum] != "") window.document.movie.goSlide(currentAudioNum);
	} else if (playBeep) playEndOfPageSound();
}

function fsShowAllText()
{
	// shows all text and last image on progressive pages
	if (pgTpl.indexOf("_progress")==-1) return;
	for (i=1;i<12;i++)
	{
		obj=document.getElementById("progressText" + i)
		if (obj!=null) obj.style.display="inline";
	}
	for (i=slideImages.length; i >1; i--)
	{
		if (slideImages[i] != null && slideImages[i] != "")
		{
			slideImages[1]=slideImages[i];
			return;
		}
	}
}

function progressUseTranscript()
{
	transArray=pgTranscript.split("|");
	for (i=0;i < transArray.length;i++)
	{
		obj=document.getElementById("progressText" + parseInt(i+1));
		if (obj!=null)
		{
			obj.innerHTML=transArray[i];
		}
	}
}

function fsFadeImg(objname, nextImg)
{
	var objholder=document.getElementById(objname)
	objholder.filters[0].apply()
	objholder.src=src=nextImg;
	objholder.filters[0].play()
}

lastSlideLoaded=1;
function fsLoadProgressiveData()
{
	if (typeof(window.document.movie)=="undefined") return;
// _root.slide, _root.slideIn, _root.slideOut, ­_root.slideXPos, _root.slideYPos,
// 1-Fade In 2-Slide Left 3-Slide Right 4-Slide Up 5-Slide Down 6-Grow
	slideIn="1";
	slideOut="1";
	if (isTfCourse)
	{
		slideOut="0"
		slideIn="0";
	}
	//progressiveBackground=sharedImageDir + "progressive_blank.gif";
	if (typeof(progressiveBackground)!="undefined")
	{
		if (progressiveBackground.indexOf("/") == -1) progressiveBackground= thisCourseDirectory + progressiveBackground;
		window.document.movie.SetVariable("_root.backgroundimage", progressiveBackground);
	}
	for (i=1; i < slideImages.length; i++) // loop through slide numbers
	{
		window.document.movie.SetVariable("_root.slide" + i, thisCourseDirectory + slideImages[i]);
		window.document.movie.SetVariable("_root.slideIn" + i, slideIn);
		window.document.movie.SetVariable("_root.slideOut" + i, slideOut);
		window.document.movie.SetVariable("_root.slideXPos" + i, "0");
		window.document.movie.SetVariable("_root.slideYPos" + i, "0");
		if (i > 1 && slideImages[i-1] != "") lastSlideLoaded=i-1;
		window.document.movie.SetVariable("_root.lastslide" + i, lastSlideLoaded);
	}
	// set last image as blank, for capturing
	if (typeof(slideImages) != "undefined") window.document.movie.SetVariable("_root.slide" + slideImages.length, "/dpec/shared/inhouse/blank.gif");

	if (!ThisPage.isIE && (!window.document.movie || !window.document.movie.goSlide) )
	{
		t=setTimeout("fsLoadProgressiveData()",500)
		return;
	}
	window.document.movie.goSlide(currentAudioNum);

	// Fix this to use with TF design
	if (pgTpl.indexOf("ecdl")>-1) document.getElementById("progressText1").style.display="block";
		else document.getElementById("progressText1").style.display="inline";
}

function hideProgressiveText() // to avoid flicker, hide text on unload on progressive pages
{
		document.getElementById("wDiv").style.display="none";
		obj=document.getElementById("wDiv2");
		if (obj != null) obj.style.display="none";
}

//******************************* End Flash and Audio Code ******************************//

//******************************* FS Style Code ******************************//

fsAssessmentPage="";
function fsGoAssessment()
{
	if (fsAssessmentPage !="") location.href=thisCourseDirectory + fsAssessmentPage;
}

function fsGetPromptDiv()
{
	fsPromptWidth=440;
	wTop=parseInt(parseInt(document.body.clientHeight)/2)-75;
	wLeft=parseInt(parseInt(document.body.clientWidth)/2) - (fsPromptWidth/2);
	if (ThisPage.isIE) filterCode="filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);";
		else filterCode="";
	pBox="<div id=fsPrompt class=\"keyBoxStyle\" style=\"width:" + fsPromptWidth + "px;position:absolute;top:" + wTop + ";left:" + wLeft + ";display:none;" + filterCode + "\">";
	pBox+="<TABLE id=fsPromptTable WIDTH=100% cellpadding=0 cellspacing=0>";
	pBox+="<TR><TD ALIGN=CENTER VALIGN=center bgcolor=\"#52527D\"><center><span id=fsPromptTitle style=\"font-size:10pt;color:white;\"></span></TD></TR>"
	pBox+="<TR><TD align=center><br><table width=92%><tr><td><span id=fsPromptText style=\"font-size:11pt;font-weight:bold;\"></span></td></tr></table></TD></TR>";
	pBox+="<TR><TD align=center><br><span id=fsPromptButtons></span></TD></TR>";
	pBox+="</TABLE></div>";
	return pBox;
}

lastSearchTerm="";
function toolstabClick(dest)
{
	srhTerm=lastSearchTerm;
	fsShowPrompt(dest,srhTerm)
}

function fsShowPrompt(pType,srhTerm)
{
	if (typeof(tabType)=="undefined") tabType="";
	if (isTfCourse) tabType="4_tf";
	tabMap="<map name=\"tabmap\">";
	switch (tabType)
	{
		case "4":
		case "4_tf":
			tabMap+="<area shape=\"rect\" coords=\"5,0,135,20\" href=\"javascript:toolstabClick('help')\">";
			tabMap+="<area shape=\"rect\" coords=\"136,0,249,20\" href=\"javascript:toolstabClick('glossary')\">";
			tabMap+="<area shape=\"rect\" coords=\"250,0,363,20\" href=\"javascript:toolstabClick('other_resources')\">";
			tabMap+="<area shape=\"rect\" coords=\"364,0,480,20\" href=\"javascript:toolstabClick('course_summary')\">";
		break;
		default:
			tabMap+="<area shape=\"rect\" coords=\"5,0,135,20\" href=\"javascript:toolstabClick('help')\">";
			tabMap+="<area shape=\"rect\" coords=\"136,0,249,20\" href=\"javascript:toolstabClick('glossary')\">";
			tabMap+="<area shape=\"rect\" coords=\"250,0,363,20\" href=\"javascript:toolstabClick('encyclopedia')\">";
			tabMap+="<area shape=\"rect\" coords=\"364,0,477,20\" href=\"javascript:toolstabClick('other_resources')\">";
			tabMap+="<area shape=\"rect\" coords=\"480,0,600,20\" href=\"javascript:toolstabClick('course_summary')\">";
	}
	tabMap+="</MAP>";

	document.getElementById("fsPromptTable").background="";
	locParm="&loc=" + coursewareHandler.localizationCode;
	switch (pType)
	{
		case "pretest":
			fsSetPromptValues(480,sharedImageDir + "fs_prompt_bg.jpg","center","center")
			document.getElementById("fsPromptTitle").innerHTML="<b>" + resStr.takeAssessment + "</b>";
			document.getElementById("fsPromptText").innerText=resStr.completeAssessment;
			pButtons="<img id=fsYes src=\"" + sharedImageDir + "yes.gif\" height=26 width=78 onclick=\"fsGoAssessment();\" onmouseover=\"buttonRollover('fsYes','yes',true,'" + sharedImageDir + "');\" onmouseout=\"buttonRollover('fsYes','yes',false,'" + sharedImageDir + "');\">&nbsp;&nbsp;";
			pButtons+="<img id=fsNo src=\"" + sharedImageDir + "no.gif\" height=26 width=78 onclick=\"coursewareHandler.goPage('" + nextPage + "');\" onmouseover=\"buttonRollover('fsNo','no',true,'" + sharedImageDir + "');\" onmouseout=\"buttonRollover('fsNo','no',false,'" + sharedImageDir + "');\">";
			document.getElementById("fsPromptButtons").innerHTML=pButtons;
		break;
		case "unavailable":
			fsSetPromptValues(440,sharedImageDir + "fs_prompt_bg.jpg","center","center")
			document.getElementById("fsPromptTable").background=sharedImageDir + "fs_prompt_bg.jpg";
			document.getElementById("fsPromptTitle").innerHTML="<b>" + resStr.contentUnavailable + "</b>";
			document.getElementById("fsPromptText").innerText=resStr.grayFolders;
			pButtons="<img id=fsClose src=\"" + sharedImageDir + tfPrefix + "act_close.gif\" height=24 width=48 onclick=\"fsClosePrompt();\" onmouseover=\"buttonRollover('fsClose','" + tfPrefix + "act_close',true,'" + sharedImageDir + "');\" onmouseout=\"buttonRollover('fsClose','" + tfPrefix + "act_close',false,'" + sharedImageDir + "');\">&nbsp;&nbsp;";
			document.getElementById("fsPromptButtons").innerHTML=pButtons;
		break;
		case "completion":
			fsSetPromptValues(440,sharedImageDir + "fs_prompt_bg.jpg","center","center")
			document.getElementById("fsPromptTable").background=sharedImageDir + "fs_prompt_bg.jpg";
			document.getElementById("fsPromptTitle").innerHTML="<b>" + resStr.fsCongrats1 + "</b>";
			if (coursewareHandler.userFirstName==null) congratsMsg=resStr.fsCongrats1 + ", " + resStr.fsCongrats2;
				else congratsMsg=resStr.fsCongrats1 + ", " + coursewareHandler.userFirstName + ", " + resStr.fsCongrats2;
			// Evaluation Message
			if (isMindLeaders && coursewareHandler.evalUrl != null) congratsMsg+="<br><br>" + resStr.courseEvalMessage;
			document.getElementById("fsPromptText").innerHTML=congratsMsg
			pButtons="<img id=fsClose src=\"" + sharedImageDir + tfPrefix + "act_close.gif\" height=24 width=48 onclick=\"fsClosePrompt();\" onmouseover=\"buttonRollover('fsClose','" + tfPrefix + "act_close',true,'" + sharedImageDir + "');\" onmouseout=\"buttonRollover('fsClose','" + tfPrefix + "act_close',false,'" + sharedImageDir + "');\">&nbsp;&nbsp;";
			document.getElementById("fsPromptButtons").innerHTML=pButtons;
		break;
		case "glossary":
			fsPromptWidth=parseInt(document.body.clientWidth)-50;
			wLeft=parseInt(parseInt(document.body.clientWidth)/2) - (fsPromptWidth/2);
			fsSetPromptValues(fsPromptWidth,"",40,wLeft)
			if (typeof(srhTerm)=="undefined") srhTerm="";
			frameHeight=parseInt(parseInt(document.body.clientHeight)-150);
			document.getElementById("fsPromptTitle").innerHTML="<img src=\"" + localizedSharedDirectory + "images/skins/1/images/fs_toolstab" + tabType + "_glossary.jpg\" border=0 ISMAP USEMAP=\"#tabmap\">" + tabMap;
			document.getElementById("fsPromptText").innerHTML="<iframe frameborder=0 id=promptFrame src=\"" + rootDir + "/shared/templates/glossary_search.htm?course=" + crsAcronym + "&stitle=" + escape(ThisPage.getSeriesTitle()) + "&searchfor=" + srhTerm + locParm + "\" width=" + (fsPromptWidth-20) + " height=" + frameHeight + "></iframe>";
			pButtons="<img id=fsClose src=\"" + sharedImageDir + tfPrefix + "act_close.gif\" height=24 width=48 onclick=\"fsClosePrompt();\" onmouseover=\"buttonRollover('fsClose','" + tfPrefix + "act_close',true,'" + sharedImageDir + "');\" onmouseout=\"buttonRollover('fsClose','" + tfPrefix + "act_close',false,'" + sharedImageDir + "');\">&nbsp;&nbsp;";
			document.getElementById("fsPromptButtons").innerHTML=pButtons;
		break;
		case "encyclopedia":
			fsPromptWidth=parseInt(document.body.clientWidth)-50;
			wLeft=parseInt(parseInt(document.body.clientWidth)/2) - (fsPromptWidth/2);
			fsSetPromptValues(fsPromptWidth,"",40,wLeft)
			if (typeof(srhTerm)=="undefined") srhTerm="";
			frameHeight=parseInt(parseInt(document.body.clientHeight)-150);
			document.getElementById("fsPromptTitle").innerHTML="<img src=\"" + localizedSharedDirectory + "images/skins/1/images/fs_toolstab" + tabType + "_encyclopedia.jpg\" border=0 ISMAP USEMAP=\"#tabmap\">" + tabMap;
			document.getElementById("fsPromptText").innerHTML="<iframe frameborder=0 id=promptFrame src=\"" + rootDir + "/shared/templates/encyclopedia.htm?course=" + crsAcronym + "&stitle=" + escape(ThisPage.getSeriesTitle()) + "&searchfor=" + srhTerm + locParm + "\" width=" + (fsPromptWidth-20) + " height=" + frameHeight + "></iframe>";
			pButtons="<img id=fsClose src=\"" + sharedImageDir + tfPrefix + "act_close.gif\" height=24 width=48 onclick=\"fsClosePrompt();\" onmouseover=\"buttonRollover('fsClose','" + tfPrefix + "act_close',true,'" + sharedImageDir + "');\" onmouseout=\"buttonRollover('fsClose','" + tfPrefix + "act_close',false,'" + sharedImageDir + "');\">&nbsp;&nbsp;";
			document.getElementById("fsPromptButtons").innerHTML=pButtons;
		break;
		case "other_resources":
			fsPromptWidth=parseInt(document.body.clientWidth)-50;
			wLeft=parseInt(parseInt(document.body.clientWidth)/2) - (fsPromptWidth/2);
			fsSetPromptValues(fsPromptWidth,"",40,wLeft)
			frameHeight=parseInt(parseInt(document.body.clientHeight)-150);
			document.getElementById("fsPromptTitle").innerHTML="<img src=\"" + localizedSharedDirectory + "images/skins/1/images/fs_toolstab" + tabType + "_resources.jpg\" border=0 ISMAP USEMAP=\"#tabmap\">" + tabMap;
			document.getElementById("fsPromptText").innerHTML="<iframe frameborder=0 id=promptFrame src=\"" + rootDir + "/shared/templates/resources.htm?course=" + crsAcronym + "&stitle=" + escape(ThisPage.getSeriesTitle()) + "&searchfor=" + srhTerm + locParm + "\" width=" + (fsPromptWidth-20) + " height=" + frameHeight + "></iframe>";
			pButtons="<img id=fsClose src=\"" + sharedImageDir + tfPrefix + "act_close.gif\" height=24 width=48 onclick=\"fsClosePrompt();\" onmouseover=\"buttonRollover('fsClose','" + tfPrefix + "act_close',true,'" + sharedImageDir + "');\" onmouseout=\"buttonRollover('fsClose','" + tfPrefix + "act_close',false,'" + sharedImageDir + "');\">&nbsp;&nbsp;";
			document.getElementById("fsPromptButtons").innerHTML=pButtons;
		break;
		case "help":
			fsPromptWidth=parseInt(document.body.clientWidth)-50;
			wLeft=parseInt(parseInt(document.body.clientWidth)/2) - (fsPromptWidth/2);
			fsSetPromptValues(fsPromptWidth,"",40,wLeft)
			frameHeight=parseInt(parseInt(document.body.clientHeight)-150);
			document.getElementById("fsPromptTitle").innerHTML="<img src=\"" + localizedSharedDirectory + "images/skins/1/images/fs_toolstab" + tabType + "_help.jpg\" border=0 ISMAP USEMAP=\"#tabmap\">" + tabMap; //menuHelpOff + menuGlossary + menuEncyclopedia + menuCopyright;
			if (isTfCourse)
				document.getElementById("fsPromptText").innerHTML="<iframe id=promptFrame src=\"" + localizedSharedDirectory + "help/courses/using_this_course_tf.htm?course=" + crsAcronym + "&fs=1&3rd=0&ceus=0&env=" + coursewareHandler.launchEnvironment + "&acro=" + crsAcronym + locParm + "\" width=" + (fsPromptWidth-20) + " height=" + frameHeight + "></iframe>";
			else
				document.getElementById("fsPromptText").innerHTML="<iframe id=promptFrame src=\"" + localizedSharedDirectory + "help/courses/using_this_course_fs.htm?course=" + crsAcronym + "&fs=1&3rd=0&ceus=0&env=" + coursewareHandler.launchEnvironment + "&acro=" + crsAcronym + locParm + "\" width=" + (fsPromptWidth-20) + " height=" + frameHeight + "></iframe>";
			pButtons="<img id=fsClose src=\"" + sharedImageDir + tfPrefix + "act_close.gif\" height=24 width=48 onclick=\"fsClosePrompt();\" onmouseover=\"buttonRollover('fsClose','" + tfPrefix + "act_close',true,'" + sharedImageDir + "');\" onmouseout=\"buttonRollover('fsClose','" + tfPrefix + "act_close',false,'" + sharedImageDir + "');\">&nbsp;&nbsp;";
			document.getElementById("fsPromptButtons").innerHTML=pButtons;
		break;
		case "course_summary":
			fsPromptWidth=parseInt(document.body.clientWidth)-50;
			wLeft=parseInt(parseInt(document.body.clientWidth)/2) - (fsPromptWidth/2);
			fsSetPromptValues(fsPromptWidth,"",40,wLeft)
			frameHeight=parseInt(parseInt(document.body.clientHeight)-150);
			document.getElementById("fsPromptTitle").innerHTML="<img src=\"" + localizedSharedDirectory + "images/skins/1/images/fs_toolstab" + tabType + "_summary.jpg\" border=0 ISMAP USEMAP=\"#tabmap\">" + tabMap;
			document.getElementById("fsPromptText").innerHTML="<iframe frameborder=0 id=promptFrame src=\"" + rootDir + "/shared/templates/" + tfPrefix + "course_summary.htm?acro=" + crsAcronym + locParm + "\" width=" + (fsPromptWidth-20) + " height=" + frameHeight + "></iframe>";
			pButtons="<img id=fsClose src=\"" + sharedImageDir + tfPrefix + "act_close.gif\" height=24 width=48 onclick=\"fsClosePrompt();\" onmouseover=\"buttonRollover('fsClose','" + tfPrefix + "act_close',true,'" + sharedImageDir + "');\" onmouseout=\"buttonRollover('fsClose','" + tfPrefix + "act_close',false,'" + sharedImageDir + "');\">&nbsp;&nbsp;";
			document.getElementById("fsPromptButtons").innerHTML=pButtons;
		break;
		case "evaluation":
			fsPromptWidth=parseInt(document.body.clientWidth)-50;
			wLeft=parseInt(parseInt(document.body.clientWidth)/2) - (fsPromptWidth/2);
			fsSetPromptValues(fsPromptWidth,"",40,wLeft)
			frameHeight=parseInt(parseInt(document.body.clientHeight)-150);
			document.getElementById("fsPromptTitle").innerHTML="<b>" + resStr.courseEval + "<b>";
			parent.params.put("cc", coursewareHandler.getSiteEvaluationCc());
			document.getElementById("fsPromptText").innerHTML="<iframe frameborder=0 id=promptFrame src=\"" + coursewareHandler.evalUrl + "?" + parent.params.toURLString() + "&ctitle=" + escape(crsTitle) + locParm + "\" width=" + (fsPromptWidth-20) + " height=" + frameHeight + "></iframe>";
			pButtons="<img id=fsClose src=\"" + sharedImageDir + tfPrefix + "act_close.gif\" height=24 width=48 onclick=\"fsClosePrompt();\" onmouseover=\"buttonRollover('fsClose','" + tfPrefix + "act_close',true,'" + sharedImageDir + "');\" onmouseout=\"buttonRollover('fsClose','" + tfPrefix + "act_close',false,'" + sharedImageDir + "');\">&nbsp;&nbsp;";
			document.getElementById("fsPromptButtons").innerHTML=pButtons;
		break;
		case "orientation_prompt":
			fsSetPromptValues(440,sharedImageDir + "fs_prompt_bg.jpg","center","center")
			document.getElementById("fsPromptTitle").innerHTML="<b>" + resStr.fsViewOrientationTitle + "</b>";
			document.getElementById("fsPromptText").innerHTML=resStr.fsViewOrientation;
			firstColW="100"
			spanishAudioButton="";
			pButtons="<table width=92%><tr><td width=" + firstColW +">" + spanishAudioButton + "</td><td>"
			pButtons+="<img id=fsYes src=\"" + sharedImageDir + "yes.gif\" height=26 width=78 onclick=\"fsShowOrientation();\" onmouseover=\"buttonRollover('fsYes','yes',true,'" + sharedImageDir + "');\" onmouseout=\"buttonRollover('fsYes','yes',false,'" + sharedImageDir + "');\">&nbsp;&nbsp;";
			pButtons+="<img id=fsNo src=\"" + sharedImageDir + "no.gif\" height=26 width=78 onclick=\"stopAudio();fsClosePrompt();\" onmouseover=\"buttonRollover('fsNo','no',true,'" + sharedImageDir + "');\" onmouseout=\"buttonRollover('fsNo','no',false,'" + sharedImageDir + "');\">";
			pButtons+="</td></tr></table>";
			document.getElementById("fsPromptButtons").innerHTML=pButtons;
		break;
		case "help_prompt":
			fsSetPromptValues(440,sharedImageDir + "fs_prompt_bg.jpg","center","center")
			document.getElementById("fsPromptTitle").innerHTML="<b>" + resStr.fsViewHelpTitle + "</b>";
			document.getElementById("fsPromptText").innerHTML=resStr.fsViewHelp;
			firstColW="100"
			pButtons="<table width=92%><tr><td width=" + firstColW +">&nbsp;</td><td>"
			pButtons+="<img id=fsYes src=\"" + sharedImageDir + "yes.gif\" height=26 width=78 onclick=\"coursewareHandler.goPage('help');\" onmouseover=\"buttonRollover('fsYes','yes',true,'" + sharedImageDir + "');\" onmouseout=\"buttonRollover('fsYes','yes',false,'" + sharedImageDir + "');\">&nbsp;&nbsp;";
			pButtons+="<img id=fsNo src=\"" + sharedImageDir + "no.gif\" height=26 width=78 onclick=\"stopAudio();fsClosePrompt();\" onmouseover=\"buttonRollover('fsNo','no',true,'" + sharedImageDir + "');\" onmouseout=\"buttonRollover('fsNo','no',false,'" + sharedImageDir + "');\">";
			pButtons+="</td></tr></table>";
			document.getElementById("fsPromptButtons").innerHTML=pButtons;
		break;
		case "scores_tf":
			fsPromptWidth=parseInt(document.body.clientWidth)-50;
			if (fsPromptWidth>720) fsPromptWidth=720;
			wLeft=parseInt(parseInt(document.body.clientWidth)/2) - (fsPromptWidth/2);
			fsSetPromptValues(fsPromptWidth,"",40,wLeft)
			frameHeight=parseInt(parseInt(document.body.clientHeight)-150);
			document.getElementById("fsPromptTitle").innerHTML="<b>" + resStr.postScoresTitle + "<b>";
			document.getElementById("fsPromptText").innerHTML="<iframe frameborder=0 topmargin=0 id=tfScoresFrame src=\"" + sharedDirectory + "templates/scores_tf.htm?acro=" + crsAcronym + "&env=" + coursewareHandler.launchEnvironment + locParm + "\" width=" + (fsPromptWidth-20) + " height=" + frameHeight + "></iframe>";
			pButtons="<img id=fsClose src=\"" + sharedImageDir + tfPrefix + "act_close.gif\" height=24 width=48 onclick=\"fsClosePrompt();\" onmouseover=\"buttonRollover('fsClose','" + tfPrefix + "act_close',true,'" + sharedImageDir + "');\" onmouseout=\"buttonRollover('fsClose','" + tfPrefix + "act_close',false,'" + sharedImageDir + "');\">&nbsp;&nbsp;";
			document.getElementById("fsPromptButtons").innerHTML=pButtons;
		break;
		default:
			return;
	}
	obj=document.getElementById("fsPrompt");
	obj.style.display="block";
	fadeItemIn("fsPrompt",15);
}

function fsYesNoPrompt(pTitle,pText,yesFunction,noFunction)
{
	fsSetPromptValues(440,sharedImageDir + "fs_prompt_bg.jpg","center","center")
	document.getElementById("fsPromptTitle").innerHTML="<b>" + pTitle + "</b>";
	document.getElementById("fsPromptText").innerHTML="<center>" + pText + "</center>";
	firstColW="100"
	pButtons="<img id=fsYes src=\"" + sharedImageDir + "yes.gif\" height=26 width=78 onclick=\"" + yesFunction + "\" onmouseover=\"buttonRollover('fsYes','yes',true,'" + sharedImageDir + "');\" onmouseout=\"buttonRollover('fsYes','yes',false,'" + sharedImageDir + "');\">&nbsp;&nbsp;";
	pButtons+="<img id=fsNo src=\"" + sharedImageDir + "no.gif\" height=26 width=78 onclick=\"" + noFunction + "\" onmouseover=\"buttonRollover('fsNo','no',true,'" + sharedImageDir + "');\" onmouseout=\"buttonRollover('fsNo','no',false,'" + sharedImageDir + "');\">";
	document.getElementById("fsPromptButtons").innerHTML=pButtons;
	obj=document.getElementById("fsPrompt");
	obj.style.display="block";
	fadeItemIn("fsPrompt",15);
}

function fsShowOrientation()
{
	if (isTfCourse)
		location.href="" + localizedSharedDirectory + "help/courses/tf_orientation/tf_orientation.htm?language=" + coursewareHandler.fsAudioDirectory + "&loc=" + coursewareHandler.localizationCode;
	else
		location.href="" + localizedSharedDirectory + "help/courses/fs_orientation/fs_orientation.htm?language=" + coursewareHandler.fsAudioDirectory + "&loc=" + coursewareHandler.localizationCode;
}

function changeLanguageInPrompt()
{
	fsSpanishAudio();
	playAudioFile(sharedSoundDirectory + "fs_welcome.mp3");
	fsShowPrompt("orientation_prompt");
}
function fsSetPromptValues(pWidth, pBgImg, pTop, pLeft)
{
	if (pTop=="center") pTop=parseInt(parseInt(document.body.clientHeight)/2)-75;
	if (pLeft=="center") pLeft=parseInt(parseInt(document.body.clientWidth)/2) - (pWidth/2);
	document.getElementById("fsPrompt").style.width=pWidth;
	document.getElementById("fsPromptTable").background=pBgImg;
	document.getElementById("fsPrompt").style.top=pTop;
	document.getElementById("fsPrompt").style.left=pLeft;
}

function fsClosePrompt(flag)
{
	obj=document.getElementById("fsPrompt");
	fadeItemOut("fsPrompt",15);
	//obj.style.display="none";
}


function openResource(fName, winH, winW) // Called by resource links in other resources
{
	if (typeof(winH)=="undefined") winH=575;
	if (typeof(winW)=="undefined") winW=640;
	//if (fName.indexOf("http:") > -1)
	window.open(fName,"resourcewin","width=" + winW + ",height=" + winH + ",toolbar=1,status=1,resizable=1,scrollbars=1");
	//else
		//ThisPage.floatWin(fName,"pdf_" + crsAcronym,"width=" + winW + ",height=" + winH + ",toolbar=0,status=0,resizable=1,scrollbars=1");
}
//******************************* End FS Style Code ******************************//

//******************************* Keystroke Code *************************//

var shiftHeld=false;
var ctrlHeld=false;
var altHeld=false;
function captureKeystrokes(ev)
{
	if (typeof(isLoaded) == "undefined") isLoaded=true;
	if (typeof(pgType) == "undefined") pgType="content";
	if (isLoaded==false) return true;
	if (ThisPage.isIE) // Map event object
	{
		if (capEvents)
		{
			event = ev;
			event.keyCode = ev.which
			event.srcElement = ev.target
		}
	}
	else
	{
		event = ev;
		event.srcElement = ev.target
	}
	if (event==null) event = ev
	var key = String.fromCharCode(event.keyCode).toUpperCase()
	var entry = keyRegistry[key];
	shiftHeld=event.shiftKey;
	ctrlHeld=event.ctrlKey;
	altHeld=event.altKey;
// ******************* ENTER Key ************************************
	if (event.keyCode == 13)
	{
		if (typeof(pgTpl) != "undefined")
		{
			if (pgTpl.indexOf("full") > -1 && pgType.indexOf("text") == -1)
			{
				simKey("enter");
				return;
			}
			if (pgTpl=="fullq")
			{
				submitTextQuestion();
				return;
			}
			// don't submit in SA sims
			if (typeof(document.form1) != "undefined" && pgTpl != "fullq"  && pgTpl != "questiontime_q")
			{
				if (pgTpl.indexOf("cliq") < 0 && pgTpl !="sasimweb" && pgTpl !="safsim" && pgTpl !="htldoit" && !hasBeenAnswered()) submitQuestion();
				if (pgType.indexOf("question") > -1) return false;
			}
			else
			{
				if (pgTpl=="doit")
				{
					if (pgSim.indexOf(".swf") > -1) openSim(pgSim) //flash sims, don't add .htm
						else openSim(pgSim + ".htm"); //on Do It pages, open the sim
				}
				else if (pgTpl=="activity") openActivity(pgSim); //on Do It Activity pages, open the activity
					else if (pgLinks!="" && pgLinks.indexOf(",") < 0 && pgTpl.indexOf("question") < 0 && pgTpl.indexOf("doitpg") < 0) coursewareHandler.onHotWordClick(pgLinks); //if there is only one link on the page, go there
			}
		}
	}
	if (event.keyCode == 27) // escape key
	{
		if (typeof(pgTpl) != "undefined" && pgTpl.indexOf("full") > -1 && pgType.indexOf("text") == -1)
		{
			simKey("escape");
			return;
		}
	}
// ******************************************************************
// If valid entry and not within an input control
	if (entry!=null)
	{
		if (event.srcElement.type==null || (pgType.indexOf("question") > -1 && hasBeenAnswered())) executeKey(entry.toLowerCase());
	}
}

function ffCaptureKeystrokes(ev) // DELETE THIS????
{
	if (typeof(isLoaded) == "undefined") isLoaded=true;
	if (typeof(pgType) == "undefined") pgType="content";
	if (isLoaded==false) return true;
//	if (capEvents) // Map event object
//	{
//		event = ev
//		event.keyCode = ev.which
//		event.srcElement = ev.target
//	}
//	if (event==null) event = ev
	ev.srcElement = ev.target
	var key = String.fromCharCode(ev.keyCode).toUpperCase();
	var entry = keyRegistry[key];
	shiftHeld=ev.shiftKey;
// ******************* ENTER Key ************************************
	if (ev.keyCode == 13)
	{
		if (typeof(pgTpl) != "undefined")
		{
			if (pgTpl.indexOf("full") > -1 && pgType.indexOf("text") == -1)
			{
				simKey("enter");
				return;
			}
			if (pgTpl=="fullq")
			{
				submitTextQuestion();
				return;
			}
			// don't submit in SA sims
			if (typeof(document.form1) != "undefined" && pgTpl != "fullq" )
			{
				if (pgTpl.indexOf("cliq") < 0 && pgTpl !="sasimweb" && pgTpl !="safsim" && pgTpl !="htldoit" && !hasBeenAnswered()) submitQuestion();
				if (pgType.indexOf("question") > -1) return false;
			}
			else
			{
				if (pgTpl=="doit")
				{
					if (pgSim.indexOf(".swf") > -1) openSim(pgSim) //flash sims, don't add .htm
						else openSim(pgSim + ".htm"); //on Do It pages, open the sim
				}
				else if (pgTpl=="activity") openActivity(pgSim); //on Do It Activity pages, open the activity
					else if (pgLinks!="" && pgLinks.indexOf(",") < 0 && pgTpl.indexOf("question") < 0 && pgTpl.indexOf("doitpg") < 0) coursewareHandler.onHotWordClick(pgLinks); //if there is only one link on the page, go there
			}
		}
	}
	if (ev.keyCode == 27) // escape key
	{
		if (typeof(pgTpl) != "undefined" && pgTpl.indexOf("full") > -1 && pgType.indexOf("text") == -1)
		{
			simKey("escape");
			return;
		}
	}
// ******************************************************************
// If valid entry and not within an input control
	if (entry!=null)
	{
		if (ev.srcElement.type==null || (pgType.indexOf("question") > -1 && hasBeenAnswered())) executeKey(entry.toLowerCase());
	}
}


keystrokes=""
// This function deals with question keys or sends keys onto courseware handler if not a question key.
function executeKey(keyStroke)
{
	keystrokes=keystrokes + keyStroke
	if (keystrokes.length > 7) keystrokes=keystrokes.substring(1,9);
	if (keystrokes.indexOf("cmpl") > -1) showMarkers=true;

	if (pgTpl=="video" && "itcrqfehs".indexOf(keyStroke) > -1)
	{
		clickBSV(keyStroke);
		return true;
	}
	if (coursewareHandler.launchEnvironment == "TF")
	{
		if (typeof(isCorrect_tf) != "undefined" && isCorrect_tf == "0")
			return;
	}

	isMcLetter="abcdefg".indexOf(keyStroke) > -1;
	if (isMcLetter)
	{
		if (pgType.indexOf("radio") > 0 || pgType.indexOf("check") > 0)
		 {
			clickMC (keyStroke);
			return true;
		 }
	}
	switch (keyStroke)
	{
	case "i":
		if (isMLproduction()) floatWin("/dpec/shared/inhouse/imagelibrary/image_picker.htm", 'imagePicker', 'resizable=yes,width=640,height=640,scrollbars=yes,menubar=no,toolbar=no,statusbar=no');
		return;
		break;
	case "m":
		if (isMLproduction())
		{
			if (shiftHeld)
			{
				if (typeof(showmeName) != "undefined" && showmeName != "") sim=showmeName;
					else if (pgTpl=="doitpg") sim=pgSim;
						else return;
				floatWin("/dpec/shared/inhouse/doit_text.htm?acro=" + crsAcronym + "&sim=" + sim + "&htm=" + currPage, 'imagePicker', 'resizable=yes,width=680,height=640,scrollbars=yes,menubar=no,toolbar=no,statusbar=no');
			} else if (!isBsv) openGifComments(location.href);
		}
		return;
		break;
	case "n":
		//second N goes to next page on YN pages
		if (typeof(firstc2c) != "undefined" && firstc2c==true) nextPage = currPage + "?instr=yes"
		if (pgType.indexOf("yn") > 0 && !hasBeenAnswered() )
		{
			if(!document.form1.radio[1].checked)
			{
				clickMC("b");
				return;
			}
		}
		break;
	case "l": //copy location to clipboard -- press L for us; press L twice for users
		if (isMLtech() || lastKey == "l" && !shiftHeld) window.clipboardData.setData("Text", crsTitle + ", " + window.defaultStatus + ": " + location.href);
		if (isMLproduction() && shiftHeld && (typeof(actName) != "undefined" || pgTpl.indexOf("act") > -1) )
		{
			if (pgTpl.indexOf("act") > -1) actName=crsAcronym;
			floatWin("/dpec/shared/inhouse/activity_colorizer.htm?act=" + actName + "&type=" + pgTpl, 'actColorWin', 'resizable=yes,width=390,height=655,scrollbars=yes,menubar=no,toolbar=no,statusbar=no');
		}
		break;
		return;
	case "o":
		if (isMLtech() || lastKey=="5") quickGo();
			else if (this.coursewareHandler.useNewDesign && !isBsv && (typeof(pgBBar) != "undefined" && (pgBBar=="" || pgBBar=="std")) && (typeof(omitNotes) == "undefined" || !omitNotes) ) coursewareHandler.goPage("notes_open");
		return;
		break;
	case "q":
		if (isMLproduction() && typeof(squishFullPgBox) != "undefined") squishFullPgBox(wordBoxClicked);
		return;
		break;
	case "r":
		if (isMLproduction())
		{
			if (lastKey=="c") showCr();
				else printSimulation();
			lastKey="r";
		}
		return;
		break;
	case "u":
		if (isMLtech()) alert("Page Audio: " + pgAudio.substring(pgAudio.indexOf("a_"), pgAudio.length) + ".mp3");
		return;
		break;
	case "v":
		if (pgTpl=="scovie") toggleVersion();
		if (pgTpl.indexOf("flash") > -1) toggleFlash();
		return;
		break;
	case "t":
		if (pgType.indexOf("tf") > 0)
		{
			clickMC("a");
		}
		else if (isMLproduction() && typeof(showmeName) != "undefined" && showmeName!="")
		{
			doitUrl=rootDir + "/shared/templates/fsimwin.htm?coursedir=" + thisCourseDirectory + "&simid=" + showmeName + "&walkthru=0&sa=1&player=simplayer_" + simVersion + ".swf&autorun=0";
			simWindow=ThisPage.floatWin(doitUrl, 'fsimWin', 'resizable=no,width=788,height=480,scrollbars=no');
		}
		else if (isMLproduction() && pgTpl.indexOf("doitpg") > -1)
		{
			if (typeof(simVersion)=="undefined") simVersion="6";
			doitUrl=rootDir + "/shared/templates/fsimwin.htm?coursedir=" + thisCourseDirectory + "&simid=" + pgSim.substring(0, pgSim.length-4) + "&walkthru=0&sa=1&player=simplayer_" + simVersion + ".swf&autorun=0";
			simWindow=ThisPage.floatWin(doitUrl, 'fsimWin', 'resizable=no,width=788,height=480,scrollbars=no');
		}
		return;
		break;
	case "x": // press x to copy text, pres rx to copy html
			if (shiftHeld && isMLproduction() && typeof(pgRClickImage) != "undefined" && pgRClickImage != "" && typeof(mapRightCoordinates) != "undefined") mapRightCoordinates();
			else if (isMLtech() && lastKey == "r") ThisPage.copyToClipboard("pgText", true);
				else if (isMLtech() && lastKey == "c" && typeof(getCatInfo) != "undefined") getCatInfo();
					else ThisPage.copyToClipboard("pgText", false);
		return;
		break;
	case "w":
		if (shiftHeld && isMLproduction() && typeof(pgRClickImage) != "undefined" && pgRClickImage != "" && typeof(mouseoverImage) != "undefined") mapRightCoordinates(mouseoverImage);
			else if (isMLproduction() && typeof(widenFullPgBox) != "undefined") widenFullPgBox(wordBoxClicked);
		return;
		break;
	case "y":
		if (isMLproduction() && pgTpl.indexOf("_progress")>-1)
		{
			if (shiftHeld && typeof(showPictureBorder) !="undefined") showPictureBorder();
				else if (typeof(openImageWindow) != "undefined") openImageWindow();
		}
		if (pgType.indexOf("yn") > 0)
		{
			clickMC("a");
			return;
		}
		break;
	case "z":
		if (isMLproduction())
		{
			if (shiftHeld && typeof(mapCoordinates) != "undefined") mapCoordinates("2");
				else location.href=sharedDirectory +"inhouse/showsize.htm";
		}
		return;
		break;
		case "1":
			if (keystrokes.substring(keystrokes.length-3,keystrokes.length) == "411") displayStudentInfo(); 
			if (isMLproduction() && lastKey !="4" && lastKey !="1" && typeof(alertGifComments) != "undefined") alertGifComments();
			lastKey=keyStroke;
		return;
		break;
	}
	lastKey=keyStroke;
	coursewareHandler.onKeyClick(keyStroke);
}

function clickMC(letter)
{
	if (hasBeenAnswered()) return;
	if (letter=="f" && pgType.indexOf("tf") > 0) letter="b";
	 if (pgType.indexOf("radio")>-1)
	 {
		var radioLen=document.form1.radio.length
		var bNum="abcdefghi".indexOf(letter); //a=0
		if (radioLen>bNum) rClk(bNum);
	}
	if (pgType.indexOf("check")>-1)
	{
		var bNum="0abcdefghi".indexOf(letter); //a=1
		chkClk(bNum);
	}
}

function clickBSV(letter)
{
	switch(letter)
	{
		case "c":
			if (bsv_features.indexOf("conatributors") > -1) coursewareHandler.goPage("bsv_contributors");
			break;
		case "i":
			if (bsv_features.indexOf("index") > -1) coursewareHandler.goPage("bsv_index");
			break;
		case "t":
			if (bsv_features.indexOf("transcript") > -1) coursewareHandler.goPage("bsv_transcript");
			break;
		case "r":
			if (bsv_features.indexOf("reference") > -1 || reflibEnabled) coursewareHandler.goPage("bsv_reference");
			break;
		case "q":
			if (bsv_features.indexOf("quiz") > -1 || numberOfPopups > 0) coursewareHandler.goPage("bsv_quiz");
			break;
		case "f":
			if (bsv_features.indexOf("faq") > -1) coursewareHandler.goPage("bsv_faq");
			break;
		case "h":
			coursewareHandler.goPage("bsv_help");
			break;
		case "e":
			coursewareHandler.goPage("bsv_evaluation");
			break;
		case "s":
			if (bsv_features.indexOf("quiz") > -1)
			{
				if (typeof(document.WMPlay) != "undefined" && document.WMPlay.PlayState == 2) document.WMPlay.Pause();
				coursewareHandler.goPage("bsv_scores");
			}
			break;
		default:
	}
}

function beginHide()
{
	var bh="<" + "!--"
	document.write(bh);
}

function endHide()
{
	var bh="--" + ">"
	document.write(bh);
}

// **************************** ML Testing Navigation ********************************//
function isLoggedOn()
{
	if (ThisPage.getCookie("id")) return true;
	return false;
}

if (typeof(isProductionServer) == "undefined") isProductionServer=false;
function isMLtech()
{
	if (userId.indexOf("mltechsup")>-1) userId="mltechsup";
	if (userId.substring(0,4)=="dpec" && userId.length==9 && parseInt(userId.substring(6,userId.length)) >0) userId="old-dpecker";
	var hostestWithTheMostest="grumpy,claymore,deadbolt,courses.rubino.com,oracle.deadbolt.com,";
	var specialUsers=",jar,old-dpecker,mltechsup,megelhoff,jmiller"
	if (hostestWithTheMostest.indexOf(location.host.toLowerCase())>-1 || specialUsers.indexOf("," + userId + ",")>-1 || isProductionServer) return true;
		else return false;
}

function isMLproduction()
{
	// return true; // off-site devs should comment out this line.
	if (location.host.indexOf("preview.mindleaders") > -1) isProductionServer=false;
	return (isMLtech() && (location.host.indexOf("davinci") > -1 || userId=="jar" || isProductionServer) )
}

function quickGo()
{
	var where=prompt("Enter the page you want to go to, enter \"title\" to go to the title page, \"search\" to search, \"ml\" to go to mindleaders, or beginsannn to start SA with nnn questions.", location.href); //currPage.substring(0, currPage.length-4));
	if (where)
	{
		if (where.length < 4)
		{
			letter=where.substring(0,1);
			pg=parseInt(where.substring(1,where.length))
			if (isNaN(letter) && !isNaN(pg))
			{
				if (pg < 10) pg="00" + pg;
					else pg="0" + pg;
				coursewareHandler.goPage(crsAcronym.substring(0,2) + letter + pg + ".htm");
				return;
			}
		}
		if (where=="noflash")
		{
			parent.testNoFlash=!parent.testNoFlash;
			location.reload();
		}
		if (where=="fsclear")
		{
			if (coursewareHandler.crsVersion !="") cCookie=coursewareHandler.acro + "_" + coursewareHandler.crsVersion + "_topics";
				else cCookie=coursewareHandler.acro + "_topics";
			ThisPage.setCookie(cCookie,"",-99);
			coursewareHandler.fsTopicCompletionString="";
			if (coursewareHandler.crsVersion !="") cCookie=coursewareHandler.acro + "_" + coursewareHandler.crsVersion + "_completion";
				else cCookie=coursewareHandler.acro + "_completion";
			ThisPage.setCookie(cCookie,"0");
			location.reload();
		}
		if (where=="gripper")
		{
			if (coursewareHandler.tempStorage!="nogripper") coursewareHandler.tempStorage="nogripper";
				else coursewareHandler.tempStorage=""
			location.reload();
		}
		if (where=="review")
		{
			if (coursewareHandler.tempStorage!="review") coursewareHandler.tempStorage="review";
				else coursewareHandler.tempStorage=""
			location.reload();
		}
		if (where=="flv")
		{
			if (ThisPage.getCookie("useflv")!="1") ThisPage.setCookie("useflv", "1");
				else ThisPage.setCookie("useflv", "");
			location.reload();
		}
		
		if (where.substring(0,3)=="ts:")
		{
			coursewareHandler.tempStorage=where.substring(3,where.length);
			location.reload();
		}

		if (where=="pretest") location.href=rootDir + "/shared/templates/fs_assessment.htm?acro=" + crsAcronym;
		if (where=="exam") location.href=rootDir + "/shared/templates/fs_exam.htm?acros=" + "mgfd01,mgfd04";

		if (where=="cr") showCr();

		if (where=="tpl") alert(pgTpl);
		if (where=="fspre") location.href=rootDir + "/shared/templates/fs_assessment.htm";
		if (where=="tabs") top.location.href=ThisPage.replaceText(top.location.href.substring(0, top.location.href.length - top.location.search.length), "course.htm", "courseware.htm") + "?acro=" + crsAcronym + "&env=" + coursewareHandler.launchEnvironment + "&fullpg=/dpec/courses/" + crsAcronym + "/" + currPage;
		if (where=="lnk") window.clipboardData.setData('Text', ThisPage.replaceText(top.location.href.substring(0, top.location.href.length - top.location.search.length), "course.htm", "courseware.htm") + "?acro=" + crsAcronym + "&env=" + coursewareHandler.launchEnvironment + "&fullpg=/dpec/courses/" + crsAcronym + "/" + currPage );
		if (where=="size") where="j:top.window.resizeTo(730,600)";
		if (where=="size2") where="j:top.window.resizeTo(730,640)";
		if (where=="acc") where="j:coursewareHandler.goPage('access')";
		if (where=="print") where="j:coursewareHandler.goPage('textonly')";
		if (where=="cert") where="j:showCertificate()";
		if (where=="dates") where="j:alert(showFileDates('n'))";
		if (where=="cookies")
		{
			window.clipboardData.setData('Text', document.cookie);
			where="j:alert(document.cookie)";
		}
		if (where.indexOf("j:")>-1) location.href="javascript:" + where.substring(2,where.length);
		if (where.indexOf("a:")>-1) location.href="javascript:alert(" + where.substring(2,where.length) + ")";
		if (where.indexOf("c:")>-1) window.clipboardData.setData("Text",eval(where.substring(2,where.length)));
		dest=where; //"/dpec/course.htm?cid=" + crsAcronym + "&pg=" + where
		if (where.indexOf("beginsa")>-1) dest=rootDir + "/scripts/test.exe?course=" + crsAcronym + "&type=start&numq=" + where.substring(7,where.length);
		if (where=="title") dest=rootDir + "/course.htm?fullpg=" + rootDir + "/shared/templates/title_page.htm?course=" + crsAcronym;
		if (where=="search") dest= thisCourseDirectory + crsAcronym +".srh";
		if (where=="ml") floatWin("http://courses.mindleaders.com/dpec/courseware.htm?acro=" + crsAcronym + "&env=ML&pg=" + currPage, "ml_win");
		if (where=="mlc") floatWin("http://central.mindleaders.com/dpec/courseware.htm?acro=" + crsAcronym + "&env=TF&pg=" + currPage, "ml_win");
		if (where=="rub") window.open("http://davinci:9900/dpec/course.htm?acro=" + crsAcronym + "&fullpg=/dpec/courses/"+ crsAcronym + "/" + currPage, 'cw', 'resizable=yes,width=750,height=620,scrollbars=yes');
		if (where=="dum") parent.location.href=rootDir + "/course.htm?fullpg=" + location.href + "&sk=dummies";
		if (where=="base" || where=="refresh") parent.parent.location.href=rootDir + "/courseware.htm?acro=" + crsAcronym + "&env=" + coursewareHandler.launchEnvironment + "&pg=" + currPage;
		if (where=="showmarkers") showMarkers=true;
		if (where=="bsvlen") alert("Current Position: " + videoPosition + ", Course JS Video Length: " + vidLen);
		if (where=="topics") alert(coursewareHandler.fsTopicCompletionString);
		if (where.substring(0,2)=="l ")
		{
			cAcro=where.substring(2,where.length);
				quickLaunch(cAcro);
				//else location.href=rootDir + "/course.htm?acro=" + cAcro + "&pg="+ cAcro.substring(0,2)+"a001&sk=" + skinDir;
		}
			else if (dest.indexOf("/") > -1) location.href=dest;
	}
}

function quickLaunch(cid)
{
	parent.parent.LaunchLob(cid, 0, coursewareHandler.launchEnvironment, "ML", false, null);
}

function showCr()
{
	if (pgTpl.indexOf("fs_asmnt") > -1)
	{
		if (location.href.indexOf("?")==-1) location.href=location.href + "?creview=1";
			else if (location.href.indexOf("creview")==-1) location.href=location.href + "&creview=1";
	}
	if (pgTpl.indexOf("_progress") != -1)
	{
		stopAudio();
		fsShowAllText();
		fsLoadProgressiveData();
	}
}

// goes to the next question
function goNextQuestion(which)
{
	if (typeof(cQuestions)=="undefined" || pgBBar == "bk") return;
	showQuestions=cQuestions;
	var pgNoExt=currPage.substring(0,currPage.length-4)
	var qArray = showQuestions.split(",");
	if (pgType.indexOf("question") == -1) location.href=qArray[1]+".htm";
	for (var i=0; i < qArray.length; i++)
	{
		if (qArray[i] == pgNoExt)
		{
			if (which=="prev")
			{
	 		if (i < qArray.length - 1 && qArray[i-1] != "undefined") location.href=qArray[i-1]+".htm";
			}
			else
			{
				if (i < qArray.length - 1 && qArray[i+1] != "undefined") location.href=qArray[i+1]+".htm";
			}
		}
	}
}

function showFileDates(breakChar)
{
	if (typeof(breakChar)=="undefined" || breakChar=="n") breakChar="\n";
	var fileDates="JS File Dates" + breakChar + "common.js: " + commonDate + breakChar;
	if ( typeof(mlclientpageDate) != "undefined") fileDates += "mlclientpage.js: " + mlclientpageDate + breakChar;
	if ( typeof(skillDate) != "undefined") fileDates += "skill.js: " + skillDate + breakChar;
	if ( typeof(footerDate) != "undefined") fileDates += "footer.js: " + footerDate + breakChar;
	if ( typeof(parent.coursewareDate) != "undefined") fileDates += "courseware.js: " + parent.coursewareDate + breakChar;
	return(fileDates);
}

// press 411 to display student info
function displayStudentInfo()
{
	breakCode="\n";
	sInfo="Current User Information"+ breakCode;
	sInfo+="User ID: " + coursewareHandler.userId.toUpperCase() + breakCode;
	sInfo+="Site ID: " + coursewareHandler.siteId.toUpperCase() + breakCode;
	sInfo+="Environment: " + coursewareHandler.launchEnvironment.toUpperCase() + breakCode;
	sInfo+="Current Location: " + crsTitle + ", " + window.defaultStatus + breakCode;
	sInfo+="Current URL: " + location.href + breakCode;
	sInfo+="Completion Markers: " + ThisPage.getCompletionCookie(crsAcronym) + breakCode;
	sInfo+="LMS Access: " + (coursewareHandler.is3rdLMS ? "Yes" : "No") + breakCode;
	if (typeof(parent.actualVersion) != "undefined") sInfo+="Flash Version: " + parent.actualVersion + breakCode;
	else if(hasFlash()) sInfo+="Flash Version: Unknown" + breakCode;
		else sInfo+="Flash Version: None" + breakCode;
	sInfo+="Browser: " + (ThisPage.isIE ? "Internet Explorer" : navigator.userAgent) + breakCode;
	sInfo+="Browser Version: " + ThisPage.browserVersion + breakCode;
	if (breakCode=="<br>") sInfo+=breakCode + showFileDates("<br>") + breakCode;
		else sInfo+=breakCode + showFileDates("n") + breakCode;

	// get score info if on a scores page
	scoreInfo="";
	if (typeof(getEmailScores) != "undefined") scoreInfo+= breakCode + "Score Information" + breakCode + getEmailScores("\n",true) + breakCode;
	window.clipboardData.setData('Text', sInfo + scoreInfo);
	if (scoreInfo=="") sInfo+=breakCode + "This information has been put on the Windows clipboard.";
		else sInfo+=breakCode + "This information, together with your scores, have been put on the Windows clipboard.";
	alert(sInfo)

}
function openGifComments(url)
{
	if (parent.parent.location.href.indexOf("gifcmnt")>-1) return;
	url = url.toLowerCase()
	if (url.indexOf("http://")==0) url=url.substring(location.host.length+7,url.length)
	if (confirm("Do you want to open a gif comment window?")) gifCmntWin= window.open(sharedDirectory +"inhouse/gifcmnt.htm?"+url, "gifWin");
}
// **************************** End ML Testing Navigation ********************************//
//******************************* End Keystroke Code *****************************************//

// ******************************* Question Functions ***********************************//
/*******************************************
** Name:	writeCliqPic
** Description:	Depending on IE or NN, this writes (while loading htm)
	the correct html code to properly use the cliq ques inside the DPECRMV tags.
** Inputs:	1-cliq event;2-the target pic;
	3-6-the ltrbcoord for correct area
** Outputs:	For IE: MAPLESS! writes the <IMG> inside of anchor tags, w/Img calling cliq onClick
	For NN: writes normal code....a MAP conating reference to cliq onClick, and then writes the
	<IMG> code for the image below it that uses the map.
*******************************************/
function writeCliqPic(acro,gifName,gifW,gifH,mapCoords,targCoords,mapName)
{
	if (targCoords.substring(0,1)==" ") targCoords=targCoords.substring(1,targCoords.length);
	if (targCoords.indexOf(" ")>-1) targCoords=ThisPage.replaceText(targCoords," ",",");
	tCoords=targCoords;
	cliqW=gifW;
	cliqH=gifH;
	coords=mapCoords;
	if (typeof(mapName) == "undefined") mapName=gifName;
	cliqMap=mapName;

	qAction="onclick";
	if (typeof(pgAction) != "undefined")
	{
		if (pgAction=="2") qAction="ondblclick";
	}

	fullGifName=thisCourseDirectory + gifName; // full path needed for feedback and skill assessment
	if (fullGifName.indexOf(".") == -1) fullGifName += ".gif";
	if (!ThisPage.isIE)
	{
		divTag="<div id=\"cp\" STYLE=\"position:relative;display:block;width:" + gifW + "px;\">";
		if (document.getElementById("fullpic") != null)
		{
			document.getElementById("fullpic").style.width=gifW;
			document.getElementById("fullpic").style.display="block";
		}
	} else divTag="<div id=\"cp\" STYLE=\"position:relative;display:inline;\">";
	if (hasBeenAnswered())
	{
		document.write(divTag + "<IMG SRC=\"" + fullGifName+"\" height=" + gifH + " width=" + gifW + " border=0 id=\"cliqPic\" NAME=\"cliqPic\" ISMAP USEMAP=\"#"+mapName+".map\">" + getCliqHighlight(qAction) + "</div>");
	}
	else
	{
		document.write(divTag + "<a " + qAction + "=\"cliq(event,document.cliqPic," + targCoords + ")\"><IMG SRC=\"" + fullGifName + "\" WIDTH=" + gifW + " HEIGHT=" + gifH + " border=0 id=\"cliqPic\" NAME=\"cliqPic\" STYLE=\"cursor:default;\"></a>" + getCliqHighlight(qAction) + "</div>");
	}
}

function showCliqHighlight() // called by scoredata.jsp to highlight correct area
{
	obj=document.getElementById("imgBox");
	if (obj != null) obj.style.display="block";
}

function getCliqHighlight(qAction)
{
	if (typeof(qAction) == "undefined") qAction="onclick";
	cords=tCoords.split(",");
	imgHeight=cords[3]-cords[1] - 2;
	imgWidth=cords[2]-cords[0] - 2;
	imgLeft=cords[0] - 2;
	imgTop=cords[1] - 2;
	if (!isSa() && hasBeenAnswered()) showHighlight = "display:block;"
		else showHighlight = "display:none;"
	if (useJsDat && !hasBeenAnswered()) showHighlight = "display:none;"
	imgHighlight="<div id=\"imgBox\" STYLE=\"position:absolute; left:" + imgLeft + "px; top:" + imgTop + "px;" + showHighlight + "\"><table border=2 cellpadding=0 cellspacing=0 STYLE=\"border-color:red;border-style:solid;\"><tr><td><a " + qAction + "=\"javascript:coursewareHandler.goPage('next')\"><IMG SRC=\"" + sharedImageDir + "spacer.gif\" height="
		+ imgHeight + " width=" + imgWidth + " border=0></a></td></tr></table></div>";
	return imgHighlight;
}

/*******************************************/
// Used by click questions to evaluate user click as right or wrong
function cliq(event,image,lf,tp,rt,bt )
{
	if (hasBeenAnswered() || document.form1.text1.value != "") return;
	if (ThisPage.isIE)
	{
		x = window.event.offsetX;
		y = window.event.offsetY;
	}
	 else
	{
		if (document.getElementById("fullpic") != null)
		{
			x = event.offsetX?(event.offsetX):event.pageX-document.getElementById("fullpic").offsetLeft;
			y = event.offsetY?(event.offsetY):event.pageY-document.getElementById("fullpic").offsetTop;
		}
		else
		{
			x = event.offsetX?(event.offsetX):event.pageX-document.getElementById("cp").offsetLeft;
			y = event.offsetY?(event.offsetY):event.pageY-document.getElementById("cp").offsetTop;
		}
	}

	if ( typeof(cV) == typeof(noVar) ) var cV = 1;
		var isCorrect = ((x >= lf && x <= rt && y >= tp && y <= bt) ? cV : 0);
	if (typeof(altArea) != "undefined" && isCorrect != cV)
	{
		c=altArea.split(",");
		isCorrect = ((x >= c[0] && x <= c[2] && y >= c[1] && y <= c[3]) ? cV : 0);
	}
	if (typeof(requiredKey) != "undefined")
	{
		if ( (requiredKey=="ctrl" && !event.ctrlKey) || (requiredKey=="alt" && !event.altKey) ) isCorrect=0;
	}
	document.form1.text1.value=isCorrect;
	void(document.form1.submit());
}

//**************************************************************************
// called by click of radio MC buttons -- selects the corresponding option
function rClk(bNum)
{
	if (hasBeenAnswered()) return;
	document.form1.radio[bNum].click();
}

//**************************************************************************
// called by click of checkbox MC buttons -- selects the corresponding option
function chkClk(bNum)
{
	var thisCheckbox="checkbox"+bNum
	if (document.form1[thisCheckbox]) document.form1[thisCheckbox].click();
}

//**************************************************************************
// Writes the MC buttons and corresponding radio or checbox options
// passed a, b, c, d, true, false, yes, no; adds highlighted buttons on final try
function qBut(whichButton)
{
	fullButtonGif=sharedImageDir + whichButton + ".gif";
	var isFinalAnswer=false;
	if (typeof(CAns) != "undefined") isFinalAnswer=true;
	if (nextPage== "") // can't have link to next page in bsv popup questions
	{
		nextLink="";
		endLink = ""
	} else
	{
		nextLink = "<A href=\"javascript:coursewareHandler.onImageClick('next')\" onMouseover=\"self.status='" + resStr.sContinue + "'; return true\">";
		endLink = "</A>";
	}
	var butId = "0abcdefghi".indexOf(whichButton);
	if (whichButton == "true" || whichButton == "yes") butId = 1;
	if (whichButton == "false" || whichButton == "no") butId = 2;
	if(useNewDesign)
	{
		mouseCode=" onMouseover=\"qButtonRollover('" + whichButton + "',true," + butId + ")\" onMouseout=\"qButtonRollover('" + whichButton + "',false," + butId + ")\" STYLE=\"cursor:default;\"";
		if (hasBeenAnswered()) mouseCode="";
		tfynHeight=26;
		bHeight=26;
		letterWidth=43;
		bAlign="right";
	} else
	{
		mouseCode="";
		tfynHeight=24;
		bHeight=23;
		letterWidth=23;
		bAlign="left";
	}
	switch (whichButton)
	{
		case "true":
			if (isFinalAnswer)
			{
				if(CAns.indexOf("a") > -1) fullButtonGif=sharedImageDir + "true_high.gif";
				buttonText=nextLink + "<IMG SRC=\"" + fullButtonGif + "\" HEIGHT=" + tfynHeight + " WIDTH=" + trueW + " border=0 align=top id=\"trueBut\" NAME=\"trueBut\">" + endLink;
			} else buttonText="<A href=\"javascript:rClk(0)\"" + mouseCode + "><IMG SRC=\"" + fullButtonGif + "\" HEIGHT=" + tfynHeight + " WIDTH=" + trueW + " border=0 align=top alt=\"" + resStr.sTrue + "\" id=\"trueBut\" NAME=\"trueBut\"></A>";
			buttonTextAcc=resStr.sTrue;
			break;
		case "false":
			if (isFinalAnswer)
			{
 				if(CAns.indexOf("b") > -1) fullButtonGif=sharedImageDir + "false_high.gif";
				buttonText=nextLink + "<IMG SRC=\"" + fullButtonGif + "\" HEIGHT=" + tfynHeight + " WIDTH=" + falseW + " border=0 align=top alt=\"" + resStr.sFalse + "\" NAME=\"falseBut\" id=\"falseBut\">" + endLink;
			} else buttonText="<A href=\"javascript:rClk(1)\"" + mouseCode + "><IMG SRC=\"" + fullButtonGif + "\" HEIGHT=" + tfynHeight + " WIDTH=" + falseW + " border=0 align=top alt=\"" + resStr.sFalse + "\" NAME=\"falseBut\" id=\"falseBut\"></A>";
			buttonTextAcc=resStr.sFalse;
			break;
		case "yes":
			if (isFinalAnswer)
			{
				if(CAns.indexOf("a") > -1) fullButtonGif=sharedImageDir + "yes_high.gif";
				buttonText=nextLink + "<IMG SRC=\"" + fullButtonGif + "\" HEIGHT=" + tfynHeight + " WIDTH=" + yesW + " border=0 align=top alt=\"" + resStr.yes + "\" NAME=\"yesBut\" id=\"yesBut\">" + endLink;
			} else buttonText="<A href=\"javascript:rClk(0)\"" + mouseCode + "><IMG SRC=\"" + fullButtonGif + "\" HEIGHT=" + tfynHeight + " WIDTH=" + yesW + "	border=0 align=top alt=\"" + resStr.yes + "\" NAME=\"yesBut\" id=\"yesBut\"></A>";
			buttonTextAcc=resStr.yes;
			break;
		case "no":
			if (isFinalAnswer)
			{
				if (CAns.indexOf("b") > -1) fullButtonGif=sharedImageDir + "no_high.gif";
				buttonText=nextLink + "<IMG SRC=\"" + fullButtonGif + "\" HEIGHT=" + tfynHeight + " WIDTH=" + noW + " border=0 align=top alt=\"" + resStr.no + "\" NAME=\"noBut\" id=\"noBut\">" + endLink;
			} else buttonText="<A href=\"javascript:rClk(1)\"" + mouseCode + "><IMG SRC=\"" + fullButtonGif + "\" HEIGHT=" + tfynHeight + " WIDTH=" + noW + " border=0 align=top alt=\"" + resStr.no + "\" NAME=\"noBut\" id=\"noBut\"></A>";
			buttonTextAcc=resStr.no;
			break;
		default: //a, b, c, ..., i
			// construct the image, anchor, and input field based on the letter and mc type
			bLetter=whichButton.substring(0,1);
			gifName=bLetter;
			capBLetter=bLetter.toUpperCase().substring(0,1);
			radioNumber="abcdefghi".indexOf(bLetter); //a=0
			checkNumber="0abcdefghi".indexOf(bLetter); //a=1

			if (isFinalAnswer && CAns.indexOf(whichButton) > -1) fullButtonGif=sharedImageDir + whichButton.substring(0,4) + "_high.gif";

			if (pgType.indexOf("check") < 0)
			{
				var thisAnchor="<A href=\"javascript:rClk(" + radioNumber + ")\"" + mouseCode + ">"
				if (isFinalAnswer) thisAnchor=nextLink;
				buttonText=thisAnchor +"<IMG SRC=\"" + fullButtonGif + "\" HEIGHT=" + bHeight + " WIDTH=" + letterWidth + " border=0 align=" + bAlign + " alt=\""+ capBLetter + ".\" NAME=\"" + bLetter + "But\" id=\"" + bLetter + "But\"></A>";
			} else
			{
				var thisAnchor="<A href=\"javascript:chkClk(" + checkNumber + ")\"" + mouseCode + ">"
				if (isFinalAnswer) thisAnchor=nextLink;
				buttonText=thisAnchor + "<IMG SRC=\"" + fullButtonGif + "\" HEIGHT=" + bHeight + " WIDTH=" + letterWidth +" border=0 align=" + bAlign + " alt=\""+ capBLetter + ".\" NAME=\"" + bLetter + "But\" id=\"" + bLetter + "But\"></A>";
			}
			buttonTextAcc=capBLetter;
	}
	if (isAccessibilityWindow) buttonText=buttonTextAcc;
	//Wrap all question buttons sequentially with the pair of <DIV></DIV> in order to dynamically update the buttons
	buttonText = "<DIV id=button" + butId + " style='display:inline;'>" + buttonText + "</DIV>";

	document.write(buttonText);
}

function qButtonRollover(name,isOver,butId)
{
	if (!useNewDesign || hasBeenAnswered()) return;
	if(isOver==false)
	{
		if (document.form1.radio && document.form1.radio[butId-1].checked==true) return;
		if (document.form1.checkbox1 && document.form1["checkbox" + butId].checked==true) return;
	}
	buttonRollover(name + "But",name,isOver)
}

function highlightQuestionButtons()
{
	if (!useNewDesign) return;
	// Shows the selected state for question buttons and, after answering, displays high_on images to show which answers were selected.
	for (i=0;i<9;i++)
	{
		boxNum=(i +1).toString();
		name="abcdefghi".charAt(i);
		if (pgType.indexOf("tf") > -1 && i < 2) name = (name=="a") ? "true" : "false";
		if (pgType.indexOf("yn") > -1 && i < 2) name = (name=="a") ? "yes" : "no";
		thisBut=document.getElementById(name + "But");
		if (thisBut != null)
		{
			if (hasBeenAnswered())
			{
				if (optionSelected(i))
				{
					if (thisBut.src.indexOf("high.gif") > -1) thisBut.src=thisBut.src.substring(0,thisBut.src.length - 4) + "_on.gif";
						else thisBut.src=sharedImageDir + name + "_on.gif";
				}
			}
			else
			{
				if (document.form1.radio && document.form1.radio[i].checked) thisBut.src = sharedImageDir + name + "_on.gif";
					else if (document.form1["checkbox" + boxNum] && document.form1["checkbox" + boxNum].checked) thisBut.src = sharedImageDir + name + "_on.gif";
						else thisBut.src = sharedImageDir + name + ".gif";
			}
		}
	}
	self.focus();
}

/********************************************************************
*	update question buttons on final try and return the image string
*********************************************************************/
function updateButton(CAns, whichButton)
{
	fullButtonGif=sharedImageDir + whichButton + ".gif";
	if (nextPage== "") // can't have link to next page in bsv popup questions
	{
		nextLink="";
		endLink = ""
	} else
	{
		nextLink = "<A href=\"javascript:coursewareHandler.onImageClick('next')\" onMouseover=\"self.status='" + resStr.sContinue + "'; return true\">";
		endLink = "</A>";
	}
	if(useNewDesign)
	{
		tfynHeight=26;
		bHeight=26;
		letterWidth=43;
	} else
	{
		tfynHeight=24;
		bHeight=23;
		letterWidth=23;
	}

	switch (whichButton)
	{
		case "true":
			if(CAns.indexOf("a") > -1) fullButtonGif=sharedImageDir + "true_high.gif";
			buttonText=nextLink + "<IMG SRC=\"" + fullButtonGif + "\" HEIGHT=" + tfynHeight + " WIDTH=" + trueW + " border=0 align=top NAME=\"trueBut\" id=\"trueBut\">" + endLink;
			break;
		case "false":
 			if(CAns.indexOf("b") > -1) fullButtonGif=sharedImageDir + "false_high.gif";
			buttonText=nextLink + "<IMG SRC=\"" + fullButtonGif + "\" HEIGHT=" + tfynHeight + " WIDTH=" + falseW + " border=0 align=top alt=\"False\" NAME=\"falseBut\" id=\"falseBut\">" + endLink;
			break;
		case "yes":
			if(CAns.indexOf("a") > -1) fullButtonGif=sharedImageDir + "yes_high.gif";
			buttonText=nextLink + "<IMG SRC=\"" + fullButtonGif + "\" HEIGHT=" + tfynHeight + " WIDTH=" + yesW + " border=0 align=top alt=\"Yes\" NAME=\"yesBut\" id=\"yesBut\">" + endLink;
			break;
		case "no":
			if (CAns.indexOf("b") > -1) fullButtonGif=sharedImageDir + "no_high.gif";
			buttonText=nextLink + "<IMG SRC=\"" + fullButtonGif + "\" HEIGHT=" + tfynHeight + " WIDTH=" + noW + " border=0 align=top alt=\"No\" NAME=\"noBut\" id=\"noBut\">" + endLink;
			break;
		default: //a, b, c, ..., i
			// construct the image, anchor, and input field based on the letter and mc type
			if (CAns.indexOf(whichButton) > -1)
				fullButtonGif=sharedImageDir + whichButton.substring(0,1) + "_high.gif";
			bLetter=whichButton.substring(0,1);
			gifName=bLetter;
			capBLetter=bLetter.toUpperCase().substring(0,1);
			var thisAnchor = "";
			if (pgType.indexOf("check") < 0)
			{
				thisAnchor="<A href=\"javascript:coursewareHandler.onImageClick('next')\" onMouseover=\"self.status='Continue...'; return true\">";
				buttonText=thisAnchor +"<IMG SRC=\"" + fullButtonGif + "\" HEIGHT=" + bHeight + " WIDTH=" + letterWidth + " border=0 align=left alt=\""+ capBLetter + ".\" NAME=\"" + bLetter + "But\" id=\"" + bLetter + "But\"></A>";
			} else
			{
				thisAnchor="<A href=\"javascript:coursewareHandler.onImageClick('next')\" onMouseover=\"self.status='Continue...'; return true\">";
				buttonText=thisAnchor+"<IMG SRC=\"" + fullButtonGif + "\" HEIGHT=" + bHeight + " WIDTH=" + letterWidth + " border=0 align=left alt=\""+ capBLetter + ".\" NAME=\"" + bLetter + "But\" id=\"" + bLetter + "But\"></A>";
			}
	}
	return (buttonText);
}

function submitQuestion()
{
	stopAudio();
	if (displayCheckboxMessage()) return;
	if (displayRadioMessage()) return;
	if (typeof(seqDisplayMessage) != "undefined" && seqDisplayMessage()) return;
	if (typeof(droptextDisplayMessage) != "undefined" && droptextDisplayMessage()) return;

	// change Submit gif to Checking gif. Don't submit again if already submitted.
	if (hasBeenSubmitted=="no")
	{
		hasBeenSubmitted="yes";
		if (ThisPage.isIE) document.form1.submit(); // IE: submit before image change
		if (typeof(document["done"]) != "undefined" && pgTpl != "htldoit" )
		{
			document["done"].alt=resStr.checkAnswer;
			document["done"].src=sharedImageDir + "checking_answer.gif";
		}
		if (!ThisPage.isIE) document.form1.submit(); //Not IE, submit after image change
	}
}

function setFormAction()
{
	if (isTfCourse) return;
	var newAction = "";
	var questionProgram="text.exe";
	if (pgType.indexOf("radio")>-1 && pgType.indexOf("mcrand")==-1) questionProgram="radio.exe";
	if (pgType.indexOf("check")>-1) questionProgram="checkbox.exe";

	if (!isSa() && coursewareHandler.access)
	{
		var oNewInput = document.createElement("input");
		oNewInput.setAttribute("type", "hidden");
		oNewInput.setAttribute("name", "omitAccQuestionList");
		var omitAccQuesList = "";
		if (typeof(imageQuestions) != "undefined") omitAccQuesList = imageQuestions;
		// add hidden questions
		if (typeof(hiddenQuestionUnits) != "undefined")
		{
			hQUnits=hiddenQuestionUnits.split(",");
			for (i=0;i<=hQUnits.length;i++)
			{
				if (hQUnits[i] != null && hQUnits[i] != "")
					omitAccQuesList += "," + crsAcronym.substring(0,2) + hQUnits[i] + "500";
			}
		}
		if (typeof(cQuestions) != "undefined" && typeof(saQuestions) != "undefined") omitAccQuesList += getUnscoredAccQues();
		oNewInput.setAttribute("value", omitAccQuesList);
		document.form1.appendChild(oNewInput);
	}

	if (coursewareHandler.launchEnvironment == "TF")
	{
		var servlet = "/lms/ScoreServer.srv";
		var scoreframe = document.getElementById("scoreframe");

		//make sure only one scoreframe be added. e.g., showSimFeedback() call setFormAction() again
		if (scoreframe == null)
		{
			addScoreFrame();
			scoreframe = document.getElementById("scoreframe");
		}
		var score_iframe = "<iframe name='scoredata' id='scoredata' src='/lms/learn/scoredata.jsp?inition=yes' \n";
		score_iframe+="height='0' width='0' />";
		scoreframe.innerHTML = score_iframe;
		newAction=servlet + "/" + questionProgram + "/" + crsAcronym + ".cid/" + currPage;
		if (coursewareHandler.access)
			newAction += "/isacc.acc"
		if (coursewareHandler.inSkillAssessment || isSa())
			newAction += "/answer.sa"
		if (typeof(sapass) != "undefined" && sapass != "-1")
			newAction += "/" + sapass + ".sim";
		document.form1.target = "scoredata";
		if (typeof(seqRepaintObjects) != "undefined") seqRepaintObjects();
	}
	else
	{
		if (typeof(c_scrollToFdbk) != "undefined") fdbkBk ="#fdbk";
			else fdbkBk="";
		newAction=scriptsDirectory + questionProgram + "/" + crsAcronym + "/" + currPage + fdbkBk;
		if (isSa()) newAction=scriptsDirectory + questionProgram + "/" + crsAcronym + "/test/" + currPage + fdbkBk;
		if (typeof(isSalsa)!="undefined")
			newAction=scriptsDirectorySalsa + questionProgram + "/" + crsAcronym + "/test/" + currPage;
	}

	if (useJsDat)
	{
		if (typeof(qNum) == "undefined") qNum="";
		newAction="javascript:submitJsQ(qNum)";
	}
	document.form1.action=newAction;
}

function addScoreFrame()
{
	var oNewItem = document.createElement("DIV");
	var oBody = document.body;
	oBody.insertBefore(oNewItem,oBody.firstChild);
	oNewItem.id = "scoreframe";
}

// Get all unscored questions to mark during accessibility.
function getUnscoredAccQues()
{
	var omitList = "";
	var courseQ = cQuestions.split(",");
	for(var i=0; i<courseQ.length;i++)
	{
		if (saQuestions.indexOf(courseQ[i]) == -1 && courseQ[i] != "")
			omitList += courseQ[i] + ",";
	}
	return omitList;
}

// Old style click questions with client-side image maps
function cliqText(answerNum)
{
	if (coursewareHandler.launchEnvironment == "TF")
	{
		if (isAnswered)
		{
			if (answerNum == correctAnswer)
				coursewareHandler.onImageClick('next');
		}
		else
		{
			document.form1.text1.value=answerNum;
			document.form1.submit();
		}
	}
	else
	{
		document.form1.text1.value=answerNum;
		setFormAction();
		document.form1.submit();
	}
}

function isRight()
{
	if (pgType.indexOf("question") == -1) return false;
	if (typeof(isCorrect) != "undefined" && isCorrect==1) return true;
	return false;
}

function writeFdbkGif()
{
	if (coursewareHandler.launchEnvironment == "TF")
		return FdbkGif();
	else
		document.write(FdbkGif());
}

//Generate fdbk string. Shared by writeFdbkGif() and getFdbkGif()
function FdbkGif()
{
	fgif="hint.gif";
	if (typeof(isCorrect) != "undefined")
	{
		fgif="wrong.gif";
		if (isCorrect==1) fgif="right.gif"
	}
	if (typeof(isCorrect_tf) != "undefined")
	{
		if (isCorrect_tf == -1) fgif="wrong.gif";
		if (isCorrect_tf == 1) fgif="right.gif"
	}
	fdbk="<IMG SRC=\"" + sharedImageDir + fgif + "\" WIDTH=39 HEIGHT=39 border=0>";
	if (typeof(c_hideFdbkImage) != "undefined") fdbk="";
	if (pgTpl != "fullq" && typeof(c_scrollToFdbk) != "undefined") fdbk="<a name=\"fdbk\"></a>"+ fdbk;
	if (typeof(c_hideQuestionComments) == "undefined" && typeof(qCommentUrl) != "undefined")
	{
		tempTitle=crsTitle;
		if (tempTitle.indexOf("'") > -1) tempTitle=ThisPage.replaceText(tempTitle, "'", "&#146;");
		var qCommentFullUrl=qCommentUrl + "?qUrl=" + escape(self.location.href)+ "&ctitle=" + escape(tempTitle) + "&acro=" + crsAcronym + "&env=" + coursewareHandler.launchEnvironment + "&pgType=" + pgType + "&loc=" + localizationCode;
		qCommentLink="<BR><A HREF=\"javascript:floatWin('" + qCommentFullUrl + "','qComments','resizable=yes,width=375,height=400,scrollbars=yes')\"";
		qCommentLink += " onMouseover=\"self.status='" + resStr.evalQuestion + "'; return true\">";
		qCommentLink += "<IMG SRC=\"" + sharedImageDir + "comments.gif\" WIDTH=60 HEIGHT=13 BORDER=0></A>";
		fdbk += qCommentLink;
	}
	if (hasStreamingAudio && typeof(c_fdbkAudio) == "undefined") pageHasAudio=false;
	if (isAccessibilityWindow) fdbk="&nbsp;"

	return fdbk;
}

// randomly chooses the flash sims to go into the SA
function getRequiredSAQuestions()
{
	if (useJsDat || typeof(saFlashSims) == "undefined" || saFlashSims == "") return "";
	simVer="5";
	if (typeof(simVersion) != "undefined") simVer=simVersion; //simVersion is set in course.js
	if (!hasFlash(simVer)) return "&omitQuestionList=" + saFlashSims; // if flash is not installed, do not include sims in SA
	var fSims = saFlashSims.split(",");
	var numSims=fSims.length;
	var maxSims=3;
	if (typeof(c_maxSims) != "undefined") maxSims=c_maxSims;
	if (numSims <= maxSims) return "&reqQuestionList=" + saFlashSims;
	// We've got more than 3 sims to choose from. Select 3 from different units and pass others as omitQuestionList
	// 1) find out number of different units available
	var differentUnits="";
	for (var i=0; i < numSims; i++)
	{
		if (differentUnits.indexOf(fSims[i].substring(2,3)) == -1) differentUnits = differentUnits + fSims[i].substring(2,3);
	}
	// 2) randomly choose until you get max number of sims from different units, then choose any
	var usedUnits="";
	var reqQuestions="";
	while (usedUnits.length < maxSims)
	{
		randomNum=Math.round(Math.random() * (numSims-1));
		chosenSim=fSims[randomNum];
		// if the chosen sim has not yet been used and either we've got max different units or it is from an unselected unit
		if (reqQuestions.indexOf(chosenSim) == -1 && (usedUnits.length >= differentUnits.length || usedUnits.indexOf(chosenSim.substring(2,3)) == -1))
		{
			reqQuestions=reqQuestions + chosenSim + ",";
			usedUnits=usedUnits + chosenSim.substring(2,3);
		}
	}
	reqQuestions=reqQuestions.substring(0,reqQuestions.length-1); // remove terminal comma
	//3) set remaining questions to omitQuestions
	omitQuestions="";
	for (var i=0; i < numSims; i++)
	{
		if (reqQuestions.indexOf(fSims[i]) == -1) omitQuestions = omitQuestions + fSims[i] + ",";
	}
	omitQuestions=omitQuestions.substring(0,omitQuestions.length-1); // remove terminal comma
	//4 return the parms
	return "&reqQuestionList=" + reqQuestions + "&omitQuestionList="+ omitQuestions;
}
// ******************************* End Question Functions ***********************************//

//******************************* Simulation Functions *****************************************//
function openFlashSim(flashName)
{
	if (typeof(simVersion) != "undefined") requiredVersion=simVersion;
		else requiredVersion="5";
	if (!activeXenabled)
	{
		simWindow=ThisPage.floatWin(sharedDirectory + 'launchlob/no_activex_msg.htm', 'simWin', 'resizable=no,width=350,height=150,scrollbars=no');
	}
	else
	{
		if (!hasFlash(requiredVersion)) openFlashDownloadPage();
			else openSim(flashName);
	}
}

var sapass = "-1";
function showSimFeedback(percent)
{
	if (isSa())
	{
		var simPassPercentage=70;
		pgType="question,text";
		if (percent > simPassPercentage) document.form1.text1.value="1";
		sapass = (percent > simPassPercentage)? "1" : "0";
		setFormAction();
		if (ThisPage.isIE && !hasBeenAnswered()) submitQuestion(); // IE: submit before image change
		if (typeof(document["doit"]) != "undefined")
		{
			document["doit"].alt=resStr.checkResults;
			document["doit"].src=sharedImageDir + "checking_answer.gif";
		}
		if (!ThisPage.isIE && !hasBeenAnswered()) submitQuestion(); //Not IE, submit after image change
	}
}

function openSim(simURL)
{
	var simType="aw";
	if (simURL.indexOf(".swf") > -1) simType="flash" // simType= aw or flash
	if (!activeXenabled)
	{
		simWindow=ThisPage.floatWin(sharedDirectory + 'nosims/no_activex_msg.htm', 'simWin', 'resizable=no,width=350,height=150,scrollbars=no');
		return;
	}
	// Do It in SA: if Skip button, close sim win and mark as incorrect
	if (isSa() && typeof(document["doit"].src) != "undefined" && document["doit"].src.indexOf("skip_doit.gif") > -1)
	{
		closeWin();
		showSimFeedback(0);
		return;
	}
	var skipSim = ThisPage.getCookie("noSims");
	if (simType=="aw" && skipSim == "1")
	{
		simWindow=ThisPage.floatWin(sharedDirectory + 'nosims/simmsg1.htm', 'simWin', 'resizable=no,width=350,height=150,scrollbars=no');
	}
	else
	{
		if (simType=="aw" && skipSim == "2")
		{
			simWindow=ThisPage.floatWin(sharedDirectory + 'nosims/simmsg2.htm', 'simWin', 'resizable=no,width=350,height=150,scrollbars=no');
		}
		else
		{
			// uses /dpec/shared/templates/simwin.htm template:
			//if it comes in with a full path, delete it.
			var marker="/" + crsAcronym + "/";
			var whereMarker=simURL.indexOf(marker);
			if (whereMarker > -1) simURL=simURL.substring(whereMarker + marker.length, simURL.length);
			if (simType=="flash") //flash procedural sims
			{
				// in SA fix button so it does not get double clicked
				if (isSa() && typeof(document["doit"]) != "undefined")
				{
					document["doit"].alt=resStr.skipQuestion;
					document["doit"].src=sharedImageDir + "skip_doit.gif";
				}
				winSize="width=788,height=480,";
				if (typeof(stageHeight) != "undefined" && typeof(stageWidth) != "undefined")
				{
					winSize="width=" + (148 + stageWidth).toString() +",height=" + stageHeight.toString() + ",";
					stageParm="&stageheight=" + stageHeight.toString();
				} else stageParm="";

				var saParm= (isSa()) ? "&sa=1" : "&sa=0";
				var walkThroughParm="&walkthru=1"; // shows hint button
				if (typeof(c_showSimHints) != "undefined") walkThroughParm="&walkthru=2";
				var playerParm="&player=simplayer";

				if (isDummies)
				{
					playerParm="&player=d_simplayer";
				}
				if (pgTpl=="showme" || (typeof(showmeName) != "undefined" && showmeName != "") ) //Show Me Parameters
				{
					walkThroughParm="&walkthru=0"; // hides hint button
					autorunParm="&autorun=1";
				} else autorunParm="";
				if (typeof(simVersion) != "undefined") playerParm=playerParm + "_" + simVersion;
				if (typeof(localizationCode) != "undefined" && localizationCode != "") playerParm=playerParm + "_" + localizationCode;
				playerParm=playerParm + ".swf";
				simURL=sharedDirectory +"templates/fsimwin.htm?coursedir=" + thisCourseDirectory + "&simid=" + simURL.substring(0,simURL.length-4) + walkThroughParm + saParm + playerParm + autorunParm + stageParm;
				simWindow=ThisPage.floatWin(simURL, 'fsimWin', 'resizable=no,' + winSize + ',scrollbars=no');
			}
			else
			{
				winSize=getSimWindowSize();
				simURL=sharedDirectory +"templates/simwin.htm?" + thisCourseDirectory + simURL.substring(0,simURL.length-4) + ".aam";
				simWindow=ThisPage.floatWin(simURL, 'simWin', 'resizable=yes,' + winSize + ',scrollbars=yes');
			}
		}
	}
}

// Called by onpage showme if hiderestart is passed.
function endOfSim()
{
	playEndOfPageSound();
	foobar.forwardoff.src=rootDir + "/shared/images/buttons/forward_beep.gif"
}

// Close the sim window on unload
function closeWin()
{
	if (simWindow != null){if (simWindow.closed) { return; } else {simWindow.close();}}
}

function getSimWindowSize()
{
	/* open bigger window if browser window is bigger than 640X480 */
	if(document.all)
	{
		var displayWidth= document.body.clientWidth;
		var displayHeight= document.body.clientHeight;
	}
	else
	{
		var displayWidth= window.innerWidth;
		var displayHeight=  window.innerHeight;
	}
	if (displayWidth > 640 || displayHeight > 480) return "width=650,height=510,";
		else return "width=630,height=480,";
}

function openActivity(activityName)
{
	if (!activeXenabled)
	{
		simWindow=ThisPage.floatWin(sharedDirectory + 'nosims/no_activex_msg.htm', 'simWin', 'resizable=no,width=350,height=150,scrollbars=no');
		return;
	}
	playAudioFile(rootDir + "/shared/templates/quartersecond.mp3"); // stops page audio
	activityURL = sharedDirectory +"templates/actwin.htm?activity=" + thisCourseDirectory + activityName + "&activityname=" + activityName + "&coursedir=" + thisCourseDirectory + "&loc=" + localizationCode + "&sk=" + skinDir;
	if (!hasFlash("5")) openFlashDownloadPage();
		else simWindow=ThisPage.floatWin(activityURL, 'actWin', 'resizable=yes,' + getSimWindowSize() +'scrollbars=yes');
}

function openFlashDownloadPage()
{
	var flashParms="?incourse=yes&reqversion=" + requiredVersion+"&acro=" + crsAcronym + "&loc=" + localizationCode;
	if (typeof(noAlternateGifs) != "undefined" && noAlternateGifs) flashParms+="&noaltgifs=1";
	getFlashUrl=sharedDirectory + "launchlob/flash_install.htm" + flashParms;
	if (typeof(dynamicCd) != "undefined" && dynamicCd) getFlashUrl=sharedDirectory + "launchlob/flash_install_cd.htm" + flashParms;
	getFlashWindow=floatWin(getFlashUrl, 'getFlashWin', 'resizable=no,width=630,height=450,scrollbars=yes');
}
//******************************* End Simulation Functions *****************************************//
//******************************* Custom Notes *****************************************//
function getCustomNote()
{
	// Note Format HTML
	notePic=rootDir + "/custom/notes/add-a-note/images/custom_note.gif";
	if (typeof(parent.noteIconURL) != "undefined") notePic=parent.noteIconURL;
	beginNoteCode="<center><TABLE WIDTH=\"545\" class=\"ntcBox\"><TR><TD VALIGN=TOP><TABLE CELLSPACING=0 CELLPADDING=0 WIDTH=\"535\" class=\"innerNtcBox\">";
	beginNoteCode=beginNoteCode+"<TR><TD ALIGN=LEFT VALIGN=TOP WIDTH=85><IMG SRC=\"" + notePic + "\" WIDTH=75 HEIGHT=75>";
	beginNoteCode=beginNoteCode+"</TD><TD ALIGN=LEFT VALIGN=TOP WIDTH=450><HR ALIGN=LEFT class=\"ntcRule\"><div class=\"cWords\">";
	endNoteCode="</div><HR ALIGN=LEFT class=\"ntcRule\"></TD></TR></TABLE></TD></TR></TABLE></CENTER><BR>";
	if (typeof(parent.beginNoteCode) != "undefined")
	{
		beginNoteCode=parent.beginNoteCode;
		endNoteCode=parent.endNoteCode;
	}

	thisNote="";
	if (typeof(parent.noteList) != "undefined" && parent.noteList.indexOf(noteID) > -1)
	{
		thisNote= parent.eval(noteID);
		noteText=beginNoteCode + thisNote + endNoteCode;
	} else noteText="";
	if (typeof(parent.parent.frames[0].dnoteForm) != "undefined") displayDNote(thisNote);
	return noteText;
}

function writeCustomNote()
{
	noteText = getCustomNote()
	if (noteText != "") document.write(noteText);
}

//****************** DNOTE ********************************
function displayDNote(noteTxt)
{
	noteTxt=prepareNoteText(noteTxt);
	parent.parent.frames[0].dnoteForm.txtNote.value=noteTxt;
}
function prepareNoteText(noteTxt)
{
	noteTxt=ThisPage.replaceText(noteTxt,"<BR>", "\r")
	return noteTxt;
}
//******************* END DNOTE ********************************

//************************************** Dummies **********************************************//
function setPagePath()
{
	if (isDummies && typeof(dummiesPath) != "undefined")
	{
		pgSequence = new Array;
		pgSequence=dummiesPath;
	}
	if (!isSa() && typeof(pgSequence) != "undefined")
	{
		currPageNoExt = currPage.substring(0, currPage.length-4);
		if (unitNum == 0) unitNum = "0abcdefghijklmnopqrstuvwxyz".indexOf(currPage.substring(2, 3)); //a=1
		if (typeof(pgSequence[unitNum]) != "undefined" && pgSequence[unitNum].indexOf(currPageNoExt) > -1)
		{
			var pageArray=pgSequence[unitNum].split(",");
			var numPages=pageArray.length;
			for (var i=0; i <= numPages;i++)
			{
				if (pageArray[i]==currPageNoExt)
				{
					if (i == numPages - 1)
					{
						if (typeof(pgSequence[unitNum+1]) != "undefined") nextPage=pgSequence[unitNum+1].substring(0, pgSequence[unitNum+1].indexOf(",")) + ".htm";
					} else nextPage=pageArray[i + 1] + ".htm";

					if (typeof(pgSequence[unitNum -1]) != "undefined")
					{
						if (i == 0)
						{
							var prevPageArray=pgSequence[unitNum-1].split(",");
							prevPage=prevPageArray[prevPageArray.length-1] + ".htm";
						} else prevPage=pageArray[i - 1] + ".htm";
					}

					pgNum="page " + (i+1).toString() + " of " + pageArray.length;
					pgUnit = scoType + " " + unitNum.toString() + " of " + numberOfUnits.toString();
					i=numPages+1;
				}
			}
		}
	}
	showWindowStatus();
}

function writeDummiesLabel(text)
{
	var whereTilda=text.indexOf("~");
	if (isDummies)
	{
		if (whereTilda > -1) text=text.substring(0,whereTilda);
	}
	else
	{
		if (whereTilda > -1) text=text.substring(whereTilda+1, text.length);
			else text="";
	}
	label="<span class=\"cLabel\">" + text + "</span><BR>";
	if (text != "") document.write (label);
}

function setUnitCompletion()
{
	if (coursewareHandler.useFsStyle) return;
	if (nextPage.indexOf("001.htm") > -1 || nextPage.indexOf("congrats") > -1)
	{
		if (coursewareHandler.lastCoursePage==prevPage)
		{
			ThisPage.setCompletionCookie(crsAcronym,numberOfUnits,unitNum)
		}
	}
}

function displayRadioMessage() // Ensure at least one radio button selected
{
	if (isAccessibilityWindow || typeof(document.form1.radio) == "undefined" || answersChecked || isCustom) return false;
	answersChecked=true;
	numSelected=0;
	for (i=0; i<8; i++)
	{
		if (optionSelected(i)) numSelected++;
	}
	if (numSelected < 1)
	{
		msg="<BR>&nbsp;<BR><CENTER><TABLE class=\"feedback\" WIDTH=440><TR><TD>";
		msg += "<TABLE BORDER=0><TR>";
		if (!isAccessibilityWindow) msg += "<TD VALIGN=TOP ALIGN=CENTER><IMG SRC=\"" + sharedImageDir + "hint.gif\"></TD><TD class=\"fdbkWords\">";
			else msg += "<TD class=\"fdbkWords\">";
		msg += resStr.radioMsg;
		msg += "</TD></TR></TABLE></TD></TR></TABLE></CENTER>"
		obj=document.getElementById("answerFeedback");
		if (obj != null)
		{
			obj.innerHTML=msg;
			return true;
		} else return false;
	} else return false;
}

function displayCheckboxMessage()
{
	if (isAccessibilityWindow || typeof(document.form1.checkbox1) == "undefined" || answersChecked || isCustom) return false;
	answersChecked=true;
	numSelected=0;
	for (i=0; i<8; i++)
	{
		if (optionSelected(i)) numSelected++;
	}
	if (numSelected < 2)
	{
		msg="<BR>&nbsp;<BR><CENTER><TABLE class=\"feedback\" WIDTH=440><TR><TD>";
		msg += "<TABLE BORDER=0><TR>";
		if (!isAccessibilityWindow) msg += "<TD VALIGN=TOP ALIGN=CENTER><IMG SRC=\"" + sharedImageDir + "hint.gif\"></TD><TD class=\"fdbkWords\">";
			else msg += "<TD class=\"fdbkWords\">";
		msg += resStr.checkboxMsg;
		msg += "</TD></TR></TABLE></TD></TR></TABLE></CENTER>"
		obj=document.getElementById("answerFeedback");
		if (obj != null)
		{
			obj.innerHTML=msg;
			return true;
		} else return false;
	} else return false;
}

//**************************************************************************

function optionSelected(opNum)
{
	boxNum=(opNum +1).toString();
	if (typeof(document.form1.radio) != "undefined" && typeof(document.form1.radio[opNum]) != "undefined" && document.form1.radio[opNum].checked) return true;
	if (document.form1["checkbox" + boxNum] && document.form1["checkbox" + boxNum].checked) return true;
	return false;
}

function writeHighlightedImage(imgName, gifH, gifW, tCoords)
{
		fullGifName=thisCourseDirectory + imgName;
		divTag="<div id=\"cp\" STYLE=\"position:relative;display:inline;\">";
		cords=tCoords.split(",");
		imgHeight=cords[3]-cords[1] - 2;
		imgWidth=cords[2]-cords[0] - 2;
		imgLeft=cords[0] - 2;
		imgTop=cords[1] - 2;
		imgHighlight="<table id=\"borderTable\" border=2 cellpadding=0 cellspacing=0 STYLE=\"position:absolute; left:" + imgLeft + "px; top:" + imgTop + "px;border-color:red;border-style:solid;\"><tr><td><a href=\"javascript:coursewareHandler.goPage('next')\" border=0><IMG SRC=\"" + sharedImageDir + "spacer.gif\" height="
			+ imgHeight + " width=" + imgWidth + " border=0></a></td></tr></table>";
		document.write(divTag + "<IMG SRC=\"" + fullGifName +"\" height="+gifH+" width="+gifW+" border=0 NAME=\"highPic\">" + imgHighlight + "</div>");
		timerId = setInterval(blinkBox,500);
}

function returnText(divId)
{
	obj=document.getElementById(divId);
	if (obj != null)
		return "<style>.cLabel{font-size:9pt;}.body{font-size:8pt;}</style>" + obj.innerHTML; // return obj.innerText; 
	else return "";
}

// *************** Dynamic HTML List Pages ***************
function writeClickList()
{
	eBul="</B></span></TD></TR></div>";
	list="";
	for (i=1;i<bulletItem.length;i++)
	{
		list+="<TR><TD ALIGN=LEFT VALIGN=TOP><IMG id=bullet" + i + " src=\"" + rootDir + "/shared/images/skins/1/images/bullist.gif\">";
		list+="</TD><TD><span id=item" + i + " class=\"fBullist\" onclick=\"showClickListContent(" + i + ")\" style=\"cursor:pointer;\"><B>";
		list+=bulletItem[i];
		list+="</span></TD></TR></div>";
	}
	if (typeof(allowAutoPlay)!="undefined" && allowAutoPlay) list+="<tr><td align=right colspan=2><img id=autobut src=\"" + sharedImageDir + "autoplay.gif\" onclick=\"clicklistAutoToggle()\">&nbsp;&nbsp;&nbsp;</td></tr>";
	document.write(list);
}

var hasBeenClicked=false;
function showClickListContent(num)
{
	if (num >= bulletItem.length) return;
	var divAudioFile=new Array;
	stopAudio();

	if (num==0) num=1;
	clicklistCurrentNum=num;
	for (i=1;i<content.length;i++)
	{
		thisItem=document.getElementById("item" + i);
		if (i==num)
		{
			thisBullet=document.getElementById("bullet" + i);
			thisBullet.src=rootDir + "/shared/images/skins/1/images/bullista.gif";
			thisItem.className="fBullista";
			thisItem.style.cursor="default"
			//if (typeof(pgAudio) != "undefined") playAudioFile(pgAudio + "_" + i + ".mp3")
			divAudioFile[i]=courseSoundDirectory + "a_" + currPage.substring(0, currPage.length-4) + "_" + i + ".mp3";
			if (!optionalAudio) playAudioFile(divAudioFile[i]);
		}
		else
		{
			thisBullet=document.getElementById("bullet" + i);
			thisBullet.src=rootDir + "/shared/images/skins/1/images/bullist.gif";
			thisItem.style.cursor="pointer"
			thisItem.className="fBullist";
		}
	}
	if (content[num].length < 20 && content[num].indexOf(".gif") > -1) // pictures
	{
		document.getElementById("wDiv").style.display="none";
		document.getElementById("clickBgPic").src=thisCourseDirectory + content[num];
		document.getElementById("clickBgPic").style.cursor="pointer";
		document.getElementById("clickBgPic").style.visibility="visible";
	}
	else if (typeof(useFullImages) != "undefined" && ThisPage.getPreference(PR_PageAudio) != "0")
	{
		obj=document.getElementById("clickBgPic");
		if (contentPic[num].indexOf("swf") > -1)
		{
			obj.src=rootDir + "/shared/images/skins/1/images/spacer.gif";
			fImage=insertFlash(contentPic[num].substring(0,contentPic[num].length-4), parseInt(obj.width),parseInt(obj.height),"#FFFFFF",false,false,true);
			obj=document.getElementById("wDiv");
			obj.innerHTML=fImage;
		} else obj.src=thisCourseDirectory + contentPic[num];
		obj.style.display="block";
	} else
	{
		obj=document.getElementById("clickBgPic")
		wWidth=parseInt(obj.width)-10;
		obj.src=sharedImageDir + "spacer.gif"; //"clicklist_gradient.jpg";
		obj.style.cursor="default";
		if (typeof(useMyLabels)!="undefined" && useMyLabels) pgWords = "";
			else pgWords = "<span class=\"overlayLabel\">" + bulletItem[num] + "</span><BR>"; 
		pgWords += content[num];
		bg="";
		if ((ThisPage.isIE && ThisPage.browserVersion >= 7) || coursewareHandler.useFsStyle)
		{
			obj.style.visibility="hidden";
			bg=" bgcolor='#FFFFFF'";
		}
		contents="<TABLE" + bg + " id=wordsTable style=\"filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);\"><TR><TD WIDTH=5>&nbsp;</TD><TD id=\"wCell\" width=" + wWidth + ">"
		contents+="<img src=\"" + sharedImageDir + "spacer.gif\" height=5>";
		contents+="<div id=\"textDiv\" class=\"overlayWords\">" + pgWords + "</div>";
		if (typeof(contentPic) != "undefined" && contentPic[num] != null && contentPic[num] != "" && typeof(useFullImages) == "undefined")
			contents+="</TD></TR><TR><TD WIDTH=5>&nbsp;</TD><TD><br><center><img src=\"" + thisCourseDirectory + contentPic[num] + "\"></center>"
		else contents+="</TD></TR></TABLE>";
		obj=document.getElementById("wDiv");
		if (optionalAudio)
		{
			opAudioButton="<table width=90%><tr><td align=right>"
			opAudioButton+="<img id=audioButton" + num + " src=\"" + sharedImageDir + "audio_onpg.gif\" style=\"cursor:pointer;\" border=0 onclick=\"playAudioFile('" + divAudioFile[num] + "')\" alt=\"" + resStr.playAudio + "\""
			opAudioButton+=" onmouseover=\"buttonRollover('audioButton" + num + "','audio_onpg',true,'" + sharedImageDir + "');\" onmouseout=\"buttonRollover('audioButton" + num + "','audio_onpg',false,'" + sharedImageDir + "');\">";
			opAudioButton+="</td></tr></table>";
			contents += opAudioButton;
		}
		obj.innerHTML=contents;
		obj.style.display="block";
		fadeItemIn("wordsTable",4);
	}
	hasBeenClicked=true;
	if (allowAutoSearch) closeAutoSearchBox();
}

function showClickListInstructions(type)
{
	useLocalNav=false;
	if (hasBeenClicked || type != "next")
	{
		coursewareHandler.goPage(type)
		return;
	}
	obj=document.getElementById("clickBgPic");
	if (obj ==null) obj=document.getElementById("pgPic1");
	if (obj !=null) obj.src=rootDir + "/shared/images/skins/1/images/spacer.gif";
	sInstructions="Instructions";
	if (typeof(resStr.instructions) != "undefined") sInstructions=resStr.instructions;
	pgWords = "<span class=\"overlayLabel\">" + sInstructions + "</span><BR>";
	if (typeof(mouseInstructionsImage) == "undefined") mouseInstructionsImage=rootDir + "/shared/images/skins/1/images/hint_mouse_left.gif";
	pgWords += "<table><tr><td><img src=\"" + mouseInstructionsImage + "\"></td><td>" + resStr.clicklist_instructions + "</td></tr></table>";
	document.getElementById("textDiv").innerHTML=pgWords;
	document.getElementById("wDiv").style.display="block";
	if (isTfCourse) iAudio=sharedSoundDirectory + "a_clicklist_instructions_tf.mp3";
		else  iAudio=sharedSoundDirectory + "a_clicklist_instructions.mp3";
	if (typeof(pgAudio) != "undefined") playAudioFile(iAudio)
}

function getPageInstructions(pageType)
{
	switch (pageType)
	{
		case "exploreit" :
			instruction=resStr.moveMouse_instructions;
			break;
		case "clickpic" :
			instruction=resStr.clickImage_instructions;
			break;
		case "clickcode" :
			instruction=resStr.clickCode_instructions;
			break;
		default:
			instruction="";
	}
	
	sInstructions="Instructions";
	if (typeof(resStr.instructions) != "undefined") sInstructions=resStr.instructions;
	if (typeof(mouseInstructionsImage) == "undefined") mouseInstructionsImage=rootDir + "/shared/images/skins/1/images/hint_mouse_left.gif";
	instrWords = "<center><div id=\"instructions\" style=\"display:none;\">";
	instrWords += "<table class=\"overlayBox\"><tr><td>";
	instrWords += "<span class=\"overlayLabel\">" + sInstructions + "</span><BR>"; 
	instrWords += "<table><tr><td><img src=\"" + mouseInstructionsImage + "\"></td><td>" + instruction + "</td></tr></table>";
	instrWords += "</td></tr></table></div></center>";

	if (instruction != "") return instrWords;
		else return "";
}

function writePageInstructions(pageType)
{
	instructions=getPageInstructions(pageType)
	if (instructions != "") document.write(instructions);
}

function showInstructions(type)
{
	useLocalNav=false;
	if (instructionsShown || type != "next")
	{
		coursewareHandler.goPage(type)
		useLocalNav=true;
		return;
	}
	instructionsShown=true;

	if (pgTpl=="full_exploreit")
	{
		obj=document.getElementById("wCell");
		if (obj==null) return;
		obj.innerHTML=getPageInstructions("exploreit")
		toggleExploreBorders();
	}
	obj=document.getElementById("instructions");
	if (obj != null) obj.style.display="block";
	if (pgTpl.indexOf("clickpic_code") > -1) audioId="clickcode";
	else if (pgTpl.indexOf("clickpic") > -1) audioId="clickpic";
	else if (pgTpl.indexOf("exploreit") > -1) audioId="explore";
		else audioId=pgTpl;
	if (isTfCourse) iAudio=sharedSoundDirectory + "a_" + audioId + "_instructions_tf.mp3";
		else iAudio=sharedSoundDirectory + "a_" + audioId + "_instructions.mp3";
	playAudioFile(iAudio);
	repaintDivs();
}

function hideInstructions()
{
	instructionsShown=true;
	obj=document.getElementById("instructions");
	if (obj != null) obj.style.display="none";
}

function hideIntroText(idName)
{

	//if (!hasStreamingAudio || ThisPage.getPreference(PR_PageAudio) == "0" || coursewareHandler.useFsStyle) return;
	if (!hasStreamingAudio || ThisPage.getPreference(PR_PageAudio) == "0") return;
	if (typeof(doNotHideInstructions) != "undefined" && doNotHideInstructions) return;
	obj=document.getElementById(idName);
	if (obj != null)
	{
		intro=obj.innerHTML;
		endLabel=intro.toLowerCase().indexOf("</span>");
		if (endLabel == -1) intro="";
			else intro=intro.substring(0, endLabel + 7)
		if (pgTpl.indexOf("act") == -1) intro += "<br><br>";
		obj.innerHTML=intro;
	}
}

optionalAudio=false;
function showClickText(num)
{
	hideInstructions();
	clicklistCurrentNum=num;
	divAudio=courseSoundDirectory + "a_" + currPage.substring(0, currPage.length-4) + "_" + num + ".mp3";
	stopAudio();
	opAudioButton="<table width=90%><tr><td align=right>"
	opAudioButton+="<img id=\"audioButton" + num + "\" src=\"" + sharedImageDir + "audio_onpg.gif\" style=\"cursor:pointer;\" border=0 onclick=\"playAudioFile('" + divAudio + "')\" alt=\"" + resStr.playAudio + "\"";
	opAudioButton+=" onmouseover=\"buttonRollover('audioButton" + num + "','audio_onpg',true,'" + sharedImageDir + "');\" onmouseout=\"buttonRollover('audioButton" + num + "','audio_onpg',false,'" + sharedImageDir + "');\">";
	opAudioButton+="</td></tr></table>";
	if (typeof(clickText) != "undefined")
	{
		obj=document.getElementById("clickTextDiv");
		if (obj != null)
		{
			if (optionalAudio) obj.innerHTML=clickText[num] + opAudioButton;
				else obj.innerHTML=clickText[num];
		}
	}
	else
	{
		// hide all other text blocks
		for (i=0;i<11;i++)
		{
			obj=document.getElementById("clickTextDiv" + i);
			if (obj != null) obj.style.display="none";
		}
		obj=document.getElementById("clickTextDiv" + num);
		if (obj != null)
		{
			if (optionalAudio && obj.innerHTML.indexOf("audio_onpg.gif")==-1) obj.innerHTML=obj.innerHTML+opAudioButton;
			obj.style.display="block";
		}
	}
	if (typeof(useHighlightImages) != "undefined" && useHighlightImages)
	{
		obj=document.getElementById("pgpic1");
		if (obj != null)
		{
			endGifPos=4;
			if (obj.src.substring(obj.src.length-6,obj.src.length).indexOf("_")>-1) endGifPos=6;
			obj.src=obj.src.substring(0,obj.src.length-endGifPos) + "_" + num + obj.src.substring(obj.src.length-4,obj.src.length);
		}
	}
	repaintDivs();
	if (!optionalAudio) playAudioFile(divAudio);
}

function clickpicAudioOnly()
{
	if (!hasStreamingAudio || ThisPage.getPreference(PR_PageAudio) == "0" || typeof(audioOnly) == "undefined" || audioOnly==false) return;
	obj=document.getElementById("clickpicTable");
	if (obj != null) obj.style.display="none";
}

function writeNotepadTop()
{
	if (isAccessibilityWindow) return;
	if (typeof(topImage) != "undefined" && topImage=="none") return;
	winStyle="winTitle";
	if (typeof(topImage) != "undefined") topImg= thisCourseDirectory + topImage + "\" height=" + topImageHeight + " width=633";
	else if (typeof(useDos) != "undefined" && useDos)
	{
		winStyle="winTitleDos";
		topImg=sharedImageDir + "dos_top.jpg\" height=24 width=633";
		if (typeof(winTitleText)=="undefined") winTitleText="Command Prompt";
	}
	else
	{
		if (typeof(winTitleText)=="undefined") winTitleText="";
		topImg=sharedImageDir + "notepad_top.jpg\" height=40 width=633";
		if (typeof(winTitleText)=="undefined" || winTitleText== " - Notepad") winTitleText="Untitled&nbsp;-&nbsp;Notepad";
	}

	if (typeof(winTitleText)=="undefined") winTitleText="";
	npTop="<tr><td colspan=2 bgcolor=\"#c0c0c0\"><div id=\"np\" STYLE=\"position:relative;display:inline;\"><div id=winTitle class=\"" + winStyle + "\" style=\"display:block;\">"
	npTop += winTitleText + "</div>";
	npTop += "<img src=\"" + topImg + "></div>";
	npTop += "</td></tr>";
	npTop += "<tr><td></td></tr>";
	document.write(npTop);
}

function writeHeightColumn(cHeight, style)
{
	if (typeof(cHeight) == "undefined") cHeight=395;
	if (typeof(topImageHeight) != "undefined") cHeight=395-(topImageHeight-40);
	if (typeof(statusBarHeight) != "undefined") cHeight=cHeight-statusBarHeight + 25;
	if (typeof(style) == "undefined") style="";
	if (typeof(leftMargin) == "undefined") leftMargin="2";
	document.write("<td class=\"" + style + "\"><img id=columnSpacer src=\"" + sharedImageDir + "spacer.gif\" height=" + cHeight + " width=" + leftMargin + "></td>");
}

function writeCopyCodeButton(boxNum)
{
	if (typeof(omitCopyButton) != "undefined" && omitCopyButton)
	{
		obj=document.getElementById("columnSpacer");
		if (obj!=null) obj.height=obj.height + 23;
		writeStatusBar();
		return;
	}
	if (typeof(boxNum)=="undefined") boxNum="";
	butCode="<tr><td colspan=2><table border=0 width=100%><tr><td align=right>";

	if (typeof(showEditButton) != "undefined" && showEditButton)
	{
		butCode+="<img id=showhtml src=\"" + sharedImageDir + "showhtml.gif\" height=23 width=23 alt=\"" + resStr.showBrowser + "\"";
		butCode+=" onclick=\"showHtml()\"";
		butCode+=" onmouseover=\"buttonRollover('showhtml','showhtml',true,'" + sharedImageDir + "')\"";
		butCode+=" onmouseout  =\"buttonRollover('showhtml','showhtml',false,'" + sharedImageDir + "')\">";
		butCode+="&nbsp;";

		butCode+="<img id=edithtml src=\"" + sharedImageDir + "edithtml.gif\" height=23 width=23 alt=\"" + resStr.editHtml + "\"";
		butCode+=" onclick=\"editHtml()\"";
		butCode+=" onmouseover=\"buttonRollover('edithtml','edithtml',true,'" + sharedImageDir + "')\"";
		butCode+=" onmouseout  =\"buttonRollover('edithtml','edithtml',false,'" + sharedImageDir + "')\">";
		butCode+="&nbsp;";
	}
	butCode+="<img id=copycode src=\"" + sharedImageDir + "copy_code_off.gif\" height=23 width=23 alt=\"" + resStr.copyCode + "\"";
	butCode+=" onclick=\"copyCode(" + boxNum + ")\"";
	butCode+=" onmouseover=\"buttonRollover('copycode','copy_code',true,'" + sharedImageDir + "')\"";
	butCode+=" onmouseout   =\"buttonRollover('copycode','copy_code_off',false,'" + sharedImageDir + "')\">";

	butCode+="</td></tr></table></td></tr>";
	document.write(butCode);
	writeStatusBar();
}

function writeStatusBar()
{
	if (typeof(statusBarImage) == "undefined") return;
	sbCode="<tr><td colspan=2><table border=0 cellspacing=0 cellpadding=0 width=100%><tr><td>";
	sbCode+="<img id=sbar src=\"" + thisCourseDirectory + statusBarImage + "\" height=" + statusBarHeight + " width=633>";
	sbCode+="</td></tr></table></td></tr>";
	document.write(sbCode);
}

function writeShowHtmlButton()
{
	butCode="<tr><td colspan=2><table border=0 width=100%><tr><td align=right>";
	butCode+="<img id=showhtml src=\"" + sharedImageDir + "showhtml.gif\" height=23 width=23" // alt=\"" + resStr.copyCode + "\"";
	butCode+=" onclick=\"showHtml()\"";
	butCode+=" onmouseover=\"buttonRollover('showhtml','showhtml',true,'" + sharedImageDir + "')\"";
	butCode+=" onmouseout  =\"buttonRollover('showhtml','showhtml',false,'" + sharedImageDir + "')\">";

	if (pgTpl=="acthtml")
	{
		butCode+="&nbsp;&nbsp;&nbsp;";
		butCode+="<img id=showhtml_solution src=\"" + sharedImageDir + "showhtml_solution.gif\"" // alt=\"" + resStr.copyCode + "\"";
		butCode+=" onclick=\"showHtmlSolution()\"";
		butCode+=" onmouseover=\"buttonRollover('showhtml_solution','showhtml_solution',true,'" + sharedImageDir + "')\"";
		butCode+=" onmouseout  =\"buttonRollover('showhtml_solution','showhtml_solution',false,'" + sharedImageDir + "')\">";
	}

	butCode+="&nbsp;&nbsp;&nbsp;";
	butCode+="</td></tr></table></td></tr>";
	document.write(butCode);
}
function showHtml()
{
	dest=thisCourseDirectory + "showhtml.htm";
	ThisPage.floatWin(dest,'showhtmlWin', 'toolbar=no,menubar=yes,resizable=yes,width=500,height=350,scrollbars=yes');
}

function editHtml()
{
	dest=thisCourseDirectory + "edithtml.htm?acro=" + crsAcronym;
	ThisPage.floatWin(dest,'edithtmlWin', 'toolbar=no,menubar=yes,resizable=yes,width=640,height=385,scrollbars=no');
}

function showHtmlSolution()
{
	document.form1.text1.value=document.form1.solution.value;
}

function submitCliqNP(key)
{
	if (hasBeenAnswered())
	{
		if (key==1) coursewareHandler.goPage("next");
		return;
	}
	document.getElementById("winCode").onclick="";
	document.form1.text1.value=key;
	submitQuestion();
}

function toggleFlash()
{
	if (ThisPage.getPreference(PR_PageAudio) == "1") coursewareHandler.goPage("audioOff");
		else coursewareHandler.goPage("audioOn");
}

function autoNumberCodeLines()
{
	obj=document.getElementById("winCode");
	codeHtml=obj.innerHTML;
	codeHtml=ThisPage.replaceText(codeHtml,"Line>","Line><BR>",false);
	codeHtml=ThisPage.replaceText(codeHtml,"<BR><span","<BR/><span",false);
	codeHtml=ThisPage.replaceText(codeHtml,"<BR></span>","</span><BR>",false);
	codeHtml="&nbsp;1: " + codeHtml;
	lineNum=1;
	while (codeHtml.indexOf("<BR>") > -1)
	{
		lineNum++;
		codeHtml=ThisPage.replaceText(codeHtml,"<BR>","<BR/>&nbsp;" + lineNum + ": ",true)
	}
	codeHtml=ThisPage.replaceText(codeHtml,"Line><BR/>","Line>",false);
	codeHtml=ThisPage.replaceText(codeHtml,"</span><BR/>","</span>",false);
	obj.innerHTML= codeHtml + "<BR>";
	numCodeLines=lineNum;
}

function removeCodeLineNumbers(codeText)
{
	textNoNumbers=codeText;
	for (i=1; i <= numCodeLines;i++)
	{
		textNoNumbers=ThisPage.replaceText(textNoNumbers," " + i + ": ","",true)
	}
	return textNoNumbers;
}

function copyCode(boxNum)
{
	if (typeof(boxNum)=="undefined") boxNum="";
	obj=document.getElementById("winCode" + boxNum);
	if (obj==null) return;
	codeText=obj.innerText;
	if ( (typeof(autoNumberCode) != "undefined" && autoNumberCode) || (typeof(removeCodeNumbers) != "undefined" && removeCodeNumbers) )
		codeText=removeCodeLineNumbers(codeText);

	window.clipboardData.setData('Text', codeText);
}

function writeImageMap()
{
	if (pgTpl=="actfull") return;
	mapCode="<MAP name=\"clickpic.map\">";
	if (typeof(c2cCoords ) != "undefined")
	{
		mapCode += "<area shape=\"rect\" coords=\"" + c2cCoords + "\" href=\"javascript:coursewareHandler.goPage('next')\">";
		mapCode +="</MAP>";
		document.write (mapCode);
	}
	else if (typeof(clickCoords ) != "undefined")
	{
		for (i=1;i<clickCoords.length;i++)
		{
			if (clickCoords[i] != "") mapCode += "<area shape=\"rect\" coords=\"" + clickCoords[i] + "\" href=\"javascript:" + clickpicFunction + "('" + i + "')\">";
		}
		mapCode +="</MAP>";
		document.write (mapCode);
	}
	else if (typeof(mouseoverCoords) != "undefined" && (typeof(exploreUseMap) =="undefined" || exploreUseMap==true) )
	{
		for (i=1;i<mouseoverCoords.length;i++)
		{
			mapCode += "<area shape=\"rect\" coords=\"" + mouseoverCoords[i] + "\" onmouseover=\"" + clickpicFunction + "('" + i + "',true)\" onmouseout=\"" + clickpicFunction+ "('" + i + "',false)\">";
		}
		mapCode +="</MAP>";
		document.write (mapCode);
	}
}

function exploreShowText(event,num,show)
{
	instructionsShown=true;
	exploreDiv=document.getElementById("expDiv");
	if (exploreDiv == null) return;

	exploreLabel=expLabel[num];
	if (exploreLabel!="") exploreLabel += "<br>";
	exploreText=expText[num];
	wWidth=expWidth[num];
	if (wWidth=="") wWidth=defaultBoxWidth;
	picTop=parseInt( (document.body.clientHeight-picHeight)/2);
	picLeft=parseInt( (document.body.clientWidth-picWidth)/2) - 20;

	if (ThisPage.isIE)
	{
		xPos = window.event.x;
		yPos = window.event.y;
	}
	 else
	{
		xPos = parseInt(event.pageX);
		yPos = parseInt(event.pageY-document.getElementById("cp").offsetTop);
	}

	if (typeof(boxDown) == "undefined") boxDown=20;
	wTop=yPos + parseInt(picTop) + boxDown;
	if (wTop > (picTop + (picHeight-100)) ) wTop=wTop-100;
	mPos=xPos;
	// always show to the right unless mouse is wWidth from the right edge
	maxLeft=parseInt(picWidth) + picLeft - wWidth - 30 
	if ( mPos > maxLeft) wLeft=mPos-wWidth - 20; //left
		else wLeft=mPos + 20 //right

	exploreBox=document.getElementById("box" + num);
	if (show)
	{

		exploreLabelDiv=document.getElementById("expLabelDiv");
		exploreTextDiv=document.getElementById("expTextDiv");

		if (exploreBox != null && exploreDynamicBoxes) exploreBox.style.borderStyle=exploreBorderStyle;

	if (typeof(staticBoxPosition) != "undefined")
	{
		wTop=staticBoxPosition.substring(0,staticBoxPosition.indexOf(",")) - 1 + picTop + 20;
		wLeft=staticBoxPosition.substring(staticBoxPosition.indexOf(",")+1,staticBoxPosition.length) - 1 + picLeft + 20;
	}

		if (exploreLabelDiv != null) exploreLabelDiv.innerHTML=exploreLabel;
		exploreTextDiv.innerHTML=exploreText;
		exploreDiv.style.width=wWidth + "px";
		exploreDiv.style.top=wTop + document.body.scrollTop;
		exploreDiv.style.left=wLeft + "px";
		exploreDiv.style.visibility="visible";

		pgNoExt=currPage.substring(0, currPage.length-4);
		if (typeof(playFullExploreAudio) != "undefined" && playFullExploreAudio)
			playAudioFile(courseSoundDirectory + "a_" + pgNoExt + "_" + num + ".mp3");
		else
			playAudioFile(courseSoundDirectory + "a_" + pgNoExt + "_label_" + num + ".mp3")
	}
	else
	{
		exploreDiv.style.visibility="hidden";
		if (exploreBox != null && exploreDynamicBoxes && !expBordersShown) exploreBox.style.borderStyle="none";
	}
}

function fadeItemIn(what,speed)
{
	if (typeof(speed)=="undefined") speed=10;
	obj=document.getElementById(what);
	if (!ThisPage.isIE)
	{
		obj.style.display="block";
		return;
	}
	fadeTmr=setTimeout("fadeItemIn('" + what + "'," + speed + ")",20);
	if (obj.filters.item("DXImageTransform.Microsoft.Alpha").opacity < 100) obj.filters.item("DXImageTransform.Microsoft.Alpha").opacity += speed;
		else clearTimeout(fadeTmr)
}

function getShortcutKeyDiv()
{
	if (typeof(keyTitle)=="undefined") keyTitle="Keyboard Shortcuts";
	keyText="<br><center><table class=\"keyTable\" width=95% border=1 cellspacing=0 cellpadding=2><tr class=\"keyTableHeading\"><td nowrap>Use this key...</td><td>To...</td></tr>";
	for (i=0;i<keyName.length;i++)
	{
		keyText += "<tr><td>" + keyName[i] + "</td><td>" + keyDescription[i] + "</td></tr>";
	}
	keyText += "</table></center>"
	wTop=parseInt(parseInt(document.body.clientHeight)/2)-75;
	wLeft=parseInt(parseInt(document.body.clientWidth)/2) - 175;
	kBox="<div id=keyBox class=\"keyBoxStyle\" style=\"position:absolute;top:" + wTop + ";left:" + wLeft + ";display:none;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);\">";
	kBox+="<TABLE WIDTH=350 cellpadding=5 background=\"" + sharedImageDir + "keyboard_bg.jpg\"><TR>";
	kBox+="<TD ALIGN=LEFT VALIGN=TOP><center><span style=\"font-weight:bold;font-size:10pt;\" class=\"xoverlayLabel\">" + keyTitle + "</span></center><span id=scenarioText style=\"font-size:8pt;\">" + keyText + "</span></TD>"
	kBox+="</TD></TR><TR><TD align=right><img id=keyClose src=\"" + sharedImageDir + tfPrefix + "act_close.gif\" height=24 width=48 onclick=\"closeKeyBox();\" onmouseover=\"buttonRollover('keyClose','act_close',true,'" + sharedImageDir + "');\" onmouseout=\"buttonRollover('keyClose','act_close',false,'" + sharedImageDir + "');\">&nbsp;&nbsp;";
	kBox+="</TR></TABLE></div>";
	return kBox;
}
function showKeyBox()
{
	obj=document.getElementById("keyBox");
	if (obj != null) obj.style.display="block";
	fadeItemIn("keyBox",15);
}

function closeKeyBox()
{
	obj=document.getElementById("keyBox");
	fadeItemOut("keyBox",15);
}

function fadeItemIn(what,speed)
{
	if (typeof(speed)=="undefined") speed=10;
	obj=document.getElementById(what);
	if (!ThisPage.isIE)
	{
		obj.style.display="block";
		return;
	}
	fadeTmr=setTimeout("fadeItemIn('" + what + "'," + speed + ")",20);
	if (obj.filters.item("DXImageTransform.Microsoft.Alpha").opacity < 100) obj.filters.item("DXImageTransform.Microsoft.Alpha").opacity += speed;
		else clearTimeout(fadeTmr)
}

function fadeItemOut(what,speed)
{
	if (typeof(speed)=="undefined") speed=20;
	obj=document.getElementById(what);
	if (!ThisPage.isIE)
	{
		obj.style.display="none";
		return;
	}
	fadeTmr=setTimeout("fadeItemOut('" + what + "'," + speed + ")",speed);
	if (obj.filters.item("DXImageTransform.Microsoft.Alpha").opacity > 0) obj.filters.item("DXImageTransform.Microsoft.Alpha").opacity -= 10;
	else
	{
		clearTimeout(fadeTmr);
		if (obj != null) obj.style.display="none";
	}
}

function writeShowAnswerButton()
{
	butCode="<table border=0 width=95%><tr><td align=right>";
	butCode+="<img id=showanswer src=\"" + sharedImageDir + "act_showanswer.gif\"" // alt=\"" + resStr.copyCode + "\"";
	butCode+=" onclick=\"actShowAnswer()\"";
	butCode+=" onmouseover=\"buttonRollover('showanswer','act_showanswer',true,'" + sharedImageDir + "')\"";
	butCode+=" onmouseout  =\"buttonRollover('showanswer','act_showanswer',false,'" + sharedImageDir + "')\">";
	butCode+="</td></tr></table>";
	document.write(butCode);
}

function actShowAnswer()
{
	obj=document.getElementById("actAnswer");
	if (obj!=null) obj.style.display="block";
	obj=document.getElementById("showanswer");
	if (obj!=null) obj.style.display="none";
	actChoiceSubmitted=true;
}
// *************** End Dynamic HTML List Pages ***************

/******************** Begin Full Page Flash Functions *******************/
function hideFullText()
{
	obj=document.getElementById("wDiv");
	if (obj==null || !hasStreamingAudio ) return;
	if (ThisPage.getPreference(PR_PageAudio) != "0") obj.style.display="none";
		else obj.style.display="block";
}

function resizeFlash(show)
{
	if (pgTpl.indexOf("clicklist") > -1)
	{
		showClickListContent(clicklistCurrentNum);
		return;
	}
	trans=document.getElementById("transcript");

	if (pgTpl.indexOf("flsize_slideshow") > -1 || pgTpl == "flsize_camtasia")
	{
		if (!hasFlash()) trans.style.display="block";
			else trans.style.display="none";
		return;
	}

	flashPic=document.getElementById("movie");
	if (flashPic==null)
	{
		if (trans != null) trans.style.display="block";
		return;
	}

	if (pgTpl == "flsize_sequence" && typeof(useFull) == "undefined")
	{
		fWidth=640 // picWidth;
		fHeight=380 //picHeight;
	}
	if (ThisPage.getPreference(PR_PageAudio) == "0")
	{
		winH=document.body.clientHeight; // default: 523 - 30 (logo)
		if (winH < 640)
		{
			flashPic.style.width=parseInt(parseInt(fWidth) * .75) + "px";
			flashPic.style.height=parseInt(parseInt(fHeight) * .75) + "px";
		}
		if (trans!=null) trans.style.display="block";
	}
	else
	{
		flashPic.style.width=parseInt(fWidth) + "px";
		flashPic.style.height=parseInt(fHeight) + "px";
		if (trans!=null) trans.style.display="none";
	}
}

function loadFlsizePage()
{
	if (!hasFlash(requiredVersion))
	{
		obj=document.getElementById("transcript");
		if (obj!=null) obj.style.display="block";
	}
	else
	{
		resizeFlash()
	}
	flsizeLoadFlashParms();
	if (pgTpl=="flsize_sequence") loadExploreValues();
}

function getFlashInstructions()
{
	fInstr="<table width=\"600\"><tr><td valign=top>";
	fInstr += "<span class=\"cLabel\">" + resStr.flashTitle + "</span><BR>";
	fInstr += "This page was designed to be viewed using the Flash Web Player.<br><br>"
	fInstr += "To install the Flash Web Player, click the Get Adobe Flash<font size='-1'><sup>&reg;</sup></font> button, and follow the installation instructions on the Adobe website.";
	fInstr += " After the Flash player is installed, close the Flash window and <a href=\"javascript:location.reload()\">click here</a> to refresh this page.";
	fInstr += "<br><br>You can continue taking the course without installing the Flash Web Player."
	fInstr += "<br><br><table width=90%><tr><td align=right><A HREF=\"javascript:installFlash()\"><IMG SRC=\"" + localizedSharedDirectory + "launchlob/getflash_button.gif\" BORDER=0 WIDTH=88 HEIGHT=31></A></td></tr></table>"
	fInstr += "</td></tr></table>";
	return fInstr;
}

function printSimulation()
{
	if (!printSim) return;
	if (pgTpl=="full_exploreit")
	{
		floatWin(rootDir + "/shared/templates/explore_print.htm?acro=" + crsAcronym + "&htm=" + currPage, 'explore_print', 'resizable=yes,width=680,height=640,scrollbars=yes,menubar=yes,toolbar=no,statusbar=no');
		return;
	}
	sType="sm";
	if (typeof(showmeName) != "undefined" && showmeName != "") sim=showmeName;
	else if (pgTpl=="doitpg" || pgTpl=="doitpg_only" || pgTpl=="showme_only")
	{
		sim=pgSim;
		if (location.href.indexOf("autorun=1") == -1 && pgTpl != "showme_only") sType="doit";
	} else return;
	floatWin(rootDir + "/shared/templates/sim_print.htm?acro=" + crsAcronym + "&sim=" + sim + "&type=" + sType + "&htm=" + currPage, 'sim_print', 'resizable=yes,width=680,height=640,scrollbars=yes,menubar=yes,toolbar=no,statusbar=no');
}

function writeScoresButtonImage()
{
	if (useNewDesign) document.write("<sub>" + sgif("scoresbut_small",19,21,"",true) + "</sub>");
}

// TF Task Flash Paper Pages
function insertTaskPlayer()
{
	requiredVersion=9;
	insertFlash(sharedDirectory + "templates/task",700,420,"#FFFFFF",false,false);
}

function initializeTask()
{
	if (typeof(window.document.movie)=="undefined" || typeof(taskFile)=="undefined") return;
	if (taskFile.indexOf(".")==-1) taskFile+=".swf";
	if (typeof(sampleFile)=="undefined") sampleFile="";
		else if (sampleFile != "" && sampleFile.indexOf(".") == -1) sampleFile+=".exe";
	window.document.movie.SetVariable("_root.taskFile", thisCourseDirectory + taskFile);
	if (sampleFile != "") window.document.movie.SetVariable("_root.sampleFile", thisCourseDirectory + sampleFile);

	doNotHideInstructions=false;
	hideIntroText("taskInstructions");
	window.document.movie.Play();
}

// Slideshow Pages
function insertSlidePlayer()
{
	if (typeof(slidePlayer)=="undefined") slidePlayer="";
	requiredVersion=8;
	if (slidePlayer=="wide") insertFlash(sharedDirectory + "templates/slideshow_big",740,480,"#FFFFFF",false,false);
		else insertFlash(sharedDirectory + "templates/slideshow",640,480,"#FFFFFF",false,false);

	// insert audio player for beep
	audioPlayer=sharedDirectory + "templates/audioplayer_6";
	insertFlash(audioPlayer,"2","2","#FFFFFF",false,false,false);
}

function writeSlideTranscriptTitle()
{
	document.write("Slide Presentation Transcript");
}

var slideReference=new Array;
function loadFlashSlideData()
{
	passedSlideNum=ThisPage.getPassedParm("slidenum")
	if (passedSlideNum != "")
	{
		if (passedSlideNum == "last" || parseInt(passedSlideNum) > numSlides) passedSlideNum=numSlides;
		currentSlide=parseInt(passedSlideNum);
	}
	if (typeof(slideReferencePages) != "undefined")
	{
		for (i=1; i<slideReferenceNumbers.length;i++)
		{
			slideReference[slideReferenceNumbers[i]]=slideReferencePages[i];
		}
	}
	
	if (typeof(showSlideText) != "undefined" && showSlideText) setSlideText();

	if (typeof(window.document.movie)=="undefined") return;
	if (typeof(autoAdvance)=="undefined") autoAdvance=false;
	if (typeof(slideExtension) == "undefined") slideExtension="png";
	if (typeof(slideBackgroundImage) == "undefined") slideBackgroundImage="slide_bg.png";
	window.document.movie.SetVariable("_root.backgroundimage", thisCourseDirectory + slideBackgroundImage);
	window.document.movie.SetVariable("_root.slideExt", slideExtension);
	for (i=1; i <= numSlides; i++) // loop through slide numbers
	{
		window.document.movie.SetVariable("_root.backgroundimageName" + i, thisCourseDirectory + slideBackgroundImage);
		window.document.movie.SetVariable("_root.slide" + i, thisCourseDirectory + "slide" + parseInt(slideNumbersArray[i-1]));
		window.document.movie.SetVariable("_root.slideAudio" + i, thisCourseDirectory + "slide" + parseInt(slideNumbersArray[i-1]) + ".mp3");
		if (slideNumbersArray[i-1].indexOf("a") > -1 || autoAdvance)
			window.document.movie.SetVariable("_root.autoAdvance" + i, "1");
		else
			window.document.movie.SetVariable("_root.autoAdvance" + i, "0");
	}
	window.document.movie.goSlide(currentSlide);
}

slidesPaused=false;
currentSlide=1;
function playOrPauseSlides()
{
	if (slidesPaused==false) window.document.movie.pauseIt();
		else window.document.movie.playIt();
	slidesPaused=!slidesPaused;
	coursewareHandler.foobar.update();
}

function navigateSlides(type)
{
	useLocalNav=false;
	if (type != "next" && type != "prev")
	{
		coursewareHandler.goPage(type);
		useLocalNav=true;
		return;
	}

	if (slidesPaused) playOrPauseSlides();
	if (type == "next")
	{
		if (currentSlide==numSlides)
		{
			coursewareHandler.goPage("next");
			return
		}
		currentSlide++;
		if (typeof(showSlideText) != "undefined" && showSlideText) setSlideText()
			else window.document.movie.goSlide(currentSlide);
	}
	else
	{
		if (currentSlide==1)
		{
			coursewareHandler.goPage("prev");
			return;
		}
		currentSlide--;
		if (typeof(showSlideText) != "undefined" && showSlideText) setSlideText()
			else window.document.movie.goSlide(currentSlide);
	}
	useLocalNav=true;
}

function setSlideText()
{
		document.getElementById("slidePlayerDiv").style.display="none";
		document.getElementById("slideTextOnlyDiv").style.display="block";
		obj=document.getElementById("slidePic");
		if (obj != null) obj.src="slide" + slideNumbersArray[currentSlide-1] + ".png";
		obj=document.getElementById("slideTextDiv");
		if (obj != null)
		{
			objTxt=document.getElementById("slideText" +  slideNumbersArray[currentSlide-1]);
			if (objTxt != null) obj.innerHTML=objTxt.innerHTML;
		}
		updateSlideFoobar(currentSlide)
}

function toggleSlides()
{
	if (typeof(coursewareHandler.showSlideshowText) != "undefined") coursewareHandler.showSlideshowText=!coursewareHandler.showSlideshowText;
	location.href=thisCourseDirectory + currPage + "?slidenum=" + currentSlide;
}

function slideDone()
{
	playAudioFile(sharedSoundDirectory + "a_eop_beep.mp3");
	if (typeof(animateNextButton) != "undefined") highlightNextButton();
}

function updateSlideFoobar(slideNum)
{
	currentSlide=slideNum;
	if (slidesPaused) playOrPauseSlides();
	customButton="";
	if (slideReference[slideNum] != null && slideReference[slideNum] != "")
	{
		quickrefFile=slideReference[slideNum];
		if (typeof(useMindnotes) != "undefined" && useMindnotes) addButton("mindnotes,quickref,72,29,Open the MindNotes file");
			else addButton("reference,quickref," + refButtonW + ",29," + resStr.quickrefAlt);
	}
	coursewareHandler.foobar.update();
	// set bookmark to current slide
	coursewareHandler.bookmarkUrl=rootDir + "/courses/" + crsAcronym + "/" + currPage + "?slidenum=" + slideNum;
}

function insertCamtasiaFlash()
{
	if (hasFlash())
	{
		requiredVersion=7;
		fWidth="640";
		fHeight="498";
		if (ThisPage.isIE)
		{
			camCode="<OBJECT id=\"" + camtasiaName + "_controller.swf\" ";
			camCode+="height =\"" + fHeight + "\" width =\"" + fWidth + "\"";
			camCode+="classid =\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\">";
			camCode+="<PARAM NAME=\"FlashVars\" VALUE=\"csConfigFile=";
			camCode+=thisCourseDirectory + camtasiaName + "_config.xml&csColor=FFFFFF&csPreloader=";
			camCode+=sharedDirectory + "templates/camtasia_preloader.swf\">";
			camCode+="<PARAM NAME=\"Movie\" VALUE=\"" + camtasiaName + "_controller.swf\"> ";
			camCode+="<PARAM NAME=\"WMode\" VALUE=\"Window\">";
			camCode+="<PARAM NAME=\"Quality\" VALUE=\"autolow\">";
			camCode+="<PARAM NAME=\"SAlign\" VALUE=\"\">";
			camCode+="<PARAM NAME=\"Menu\" VALUE=\"-1\">";
			camCode+="<PARAM NAME=\"Scale\" VALUE=\"ShowAll\">";
			camCode+="<PARAM NAME=\"DeviceFont\" VALUE=\"0\">";
			camCode+="<PARAM NAME=\"EmbedMovie\" VALUE=\"0\">";
			camCode+="<PARAM NAME=\"BGColor\" VALUE=\"FFFFFF\">";
			camCode+="<PARAM NAME=\"SWRemote\" VALUE=\"\">";
			camCode+="<PARAM NAME=\"MovieData\" VALUE=\"\">";
			camCode+="<PARAM NAME=\"SeamlessTabbing\" VALUE=\"1\">";
			camCode+="<PARAM NAME=\"Profile\" VALUE=\"0\">";
			camCode+="<PARAM NAME=\"ProfileAddress\" VALUE=\"\">";
			camCode+="<PARAM NAME=\"ProfilePort\" VALUE=\"0\">";
			camCode+="</OBJECT>";
		}
		else
		{
			camCode="<EMBED type=\"application/x-shockwave-flash\"";
			camCode+=" id=\"" + camtasiaName + "_controller.swf\" name=\"" + camtasiaName + "_controller.swf\"";
			camCode+=" height =\"" + fHeight + "\" width =\"" + fWidth + "\"";
			camCode+=" flashvars=\"csConfigFile=";
			camCode+=thisCourseDirectory + camtasiaName + "_config.xml&csColor=FFFFFF&csPreloader=";
			camCode+=sharedDirectory + "templates/camtasia_preloader.swf\"";
			camCode+=" src=\"" + camtasiaName + "_controller.swf\"";
			camCode+="</EMBED>";
		}
	}
	else
	{
			camCode= "<A HREF=\"javascript:openFlashDownloadPage();\">";
			camCode+="<IMG SRC=\"" + sharedImageDir + "flash_download.gif\" BORDER=0 WIDTH=100 HEIGHT=70></A>"
	}

	document.write(camCode);
}

function commonRandomizeArray (arr,lowerBound)
{
	var i = arr.length;
	if (typeof(lowerBound)=="undefined") lowerBound=1;
	if ( i == 0 ) return false;
	while ( --i )
	{
		var j = Math.floor( Math.random() * ( i + lowerBound ) );
		if(j != lowerBound-1) // array values begin at lowerBound
		{
			var tempi = arr[i];
			var tempj = arr[j];
			arr[i] = tempj;
			arr[j] = tempi;
		}
	}
}

// Called by flash to open mindnotes files
function openMindnotes()
{
	coursewareHandler.goPage("quickref");
}
/******************** End Full Page Flash Functions *******************/

/******************** Flash US Map Functions *******************/
function CA(st)
{
	alert(st)
}
function usMapMouseover(st)
{
	//sNum=getStateNum(st);
}

function usMapMouseout(st)
{
	//sNum=getStateNum(st)
}

function usMapClick(st)
{
	sNum=getStateNum(st);
	if (sNum < 1) return;
	if (sContent[sNum].substring(0,5)=="http:")
	{
		sWin=window.open(sContent[sNum],'state_info', 'toolbar=yes,menubar=yes,resizable=yes,width=650,height=480,scrollbars=yes');
		return;
	}
	//else if (sContent[sNum].substring(0,3)==currPage.substring(0,3) && sContent[sNum].indexOf(".htm")>-1)
	else if (sContent[sNum].length==1)
	{
		coursewareHandler.goPage(currPage.substring(0,currPage.length-4) + sContent[sNum] + ".htm");
		return;
	}
	if (sTitle[sNum]=="")
	{
		if (typeof(defaultLabelText) == "undefined") defaultLabelText="Information for";
		sTitle[sNum] = defaultLabelText + " " + state[sNum];
		// if (sTitle[sNum].indexOf(", ") > -1) sTitle[sNum] = sTitle[sNum].substring(0, sTitle[sNum].lastIndexOf(",") -1) + " and " + sTitle[sNum].substring(sTitle[sNum].lastIndexOf(", ") + 1,sTitle[sNum].length);
	}
	stateInfo="<span class=overlayLabel>" + sTitle[sNum] + "</span><br>";
	stateInfo+=sContent[sNum];
	obj=document.getElementById("stateInfoDiv")
	obj.innerHTML=stateInfo;

	if (typeof(usmapAllowHide) != "undefined") document.getElementById("usmapHideDiv").style.display="block";

}

function getStateNum(st)
{
	for (i=1;i < state.length;i++)
	{
		if (state[i].indexOf(st) > -1) return i;
	}
	return 0;
}

function usmapHide()
{
//<table width=600><tr><td align=right><span id=usmapHideText style="cursor:pointer;font-size:8pt;" onclick="usmapHide()">Hide Map</span></td></tr></table>
	obj=document.getElementById("usmapDiv");
	if (obj!=null)
	{
		if (obj.style.display=="block")
		{
			obj.style.display="none";
			document.getElementById("usmapHideText").innerText="Show Map";
		}
		else
		{
			obj.style.display="block";
			document.getElementById("usmapHideText").innerText="Hide Map";
		}
	}
}
/******************** EndFlash US Map Functions *******************/

/*********************************** Functions for Notes Feature ******************************/
function getPgText(which)
{
	if (typeof(which)=="undefined") which="text";
	if (pgTpl=="scovie" && ThisPage.getPreference(PR_PageAudio)=="1")
	{
		obj=document.getElementById("scovieTextVersion");
		if (obj!=null) return ThisPage.getInnerText(obj);
		scovieText=scoTitle + "\r\n";
		scovieText+=inThis + "\r\n";
		scovieText+=obj1 + "\r\n";
		if (obj2 != "") scovieText+=obj2 + "\r\n";
		if (obj3 != "") scovieText+=obj3 + "\r\n";
		if (obj4 != "") scovieText+=obj4 + "\r\n";
		if (obj5 != "") scovieText+=obj5 + "\r\n";
		return scovieText;
	}
	
	if (pgTpl=="full_exploreit" && typeof(expLabel) != "undefined")
	{
		txt=""
		obj=document.getElementById("textDiv");
		if (obj!=null) txt=ThisPage.getInnerText(obj) + "\r\n"+ " \r\n";
		for (i=1;i<expLabel.length;i++)
		{
			if (expLabel[i] != null && expLabel[i] != "") txt+=expLabel[i]+ "\r\n" + expText[i] +"\r\n";
		}
		return txt;
	}

	obj=document.getElementById("pgText");
	if (obj!=null)
	{
		if (which=="text") returnText=ThisPage.getInnerText(obj);
			else returnText=obj.innerHTML;
	} else returnText="";

	// get rid of the exit warning message
	exitMsgDiv=document.getElementById("exitWarningMessage");
	if (exitMsgDiv != null) returnText=ThisPage.replaceText(returnText,ThisPage.getInnerText(exitMsgDiv),"");

	returnText=ThisPage.replaceText(returnText," \r\n","\r\n" );
	returnText=ThisPage.replaceText(returnText,"\r\n" + "\r\n" ,"\r\n" );
	
	return returnText;
}

function clearMessageText()
{
	messageLabelDiv=document.getElementById("msgLabelDiv");
	messageTextDiv=document.getElementById("msgTextDiv");
	if (messageLabelDiv != null) messageLabelDiv.innerHTML="";
	if (messageTextDiv != null) messageTextDiv.innerHTML="";
}
/*********************************** End Functions for Notes Feature ******************************/
/********************************** TF Pre and Post Test *********************************/
function ptShowTestResults(goDest)
{
	if (typeof(goDest)=="undefined") goDest="";  // goDest is used to record scores in the middle of a test before going to the menu.
	// if they are in a test and exit early, still record and then clear the test data
	cwh=coursewareHandler;
	if (cwh.pt_type=="Pre")
	{
		if (pgTpl.indexOf("questiontime") == -1)
		{
			coursewareHandler.fsSetCompletion(coursewareHandler.getScoNum(ScoId),"2");
			prePassed=cwh.pt_numQuestions==cwh.pt_totalCredit;
			document.getElementById("pretestTopics").innerHTML=cwh.pt_missedTopics;
			if (prePassed) document.getElementById("pt_missedTopics").style.display="none";
		}

	}
	else
	{
		// The post test has ended. Record the data
		if (pgTpl.indexOf("questiontime")==-1) coursewareHandler.fsSetCompletion(coursewareHandler.getScoNum(ScoId),"2");
		setResultsDataString();
	}
	if (document.getElementById("pt_endTest") != null) document.getElementById("pt_endTest").style.display="block";
	cwh.pt_inTest=false;
	cwh.pt_questionIds=new Array;
	cwh.pt_numQuestions=0;
	cwh.pt_currentQuestionNum=0;
	cwh.pt_totalCredit=0;
	cwh.pt_creditArray=new Array;
	cwh.pt_missedTopics="";
	
	if (goDest=="menu" && typeof(ScoId) != "undefined") location.href=rootDir + "/shared/templates/fsmenu.htm?start=" + unitNum + "&lastseq=" + coursewareHandler.getScoNum(ScoId);
}

function setResultsDataString()
{
	cwh=coursewareHandler;

	if (cwh.pt_testId=="NOTSET")
	{
		alert("ERROR: Your scores have not been recorded.");
		return;
	}

	questionPool=pt_questionList[unitNum].split(","); // from the course js
	dataString="track=3&TR_ID=" + cwh.pt_testId + "&TR_STR=";  // test Id is returned by EPTOStart
	var qid="";
	var totalCorrect=0;
	for (i=0;i<cwh.pt_questionIds.length;i++)
	{
		credit=0;
		qid=cwh.pt_questionIds[i].substring(cwh.pt_questionIds[i].indexOf("_") + 1,cwh.pt_questionIds[i].length);
		if (coursewareHandler.pt_creditArray[i]==null) coursewareHandler.pt_creditArray[i]=0;
		credit=cwh.pt_creditArray[i];
		totalCorrect=totalCorrect + credit;
		var sequence=0;
		for (j=0;j<questionPool.length;j++)
		{
			if (questionPool[j].indexOf(qid) > -1)
				sequence = j + 1;
		}
		dataString+=cwh.pt_testCode + "|" + parseInt(i + 1) + "|" + sequence+"_"+qid + "|" + credit + "|1";
		if (i<cwh.pt_questionIds.length-1) dataString+=",";
	}

	dataString+="&TO_MAX=" + cwh.pt_questionIds.length;
	cwh.pt_lastScores[unitNum-1]=totalCorrect;

	// Pass the data string to EPTOFinish here
	cwh.tf_trackingRequest("EPTOFinish", dataString);
}

function exitTestEarly()
{
	// If the user exits the test early
	setResultsDataString()

	cwh.pt_inTest=false;
	cwh.pt_questionIds=new Array;
	cwh.pt_numQuestions=0;
	cwh.pt_currentQuestionNum=0;
	cwh.pt_totalCredit=0;
	cwh.pt_creditArray=new Array;
	cwh.pt_missedTopics="";
}

function writePtText(which)
{
	cwh=coursewareHandler;
	prePassed=cwh.pt_numQuestions==cwh.pt_totalCredit;
	score=0;
	if (cwh.pt_numQuestions!=0) score=parseInt((cwh.pt_totalCredit/cwh.pt_numQuestions)*100);
	cwh.pt_score=score;
	postPassed=(score>cwh.masteryPercent) ? true : false;

	// get the ordinal word for this attempt (first, second, etc.)
	attemptNumArray=resStr.ordinalWords.split(",");
	if (cwh.pt_attempts == null || typeof(cwh.pt_attempts[unitNum-1])=="undefined" || cwh.pt_attempts[unitNum-1]==null || cwh.pt_attempts[unitNum-1]=="") thisAttempt=attemptNumArray[0];
		else if (cwh.pt_attempts[unitNum-1] < 10) thisAttempt=attemptNumArray[cwh.pt_attempts[unitNum-1]];
			else thisAttempt=(cwh.pt_attempts[unitNum-1] - 0 + 1) + "th";

	switch(which)
	{
		case "prestart":
			txt=resStr.preStart1 + " <b>"+ unitTitles[unitNum] + "</b>.<br><br>" + resStr.preStart2 + " <b>" + numQuestions + "</b> " + resStr.preStart3 + "<br><br>" + resStr.preStart4 + "<br><br>" + resStr.preStart5;
			cwh.pt_type="Pre";
			//pgAudio=sharedSoundDirectory + "a_pretest_begin.mp3";
		break;
		case "predone":
			if (prePassed)
			{
				txt=resStr.preDone1 + " <b>"+ unitTitles[unitNum] + "</b>.<br><br>" + resStr.preDonePass;
				//playAudioFile(sharedSoundDirectory + "a_pretest_done_pass.mp3");
			}
			else
			{
				 txt=resStr.preDone1 + " <b>"+ unitTitles[unitNum] + "</b>.<br><br>" + resStr.preDone2;
				//playAudioFile(sharedSoundDirectory + "a_pretest_done_fail.mp3");
			}
		break;
		case "poststart":
			txt=resStr.postStart1 + " <b>"+ unitTitles[unitNum] + "</b>. " + resStr.postAttempt1 + " " + thisAttempt + " " + resStr.postAttempt2 + ".<br><br>" + resStr.postStart2 + " <b>" + numQuestions + "</b> " + resStr.postStart3 + "<br><br>" + resStr.postStart4;
			coursewareHandler.pt_type="Post";
			//playAudioFile(sharedSoundDirectory + "a_posttest_begin.mp3");
		break;
		case "postdone":
			txt=resStr.postDoneCongrats + " <b>"+ unitTitles[unitNum] + "</b>.<br><br>" + resStr.postDoneScore + cwh.pt_totalCredit + resStr.postDoneOutOf + cwh.pt_numQuestions + ".<br><br>";
			if (postPassed)
			{
				txt+=resStr.postDonePass;
				//playAudioFile(sharedSoundDirectory + "a_posttest_done_pass.mp3");
			}
			else
			{
				txt+=resStr.postDoneFail + "<br><br>";
				//playAudioFile(sharedSoundDirectory + "a_posttest_done_failed.mp3");
			}
			txt+=resStr.postDoneNote;
		break;
		case "preprint":
			txt=resStr.prePrint;
		break;
		default:
			txt="";
	}
	document.write(txt);
}

function pt_startTest(testType)
{
// FOR TESTING REMOVE BEFORE RELEASE
//numQuestions=3

	cwh=coursewareHandler;
	if (testType=="Post")
	{
		// Set testCode
		cwh.pt_testCode="2" + crsAcronym.substring(crsAcronym.length-2, crsAcronym.length);
		if (unitNum<10) cwh.pt_testCode += "0" + unitNum + "00";
			else cwh.pt_testCode += unitNum + "00";
	
		if (cwh.pt_attempts == null || typeof(cwh.pt_attempts[unitNum-1])=="undefined" || cwh.pt_attempts[unitNum-1]==null || cwh.pt_attempts[unitNum-1]=="") cwh.pt_attempts[unitNum-1]=1;
			else cwh.pt_attempts[unitNum-1]++;
	
		// Call EPTOStart with this string. We need to get back the TR_ID used to report results.
		startTestString="track=1&USR_ID=" + cwh.pt_userkey + "&AU_ID=" + unitNum + "&PR_ID=" + cwh.acro + "$" + cwh.launchEventKey;
		cwh.tf_trackingRequest("EPTOStart", startTestString, cwh);
		
		// Check to make sure tracking request succeeded
	}
	cwh.pt_testId="NOTSET";
	cwh.pt_type=testType;
	cwh.pt_startPage=currPage;
	cwh.pt_inTest=true;
	cwh.pt_questionIds=new Array;
	cwh.pt_numQuestions=numQuestions;
	cwh.pt_currentQuestionNum=0;
	cwh.pt_totalCredit=0;
	cwh.pt_creditArray=new Array;
	cwh.pt_score=0;
	cwh.pt_questionIds=new Array;
	cwh.pt_questionsAsked=""; // pt_questionIds in string form; set in pt_getQuestions()
	pt_getQuestions() // sets pt_questionIds
	pt_nextQuestion();
}

function pt_loadQuestion()
{
	//if (hasBeenAnswered())	 id="answerFeedback"
}

function pt_nextQuestion()
{
	if (coursewareHandler.pt_currentQuestionNum==coursewareHandler.pt_numQuestions)
	{
		coursewareHandler.goPage(coursewareHandler.pt_startPage)
		return;
	}
	coursewareHandler.pt_currentQuestionNum++;
	qPg=coursewareHandler.pt_questionIds[coursewareHandler.pt_currentQuestionNum-1];
	qPg=qPg.substring(qPg.indexOf("_") + 1,qPg.length) + ".htm";
	coursewareHandler.goPage(qPg);
}

function pt_getQuestions()
{
	qList=pt_questionList[unitNum].split(",");

	if (coursewareHandler.tempStorage=="review") numQuestions=qList.length;

	if (numQuestions>=qList.length)
	{
		numQuestions=qList.length;
		coursewareHandler.pt_numQuestions=numQuestions;
		for (i=0;i<numQuestions;i++)
		{
			coursewareHandler.pt_questionIds[i] = qList[i];
		}
	}

	// 1) find out number of topics with questions
	var topicList=",";
	var numTopics=0;
	for (var i=0; i < qList.length; i++)
	{
		thisTopic=qList[i].substring(0,qList[i].indexOf("_"))
		if (topicList.indexOf("," + thisTopic + ",") == -1) 
		{
			numTopics++;
			topicList= topicList + thisTopic + ",";
		}
	}

	// Randomize the question array and then pick them by topic
	commonRandomizeArray(qList,0);
	commonRandomizeArray(qList,0);
	numChosen=0;
	topicNum=0;
	while (numChosen < numQuestions)
	{
		topicNum++;
		if (topicNum>numTopics) topicNum=1;
		for (q=0;q<qList.length;q++)
		{
			thisTopic=qList[q].substring(0,qList[q].indexOf("_"))
			if (thisTopic==topicNum)
			{
				coursewareHandler.pt_questionIds[numChosen]=qList[q];
				qList[q]="x_y"; // this removes it from the pool
				numChosen++;
				break;
			}
		}
	}
}

// called in templates/scores_tf.htm
function ptGetScoreRows()
{
	cwh=coursewareHandler;
	if (typeof(numberOfUnits) == "undefined")
	{
		alert(resStr.error_lessonTitles);
		return;
	}

	scoreRow=""
	noItemsArray=pt_questionCount.split(","); // from the course js

	for (var i=0;i < numberOfUnits;i++)
	{
		if (cwh.pt_attempts[i]==null || cwh.pt_attempts[i]==0 || cwh.pt_attempts[i]=="")
		{
			noAttempts=0;
			scoreString="&#151";
			noItems=noItemsArray[i]; // from the course js
		}
		else
		{
			noAttempts=cwh.pt_attempts[i];
			noItems=noItemsArray[i]; // from the course js
			if (cwh.pt_lastScores[i]==null) cwh.pt_lastScores[i]=0
			lesScore=cwh.pt_lastScores[i];
			scoreString="<span class=scoreValue>" + lesScore + "</span> " + resStr.postScoresOutOf + " " + noItems;
		}
		scoreRow+="<TR>"
		scoreRow+="<TD ALIGN=LEFT class=scoresTable>";
		scoreRow+= parseInt(i+1) + ". " + unitTitles[i+1] + "</TD>"
		scoreRow+= "<TD ALIGN=CENTER class=scoresTable>" + noAttempts + "</TD>";
		scoreRow+= "<TD ALIGN=CENTER class=scoresTable>" + noItems + "</TD>";
		scoreRow+= "<TD ALIGN=CENTER class=scoresTable>" + scoreString + "</TD>";
		scoreRow+= "</TR>";
	}

	return scoreRow;
}

/********************************** End TF Pre and Post Test *********************************/
/**************** Added for FireFox ******************/
function convertRgbToHex(str)
{
	if (str.indexOf("rgb")==-1) return str;
	str = str.replace(/rgb\(|\)/g, "").split(",");
	str[0] = parseInt(str[0], 10).toString(16).toLowerCase();
	str[1] = parseInt(str[1], 10).toString(16).toLowerCase();
	str[2] = parseInt(str[2], 10).toString(16).toLowerCase();
	str[0] = (str[0].length == 1) ? '0' + str[0] : str[0];
	str[1] = (str[1].length == 1) ? '0' + str[1] : str[1];
	str[2] = (str[2].length == 1) ? '0' + str[2] : str[2];
	return ('#' + str.join(""));
}

// Called from footer js
function writeExitWarningDiv()
{
	noteCode="<table cellspacing=0 cellpadding=5 width=100%><tr>";
	if (isTfCourse) noteCode+="<td align=left valign=top width=65><img src=\"" + sharedImageDir + "tf_reminderonpg2.gif\"></td>";
		else noteCode+="<td align=left valign=top width=65><img src=\"" + sharedImageDir + "reminderonpg2.gif\"></td>";
	noteCode+="<td align=left><div id=exitWarningMessage class=\"cWordsWht\">";
	noteCode += resStr.exitWarning;
	noteCode += "</div></td></tr></table>"

	if (self.innerWidth) winWidth = self.innerWidth;
		else if (self.document.body.offsetWidth) winWidth=self.document.body.offsetWidth;
			else return;

	ewDiv="<div id=ewDiv style=\"z-index:100;width:100px;height:30px;position:absolute;top:0px;left:" + parseInt(winWidth-124) + "px;\"";
	ewDiv+=" onmouseover=\"showEWTextDiv(true);\" onmouseout=\"showEWTextDiv(false)\">&nbsp;</div>";
	ewDiv+="<div id=ewTextDiv style=\"z-index:100;width:200px;height:50px;position:absolute;top:35px;left:" + parseInt(winWidth-400) + "px; display:none;\">";
	ewDiv+="<table class=instructionBox width=360><tr><td>";
	ewDiv+=noteCode;
	ewDiv+="</td></tr></table></div></div>"
	document.write(ewDiv);
}

function showEWTextDiv(show)
{
	obj=document.getElementById("ewTextDiv");
	if (show)
	{
		obj.style.display="block";
	}
	else
	{
		obj.style.display="none";
	}
}
/********************************************************/
if (!textNoFrame) init();

if (useJsDat) document.write("<SCRIPT Language=\"Javascript\" SRC=\"" + rootDir + "/shared/js/submit_question.js\"></S" + "CRIPT>");

