
// *** shorthand
// !!COMM!!
icon_clear = "<img src='../interface/spacer_clear.gif' width='20' height='20' alt='' border='0'>";
icon_folderopen = "<img src='../interface/mm_module.gif' width='20' height='20' alt='' border='0'>";
icon_folderclosed = "<img src='../interface/mm_undone.gif' width='20' height='20' alt='' border='0'>";
icon_folderfinished = "<img src='../interface/mm_finished.gif' width='20' height='20' alt='' border='0'>";

// !!COMM!!
jumpmenu_type = 3;

// LMS communication,0=none, 1=AICC, 2=SCORM, 3=ExportLive, 4=Cookie
var LMS = 4;

// ********************************************* FRAMESETS


function BuildMainFrameset(doc)
{
	doc.writeln("<FRAMESET border=0 frameBorder=NO frameSpacing=0 rows=\"0,*\" onload=\"focus();LaunchFirst();\" onunload=\"if(LMS==2){SaveSCORMData()};if(LMS==4){SaveCookieData()};\" >");
	doc.writeln("<frame src=\"course_head.htm\" name=\"course_head\" frameBorder=NO marginHeight=0 marginWidth=0 scrolling=no>");
	doc.writeln("<frame src=\"../screens/screen_blank.htm\" name=\"course_body\" frameBorder=NO marginHeight=0 marginWidth=0>");
	doc.writeln("</FRAMESET><noframes>This Course Needs Frames to Run.</noframes>");
}

function BuildLessonFrameset(doc)
{
	doc.writeln("<FRAMESET border=0 frameBorder=NO frameSpacing=0 rows='*,0' onload='ttlms_connect.ShowScreen();focus();'>");
	doc.writeln("<FRAME frameBorder='NO' marginHeight=0 marginWidth=0 name='lesson_content' src='../screens/screen_blank.htm'>");
	doc.writeln("<FRAME frameBorder='NO' marginHeight=0 marginWidth=0 name='lesson_foot' scrolling='no' src='lesson_foot.htm'>");
	doc.writeln("</FRAMESET><noframes>This Course Needs Frames to Run.</noframes>");
}

function BuildTestFrameset(doc)
{
	doc.writeln("<FRAMESET border=0 frameBorder=NO frameSpacing=0 rows='*,0' onload='ttlms_connect.ShowScreen();focus();'>");
	doc.writeln("<FRAME frameBorder='NO' marginHeight=0 marginWidth=0 name='test_content' src='test_question.htm'>");
	doc.writeln("<FRAME frameBorder='NO' marginHeight=0 marginWidth=0 name='test_foot' scrolling='no' src='test_foot.htm'>");
	doc.writeln("</FRAMESET><noframes>This Course Needs Frames to Run.</noframes>");
}

