/**
*Stand Alone Launcher For House Titles
* Written by Nathan Deburn
* version 1.0
*/
//
// 
//
// Indicate Engine Launch File that it is running from stand alone LMS
var strLRTELaunchPath = "";
var IsRunningFromStandAloneIMS = true;
var strLMSStandard = "RVDPSCORM2004";
var RTEWindow = null; // reference of the RTE Window
// create the local databse
var tempActivityMode = 2; //explore - 2, assignment - 1
var tempEntryMode = 2; //first time entry - 2, resume entry 3
var tempLessonMode = 1; //
var tempBookmark = ""; // bookmark valid activity ID
var tempAudioPreference = 1;
var tempReadingAudioPreference = "1";
var tempSpeedPreference = 1;
var tempPrintPreference = 1;
var tempPreviouslyAccumulatedTime = "10000";
var tempStudentName = "House Series User";
var tempAccumulatedSessionTime = "100";
var tempActivityValue = "House Title";
var tempStatus = 0;
var tempActivityType = "About House Title";
var tempLaunchXML = "";
var tempSavedLearnerResponse = "";
var tempLastErrorDesc = "";
var tempLastError = "";
var tempActivityType = "";
//
var blnDebugMode = false;
var blnLMS = true;
// HOUSE variables

var tempSelfPacingState = '1';
var tempSelfVoicingState = '0';
var tempCCState = '0';
var tempSwitchState = '0';
var tempScanState = '1';
var tempScanProgressionState = '1';

var tempSoundState = '1';
var tempSoundVolumeState = '100';
var tempExitState = '1';
var tempPrintState = '1';
var tempThemeState = '1';
	//
var tempMASState = '1';
var tempKCState = '1';
var tempLMQuestionState = '2';
var tempLMCaseState = '0';
var tempLMOrderState = '0';

var tempAccessibility = 1;

// Title choosers

function launch_bailey(){
strLRTELaunchPath = "http://www.learnnowbc.ca/content/DeliverableCourse/Bailey/HS/HS_SA_Launch.html";
submit1_onclick();
}

function launch_millie(){
strLRTELaunchPath = "http://www.learnnowbc.ca/content/DeliverableCourse/Millie/HS/HS_SA_Launch.html";
submit1_onclick();
}

function launch_sammy(){
strLRTELaunchPath = "http://www.learnnowbc.ca/content/DeliverableCourse/Sammy/HS/HS_SA_Launch.html";
submit1_onclick();
}

function launch_trudy(){
strLRTELaunchPath = "http://www.learnnowbc.ca/content/DeliverableCourse/Trudy/HS/HS_SA_Launch.html";
submit1_onclick();
}


// --
// Event Handlers --
function window_onload() {
	populate();
}
function window_onbeforeunload() {

}
function submit1_onclick()
{
	RTEWindow = openWindow(strLRTELaunchPath, "100%", "100%", true);
}

function getDebugMode() {
	return false;
}


// -- Event Helpder functions
function populate()
{
	tempActivityMode = 2;

}

function openWindow(url, w, h, fullscreen)
{	
    var options = "width=" + w + ",height=" + h + ",";
    options += "resizable=no, scrollbars=no, status=no,";
    options += "menubar=no,toolbar=no,location=no,directories=no";

	if(fullscreen)
	{
		options = "fullscreen";
	}
    var contentWin = window.open(url, 'contentWin', options);
    contentWin.focus();
    return contentWin;
}
// -- Dynamic Launch Data Generator

function logError(str)
{
	alert(str);
}



function log(strMsg, numLevel, strFunction, strArg, strReturn)
{
	var logText = "[Info]";
	if(numLevel == 1)
	{
		logText = "[Warning]"
	}
	else if(numLevel == 2)
	{
		logText = "[Error]"
	}

	if(strFunction)
	{
		logText += "[Function:" + strFunction + "]";
	}
	if(strArg)
	{
		logText += "[Args:" + strArg + "]";
	}
	if(strReturn)
	{
		logText += "[Return:" + strReturn + "]";
	}
	if(strMsg != "" && strMsg != undefined)
	{
		logText += "["+ strMsg + "]"
	}
	logText += "["+new Date()+"]";
	//debugTxtArea.value += logText + "\r";
}

// LMS API Calls

