//////////////////////////////////////////////////////
// Configuration parameters //////////////////////////
//////////////////////////////////////////////////////
// Send percents is required to be true for LMS: Moodle, BlackBoard, Content Launcher so far
scormManager.sendPercents = true;
scormManager.debugMode = false;
// Using default (75)
//scormManager.masteryScore = 75;


//////////////////////////////////////////////////////
// DETECT ENVIRONMENT  ///////////////////////////////
//////////////////////////////////////////////////////
scormManager.detectEnvironment = function(){
	/*scormManager.sendPercents = (
	 		(typeof window.contentlauncher != "undefined")
			// || Next condition...
			// || Next condition...
			// || Next condition...
			) ? true : false;
	*/
}
//////////////////////////////////////////////////////
// CLOSE CONTENT  ////////////////////////////////////
//////////////////////////////////////////////////////
scormManager.customClose = function(){
	// Guessing enviroment
	var sitosVersion = getSitosVersion();
	if(typeof window.contentlauncher !== "undefined"){
		closeContentLauncher();
	}else if(sitosVersion != ""){
		closeSITOS(sitosVersion);
	}else{
		// Call here the close function in your favourite flavour
		window.close();
	}
}
//////////////////////////////////////////////////////
// Custom close functions  ///////////////////////////
//////////////////////////////////////////////////////
/**
 * Find out if enviroment is a sitos
 */
function getSitosVersion(){
	return scormManager.getParam("sitosVersion");
}
/**
 * Closer for content launcher
 */
function closeContentLauncher(){
	window.top.frames[1].setTimeout('ShowInfoTab()', 100);
}
/**
 * Closer for SITOS
 * @param {string} version
 */
function closeSITOS(version){
	switch(version){
		case "3.7":
		case "3.8":
		case "2":
			top.opener.parent.document.location.reload();
			top.window.close();
		break;		
	}
}
/**
 * Closer for reload player
 */
function closeReloadPlayer(){
	top.window.text.location.href="suspended.htm";
}
/**
 * Closer for blackboard
 */
function closeBlackboard(){
		
}
/**
 * Closer for Moodle
 */
function closeMooodle(){
	
}
//////////////////////////////////////////////////////
// /Custom close functions  ///////////////////////////
//////////////////////////////////////////////////////

//////////////////////////////////////////////////////
// Trace for debug  //////////////////////////////////
//////////////////////////////////////////////////////
/** For production, set debug mode to false**/
matsplayer.trace = 
etestingplayer.trace = 
scormManager.trace = function(msg){
	// Firebug??
	if(scormManager.debugMode === true){
		if(window.console && window.console.firebug){ 			// Firebug
			console.log(msg);
		}else if(window.console) {								// Safari
			window.console.log(msg);
		}else{													// Ugly browsers a.k.a IE any version
			alert(msg);													
		}
	}
}