function BuildMenu(doc)
{
	// Clear location
	location_order=0;
	location_screen=0;

	//header
	//BuildScreenTop(doc);

	// Build Menu
	
	//doc.write("<p align='right'><form><input type='Button' class='ibutton' value='Reset' onclick='if(confirm(\"Are you sure you want to reset your status?\")){ttlms_connect.ResetData();self.location.reload();};'></form></p>");	
	var modc = ttlms_connect.course_array.length-1;
	var t = "";

	var break1=0;
	var break2=0;
	
	var menu_cols=1.0;
	if(modc > 2)
	{
		break1=Math.floor((modc+(menu_cols-1))/menu_cols)+1;
		break2=Math.floor(((modc+(menu_cols-1))*2)/menu_cols);
	}
	
	doc.write("<div id='menushell'>");

	doc.write("<div id=\"banner\" title=\"stopfakes.gov logo\">");
	doc.write("<div id=\"title\">" + "&nbsp;" + "</div>");
	doc.write("</div>");

	doc.write("<div id='top'>");

	doc.write("<div id=\"menutitle\">" + course_name + "</div>");
	doc.write("</div>");

	doc.write("<div id='bar'>");
	doc.write("<div id='btn'>");
	//doc.write("<a href=\"javascript:ttlms_connect.LaunchMenu();\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('mm','','../interface/main1.gif',1)\"><img src=\"../interface/main.gif\" alt=\"Main Menu\" name=\"mm\" width=\"40\" height=\"30\" border=\"0\" id=\"mm\" /></a>");
	doc.write("<a href=\"javascript:winGlossaryObj=window.open('../library/htms/glossary.htm','glossary','scrollbars=yes,toolbar=yes,resizable=yes,width=640,height=480');winGlossaryObj.focus();\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('gl','','../interface/glos1.gif',1)\"><img src=\"../interface/glos.gif\" alt=\"Glossary\" name=\"gl\" width=\"60\" height=\"30\" border=\"0\" id=\"gl\" /></a>");
	doc.write("<a href=\"javascript:winResourseObj=window.open('../library/htms/resources1.htm','resources','scrollbars=yes,resizable=yes,width=940,height=480');winResourseObj.focus();\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('re','','../interface/reso1.gif',1)\"><img src=\"../interface/reso.gif\" alt=\"Resources\" name=\"re\" width=\"92\" height=\"30\" border=\"0\" id=\"re\" /></a>");
	doc.write("<a href=\"javascript:winHelpObj=window.open('../library/htms/howtouse.htm','resources','scrollbars=yes,resizable=yes,width=940,height=480');winHelpObj.focus();;\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('help','','../interface/help1.gif',1)\"><img src=\"../interface/help.gif\" alt=\"Help\" name=\"help\" width=\"40\" height=\"30\" border=\"0\" id=\"help\" /></a>");
	doc.write("<a href=\"javascript:ttlms_connect.UniversalExit();\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('exit','','../interface/exit1.gif',1)\"><img src=\"../interface/exit.gif\" alt=\"Exit\" name=\"exit\" width=\"40\" height=\"30\" border=\"0\" id=\"exit\" /></a>");
	doc.write("</div>");
	doc.write("</div>");
	
	doc.write("<div id='menucontent'>");
	doc.write("<div id='menudata'>");
	//doc.write("<ul>");

	if(modc>0)
	for(c1=1;c1<=modc;c1=c1+1)
	{
		if(isString(ttlms_connect.course_array[c1]))
		{
			t = ttlms_connect.course_array[c1];
			t = t.split(";");
			lesc = 0;
			doc.write("<DIV id=mod><UL>");
			if(course_progress[t[0]]==100)
				doc.write("<li class='complete'>");
			else
				doc.write("<li>");
			doc.write("<a href='javascript:ttlms_connect.LaunchLesson(" + t[0] + ",1);'>" + t[1]  + "</a>");
			doc.write("</li>");
			doc.write("</UL></DIV>");
		}
		else
		{
			t = ttlms_connect.course_array[c1][0];
			t = t.split(";");
			lesc = ttlms_connect.course_array[c1].length-1;
			doc.write("<DIV id=mod>");
			doc.write(t[1]);
			doc.write("</DIV>");
		}
		if(lesc>0)
		{
			doc.write("<DIV id=les><UL>");
			for(c2=1;c2<=lesc;c2=c2+1)
			{
				if(isString(ttlms_connect.course_array[c1][c2]))
				{
					t = ttlms_connect.course_array[c1][c2];
					t = t.split(";");
					chc = 0;
					if(course_progress[t[0]]==100)
						doc.write("<li class='complete'>");
					else
						doc.write("<li>");
					doc.write("<a href='javascript:ttlms_connect.LaunchLesson(" + t[0] + ",1);'>" + t[1] + "</a>");
					doc.write("</li>");
				}
				else
				{
					t = ttlms_connect.course_array[c1][c2][0];
					t = t.split(";");
					chc = ttlms_connect.course_array[c1][c2].length-1;
					doc.write("<DIV id=mod>");
					doc.write(t[1]);
					doc.write("</DIV>");
				}
				if(chc>0)
				{
					for(c3=1;c3<=chc;c3=c3+1)
					{
						if(course_progress[t[0]]==100)
							doc.write("<li class='complete'>");
						else
							doc.write("<li>");
						t = ttlms_connect.course_array[c1][c2][c3];
						t = t.split(";");
						doc.write("<a href='javascript:ttlms_connect.LaunchLesson(" + t[0] + ",1);'>" + t[1] + "</a>");
						doc.write("</li>");
					}
				}
			}
			doc.write("</UL></DIV>");
		}
	}

	//doc.write("</ul>");

	if(ttlms_connect.course_tests[0]>0)
	{
		doc.write("<DIV id=mod>Mastery Test</DIV>");
		doc.write("<DIV id=les><UL><li ");
		if(GetScore(0)>0)
			doc.write(" class='complete'");
		doc.write(">");
		doc.write("<a href='javascript:ttlms_connect.LaunchTest(0);' class='hilite'><b>Mastery Test</b></a>");
		//doc.write(" " + GetScore(0));
		doc.write("</li>");
		doc.write("</ul></DIV>");
	}
	
	if(course_discussion==1)
	{
	 doc.write("<p><b>Discussions:</b><a href=\"JavaScript:ttlms_connect.DoTopicOutside();\">Check for Topics</a></p>");
	}

	doc.write("</div>");
	doc.write("<DIV id=\"menutext\">The average time to complete this course is 1.5 hours. You may complete the course more quickly or more slowly depending on your experience and individual learning style.</DIV>");
	doc.write("<DIV id=\"menutext\">For a PDF version of this course, <a href='../media/525/IRP-text-only.pdf' target='_blank'>click here</a>.</DIV>");
	doc.write("</div>");
	doc.write("<br clear='all'>");

	doc.write("<div id=\"footer_links\">");
	doc.write("<a href=\"http://stopfakes.gov\" target=\"newWin\">Home</a>  |  <a href=\"http://www.export.gov/about/exp_000875.asp\" target=\"newWin\">Privacy Policy</a>  |  <a href=\"http://www.export.gov/about/exp_001369.asp\" target=\"newWin\">Disclaimer</a>  |  <a href=\"http://www.usa.gov/\" target=\"newWin\">USA.gov</a>  |  <a href=\"http://stopfakes.gov/contactus.asp\" target=\"newWin\">Contact Us</a> | <a href=\"http://www.adobe.com/products/acrobat/readstep2.html\" target=\"newWin\">Download Acrobat Reader</a></div>");
	doc.write("</div>");

	//doc.write("<div id=\"menufoot\">&nbsp;</div>");
	doc.write("</div>");

	
	//BuildScreenBottom(doc);

}



// *** Screen related


