/* * Copyright (C) 2007 Trivantis Corporation */ var bTrivUseLocal=(function() {try {window.sessionStorage.setItem('test','1');window.sessionStorage.removeItem('test');window.localStorage.setItem('test','1');window.localStorage.removeItem('test');return true;} catch (error) {return false;}})();function saveVariable(A,B,C,D,E,F){convertCookies(D,F);if (bTrivUseLocal){var G=C?localStorage:sessionStorage;var H="Lectora"+(D?(":"+Encode(D)):"");var I=G.getItem(H);var J=false;var K="";if (I){var L=I.split(",");for (var i=0;i=4000){if (window.console&&console.log) console.log('convertCookies: VAR too large to process ['+Y+'] length=['+a.length+'] ++++++++++++++++++++++++++++++');if (!B) trivLogMsg('convertCookies found VAR ['+Y+'] too large to process - length is '+a.length);continue;};if (R.length+a.length<4000){R+=a;continue;};var h=N.replace('_',':');document.cookie='~'+h+':'+Q+'='+R+(P?H:'')+'; path=/';if (window.console&&console.log) console.log('convertCookies: saving ['+('~'+N+Q)+'] length=['+R.length+']');if (!B) trivLogMsg('convertCookies saving cookie '+('~'+N+Q)+' with length '+R.length);Q++;R=','+a;}};if (R.length>1){document.cookie='~'+N+Q+'='+R+(P?H:'')+'; path=/';if (window.console&&console.log) console.log('convertCookies: saving ['+('~'+N+Q)+'] length=['+R.length+']');if (!B) trivLogMsg('convertCookies saving cookie '+('~'+N+Q)+' with length '+R.length);}}}};function cleanupTitle(A){if (window.name.indexOf('Trivantis_')==-1){if (window.sessionStorage) window.sessionStorage.setItem('Lectora:suspendData','');window.suspendDataCache=n;var c=null;var m=null;var B="; path=/";var C=new Date();C.setTime(C.getTime()+(-1*24*60*60*1000));B+="; expires="+C.toGMTString();var D='~LectoraTempCookie'+(A?':'+Encode(A):'');var E=new RegExp('^('+D+'[^=]*)');var F=document.cookie.split(';');for (var i=0;i0&&!isNaN(A)){B.tV+=CalcTD(B.f,A);B.uDTV();}else if (B.value=="~~~null~~~"){B.f=0;if (A!==n&&A!==''){if (B.isNumberString(A)){B.value=(divide(Math.round(parseFloat(D)*1000000),1000000)).toString();}else{B.value=A;}}}else{B.f=0;if (A!==n&&A!==''){if (B.isNumberString(A)&&B.isNumberString(B.value.toString())){B.value=(divide(Math.round((parseFloat(C)+parseFloat(D))*1000000),1000000)).toString();}else if (A!="~~~null~~~"){B.value+=A;}}};B.save();};p.sub=function(A){var B=this;B.update();var C=B.value.toString().replace(/,/g,'');var D=A.replace(/,/g,'');if (B.f>0&&!isNaN(A)){B.tV-=CalcTD(B.f,A);B.uDTV();}else if (B.value=="~~~null~~~"){B.f=0;if (B.isNumberString(A)){B.value=(divide(Math.round(parseFloat("-"+D)*1000000),1000000)).toString();}}else{B.f=0;if (A!==n&&A!==""){if (B.isNumberString(A)&&B.isNumberString(B.value.toString())){B.value=(divide(Math.round((parseFloat(C)-parseFloat(D))*1000000),1000000)).toString();}else B.value=B.value.split(A).join('');}};B.save();};p.mult=function(A){var B=this;B.update();if (B.value!="~~~null~~~"){var C=B.value.toString().replace(/,/g,'');var D=A.replace(/,/g,'');if (!isNaN(D)&&!isNaN(C)&&!isNaN(parseFloat(D))&&!isNaN(parseFloat(C))){B.value=(divide(Math.round(parseFloat(C)*parseFloat(D)*1000000),1000000)).toString();};B.save();}};p.div=function(A){var B=this;B.update();if (B.value!="~~~null~~~"){var C=B.value.toString().replace(/,/g,'');var D=A.replace(/,/g,'');if (!isNaN(D)&&!isNaN(C)&&!isNaN(parseFloat(D))&&!isNaN(parseFloat(C))){if (parseFloat(D)!==0){B.value=(divide(Math.round(divide(C*1000000,D)),1000000)).toString();}};B.save();}};p.setByVar=function(A){var B=this;if (A.f>0){A.uDT();}else{A.update();};B.value=A.value;B.f=A.f;B.eTS=A.eTS;B.tV=A.tV;B.save();};p.addByVar=function VarAddVar(A){var B=this;if (A.f>0){A.uDT();if (B.f>0){B.tV+=A.tV;if (A.f==1){B.f=1;};B.uDTV();}else{B.add(A.value);}}else{A.update();B.add(A.value);}};p.subByVar=function(A){var B=this;if (A.f>0){A.uDT();if (B.f>0){B.tV-=A.tV;if (A.f==1){B.f=1;};B.uDTV();}else{B.sub(A.value);}}else{A.update();B.sub(A.value);}};p.isNullOrEmpty=function(){this.update();var A=this.value;return (A=="~~~null~~~"||(A==""&&A!=0));};p.contains=function(A){if (this.isNullOrEmpty()){return 0;};return (String(this.value)).indexOf(A)>=0;};p.equals=function(A){this.update();return (this.value==A);};p.lessThan=function(A){this.update();var B=this.value;if (B=="~~~null~~~"||(B==""&&B!=0)){if (A=="~~~null~~~"||A===""){return 0;}else{return 1;}};if (isNaN(B)||isNaN(A)){return BA;}else{return parseFloat(B)>parseFloat(A);}};p.betweenInc=function(A,B){this.update();if (this.value=="~~~null~~~"||(this.value==""&&this.value!=0)){if (A=="~~~null~~~"||A=="") return 1;else if (B=="~~~null~~~"||B=="") return 1;else return 0;};if (isNaN(this.value)||isNaN(A)||isNaN(B)) return (this.value>=A&&this.value<=B);else return (parseFloat(this.value)>=parseFloat(A)&&parseFloat(this.value)<=parseFloat(B));};p.betweenExc=function(A,B){this.update();if (this.value=="~~~null~~~"||(this.value==""&&this.value!=0)){if (A=="~~~null~~~"||A=="") return 1;else if (B=="~~~null~~~"||B=="") return 1;else return 0;};if (isNaN(this.value)||isNaN(A)||isNaN(B)) return (this.value>A&&this.valueparseFloat(A)&&parseFloat(this.value)parseFloat(D);}else{return 0;}};p.betweenIncNE=function(A,B){this.update();if (this.value=="~~~null~~~"||(this.value==""&&this.value!=0)){if (A=="~~~null~~~"||A=="") return 1;else if (B=="~~~null~~~"||B=="") return 1;else return 0;};var C=this.value.toString().replace(/,/g,'');var D=A.replace(/,/g,'');var E=B.replace(/,/g,'');if (!isNaN(parseFloat(C))&&!isNaN(parseFloat(D))&&!isNaN(parseFloat(E))){return (parseFloat(C)>=parseFloat(D)&&parseFloat(C)<=parseFloat(E));}else{return 0;}};p.betweenExcNE=function(A,B){this.update();if (this.value=="~~~null~~~"||(this.value==""&&this.value!=0)){if (A=="~~~null~~~"||A=="") return 1;else if (B=="~~~null~~~"||B=="") return 1;else return 0;};var C=this.value.toString().replace(/,/g,'');var D=A.replace(/,/g,'');var E=B.replace(/,/g,'');if (!isNaN(parseFloat(C))&&!isNaN(parseFloat(D))&&!isNaN(parseFloat(E))){return (parseFloat(C)>parseFloat(D)&&parseFloat(C)=B-500){return;}else{A.lastUT=B;};var C=n;if (A.cm){if (A.cm<0){A.defVal=readCookie(A.name,A.defVal);A.cm*=-1;};C=getTitleMgrHandle();if (C){var D=String(C.getVariable(A.name,A.defVal,A.exp));A.value=D;}else A.value=A.defVal;}else if (A.aiccframe){C=getTitleMgrHandle();if (A.origAICC){if (A.bSCORM){if (A.name=='cmi.evaluation.course_id'){A.value=A.defVal;}else if (A.name=='cmi.core.lesson_id'){A.value=A.defVal;}else if (A.name!='cmi.core.exit'&&A.name!='cmi.exit'){var E=LMSGetValue(A.name);if (E==n) E=A.defVal;A.value=String(E);};if (C){C.setVariable(A.name,Encode(A.value),A.exp);if (A.name=='cmi.learner_id'){C.setVariable('cmi.core.student_id',A.value,A.exp);};if (A.name=='cmi.learner_name'){C.setVariable('cmi.core.student_name',A.value,A.exp);};if (A.name=='cmi.core.total_time'||A.name=='cmi.total_time'){A.value=UpdateSCORMTotalTime(A.value);}}}else if (A.name=='Core_Lesson'){A.value=getParam(A.aiccgroup);}else if (A.name=='Core_Vendor'){A.value=getParam(A.aiccgroup);}else if (A.name=='Course_ID'){A.value=getParam(A.name);}else{A.value=getParam(A.name);}}else{if (A.bSCORM){A.value=A.defVal;if (C&&C.findVariable(A.name)!=-1){var D=String(C.getVariable(A.name,A.defVal,A.exp));A.value=D;}else{var G=String(GetSuspendData());if (!A.bHidden) trivLogMsg('cmi.suspend_data (unescaped) is currently ['+decodeURIComponent(G)+']');if (G===''){if (C){C.setVariable(A.name,A.value,A.exp);}}else{var H=G.split(';');for (var i=0;i0){A.uDT();}else{var J=readVariable(A.name,A.defVal,A.exp,A.title,A.bHidden);var K=J?J.substr(0,7):n;if (K=="~~f=1~~"){A.tV=parseInt(J.substr(7,J.length-7),10);A.f=1;A.uDTV();}else if (K=="~~f=2~~"){A.tV=parseInt(J.substr(7,J.length-7),10);A.f=2;A.uDTV();}else if (K=="~~f=4~~"){B=new Date();A.tV=parseInt(J.substr(7,J.length-7),10);A.eTS=B.getTime()-A.tV;A.f=4;A.uDTV();}else{A.value=J;}};A.value=EncodeNull(A.value);};p.getValue=function(){this.update();return this.value;};p.getValueForDisplay=function(){var A=this.getValue();return (A&&A.replace?A.replace("~~~null~~~",""):A);};p.isCorr=function(A){this.update();return (this.value.toString()==A)?t:f;};p.isCorrDD=function(A){this.update();var B=this.value.toString();B=B.toLowerCase();B=B.replace(/'/g,"\\'");var C=A.split(",");for (var i=0;i=0) E=true;};if (!E) return false;};return true;};p.isCorrSub=function(A,B){this.update();var C=A.split(",");return (this.value.toString().indexOf(C[B?B:0])>=0)?t:f;};p.isAnsSub=function(A){this.update();var B=','+(A+1)+'-';var C=','+this.value;return (C.indexOf(B)>=0)?t:f;};p.isCorrFIB=function(A,B,C){this.update();var D;var E;var F=f;var G=A.split("~;~");if (!B) E=this.value.toString().toLowerCase();else E=this.value.toString();for (var i=0;i2){if (A.indexOf(";~;")==0) A=A.substring(3);else A=NewEncode(A);};myTop.suspendDataCache=A;if (window.sessionStorage) window.sessionStorage.setItem('Lectora:suspendData',A);};return myTop.suspendDataCache;};function SetSuspendData(A){myTop.suspendDataCache=n;if (window.sessionStorage) window.sessionStorage.setItem('Lectora:suspendData','');LMSSetValue('cmi.suspend_data',";~;"+A);};function NewEncode(A){var B='';if (A!=''){var C=A.split(';');for (var i=0;i