<html>
<head>

<title>empty</title>

<script type="text/JavaScript">
// =============== Initialize variables ===================
var permAudio = true;
var questionCounter = 0;
var correctCounter = 0;
var currentPage = 1;
var Branch1 = 0;
var Branch2 = 0;
var Branch3 = 0;
var Branch4 = 0;
var Branch5 = 0;
var Branch6 = 0;
var Branch7 = 0;
var Branch8 = 0;
var Branch9 = 0;
var Branch10 = 0;
var Branch11 = 0;
var Branch12 = 0;
var Branch13 = 0;
var Branch14 = 0;
var Branch15 = 0;
var BrchRtrn = 0;
var bookmarkchecked = false;
var currentValue;
var thisCurrentValue = false;
var apiIsInitialized = false;
var alreadyTerminated = false;
var ccPop;
var look;
var narration = new Object();
var storageObj = new Object();
var questionData = new Object();
var currentTime = new Date(); 
var startTime = currentTime.getTime();
var currentData = new Object();
currentData.names = new Array();
currentData.feedback = new Array();
var senarioData = new Object();
var answersArr = new Array({%questionAnswerArray%});
var pages_array = new Array();
var pages_names = "{%pages_array_names%}";
var page_names_array = new Array();
page_names_array = pages_names.split("|");
var pages_urls = "{%pages_array_urls%}";
var page_urls_array = new Array();
page_urls_array = pages_urls.split("|");
for(var i = 0; i <= page_names_array.length - 1; i++){
	pages_array.push(i);
	pages_array[i] = new Array();
	pages_array[i].push(page_names_array[i]);
	pages_array[i].push(page_urls_array[i]);
}
// =======================================================

</script>

<script type="text/javascript" src="../../APIWrapper.js"></script>
<script type="text/javascript" src="../../knowledgeCheckCode.js"></script>