function BuildScreenLocation(doc)
{

	if(location_order>0 && location_screen>0)
	{
		// Find location in course
		var f1=0;
		var f2=0;
		var f3=0;
		var f1_name="";
		var f2_name="";
		var f3_name="";
		var u = ttlms_connect.course_array.length-1;
	
		if(u>0)
		{
			for(c1=1;c1<=u;c1=c1+1)
			{
				if(!isArray(ttlms_connect.course_array[c1]))
					t = ttlms_connect.course_array[c1];
				else
					t = ttlms_connect.course_array[c1][0];
				t = t.split(";");
				if(t[0]<=location_order)
				{
					f1=c1;
					f1_name=t[1];
				}
			}
			if(isArray(ttlms_connect.course_array[f1]))
			{
				u = ttlms_connect.course_array[f1].length-1;
				for(c2=1;c2<=u;c2=c2+1)
				{
					if(!isArray(ttlms_connect.course_array[f1][c2]))
						t = ttlms_connect.course_array[f1][c2];
					else
						t = ttlms_connect.course_array[f1][c2][0];
					t = t.split(";");
					if(t[0]<=location_order)
					{
						f2=c2;
						f2_name=t[1];
					}
				}
				if(isArray(ttlms_connect.course_array[f1][f2]))
				{
					u = ttlms_connect.course_array[f1][f2].length-1;
					for(c3=1;c3<=u;c3=c3+1)
					{
						t = ttlms_connect.course_array[f1][f2][c3];
						t = t.split(";");
						if(t[0]==location_order)
						{
							f3=c3;
							f3_name=t[1];
						}
					}
				}
			}

		
			switch(jumpmenu_type)
			{
				case 0:
				{	// NO location
					break;
				}
				case 1:
				{	// old location menu
					doc.write("<TABLE class='loc' cellPadding=3 cellSpacing=0 height=40 width='100%'>");
					doc.write("<tr><!-- Show Module -->");
					doc.write("<th class='loc' width='*' align='left' nowrap>");
					doc.write("<img src='../interface/module.gif' width='44' height='10' alt='' border='0'>");
					doc.write("</th>");
					if(f2>0)
					{
						doc.write("<th class='loc' width='*' align='left' nowrap><!-- Show Lesson -->");
						doc.write("<img src='../interface/lesson.gif' width='44' height='10' alt='' border='0'>");
						doc.write("</th>");
					}
					if(f3>0)
					{
						doc.write("<th class='loc' width='*' align='left' nowrap><!-- Show Chapter -->");
						doc.write("<img src='../interface/chapter.gif' width='52' height='10' alt='' border='0'>");
						doc.write("</th>");
					}
					doc.write("<th class='loc' width='*' align='right' nowrap>");
					doc.write("<img src='../interface/screen.gif' width='44' height='10' alt='' border='0'>");
					doc.write(grx_nums(location_screen,'../interface'));
					doc.write("<img src='../interface/of.gif' width='19' height='10' alt='' border='0'>");
					doc.write(grx_nums(screens_array[location_order].length,'../interface'));
					doc.write("</th>");
					doc.write("</tr>");
				
					doc.write("<tr><!-- Show Module -->");
					doc.write("<th class='loc' width='*' align='left' nowrap>");
				
					doc.write("<FORM target='_top' action='#' method='get' name='parent2_jump'>");
					doc.write("<SELECT name='L_ID' onchange='ttlms_connect.LaunchLesson(options[selectedIndex].value,1);' class='iloc'>");
					var u = ttlms_connect.course_array.length-1;
					if(u>0)
					{
						for(c1=1;c1<=u;c1=c1+1)
						{
							if(!isArray(ttlms_connect.course_array[c1]))
								t = ttlms_connect.course_array[c1];
							else
								t = ttlms_connect.course_array[c1][0];
							t = t.split(";");
							doc.write("<OPTION value='" + t[0] + "' " + ((f1==c1)?"selected":"") + ">" + t[1] + "</OPTION>");
						}
					}
					doc.write("</SELECT>");
					doc.write("</th>");
					if(f2>0)
					{
						doc.write("<th class='loc' width='*' align='left' nowrap><!-- Show Lesson -->");
						doc.write("<SELECT name='L_ID' onchange='ttlms_connect.LaunchLesson(options[selectedIndex].value,1);' class='iloc'>");
						var u = ttlms_connect.course_array[f1].length-1;
						if(u>0)
						{
							for(c2=1;c2<=u;c2=c2+1)
							{
								if(!isArray(ttlms_connect.course_array[f1][c2]))
									t = ttlms_connect.course_array[f1][c2];
								else
									t = ttlms_connect.course_array[f1][c2][0];
								t = t.split(";");
								doc.write("<OPTION value='" + t[0] + "' " + ((f2==c2)?"selected":"") + ">" + t[1] + "</OPTION>");
							}
						}
						doc.write("</SELECT>");
						doc.write("</th>");
					}
					if(f3>0)
					{
						doc.write("<th class='loc' width='*' align='left' nowrap><!-- Show Chapter -->");
						doc.write("<SELECT name='L_ID' onchange='ttlms_connect.LaunchLesson(options[selectedIndex].value,1);' class='iloc'>");
						var u = ttlms_connect.course_array[f1][f2].length-1;
						if(u>0)
						{
							for(c3=1;c3<=u;c3=c3+1)
							{
								t = ttlms_connect.course_array[f1][f2][c3];
								t = t.split(";");
								doc.write("<OPTION value='" + t[0] + "' " + ((f3==c3)?"selected":"") + ">" + t[1] + "</OPTION>");
							}
						}
						doc.write("</SELECT>");
						doc.write("</th>");
					}
					doc.write("<th class='loc' width='*' align='right' nowrap>");
					doc.write("<SELECT name='L_ID' onchange='ttlms_connect.LaunchLesson(0,options[selectedIndex].value);' class='iloc'>");
					var s = ttlms_connect.screens_array[location_order].length;
					if(s>0)
					{
						for(c=0;c<s;c=c+1)
						{
							tn = ttlms_connect.screens_array[location_order][c];
							t = ttlms_connect.screens_titles[tn];
							doc.write("<OPTION value='" + (c+1) + "' " + ((location_screen==(c+1))?"selected":"") + ">" + t + "</OPTION>");
						}
					}
					doc.write("</SELECT>");
					doc.write("</th>");
					doc.write("</tr>");
					doc.write("</table>");
					break;
				}
				case 2:
				{	// DHTML locator menu
					doc.write("<div id=\"module\">");
					doc.write("<ul id=\"sfnav\">");
					doc.write("<li>");
					doc.write("<a href=\"javascript:ttlms_connect.LaunchMenu();\" onmouseout=\"MM_swapImgRestore()\" onmouseover=\"MM_swapImage('b_main','','../interface/b_main1.gif',1)\"><img src=\"../interface/b_main.gif\" alt=\"Main Menu\" name=\"b_main\" width=\"72\" height=\"24\" border=\"0\" id=\"b_main\" /></a>");
					doc.write("</li>");
					doc.write("<ul style='z-index: 1;'>");
					var u = ttlms_connect.course_array.length-1;
					if(u>0)
					{
						for(c1=1;c1<=u;c1=c1+1)
						{
							var hasChild=1;
							if(!isArray(ttlms_connect.course_array[c1]))
							{
								t = ttlms_connect.course_array[c1];
								hasChild=0;
							}
							else
							{
								t = ttlms_connect.course_array[c1][0];
								hasChild=1;
							}
							t = t.split(";");
							
							doc.write("<li><a href=\"javascript:ttlms_connect.LaunchLesson(" + t[0] + ",1)\"");
							if(hasChild==1)
								doc.write(" class=\"subarrow\"");
							else
								if(course_progress[t[0]]==100)
									doc.write(" class=\"complete\"");
								else
									doc.write(" class=\"incomplete\"");
							doc.write(">");
							doc.write(t[1]);
							doc.write("</a></li>");
							
							if(hasChild==1)
							{
								doc.write("<ul style='z-index: 2;'>");
								var u2 = ttlms_connect.course_array[c1].length-1;
								if(u2>0)
								{
									for(c2=1;c2<=u2;c2=c2+1)
									{
										var hasChild2=1;
										if(!isArray(ttlms_connect.course_array[c1][c2]))
										{
											t = ttlms_connect.course_array[c1][c2];
											hasChild2=0;
										}
										else
										{
											t = ttlms_connect.course_array[c1][c2][0];
											hasChild2=1;
										}
										t = t.split(";");
										doc.write("<li><a href=\"javascript:ttlms_connect.LaunchLesson(" + t[0] + ",1)\"");
										if(hasChild2==1)
											doc.write(" class=\"subarrow\"");
										else
											if(course_progress[t[0]]==100)
												doc.write(" class=\"complete\"");
											else
												doc.write(" class=\"incomplete\"");
										doc.write(">");
										doc.write(t[1]);
										doc.write("</a></li>");
										if(hasChild2==1)
										{
											doc.write("<ul style='z-index: 3;'>");
											var u3 = ttlms_connect.course_array[c1][c2].length-1;
											if(u3>0)
											{
												for(c3=1;c3<=u3;c3=c3+1)
												{
													t = ttlms_connect.course_array[f1][f2][c3];
													t = t.split(";");
													doc.write("<li><a href=\"javascript:ttlms_connect.LaunchLesson(" + t[0] + ",1)\"");
													if(course_progress[t[0]]==100)
														doc.write(" class=\"complete\"");
													else
														doc.write(" class=\"incomplete\"");
													doc.write(">");
													doc.write(t[1]);
													doc.write("</a></li>");
												}
											}
											doc.write("</ul>");
										}
									}
								}
								doc.write("</ul>");
							}
						}
					}
					doc.write("</ul>");
					doc.write("</ul>");
				
					doc.write("<h1 align=\"right\">");
					doc.write(f1_name);
					if(f2_name!="")
					{
						doc.write(": ");
						doc.write(f2_name);
					}
					if(f3_name!="")
					{
						doc.write(": ");
						doc.write(f3_name);
					}
					doc.write("</h1>");
					doc.write("</div>");
					break;
				}		
				case 3:
				{	// New location pulldowns
					/* !!FAA!! !!COMM!!
					doc.write("<TABLE class='loc' cellPadding=3 cellSpacing=0 height=40 width='100%'>");
				
					doc.write("<tr><!-- Show Module -->");
					doc.write("<th class='loc' width='*' align='left' nowrap>");
					
					doc.write("<p align=\"left\">");
					doc.write(f1_name);
					if(f2_name!="")
					{
						doc.write(": ");
						doc.write(f2_name);
					}
					if(f3_name!="")
					{
						doc.write(": ");
						doc.write(f3_name);
					}
					doc.write("</p>");

					doc.write("</th>");

					doc.write("<th class='loc' width='*' align='right' nowrap>");
					*/
					//doc.write("<img src='../interface/screen.gif' width='44' height='10' alt='' border='0'>");

					//doc.write(grx_nums(location_screen,'../interface'));
					//doc.write("<img src='../interface/of.gif' width='19' height='10' alt='' border='0'>");
					//doc.write(grx_nums(screens_array[location_order].length,'../interface'));

					doc.write("<SELECT name='L_ID' onchange='if(options[selectedIndex].value!=0){ttlms_connect.LaunchLesson(options[selectedIndex].value,1);}' class='iloc'>");
					doc.write("<option value='0' selected>Menu Jump...</option>");
					var u = ttlms_connect.course_array.length-1;
					if(u>0)
					{
						for(c1=1;c1<=u;c1=c1+1)
						{
							var hasChild=1;
							if(!isArray(ttlms_connect.course_array[c1]))
							{
								t = ttlms_connect.course_array[c1];
								hasChild=0;
							}
							else
							{
								t = ttlms_connect.course_array[c1][0];
								hasChild=1;
							}
							t = t.split(";");
							
							doc.write("<option value=\"");
							doc.write(t[0]);
							doc.write("\" ");
							doc.write("class=\"");
							if(hasChild==1)
									doc.write("parent");
							else
								if(t[0]==location_order)
										doc.write("current");
								else
									if(course_progress[t[0]]==100)
										doc.write("complete");
									else
										doc.write("incomplete");
							doc.write("\">");
							doc.write(t[1]);
							doc.write("</option>");
							
							if(hasChild==1)
							{
								doc.write("<ul style='z-index: 2;'>");
								var u2 = ttlms_connect.course_array[c1].length-1;
								if(u2>0)
								{
									for(c2=1;c2<=u2;c2=c2+1)
									{
										var hasChild2=1;
										if(!isArray(ttlms_connect.course_array[c1][c2]))
										{
											t = ttlms_connect.course_array[c1][c2];
											hasChild2=0;
										}
										else
										{
											t = ttlms_connect.course_array[c1][c2][0];
											hasChild2=1;
										}
										t = t.split(";");

										doc.write("<option value=\"");
										doc.write(t[0]);
										doc.write("\" ");
										doc.write("class=\"");
										if(hasChild2==1)
												doc.write("parent");
										else
											if(t[0]==location_order)
													doc.write("current");
											else
												if(course_progress[t[0]]==100)
													doc.write("complete");
												else
													doc.write("incomplete");
										doc.write("\">-&gt;");
										doc.write(t[1]);
										doc.write("</option>");

										
										if(hasChild2==1)
										{
											doc.write("<ul style='z-index: 3;'>");
											var u3 = ttlms_connect.course_array[c1][c2].length-1;
											if(u3>0)
											{
												for(c3=1;c3<=u3;c3=c3+1)
												{
													t = ttlms_connect.course_array[f1][f2][c3];
													t = t.split(";");
													doc.write("<option value=\"");
													doc.write(t[0]);
													doc.write("\" ");
													doc.write("class=\"");
													if(t[0]==location_order)
															doc.write("current");
													else
													{
														if(course_progress[t[0]]==100)
															doc.write("complete");
														else
															doc.write("incomplete");
													}
													doc.write("\">-=&gt;");
													doc.write(t[1]);
													doc.write("</option>");

												}
											}
										}
									}
								}
							}
						}
					}
					
					doc.write("</SELECT>");
					/* !!FAA!!
					doc.write("</th>");
					doc.write("</tr>");
					doc.write("</table>");
					*/
					break;
				}
			}
		}
	}
}


