/*******************************************************************************
** 
** Filename: SCOFunctions.js
**
** File Description: This file contains several JavaScript functions that are 
**                   used by the Sample SCOs contained in the Sample Course.
**                   These functions encapsulate actions that are taken when the
**                   user navigates between SCOs, or exits the Lesson.
**
** Author: ADL Technical Team
**
** Contract Number:
** Company Name: CTC
**
** Design Issues:
**
** Implementation Issues:
** Known Problems:
** Side Effects:
**
** References: ADL SCORM
**
********************************************************************************
**
** Concurrent Technologies Corporation (CTC) grants you ("Licensee") a non-
** exclusive, royalty free, license to use, modify and redistribute this
** software in source and binary code form, provided that i) this copyright
** notice and license appear on all copies of the software; and ii) Licensee
** does not utilize the software in a manner which is disparaging to CTC.
**
** This software is provided "AS IS," without a warranty of any kind.  ALL
** EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
** IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-
** INFRINGEMENT, ARE HEREBY EXCLUDED.  CTC AND ITS LICENSORS SHALL NOT BE LIABLE
** FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
** DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES.  IN NO EVENT WILL CTC  OR ITS
** LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
** INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
** CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
** OR INABILITY TO USE SOFTWARE, EVEN IF CTC  HAS BEEN ADVISED OF THE
** POSSIBILITY OF SUCH DAMAGES.
**
*******************************************************************************/
//var startDate;
//var strFunction="";
//var totalMilseconds=0;
//var totalMilsecondsAllow=0;
//var timer;
var bExistAPI=true;
//var bAppletPageLoaded = false; // The variable is used in the page refresh case



// score: String
function scormPassTestScore(score)
{	
	// initialize the connection to the LMS system
	var result = doLMSInitialize();
	if (result=="false") bExistAPI=false;

	if (!bExistAPI) return;
	var lessonlocation;
	
	lessonlocation = document.location.href;
	lessonlocation = lessonlocation.substring(0, lessonlocation.lastIndexOf("/")+1);
	
	doLMSSetValue("cmi.core.score.max",100);
	doLMSSetValue("cmi.core.score.min",0);
	doLMSSetValue("cmi.core.score.raw",score);
	
	doLMSSetValue("cmi.suspend_data",lessonlocation);
	
	if (score >= 75) {
		doLMSSetValue("cmi.core.lesson_status","passed");
	}
	
	doLMSSetValue("cmi.core.exit", "");
	
	doLMSCommit();
	doLMSFinish();
}
