	<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>PDF - SCO: Test Static Content</title>
		<!-- this needs to be present for height="100%" to work properly in some browsers -->
		<style type="text/css">
			<!--
				body,html {
					margin:0px;
					padding:0px;
					height:100%;
					overflow:hidden;
				}
			-->
		</style>
		<script src="standard.js" type="text/javascript"></script>
		<script src="SCORM_support/scorm_support.js"></script>
	<script type="text/javascript" language="JavaScript">
	        var unload_str = "Call log for this session: \n";
			//var g_objAPI=null;
			// set document.domain property here, if it works for your environment/SCORM implementation
			// document.domain="";
			var g_intAPIType = 0;
			// Hook for Internet Explorer
			if ((navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) || g_intAPIType == -1)
			{
				g_intAPIType = 0;
				document.write('<script language=\"VBScript\"\>\n');
				document.write('On Error Resume Next\n');
				document.write('Sub Captivate_FSCommand(ByVal command, ByVal args)\n');
				document.write('Call Captivate_DoFSCommand(command, args)\n');
				document.write('End Sub\n');
				document.write('</script\>\n');
				document.write('<script language=\"VBScript\"\>\n');
				document.write('On Error Resume Next\n');
				document.write('Sub Captivate_DoExternalInterface(ByVal command, ByVal parameter, ByVal value, ByVal variable)\n');
				document.write('Call Captivate_DoExternalInterface(command, parameter, value, variable)\n');
				document.write('End Sub\n');
				document.write('</script\>\n');
			} else {
				g_intAPIType = 1;
			}
			var strURLFile = "test_pdf_scorm_wrapper.swf";			// Name of the flash file
			var intIntervalSecs = 1;				// Number of seconds to wait for SCORM API to load
			var g_intAPIOrder = 0;					// Way to search for API object (0 - starts with bottom up; 1 - starts top down)
			var strURLBase = "";
			var strURLParams = "";
			var strURLFull = document.location + "";
			var intTemp = strURLFull.indexOf("#");
			if (intTemp == -1)
				intTemp = strURLFull.indexOf("?");
			if (intTemp > 0)
				strURLParams = strURLFull.substring(intTemp + 1, strURLFull.length);
			var strTemp = location.protocol.toUpperCase();
			if (strTemp.indexOf("FILE") == -1)
			  var intTemp = location.pathname.lastIndexOf("/");
			else
			  var intTemp = location.pathname.lastIndexOf("\\");
			if (intTemp != -1)
			  strURLBase = location.protocol + "//" + location.host + location.pathname.substring(0, intTemp + 1);
			else
			  strURLBase = location.protocol + "//" + location.host + location.pathname;

			strURLParams = (strURLParams==unescape(strURLParams)?escape(strURLParams):strURLParams);
			strURLParams = (strURLParams==""?"":"?") + strURLParams;

			function Finish()
			{
				if ((isAPI()) && (g_bFinishDone == false))
				{
					(g_zAPIVersion=="0.2"?g_objAPI.LMSCommit(""):g_objAPI.Commit(""));
					g_bFinishDone = (g_zAPIVersion=="0.2"?g_objAPI.LMSFinish("") == "true":g_objAPI.Terminate("") == "true");
				}
				return (g_bFinishDone + "" ) // Force type to string
			}

			if(g_intAPIType==0)
			{
				// Detect Internet Explorer
				var g_bIsInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
				// Handle fscommand messages from a Flash movie
				function Captivate_DoFSCommand(command, args)
				{
					var CaptivateObj = g_bIsInternetExplorer ? Captivate : document.Captivate;

					var strFSArgs = new String(args);
					var strFSCmd = new String(command);
					var strErr = "true";
					var strFSArg1, strFSArg2, strFSArg3
					var intFSDelimiter = strFSArgs.indexOf("|");
					if (intFSDelimiter > -1)
					{
						strFSArg1 = strFSArgs.substr(0, intFSDelimiter); 	// Name of data element to get from API
						var strFSTemp = strFSArgs.substr(intFSDelimiter + 1);
						intFSDelimiter = strFSTemp.indexOf("|");
						if(intFSDelimiter > -1)
						{
							strFSArg2 = strFSTemp.substr(0, intFSDelimiter);	// Value
							strFSArg3 = strFSTemp.substr(intFSDelimiter + 1);	// Variable
						} else {
							strFSArg2 = strFSTemp;
						}
					} else {
						strFSArg1 = strFSArgs;
					}

					// do nothing, if SCORM API is not available
					if (!isAPI()) return;

					if ( strFSCmd == "LMSInitialize" || strFSCmd=="Initialize")
					{
						CaptivateObj.SetVariable(strFSArg3, eval('g_objAPI.' + strFSCmd + '(\"\");'));
					} else if ( strFSCmd == "LMSSetValue" || strFSCmd=="SetValue") {
						strErr = eval('g_objAPI.' + strFSCmd + '(\"' + strFSArg1 + '\",\"' + strFSArg2 + '\");');
						CaptivateObj.SetVariable(strFSArg3, strErr);
					} else if ( strFSCmd == "LMSFinish" || strFSCmd=="Terminate") {
						g_bFinishDone = eval('g_objAPI.' + strFSCmd + '(\"\");')
						strErr = g_bFinishDone;
						CaptivateObj.SetVariable(strFSArg3, g_bFinishDone);
					} else if ( strFSCmd == "LMSCommit" || strFSCmd=="Commit") {
						strErr = eval('g_objAPI.' + strFSCmd + '(\"\");');
						CaptivateObj.SetVariable(strFSArg3, strErr);
					} else if ((strFSArg2) && (strFSArg2.length > 0)) {
						if(strFSCmd=="LMSGetLastError" || strFSCmd=="GetLastError")
						{
							strErr = eval('g_objAPI.' + strFSCmd + '();')
							CaptivateObj.SetVariable(strFSArg3, strErr);
						} else {
							strErr = eval('g_objAPI.' + strFSCmd + '(\"' + strFSArg1 + '\");')
							CaptivateObj.SetVariable(strFSArg3, strErr);
						}
					} else if (strFSCmd.substring(0,3) == "LMSGet") {
						strErr = "-2: No Flash variable specified"
					}

					return strErr;
				}
				function Captivate_DoExternalInterface(command, parameter, value, variable)
				{
					var CaptivateObj = g_bIsInternetExplorer ? Captivate : document.Captivate;
					//alert("command  " + command + " ;parameter " +parameter+ " ;value " + value + " ;variable " + variable );
					//var strFSArgs = new String(args);
					var strFSCmd = new String(command);
					var strErr = "true";
					
					var strFSArg1, strFSArg2, strFSArg3;

					strFSArg1 = parameter;
					strFSArg2 = value;
					strFSArg3 = variable;
					/*var intFSDelimiter = strFSArgs.indexOf("|");
					if (intFSDelimiter > -1)
					{
						strFSArg1 = strFSArgs.substr(0, intFSDelimiter); 	// Name of data element to get from API
						var strFSTemp = strFSArgs.substr(intFSDelimiter + 1);
						intFSDelimiter = strFSTemp.indexOf("|");
						if(intFSDelimiter > -1)
						{
							strFSArg2 = strFSTemp.substr(0, intFSDelimiter);	// Value
							strFSArg3 = strFSTemp.substr(intFSDelimiter + 1);	// Variable
						} else {
							strFSArg2 = strFSTemp;
						}
					} else {
						strFSArg1 = strFSArgs;
					}*/

					// do nothing, if SCORM API is not available
					if (!isAPI()) return;

					if ( strFSCmd == "LMSInitialize" || strFSCmd=="Initialize")
					{
						//CaptivateObj.SetVariable(strFSArg3, eval('g_objAPI.' + strFSCmd + '(\"\");'));
						CaptivateObj.SetScormVariable(strFSArg3,eval('g_objAPI.' + strFSCmd + '(\"\");'));

					} else if ( strFSCmd == "LMSSetValue" || strFSCmd=="SetValue") {
						strErr = eval('g_objAPI.' + strFSCmd + '(\"' + strFSArg1 + '\",\"' + strFSArg2 + '\");');
						//CaptivateObj.SetVariable(strFSArg3, strErr);
						CaptivateObj.SetScormVariable(strFSArg3, strErr);

					} else if ( strFSCmd == "LMSFinish" || strFSCmd=="Terminate") {
						g_bFinishDone = eval('g_objAPI.' + strFSCmd + '(\"\");')
						strErr = g_bFinishDone;
						//CaptivateObj.SetVariable(strFSArg3, g_bFinishDone);
						CaptivateObj.SetScormVariable(strFSArg3, g_bFinishDone);

					} else if ( strFSCmd == "LMSCommit" || strFSCmd=="Commit") {
						strErr = eval('g_objAPI.' + strFSCmd + '(\"\");');
						//CaptivateObj.SetVariable(strFSArg3, strErr);
						CaptivateObj.SetScormVariable(strFSArg3, strErr);

					} else if ((strFSArg2) && (strFSArg2.length > 0)) {
						if(strFSCmd=="LMSGetLastError" || strFSCmd=="GetLastError")
						{
							strErr = eval('g_objAPI.' + strFSCmd + '();')
							//CaptivateObj.SetVariable(strFSArg3, strErr);
							CaptivateObj.SetScormVariable(strFSArg3, strErr);

						} else {
							strErr = eval('g_objAPI.' + strFSCmd + '(\"' + strFSArg1 + '\");')
							//CaptivateObj.SetVariable(strFSArg3, strErr);
							CaptivateObj.SetScormVariable(strFSArg3, strErr);

						}
					} else if (strFSCmd.substring(0,3) == "LMSGet") {
						strErr = "-2: No Flash variable specified"
					}

					return strErr;
			}
				}
	var pdf_obj=null;
	function onload_actions()
		{	
			
			pdf_obj = document.getElementById("PDFcontent");
			pdf_obj.messageHandler = {};
			pdf_obj.messageHandler.onMessage = onMessageFromPDF;
			if(pdf_obj) 
			{
			//alert("pdf_obj initialized (Message handlers registered)");
			}
		}
	
	function onunload_actions()
		{
			//pdf_obj.postMessage(["final_data"]);
			var x = g_objAPI.Terminate("");
		}
		
	function onbeforeunload_actions()
		{
			alert("on before unload...");
			pdf_obj.postMessage(["final_data"]);
		}
		
	var first_call=true;
	function onMessageFromPDF(value_ary)
		{
			if(g_objAPI == null)
				return false;
			
			if(value_ary == null || value_ary.length < 4)
				return false;
			
			var command,dataElement,argValue,setVariable;
			command = value_ary[0];
			dataElement = value_ary[1];
			argValue = value_ary[2];
			setVariable = value_ary[3];
			
			var return_value = "";
			var command_str="";
			if(command == "GetScormVersion")
			{
				return_value = g_zAPIVersion;
				pdf_obj.postMessage([return_value]);
				return true;
			}
			
			if(command == "Initialize" || command == "LMSInitialize" || command == "Commit" || command == "LMSCommit" ) //Initialize(), Terminate() or Commit()
			{
				command_str = 'g_objAPI.' + command + "(\"\");";
				return_value = eval(command_str);
			}
			else if(command == "GetValue" || command == "LMSGetValue") //GetValue()
			{
				command_str = "g_objAPI." + command + "(\""+ dataElement+"\");";
				return_value = eval(command_str);
			}
			else if(command == "SetValue" || command == "LMSSetValue")//SetValue()
			{
				command_str = 'g_objAPI.' + command + "(\""+ dataElement + "\",\"" + argValue + "\");";
				return_value = eval(command_str);
			}
			else if(command == "LMSGetLastError" || command=="GetLastError")
			{
				command_str = 'g_objAPI.' + command + "(\"\");";
				return_value = eval(command_str);
			}
			else if(command == "LMSGetErrorString" || command=="GetErrorString")
			{
				command_str = "g_objAPI." + command + "(\""+ dataElement+"\");";
				return_value = eval(command_str);
			}
			
			if(dataElement == "cmi.interactions._count")
			{
				return_value = return_value + "";
			}
			
			pdf_obj.postMessage([return_value]);
			return true;
		}
		
		function pause(millis)
            {
                var date = new Date();
                var curDate = null;
                do { curDate = new Date(); }
                    while(curDate-date < millis)
            }
		
		window.onbeforeunload = function (evt) {
     
		//var childwindow;
		//childwindow=window.open("test_child.html","Title","resizable=yes,width=350,height=250");
     
		//pause(5000);
		//childwindow.close();
      //return "DON'T DO IT!";
		}




		</script>
		
	
	
	<!--	<script src="../scripts/ConnectPDF.js"> </script> -->

	</head>
	<!-- <body onload='initializePDF()'> -->
	<body onload="onload_actions();" onunload="onunload_actions();">
		<script type="text/javascript" language="JavaScript">
		var intIntervalSecs =1;
		var timeCurrent_int = new Date().getTime();
		var timeLimit_int = new Date().getTime() + (intIntervalSecs * 1000);
		// This simply loops for a set period of time, waiting for the API to
		// load and/or be found.  A better solution would be to use setInterval
		// and on the timeout, redirect or load the resulting Captivate file.
		while((g_objAPI == null) && timeCurrent_int < timeLimit_int)
		{
			g_objAPI = getAPI(g_intAPIOrder);
			timeCurrent_int = new Date().getTime();
		}
	
		
		if(isAPI()){ 
		//alert("Message from HTML: API found"+g_zAPIVersion);
		}
		else alert("Message from HTML: API NOT found");
		</script>
		
		<object id="PDFcontent" data="@PDFNAME" type="application/pdf" width="100%" height="100%"/>
		
		
		
	</body>
</html>