function BuildScreenTop(doc)
{
	//ttlms_connect.BuildScreenLocation(doc);
	//doc.write("<table border=0 width='100%' height='100%' cellpadding='8' cellspacing='0' class='full'><tr><td valign='top' class='tip'>");

	var theL = "Main Menu";
	
	if(location_order>0 && location_screen>0)
	{
		// Find location in course
		var f1=0;
		var f2=0;
		var f3=0;
		var f1_name="";
		var f2_name="";
		var f3_name="";
		var u = ttlms_connect.course_array.length-1;
	
		if(u>0)
		{
			for(c1=1;c1<=u;c1=c1+1)
			{
				if(!isArray(ttlms_connect.course_array[c1]))
					t = ttlms_connect.course_array[c1];
				else
					t = ttlms_connect.course_array[c1][0];
				t = t.split(";");
				if(t[0]<=location_order)
				{
					f1=c1;
					f1_name=t[1];
				}
			}
			if(isArray(ttlms_connect.course_array[f1]))
			{
				u = ttlms_connect.course_array[f1].length-1;
				for(c2=1;c2<=u;c2=c2+1)
				{
					if(!isArray(ttlms_connect.course_array[f1][c2]))
						t = ttlms_connect.course_array[f1][c2];
					else
						t = ttlms_connect.course_array[f1][c2][0];
					t = t.split(";");
					if(t[0]<=location_order)
					{
						f2=c2;
						f2_name=t[1];
					}
				}
				if(isArray(ttlms_connect.course_array[f1][f2]))
				{
					u = ttlms_connect.course_array[f1][f2].length-1;
					for(c3=1;c3<=u;c3=c3+1)
					{
						t = ttlms_connect.course_array[f1][f2][c3];
						t = t.split(";");
						if(t[0]==location_order)
						{
							f3=c3;
							f3_name=t[1];
						}
					}
				}
			}
		}
		theL = "";
		theL = f2_name;
		if(f3_name!="")
		{
			theL = theL + ": ";
			theL = theL + f3_name;
		}
	}
	
	doc.write("<div id=\"shell\">");

	doc.write("<div id=\"banner\" title=\"stopfakes.gov logo\">");
	doc.write("<div id=\"title\">" + course_name + "</div>");
	doc.write("</div>");

	doc.write("<div id=\"top\">");

	doc.write("<a href=\"#skip\"><img src=\"../interface/spacer_clear.gif\" width=\"1\" height=\"1\" alt=\"Skip Navigation\" border=\"0\"></a>");

	//doc.write("<div id=\"title\">" + course_name + "</div>");
	doc.write("<div id=\"modtitle\">" + f1_name + "</div>");
  doc.write("<div id=\"lessontitle\">" + theL + "</div>");
	
	doc.write("</div>");
	doc.write("<div id=\"bar\">");
	if(location_order>0 && location_screen>0)
	{
  doc.write("<div id=\"btn\">");
	doc.write("<a href=\"javascript:ttlms_connect.LaunchMenu();\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('mm','','../interface/main1.gif',1)\"><img src=\"../interface/main.gif\" alt=\"Main Menu\" name=\"mm\" width=\"40\" height=\"30\" border=\"0\" id=\"mm\" /></a>");
	doc.write("<a href=\"javascript:winGlossaryObj=window.open('../library/htms/glossary.htm','glossary','scrollbars=yes,toolbar=yes,resizable=yes,width=640,height=480');winGlossaryObj.focus();\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('gl','','../interface/glos1.gif',1)\"><img src=\"../interface/glos.gif\" alt=\"Glossary\" name=\"gl\" width=\"60\" height=\"30\" border=\"0\" id=\"gl\" /></a>");
	doc.write("<a href=\"javascript:winResourseObj=window.open('../library/htms/resources1.htm','resources','scrollbars=yes,resizable=yes,width=940,height=480');winResourseObj.focus();\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('re','','../interface/reso1.gif',1)\"><img src=\"../interface/reso.gif\" alt=\"Resources\" name=\"re\" width=\"92\" height=\"30\" border=\"0\" id=\"re\" /></a>");
	doc.write("<a href=\"javascript:winHelpObj=window.open('../library/htms/howtouse.htm','resources','scrollbars=yes,resizable=yes,width=940,height=480');winHelpObj.focus();;\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('help','','../interface/help1.gif',1)\"><img src=\"../interface/help.gif\" alt=\"Help\" name=\"help\" width=\"40\" height=\"30\" border=\"0\" id=\"help\" /></a>");
	doc.write("<a href=\"javascript:ttlms_connect.UniversalExit();\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('exit','','../interface/exit1.gif',1)\"><img src=\"../interface/exit.gif\" alt=\"Exit\" name=\"exit\" width=\"40\" height=\"30\" border=\"0\" id=\"exit\" /></a>");
	doc.write("</div>");
	}
	doc.write("<div id=\"dropmenu\">");
	if(location_order>0 && location_screen>0)
		BuildScreenLocation(doc);
	else
		doc.write("&nbsp;");
	doc.write("</div>");
	doc.write("</div>");
	doc.write("<div id=\"content\">");
	doc.write("<div id=\"screentitle\">");
	if(location_order>0 && location_screen>0)
		doc.write("<div id=\"topnav\"><a href=\"javascript:ttlms_connect.ScreenBack();\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('prev','','../interface/prev1.gif',1)\"><img src=\"../interface/prev.gif\" alt=\"Previous\" name=\"prev\" width=\"46\" height=\"46\" border=\"0\" id=\"prev\" /></a><a href=\"javascript:ttlms_connect.ScreenNext();\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('next','','../interface/next1.gif',1)\"><img src=\"../interface/next.gif\" alt=\"Next\" name=\"next\" width=\"46\" height=\"46\" border=\"0\" id=\"next\" /></a></div>");
	if(location_order>0 && location_screen>0)
		doc.write("<h1>"+ ttlms_connect.screens_titles[ttlms_connect.S_ID] +"</h1>");
	doc.write("</div>");
	doc.write("<div id=\"contentbox\">");
	
	doc.write("<a name=\"skip\" id=\"skip\"></a>");

	doc.write("<div class=\"prop\"></div>");
}