function RVDP_GetLaunchMode()
{
	log("", 0, "RVDP_GetLaunchMode", false, tempActivityMode);
	return tempActivityMode;
}
function GetLessonMode()
{
	log("", 0, "GetLessonMode", false, tempLessonMode);
	return tempLessonMode;
}
function GetEntryMode()
{
	log("", 0, "GetEntryMode", false, tempEntryMode);
	return tempEntryMode;
}
function GetBookmark()
{
	log("", 0, "GetBookmark", false, tempBookmark);
	return tempBookmark;
}
function GetStatus()
{
	log("", 0, "GetStatus", false, tempStatus);
	return tempStatus;
}
function GetSessionAccumulatedTime()
{
	log("", 0, "GetSessionAccumulatedTime", false, tempAccumulatedSessionTime);
	return tempAccumulatedSessionTime;
}
function GetPreviouslyAccumulatedTime()
{
	log("", 0, "GetPreviouslyAccumulatedTime", false, tempAudioPreference);
	return tempPreviouslyAccumulatedTime;
}
function GetAudioPlayPreference()
{
	log("", 0, "GetAudioPlayPreference", false, tempAudioPreference);
	return tempAudioPreference;
}
function RVDP_GetReadingPassageAudioAllowed()
{
	log("", 0, "RVDP_GetReadingPassageAudioAllowed", false, tempReadingAudioPreference);
	return tempReadingAudioPreference;
}
function GetSpeedPreference()
{
	log("", 0, "GetSpeedPreference", false, tempSpeedPreference);
	return tempSpeedPreference;
}
function RVDP_GetPrintPermission()
{
	log("", 0, "RVDP_GetPrintPermission", false, tempPrintPreference);
	return tempPrintPreference;
}
function GetLaunchData()
{
	log("", 0, "GetLaunchData", false, tempLaunchXML);
	return tempLaunchXML;
}
function GetStudentName()
{
	log("", 0, "GetStudentName", false, tempStudentName);
	return tempStudentName;
}
function GetLastError()
{
	log("", 0, "GetLastError", false, tempLastError);
	return tempLastError;
}
function GetLastErrorDesc()
{
	log("", 0, "GetLastErrorDesc", false, tempLastErrorDesc);
	return tempLastErrorDesc;
}
function GetInteractionLearnerResponses(in_strID)
{
	log("", 0, "GetInteractionLearnerResponses", in_strID, tempSavedLearnerResponse);
	return tempSavedLearnerResponse;
}
function RecordFillInInteraction(strID, objResponse, blnCorrect, objCorrect)
{
	log("", 0, "RecordFillInInteraction", strID+"|"+objResponse+"|"+blnCorrect+"|"+objCorrect);
}
function SetSessionTime(arg)
{
	log("", 0, "SetSessionTime", arg);
}
function RVDP_HintUsed()
{
	log("", 0, "RVDP_HintUsed");
}
function RVDP_HelpUsed()
{
	log("", 0, "RVDP_HelpUsed");
}
function RVDP_CalculatorUsed()
{
	log("", 0, "RVDP_CalculatorUsed");
}
function RVDP_RecordCorrectAnswerCount()
{
	log("", 0, "RVDP_RecordCorrectAnswerCount");
}
function RVDP_RecordWrongAnswerCount()
{
	log("", 0, "RVDP_RecordWrongAnswerCount");
}
function RVDP_RecordSkippedQuestionCount(arg)
{
	log("", 0, "RVDP_RecordSkippedQuestionCount", arg);
}
function RVDP_RepeatDirectionUsed()
{
	log("", 0, "RVDP_RepeatDirectionUsed");
}
function RVDP_ContextRequested(arg)
{
	log("", 0, "RVDP_ContextRequested", arg);
}
function SetActivityStatus(arg)
{
	log("", 0, "SetActivityStatus" + arg);
}
function RVDP_PrintingUsed()
{
	log("", 0, "RVDP_PrintingUsed");
}
function RVDP_AudioUsed()
{
	log("", 0, "RVDP_AudioUsed");
}
function RVDP_SentenceUsed()
{
	log("", 0, "RVDP_SentenceUsed");
}
function SetBookmark(arg)
{
	log("", 0, "SetBookmark", arg);
}
function SetDataChunk(arg)
{
	log("", 0, "SetDataChunk", arg);
}
function ConcedeControl()
{
	log("", 0, "ConcedeControl");
	RTEWindow.close();
}
function RVDP_ContinueLearnerSession()
{
	log("", 0, "RVDP_ContinueLearnerSession");
}
function SetReachedEnd()
{
	log("", 0, "SetReachedEnd");
}
function Finish()
{
	log("", 0, "Finish");
	RTEWindow.close();
}
function Suspend()
{
	log("", 0, "Suspend");
	RTEWindow.close();
}
function CommitData()
{
	log("", 0, "CommitData");
}
function PauseTimeTracking()
{
	log("", 0, "PauseTimeTracking");
}
function ResumeTimeTracking()
{
	log("", 0, "ResumeTimeTracking");
}

//--HOUSE API getters
function RVDP_GetSelfPacingState()
{
	return tempSelfPacingState;
}

function RVDP_GetSelfVoicingState()
{
	return tempSelfVoicingState;
}

function RVDP_GetCCState()
{
	return tempCCState;
}

function RVDP_GetSingleSwitchState()
{
	return tempSwitchState;
}

function RVDP_GetScanRate()
{
	return tempScanState;
}

function RVDP_GetScanProgression()
{
	return tempScanProgressionState;
}

function RVDP_GetSoundState()
{
	return tempSoundState;
}

function RVDP_GetSoundVolume()
{
	return tempSoundVolumeState;
}

function RVDP_GetExitState()
{
	return tempExitState;
}

function RVDP_GetPrintState()
{
	return tempPrintState;
}

function RVDP_GetThemeState()
{
	return tempThemeState;
}

function RVDP_GetLMQuestionState()
{
	return tempLMQuestionState;
}

function RVDP_GetLMCaseState()
{
	return tempLMCaseState;
}

function RVDP_GetLMOrderState()
{
	return tempLMOrderState;
}

function RVDP_GetMASState()
{
	return tempMASState;
}

function RVDP_GetKCState()
{
	return tempKCState
}

//--HOUSE API Setters - null 
function RVDP_SetLMState(strCaseState, strOrderState, strQuestionState)
{

}
function RVDP_SetThemeState(strState)
{

}
function RVDP_SetMASState(strState)
{

}
function RVDP_SetKCState(strState)
{

}
function RVDP_SetPrintState(strState)
{

}
function RVDP_SetExitState(strState)
{

}
function RVDP_SetSoundState(strState, strVolume)
{

}
function RVDP_SetSingleSwitchState(strState, strScanRate, strScanProgression)
{

}
function RVDP_SetCCState(strState)
{

}
function RVDP_SetSelfVoicingState(strState)
{

}
function RVDP_SetSelfPacingState(strState)
{

}

