// */
var API = null; /* SCORM API */
/* look up through the frameset hierarchy for the SCORM API */
function findAPI(win)
{
while ((win.API == null) && (win.parent != null) && (win.parent != win))
{
win = win.parent;
}
API = win.API;
}
/* initialize the SCORM API */
function initAPI(win)
{
/* look for the SCORM API up in the frameset */
findAPI(win);
/* if we still have not found the API, look at the opener and its frameset */
if ((API == null) && (win.opener != null))
{
findAPI(win.opener);
}
}
var ScormSubmitted = false; //use this to check whether LMSFinish has been called later.
function ScormStartUp(){
initAPI(window);
if (API != null){
API.LMSInitialize('');
API.LMSSetValue('cmi.core.lesson_status', 'browsed');
API.LMSSetValue('cmi.core.score.min', 0);
API.LMSSetValue('cmi.core.score.max', 100);
API.LMSCommit('');
}
}
function CheckLMSFinish(){
if (API != null){
if (ScormSubmitted == false){
API.LMSCommit('');
API.LMSFinish('');
ScormSubmitted = true;
}
}
}
function SetScormIncomplete(){
if (ScormSubmitted == true){
return;
}
SetScormScore();
if (API != null){
API.LMSSetValue('cmi.core.lesson_status', 'incomplete');
API.LMSSetValue('cmi.core.session_time', MillisecondsToTime((new Date()).getTime() - ScormStartTime));
API.LMSCommit('');
}
}
function SetScormComplete(){
if (API != null){
API.LMSSetValue('cmi.core.session_time', MillisecondsToTime((new Date()).getTime() - ScormStartTime));
API.LMSSetValue('cmi.core.lesson_status', 'completed');
SetScormScore();
API.LMSCommit('');
API.LMSFinish('');
ScormSubmitted = true;
}
}
var ScormStartTime = (new Date()).getTime();
var SuspendData = '';
function SetScormTimedOut(){
if (API != null){
if (ScormSubmitted == false){
SetScormScore();
API.LMSSetValue('cmi.core.exit', 'time-out');
API.LMSCommit('');
CheckLMSFinish();
}
}
}
//TIME RENDERING FUNCTION
function MillisecondsToTime(Seconds){
Seconds = Math.round(Seconds/1000);
var S = Seconds % 60;
Seconds -= S;
if (S < 10){S = '0' + S;}
var M = (Seconds / 60) % 60;
if (M < 10){M = '0' + M;}
var H = Math.floor(Seconds / 3600);
if (H < 10){H = '0' + H;}
return H + ':' + M + ':' + S;
}
function Client(){
//if not a DOM browser, hopeless
this.min = false; if (document.getElementById){this.min = true;};
this.ua = navigator.userAgent;
this.name = navigator.appName;
this.ver = navigator.appVersion;
//Get data about the browser
this.mac = (this.ver.indexOf('Mac') != -1);
this.win = (this.ver.indexOf('Windows') != -1);
//Look for Gecko
this.gecko = (this.ua.indexOf('Gecko') > 1);
if (this.gecko){
this.geckoVer = parseInt(this.ua.substring(this.ua.indexOf('Gecko')+6, this.ua.length));
if (this.geckoVer < 20020000){this.min = false;}
}
//Look for Firebird
this.firebird = (this.ua.indexOf('Firebird') > 1);
//Look for Safari
this.safari = (this.ua.indexOf('Safari') > 1);
if (this.safari){
this.gecko = false;
}
//Look for IE
this.ie = (this.ua.indexOf('MSIE') > 0);
if (this.ie){
this.ieVer = parseFloat(this.ua.substring(this.ua.indexOf('MSIE')+5, this.ua.length));
if (this.ieVer < 5.5){this.min = false;}
}
//Look for Opera
this.opera = (this.ua.indexOf('Opera') > 0);
if (this.opera){
this.operaVer = parseFloat(this.ua.substring(this.ua.indexOf('Opera')+6, this.ua.length));
if (this.operaVer < 7.04){this.min = false;}
}
if (this.min == false){
alert('Your browser may not be able to handle this page.');
}
//Special case for the horrible ie5mac
this.ie5mac = (this.ie&&this.mac&&(this.ieVer<6));
}
var C = new Client();
//for (prop in C){
// alert(prop + ': ' + C[prop]);
//}
//CODE FOR HANDLING NAV BUTTONS AND FUNCTION BUTTONS
//[strNavBarJS]
function NavBtnOver(Btn){
if (Btn.className != 'NavButtonDown'){Btn.className = 'NavButtonUp';}
}
function NavBtnOut(Btn){
Btn.className = 'NavButton';
}
function NavBtnDown(Btn){
Btn.className = 'NavButtonDown';
}
//[/strNavBarJS]
function FuncBtnOver(Btn){
if (Btn.className != 'FuncButtonDown'){Btn.className = 'FuncButtonUp';}
}
function FuncBtnOut(Btn){
Btn.className = 'FuncButton';
}
function FuncBtnDown(Btn){
Btn.className = 'FuncButtonDown';
}
function FocusAButton(){
if (document.getElementById('CheckButton1') != null){
document.getElementById('CheckButton1').focus();
}
else{
if (document.getElementById('CheckButton2') != null){
document.getElementById('CheckButton2').focus();
}
else{
document.getElementsByTagName('button')[0].focus();
}
}
}
//CODE FOR HANDLING DISPLAY OF POPUP FEEDBACK BOX
var topZ = 1000;
function ShowMessage(Feedback){
var Output = Feedback + '
';
document.getElementById('FeedbackContent').innerHTML = Output;
var FDiv = document.getElementById('FeedbackDiv');
topZ++;
FDiv.style.zIndex = topZ;
FDiv.style.top = TopSettingWithScrollOffset(30) + 'px';
FDiv.style.display = 'block';
ShowElements(false, 'input');
ShowElements(false, 'select');
ShowElements(false, 'object');
ShowElements(true, 'object', 'FeedbackContent');
//Focus the OK button
setTimeout("document.getElementById('FeedbackOKButton').focus()", 50);
//
// RefreshImages();
//
}
function ShowElements(Show, TagName, ContainerToReverse){
// added third argument to allow objects in the feedback box to appear
//IE bug -- hide all the form elements that will show through the popup
//FF on Mac bug : doesn't redisplay objects whose visibility is set to visible
//unless the object's display property is changed
//get container object (by Id passed in, or use document otherwise)
TopNode = document.getElementById(ContainerToReverse);
var Els;
if (TopNode != null) {
Els = TopNode.getElementsByTagName(TagName);
} else {
Els = document.getElementsByTagName(TagName);
}
for (var i=0; i
';
if (AllCorrect == false){
Output += '
' + Incorrect;
}
ShowMessage(Output);
setTimeout('WriteToInstructions(Output)', 50);
Score = TotalScore;
CompileGuesses();
if ((AllCorrect == true)||(Finished == true)){
TimeOver = true;
Locked = true;
Finished = true;
setTimeout('Finish()', SubmissionTimeout);
}
if (AllCorrect == true){
SetScormComplete();
}
else{
SetScormIncomplete();
}
}
function TrackFocus(BoxNumber){
CurrentWord = BoxNumber;
InTextBox = true;
}
function LeaveGap(){
InTextBox = false;
}
function CheckBeginning(Guess, Answer){
var OutString = '';
var i = 0;
var UpperGuess = '';
var UpperAnswer = '';
if (CaseSensitive == false) {
UpperGuess = Guess.toUpperCase();
UpperAnswer = Answer.toUpperCase();
}
else {
UpperGuess = Guess;
UpperAnswer = Answer;
}
while (UpperGuess.charAt(i) == UpperAnswer.charAt(i)) {
OutString += Guess.charAt(i);
i++;
}
OutString += Answer.charAt(i);
return OutString;
}
function GetGapValue(GNum){
var RetVal = '';
if ((GNum<0)||(GNum>=I.length)){return RetVal;}
if (document.getElementById('Gap' + GNum) != null){
RetVal = document.getElementById('Gap' + GNum).value;
RetVal = TrimString(RetVal);
}
else{
RetVal = State[GNum].Guesses[State[GNum].Guesses.length-1];
}
return RetVal;
}
function SetGapValue(GNum, Val){
if ((GNum<0)||(GNum>=I.length)){return;}
if (document.getElementById('Gap' + GNum) != null){
document.getElementById('Gap' + GNum).value = Val;
document.getElementById('Gap' + GNum).focus();
}
}
function SetCorrectAnswer(GNum, Val){
if ((GNum<0)||(GNum>=I.length)){return;}
if (document.getElementById('GapSpan' + GNum) != null){
document.getElementById('GapSpan' + GNum).innerHTML = Val;
}
}
function FindCurrent() {
var x = 0;
FoundCurrent = -1;
//Test the current word:
//If its state is not set to already correct, check the word.
if (State[CurrentWord].AnsweredCorrectly == false){
if (CheckAnswer(CurrentWord, false) < 0){
return CurrentWord;
}
}
x=CurrentWord + 1;
while (x
Wstaw dpwiedie literki.