function BuildScreenBottom(doc)
{
	//	doc.write("</td></tr></table></body></form>");
	doc.write("<br clear='all'>");
	doc.write("</div>");
	doc.write("<div id=\"footer\">");
	BuildAudioButton(doc);
	if(location_order>0 && location_screen>0)
		doc.write("<div id=\"botnav\"><a href=\"javascript:ttlms_connect.ScreenBack();\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('prev1','','../interface/prev1.gif',1)\"><img src=\"../interface/prev.gif\" alt=\"Previous\" name=\"prev1\" width=\"46\" height=\"46\" border=\"0\" id=\"prev1\" /></a><a href=\"javascript:ttlms_connect.ScreenNext();\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('next1','','../interface/next1.gif',1)\"><img src=\"../interface/next.gif\" alt=\"Next\" name=\"next1\" width=\"46\" height=\"46\" border=\"0\" id=\"next1\" /></a></div>");
	if(location_order>0 && location_screen>0)
		doc.write("<p align=\"center\">Screen " + ttlms_connect.location_screen + " of " + ttlms_connect.screens_array[ttlms_connect.location_order].length + "</p>");
	else
		doc.write("&nbsp;");
	doc.write("</div>");

	doc.write("<div id=\"footer_links\">");
	doc.write("<a href=\"http://stopfakes.gov\" target=\"newWin\">Home</a>  |  <a href=\"http://www.export.gov/about/exp_000875.asp\" target=\"newWin\">Privacy Policy</a>  |  <a href=\"http://www.export.gov/about/exp_001369.asp\" target=\"newWin\">Disclaimer</a>  |  <a href=\"http://www.usa.gov/\" target=\"newWin\">USA.gov</a>  |  <a href=\"http://stopfakes.gov/contactus.asp\" target=\"newWin\">Contact Us</a> | <a href=\"http://www.adobe.com/products/acrobat/readstep2.html\" target=\"newWin\">Download Acrobat Reader</a></div>");
	doc.write("</div>");

	doc.write("</div>");
  doc.write("</div>");
	doc.write("</div>");
	
}