<script type="text/javascript">

    // ========== LOAD SCOMAP ============	
	var xmlDoc;	
	var xmlhttp=false;	
	isLocal=false;
	
	var isIE = -1;
	if (navigator.appName == 'Microsoft Internet Explorer')
	{
		var ua = navigator.userAgent;
		var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
		if (re.exec(ua) != null)
		isIE = parseFloat( RegExp.$1 );
	}	

	/* running locally on IE6, IE7 */      
     if(location.protocol=="file:"){
      if(!xmlhttp)try{ xmlhttp=new ActiveXObject("MSXML2.XMLHTTP"); }catch(e){xmlhttp=false;}
      if(!xmlhttp)try{ xmlhttp=new ActiveXObject("Microsoft.XMLDOM"); }catch(e){xmlhttp=false;}
	  isLocal=true;
     }                                                                                 
   /* IE7, Firefox, Safari, Opera, Chrome...  */
     if(!xmlhttp)try{ xmlhttp=new XMLHttpRequest(); }catch(e){xmlhttp=false;}
   /* IE6 */
     if(typeof ActiveXObject != "undefined"){
      if(!xmlhttp)try{ xmlhttp=new ActiveXObject("MSXML2.XMLHTTP"); }catch(e){xmlhttp=false;}
      if(!xmlhttp)try{ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }catch(e){xmlhttp=false;}
     }
	
	if(isLocal==true && isIE!=-1) {
		xmlDoc = new ActiveXObject("Microsoft.XMLDOM");		
		xmlDoc.async = "false";
		xmlDoc.load("scomap.xml");
	} else {
		xmlhttp.open("GET","scomap.xml",false);
		xmlhttp.onreadystatechange=function(){
		if(xmlhttp.readyState!=4)return;

		};//onreadystatechange
		xmlhttp.send(null);
	
		xmlDoc=xmlhttp.responseXML;	
	}
    // =====================================
    
    
	function beginSCO(){
	    
	    // Initialize API Wrapper
		doInitialize();
		
		var ii = 1;
		var status = doGetStatus();
		if (status != "completed") {
			doSetStatus("incomplete");
		}
		do {
			ii = ii + 1;
		}
		while ((apiIsInitialized == false) && (ii < 500));

		if(status != "completed"){
			var thisbookmark = doGetBookmark();
		}		
		
		var entry = doGetValue("cmi.entry");
		
		if(entry != "ab-initio"){
		
		    // If suspend data isn't empty then load the course info
		    if (doGetValue("cmi.suspend_data") != "") {
    		
		       suspendData = doGetValue("cmi.suspend_data");
		       suspendDataArr = suspendData.split("|");
    		   
		       var x = xmlDoc.documentElement.childNodes;
                
                for (var i=0; i<x.length; i++){
                    
                    // Set visited value 
                    var y = x[i].childNodes[3].getAttributeNode("value");
                    y.nodeValue = suspendDataArr[i];
                
                }
		    }
		}

	}
	
	function endSCO(requiredexit){
	
		setSessionTime();
		
		hasCompleted = true;
		
		var x = xmlDoc.documentElement.childNodes;
        var count = 0;

        for (var i=0; i<x.length; i++){

            if (x[i].childNodes[3].getAttribute("value") != "1") {

                if (x[i].getAttribute("title") != "Review") {
                    hasCompleted = false;
                }
                               
            }
            
        }

		if (hasCompleted) {
			doSetStatus("completed");
			doSetValue( 'cmi.success_status', 'passed' );
			doSetBookmark("");		
			doSetExit("");
		}else{
			// Store scomap.xml
			var x = xmlDoc.documentElement.childNodes;        
			suspendData = "";
			
			for (var i=0; i<x.length; i++){
				suspendData += x[i].childNodes[3].getAttribute("value") + "|";
			}
	
			doSetValue( "cmi.suspend_data", suspendData );
	
			doSetExit("suspend"); // Always set to suspend, if normal it won't save suspend_data
		    doSetStatus("incomplete");				
		}
	    
	    
		doCommit();
		doTerminate();
		
	}
	
	function doGetBookmark(){

		var entry = doGetValue("cmi.entry");
		
		if(entry != "ab-initio"){ // If this isn't the first time in the course get bookmark
		
			var lastLocation = doGetValue("cmi.location");
			
			if (lastLocation != "") {
				var result = confirm('Would you like to return to your last location? ');
		
		        if ( result ) {
		               window.parent.contentFrame = lastLocation;
		        }
			}
			
		} else {
			doSetBookmark("");
		}
		
	}
	
	function doSetBookmark(pagelocation){
	
		var urlParts = pagelocation.split("/");
		
		doSetValue("cmi.location", urlParts[(urlParts.length - 1)]);
		
	}
	
	function setSessionTime() {
	     
		var currentTime = new Date();
		var endTime = currentTime.getTime()
		
		var calculatedTime = endTime-startTime;
		if(calculatedTime<1000){
			calculatedTime = 1000;
		}
		var totalHours = Math.floor(calculatedTime/1000/60/60);
		
		calculatedTime = calculatedTime - totalHours*1000*60*60
		if ( totalHours < 1000 && totalHours > 99 ) {
			totalHours = "0"+totalHours.toString();
		} else if ( totalHours < 100 && totalHours > 9 ) {
			totalHours = "00"+totalHourstoString();
		} else if ( totalHours < 10 ) {
			totalHours = "000"+totalHours.toString();
		}
		
		var totalMinutes = Math.floor(calculatedTime/1000/60);
		calculatedTime = calculatedTime - totalMinutes*1000*60;
		if ( totalMinutes < 10 ) {
			totalMinutes = "0"+totalMinutes.toString();
		}
		
		var totalSeconds = Math.floor(calculatedTime/1000);
		if(totalSeconds<1){
			totalSeconds = 1;
		}
		if ( totalSeconds < 10 ) {
			totalSeconds = "0"+totalSeconds.toString();
		}
		var sessionTime = "PT";
		if (parseInt(totalHours)!=0) 
		   sessionTime += totalHours + "H";
		if (parseInt(totalMinutes) !=0) 
		   sessionTime += totalMinutes + "M";
		if (parseInt(totalSeconds)!=0){
		   sessionTime += totalSeconds + "S";
		}else{
			sessionTime += "01" + "S";
		}
		
		doSetValue("cmi.session_time", sessionTime);
	}
	
	function doGetStatus(){
	
		var getCompletionStatus = doGetValue("cmi.completion_status");

		return getCompletionStatus;
	}

	function doSetStatus(setCompletionStatus) {
	
		var getCompletionStatus = doGetStatus();
		
		if ( getCompletionStatus != "completed"){
			doSetValue( "cmi.completion_status", setCompletionStatus);
		}
	}
	
	function doSetExit(exitedstatus){
	
		doSetValue( "cmi.exit", exitedstatus );
		
	}
	
	function getExit() {	
	
		var msg = "Are you sure you want to exit the course?";
		
		if ( confirm(msg) ) {
			top.window.close();
		}
		
	}
	
	function getTOC(){
		getExit();
	}

	function doContinue(){
	
		doSetValue("adl.nav.request", "continue");
		this.top.close();

		alreadyTerminated = true;
	}

	function doPrevious(){
	
		doSetValue("adl.nav.request", "previous");
		this.top.close();

		alreadyTerminated = true;

	}
	
	// Submit any LMS objectives here, this is called from testengine.js during the SCORM submission
	function submitObjectives(passFail) {
	
	}
	

</script>

</head>

{%customEmpty%}

<body onLoad="beginSCO();" onUnload="endSCO();"></body>

</html>