function BuildScreenPopupTop(doc)
{
	doc.write("<div id=\"popup\">");
}

function BuildScreenPopupBottom(doc)
{
	doc.write("<br clear=\"all\"></div><div id=\"popupfooter\"><a href=\"javascript:window.close();\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('closewin1','','../interface/clos1.gif',1)\"><img src=\"../interface/clos.gif\" alt=\"Close Window\" name=\"closewin1\" width=\"88\" height=\"27\" border=\"0\" align=\"right\" id=\"closewin1\"></a></div>");
}





function BuildAudioButton(doc)
{
	if((ttlms_connect.audio_script == 1) && (location_order>0 && location_screen>0))
	{
		if(screens_audio_script[S_ID] != "")
				doc.write("<div id=\"audscr\"><a href=\"javascript:ttlms_connect.DoAudioScript();\" onmouseout=\"MM_swapImgRestore()\" onmouseover=\"MM_swapImage('audscr1','','../interface/script1.gif',1)\"><img src=\"../interface/script.gif\" alt=\"Audio Script\" name=\"audscr1\" width=\"86\" height=\"28\" border=\"0\" id=\"audscr1\" /></a></div>");
			else
				doc.write("<div id=\"audscr\"><img src=\"../interface/script_dim.gif\" alt=\"Audio Script\" name=\"audscr1\" width=\"86\" height=\"28\" border=\"0\" id=\"audscr1\" /></div>");
	}
}




function 		ShowTestQuestion(doc)
{

	doc.write("<div id=\"shell\">");
	doc.write("<div id=\"top\">");

	doc.write("<a href=\"#skip\"><img src=\"../interface/spacer_clear.gif\" width=\"1\" height=\"1\" alt=\"Skip Navigation\" border=\"0\"></a>");

	doc.write("<div id=\"title\">" + course_name + "</div>");
	doc.write("<div id=\"modtitle\">" + "Mastery Test" + "</div>");
  //doc.write("<div id=\"lessontitle\">" + theL + "</div>");
	
	doc.write("</div>");
	doc.write("<div id=\"bar\">");

  doc.write("<div id=\"btn\">");
	doc.write("<a href=\"javascript:ttlms_connect.LaunchMenu();\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('mm','','../interface/main1.gif',1)\"><img src=\"../interface/main.gif\" alt=\"Main Menu\" name=\"mm\" width=\"40\" height=\"30\" border=\"0\" id=\"mm\" /></a>");
//	doc.write("<a href=\"javascript:winGlossaryObj=window.open('../library/htms/glossary.htm','glossary','scrollbars=yes,toolbar=yes,resizable=yes,width=640,height=480');winGlossaryObj.focus();\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('gl','','../interface/glos1.gif',1)\"><img src=\"../interface/glos.gif\" alt=\"Glossary\" name=\"gl\" width=\"60\" height=\"30\" border=\"0\" id=\"gl\" /></a>");
//	doc.write("<a href=\"javascript:winResourseObj=window.open('../library/htms/resources1.htm','resources','scrollbars=yes,resizable=yes,width=940,height=480');winResourseObj.focus();\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('re','','../interface/reso1.gif',1)\"><img src=\"../interface/reso.gif\" alt=\"Resources\" name=\"re\" width=\"92\" height=\"30\" border=\"0\" id=\"re\" /></a>");
//	doc.write("<a href=\"javascript:ttlms_connect.UniversalExit();\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('help','','../interface/help1.gif',1)\"><img src=\"../interface/help.gif\" alt=\"Help\" name=\"help\" width=\"40\" height=\"30\" border=\"0\" id=\"help\" /></a>");
	doc.write("<a href=\"javascript:ttlms_connect.UniversalExit();\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('exit','','../interface/exit1.gif',1)\"><img src=\"../interface/exit.gif\" alt=\"Exit\" name=\"exit\" width=\"40\" height=\"30\" border=\"0\" id=\"exit\" /></a>");
	doc.write("</div>");
//	doc.write("<div id=\"dropmenu\">");
//	if(location_order>0 && location_screen>0)
//		BuildScreenLocation(doc);
//	else
//		doc.write("&nbsp;");
//	doc.write("</div>");
	doc.write("</div>");
	doc.write("<div id=\"content\">");
	
/*	doc.write("<div id=\"screentitle\">");
	if(location_order>0 && location_screen>0)
		doc.write("<div id=\"topnav\"><a href=\"javascript:ttlms_connect.ScreenBack();\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('prev','','../interface/prev1.gif',1)\"><img src=\"../interface/prev.gif\" alt=\"Previous\" name=\"prev\" width=\"46\" height=\"46\" border=\"0\" id=\"prev\" /></a><a href=\"javascript:ttlms_connect.ScreenNext();\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('next','','../interface/next1.gif',1)\"><img src=\"../interface/next.gif\" alt=\"Next\" name=\"next\" width=\"46\" height=\"46\" border=\"0\" id=\"next\" /></a></div>");
	if(location_order>0 && location_screen>0)
		doc.write("<h1>"+ ttlms_connect.screens_titles[ttlms_connect.S_ID] +"</h1>");
	doc.write("</div>");
*/
	doc.write("<div id=\"contentbox\">");
	
	doc.write("<a name=\"skip\" id=\"skip\"></a>");

	doc.write("<div class=\"prop\"></div>");
	/* */
	
	// Question Numbers
	doc.write("<p align='center'>");
	for(c=0;c < (questions_sub.length);c=c+1)
	{
		if(test_question==(c+1))
			doc.write("&nbsp;<b>" + (c+1) + "</b>");
		else
			doc.write("&nbsp;<a href='javascript:ttlms_connect.TestJump(" + (c+1) + ");'>" + (c+1) + "</a>");
	}
	doc.write("&nbsp;&nbsp;<a href='javascript:ttlms_connect.LoadTestResults();'><b>Done</b></a>");
	doc.write("</p>");
	
	doc.write("</h1>");
	doc.write("</div>");
	doc.write("<div id=\"contentbox\">");
	doc.write("<div class=\"prop\"></div>");
	
	
	if(test_question==0)
	{
			doc.write("<table cellpadding='4'><tr><td>");
			doc.write("<p>&nbsp;</p>");
			doc.write("<p>The following screens contain questions that will test your knowledge of the subject matter. ");
			doc.write("For each question, click the button next to the correct answer and then click the 'Next' button. You can navigate the questions using either the 'Next' button, the 'Previous' button, or by clicking on a question number above. Your current question will appear in bold.</p>");
			doc.write("<p>When you have completed the test, click the 'Done' button to score your test.</p>");
			doc.write("<p>Scores less than " + test_passing + "% are not considered passing and will not be recorded in your record.</p>");
			doc.write("<p>Click 'Next' to begin the test.</p>");
			doc.write("</td></tr></table>");
	}
	else
	{
		// quick-jump

	 	doc.write("<table cellpadding='4'><tr><td><p>&nbsp;</p>");
		
		// use randomize question
		refQText = questions_all[questions_sub[test_question-1]];
		theMedia = refQText[14];
		theMediaTag = refQText[15];
		theCAns = refQText[11];
		theFeedback = refQText[13];
		abc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
			if(theMedia!="")
		{
			theMediaType=theMedia.substring(theMedia.length-3).toUpperCase();
			if(theMediaType == "JPG" || theMediaType == "GIF" || theMediaType == "PNG")
				doc.write("<img src='../media/"+C_ID+"/"+theMedia+"' "+ theMediaTag +" border='0'>");
			else
				doc.write("<embed src='../media/"+C_ID+"/"+theMedia+"' "+ theMediaTag +" border='0'></embed>");
			doc.write("</td><td>");
		}

		doc.write("<p><b>" + refQText[0] +"</b></p>");
		doc.write("<table border='0' width='100%'>");
		
		for(c=1;c<11;c=c+1)
		if(refQText[c]!="")
			{
			doc.write("<tr><td align='center' valign='top'>");
			doc.write("<input type='radio' name='A' value='"+ c +"' id='A_"+ c +"'");
			if(test_answers[test_question-1]==c)
				doc.write(" checked ");
			if(test_done==2)
			{
				doc.write(" disabled ");
			}
			doc.write(" onclick='ttlms_connect.TestAnswer("+ c +");'>");
			doc.write("<td align='left' valign='top'>");
			doc.write("<b>");
			doc.write(abc.substring(c-1,c))
			doc.write(".</b></td><td width='100%' valign='top'>");
			tcol = 0; // 0=plain, 1=wrong, 2=right
			if(test_done==2)
			{
				if(test_answers[test_question-1]==c)
					tcol=1;
				if( (theCAns==c) && (always_show_correct==1) ) 
					tcol=1;
				if( (theCAns==test_answers[test_question-1]) && (theCAns==c) )
					tcol=2;

				if(tcol==1)
					doc.write("<font color=red>");
				if(tcol==2)
					doc.write("");
			}
			doc.write(refQText[c]);
			if(test_done==2 && ( (test_answers[test_question-1]==c) || (theCAns==c) ))
				doc.write("</font> ");
			if(theCAns==c && test_done==2 && ( always_show_correct || (test_answers[test_question-1]==c) ) )
				doc.write(" <font color=green>(Correct Answer)</font> ");
			doc.write("<br>");
			doc.write("</td></tr>");
			}
		doc.write("</table>");
		doc.write("</td></tr></table>");
		if( (test_done==2) && (theCAns!=test_answers[test_question-1]) )
		{			
			if(theFeedback=="")
				theFeedback="Incorrect.";
			doc.write("<p><font color=red>&nbsp;" + theFeedback + "</font></p>");
		}
	}
	
	doc.write("<br clear='all'>");
	doc.write("</div>");
	doc.write("<div id=\"footer\">");
	doc.write("<div id=\"botnav\"><a href=\"javascript:ttlms_connect.TestBack();\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('prev1','','../interface/prev1.gif',1)\"><img src=\"../interface/prev.gif\" alt=\"Previous\" name=\"prev1\" width=\"46\" height=\"46\" border=\"0\" id=\"prev1\" /></a><a href=\"javascript:ttlms_connect.TestNext();\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('next1','','../interface/next1.gif',1)\"><img src=\"../interface/next.gif\" alt=\"Next\" name=\"next1\" width=\"46\" height=\"46\" border=\"0\" id=\"next1\" /></a></div>");
/*	if(location_order>0 && location_screen>0)
		doc.write("<p align=\"center\">Screen " + ttlms_connect.location_screen + " of " + ttlms_connect.screens_array[ttlms_connect.location_order].length + "</p>");
	else
		doc.write("&nbsp;");
*/
	
	doc.write("</div>");
	doc.write("</div>");
  doc.write("</div>");
	doc.write("</div>");	
	
}


function 		ShowTestResults(doc)
{

	doc.write("<div id=\"shell\">");
	doc.write("<div id=\"top\">");

	doc.write("<a href=\"#skip\"><img src=\"../interface/spacer_clear.gif\" width=\"1\" height=\"1\" alt=\"Skip Navigation\" border=\"0\"></a>");

	doc.write("<div id=\"title\">" + course_name + "</div>");
	doc.write("<div id=\"modtitle\">" + "Mastery Test" + "</div>");
  //doc.write("<div id=\"lessontitle\">" + theL + "</div>");
	
	doc.write("</div>");
	doc.write("<div id=\"bar\">");

  doc.write("<div id=\"btn\">");
	doc.write("<a href=\"javascript:ttlms_connect.LaunchMenu();\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('mm','','../interface/main1.gif',1)\"><img src=\"../interface/main.gif\" alt=\"Main Menu\" name=\"mm\" width=\"40\" height=\"30\" border=\"0\" id=\"mm\" /></a>");
//	doc.write("<a href=\"javascript:winGlossaryObj=window.open('../library/htms/glossary.htm','glossary','scrollbars=yes,toolbar=yes,resizable=yes,width=640,height=480');winGlossaryObj.focus();\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('gl','','../interface/glos1.gif',1)\"><img src=\"../interface/glos.gif\" alt=\"Glossary\" name=\"gl\" width=\"60\" height=\"30\" border=\"0\" id=\"gl\" /></a>");
//	doc.write("<a href=\"javascript:winResourseObj=window.open('../library/htms/resources1.htm','resources','scrollbars=yes,resizable=yes,width=940,height=480');winResourseObj.focus();\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('re','','../interface/reso1.gif',1)\"><img src=\"../interface/reso.gif\" alt=\"Resources\" name=\"re\" width=\"92\" height=\"30\" border=\"0\" id=\"re\" /></a>");
//	doc.write("<a href=\"javascript:ttlms_connect.UniversalExit();\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('help','','../interface/help1.gif',1)\"><img src=\"../interface/help.gif\" alt=\"Help\" name=\"help\" width=\"40\" height=\"30\" border=\"0\" id=\"help\" /></a>");
	doc.write("<a href=\"javascript:ttlms_connect.UniversalExit();\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('exit','','../interface/exit1.gif',1)\"><img src=\"../interface/exit.gif\" alt=\"Exit\" name=\"exit\" width=\"40\" height=\"30\" border=\"0\" id=\"exit\" /></a>");
	doc.write("</div>");
//	doc.write("<div id=\"dropmenu\">");
//	if(location_order>0 && location_screen>0)
//		BuildScreenLocation(doc);
//	else
//		doc.write("&nbsp;");
//	doc.write("</div>");
	doc.write("</div>");
	doc.write("<div id=\"content\">");
	
/*	doc.write("<div id=\"screentitle\">");
	if(location_order>0 && location_screen>0)
		doc.write("<div id=\"topnav\"><a href=\"javascript:ttlms_connect.ScreenBack();\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('prev','','../interface/prev1.gif',1)\"><img src=\"../interface/prev.gif\" alt=\"Previous\" name=\"prev\" width=\"46\" height=\"46\" border=\"0\" id=\"prev\" /></a><a href=\"javascript:ttlms_connect.ScreenNext();\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('next','','../interface/next1.gif',1)\"><img src=\"../interface/next.gif\" alt=\"Next\" name=\"next\" width=\"46\" height=\"46\" border=\"0\" id=\"next\" /></a></div>");
	if(location_order>0 && location_screen>0)
		doc.write("<h1>"+ ttlms_connect.screens_titles[ttlms_connect.S_ID] +"</h1>");
	doc.write("</div>");
*/
	doc.write("<div id=\"contentbox\">");
	
	doc.write("<a name=\"skip\" id=\"skip\"></a>");

	doc.write("<div class=\"prop\"></div>");
	/* */
	
	if(test_done==0)
	{
		qgood=0;
		for(c=0;c < (questions_sub.length);c=c+1)
		{
			if(test_answers[c]==questions_all[questions_sub[c]][11])
				qgood=qgood+1;
		}
		finalscore=Math.round(qgood/questions_sub.length*100);
		
		pt=course_testscores[location_order];
		if(pt==undefined)
			pt=0;
	
		if(pt<finalscore && finalscore>=test_passing)
			course_testscores[location_order]=finalscore;
		
	}
	test_done = 1;
	test_question = 1;
	var ptq=posttest_questions;
	var ptc=posttest_content;
	var ptt=posttest_retake;
	doc.write("<p>&nbsp;</p>");
	doc.write("<p align='center'><br>Final Score: " + finalscore + "% (" + qgood + " out of " + questions_sub.length + ")<br><br></p>");
	if(finalscore>=test_passing)
	{
		doc.write("<p align='center'>You have passed the test.</p>");
		doc.write("<p align='center'>");
		if(finalscore>=test_passing && LMS==1)
			doc.write("Please click the 'Post Status to Training Server' button below in order for your score to be recorded. Click the 'Review Test' button to review the questions and your answers. ");
		if(ptq > 0)
			doc.write("Click the 'Review Test' button to review the questions and your answers. ");
		doc.write("</p>");
		if(posttest_questions==2)
			ptq=1;
		if(posttest_content==2)
			ptc=0;
		if(posttest_retake==2)
			ptt=0;
	}
	else
	{
		doc.write("<p align='center'>You have not completed the requirement for this course.<br>Please review the material and try again.<br>&nbsp;<br>Click the 'Close Test' button to return to the menu.</p>");
		if(posttest_questions==2)
			ptq=0;
		if(posttest_content==2)
			ptc=1;
		if(posttest_retake==2)
			ptt=1;
	}
	doc.write("<form><p align='center'>");
	if(ptq)
		doc.write("<input type='Button' class='ibutton' value='Review Test' onclick='ttlms_connect.LoadTestReviewQuestion();'>");
	if(ptc)
		doc.write("<input type='Button' class='ibutton' value='Review Content' onclick='ttlms_connect.LaunchLesson(1,1);'>");
	if(ptt)
		doc.write("<input type='Button' class='ibutton' value='Retake Test' onclick='ttlms_connect.LaunchTest(" + location_order + ");'>");
	if(finalscore>=test_passing && LMS==1)
		doc.write("<input type='button' value='Post Status to Training Server' class='ibutton' onclick='ttlms_connect.SaveAICCData();'>");
	else
		doc.write("<input type='Button' class='ibutton' value='Close Test' onclick='ttlms_connect.LaunchMenu();'>");
	// Save ExportLive
	if(finalscore>=test_passing && LMS==3)
		doc.write("<input type='button' value='Save Completion' class='ibutton' onclick='ttlms_connect.SaveExportLiveData();'>");

	doc.write("</p></form>");
	
	doc.write("<br clear='all'>");
	doc.write("</div>");
	doc.write("<div id=\"footer\">");
	doc.write("<div id=\"botnav\"><a href=\"javascript:ttlms_connect.TestBack();\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('prev1','','../interface/prev1.gif',1)\"><img src=\"../interface/prev.gif\" alt=\"Previous\" name=\"prev1\" width=\"46\" height=\"46\" border=\"0\" id=\"prev1\" /></a><a href=\"javascript:ttlms_connect.TestNext();\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('next1','','../interface/next1.gif',1)\"><img src=\"../interface/next.gif\" alt=\"Next\" name=\"next1\" width=\"46\" height=\"46\" border=\"0\" id=\"next1\" /></a></div>");
/*	if(location_order>0 && location_screen>0)
		doc.write("<p align=\"center\">Screen " + ttlms_connect.location_screen + " of " + ttlms_connect.screens_array[ttlms_connect.location_order].length + "</p>");
	else
		doc.write("&nbsp;");
*/
	
	doc.write("</div>");
	doc.write("</div>");
  doc.write("</div>");
	doc.write("</div>");	
}



