var API_1484_11=null;var infoLMSSpe;var devineErreur;var oRegUri=new RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?");var abandonEnCours=false;var persisteSSP=false;var niveauAudio=1;var ENTREE_PARCOURS=false;function APIAdapter(){this.version="1.0";this.errorCode="0";this.cmi=null;this.ssp=null;this.pointeurTimeoutPersiste=null;this.activite=null;this.objectifCible=null;this.etatCommunication="pasInitialise";this.scoEnAttente=false;this.cibleChoix="";this.modifications=false;this.modificationAlloc=false;this.changementEtatCompletion=false;this.changementEtatObjectif=false;this.changementObjectifSecondaire=false;this.changementInteraction=false;this.changementEtatSession=false;this.changementScore=false;this.depiste=true;this.dateTentativeEnvoi="";this.derniereAffectation="";this.valeurDerniereAffectation="";this.Initialize=LMS_Initialize;this.GetValue=LMS_GetValue;this.SetValue=LMS_SetValue;this.Commit=LMS_Commit;this.Terminate=LMS_Terminate;this.GetLastError=LMS_GetLastError;this.GetErrorString=LMS_GetErrorString;this.GetDiagnostic=LMS_GetDiagnostic;this.compteCollection=LMS_compteCollection;this.donneValeurDansCollection=LMS_donneValeurDansCollection;this.donneObjetDansCollection=LMS_donneObjetDansCollection;this.attributOuErreur=LMS_attributOuErreur;this.affecteDansVocab=LMS_affecteDansVocab;this.affecteDansCollection=LMS_affecteDansCollection;this.impacteSucces=LMS_impacteSucces;this.impacteCompletion=LMS_impacteCompletion;this.impacteSuccesCollObj=LMS_impacteSuccesCollObj;this.appliquerResultatDansSeq=LMS_appliquerResultatDansSeq;}function LMS_Initialize(strParametre){if (strParametre!=""){this.errorCode="201";return "false";} if (this.etatCommunication=="enCours"){this.errorCode="103";return "false";}this.etatCommunication="";this.errorCode="0";this.cibleChoix="";this.derniereAffectation="";this.valeurDerniereAffectation="";this.dateTentativeEnvoi="";window.planLMS.MODE_PREEMPTIF=false;infoLMSSpe="";devineErreur="";if (window.planLMS.ressourceCourante==null||window.planLMS.activiteCourante==null){this.errorCode="102";return "false";}this.activite=window.planLMS.itemCourant;this.cmi=XML_fils(this.activite,"sco");if (this.cmi!=null){var valExit=PF_attr(this.cmi,"exit");this.cmi.removeAttribute("exit");this.cmi.removeAttribute("entry");if (valExit=="suspend"){this.cmi.setAttribute("entry","resume");} else {this.cmi.parentNode.removeChild(this.cmi);this.cmi=null;}}if (this.cmi==null){this.cmi=creerElementCP(this.activite,"sco");this.activite.appendChild(this.cmi);if (niveauAudio!=1){this.cmi.setAttribute("pref_audio_level",niveauAudio);}}if (window.planLMS.oCommentairesLMS!=null){this.cmi.appendChild(window.planLMS.oCommentairesLMS.cloneNode(true));}this.depiste=true;if (window.planLMS.deliveryControls(this.activite,"tracked")=="false"){this.depiste=false;}this.objectifCible=window.planLMS.donneObjectifCible(this.activite,true);var lesobjs=window.planLMS.donneObjectifs(this.activite,false);var objColl=XML_fils(this.cmi,"objectives");window.planLMS.scoDemandeEtatObjectif=true;for (var i=0;i<lesobjs.length;i++){var oObj=lesobjs[i];var lid=PF_attr(oObj,"objectiveID");if (lid!=""){var obpris=0;var numExist=donneNumeroObj(objColl,lid);if (numExist<0){if (objColl!=null){obpris=objColl.childNodes.length;}} else {obpris=numExist;}var debNom="objectives."+obpris+".";if (numExist<0){this.affecteDansCollection(this.cmi,debNom+"id",lid,true);if (objColl==null){objColl=XML_fils(this.cmi,"objectives");}}if (window.planLMS.lireEtatObjectif(oObj,"objectiveMeasureStatus")=="true"){this.affecteDansCollection(this.cmi,debNom+"score_scaled",window.planLMS.lireValeurObjectif(oObj,"objectiveNormalizedMeasure"),false);}if (window.planLMS.lireEtatObjectif(oObj,"objectiveProgressStatus")=="true"){var obValide=window.planLMS.lireValeurObjectif(oObj,"objectiveSatisfiedStatus");var resEtat="failed";if (obValide=="true"){resEtat="passed";}this.affecteDansCollection(this.cmi,debNom+"success_status",resEtat,false);}}}window.planLMS.scoDemandeEtatObjectif=false;if (window.planLMS.lireEtatObjectif(this.objectifCible,"objectiveMeasureStatus")=="true"){this.cmi.setAttribute("score_scaled",window.planLMS.lireValeurObjectif(this.objectifCible,"objectiveNormalizedMeasure"));}if (window.planLMS.lireEtatObjectif(this.objectifCible,"objectiveProgressStatus")=="true"){var obValide=window.planLMS.lireValeurObjectif(this.objectifCible,"objectiveSatisfiedStatus");var resEtat="failed";if (obValide=="true"){resEtat="passed";}this.cmi.setAttribute("success_status",resEtat);}this.ssp=this.cmi;var oDonneesPartages=XML_filsNS(this.activite,"adlcp","data");if (oDonneesPartages!=null){var lesvar=XML_tabElementFils(oDonneesPartages);var numn=0;for (var i=0;i<lesvar.length;i++){var idv=PF_attr(lesvar[i],"targetID");if (idv!=""){var debNom="allocations."+numn+".";this.affecteDansCollection(this.cmi,debNom+"id",idv,true);this.affecteDansCollection(this.cmi,debNom+"requested","64000",false);this.affecteDansCollection(this.cmi,debNom+"persistence","course",false);if (PF_attr(lesvar[i],"readSharedData")=="false"){this.affecteDansCollection(this.cmi,debNom+"read","false",false);}if (PF_attr(lesvar[i],"writeSharedData")=="false"){this.affecteDansCollection(this.cmi,debNom+"write","false",false);}numn++;}}}this.modifications=false; this.changementEtatCompletion=false;this.changementEtatObjectif=false;this.changementEtatSession=false;this.changementObjectifSecondaire=false;this.activite.removeAttribute("affecteEtatCompletion");this.activite.removeAttribute("affecteEtatSucces");this.activite.removeAttribute("affecteEtatCompletionObj");var tabBucks=window.planLMS.donneNoeudsNS(window.planLMS.ressourceCourante,"imsssp","bucket");for (var i=0;i<tabBucks.length;i++){var oBucket=tabBucks[i];var oTaille=XML_filsNS(oBucket,"imsssp","size");if (oTaille){var params="{bucketID="+PF_attr(oBucket,"bucketID")+"}{requested="+PF_attr(oTaille,"requested")+"}{persistence="+PF_attr(oBucket,"persistence")+"}{type="+PF_attr(oBucket,"bucketType")+"}";var succ=this.SetValue("ssp.allocate",params);if (succ!="true"){alert("Can't init bucket: "+params);}}}this.errorCode="0";/*window.haut.NAVIG_majFleches(!window.planLMS.masquePrecedent,!window.planLMS.masqueSuivant);window.planLMS.PLAN_afficheParcours(false);*/this.etatCommunication="enCours";window.planLMS.majBoutonsInit('enCours');return "true";}function LMS_GetValue(mElt){ infoLMSSpe="";if (this.etatCommunication=="pasInitialise"){this.errorCode="122";return "";}if (this.etatCommunication=="termine"){this.errorCode="123";return "";}if (mElt==""){this.errorCode="301";return "";}if (mElt.indexOf("cmi.")!=0 && mElt.indexOf("adl.")!=0 && mElt.indexOf("ssp.")!=0){this.errorCode="401";return "";}if (mElt.indexOf("ssp.")!=0){mElt=mElt.substring(4);}if (mElt==this.derniereAffectation){return this.valeurDerniereAffectation;}this.errorCode="0";if (mElt=="_version"){return "1.0";}if (mElt=="comments_from_learner" || mElt=="learner_preference" || mElt=="interactions" || mElt=="comments_from_lms" || mElt=="objectives" || mElt=="data"){this.errorCode="401";return "";}if (mElt=="comments_from_learner._children"){return "comment,location,timestamp";}if (mElt=="comments_from_learner._count"){return this.compteCollection(this.cmi,"comments_from_learner");}var indTemp=mElt.indexOf("comments_from_learner.");if (indTemp==0){return this.donneValeurDansCollection(this.cmi,mElt,"comment");}if (mElt=="comments_from_lms._children"){return "timestamp,comment,location";}if (mElt=="comments_from_lms._count"){return this.compteCollection(this.cmi,"comments_from_lms");}indTemp=mElt.indexOf("comments_from_lms.");if (indTemp==0){return this.donneValeurDansCollection(this.cmi,mElt,"comment");}if (mElt=="completion_status"){this.impacteCompletion(PF_attr(this.cmi,mElt));if (window.planLMS.peutLireValeurAdlObj("attemptCompletionStatus",this.activite,null)){var resDansObj=window.planLMS.lireValeurAdlObj("attemptCompletionStatus",this.activite,null);if (resDansObj=="false"){return "incomplete";}else if (resDansObj=="true"){return "completed";}}return attributOuDefaut(this.cmi,mElt,"unknown");}if (mElt=="success_status"){this.impacteSucces(PF_attr(this.cmi,"success_status"));return attributOuDefaut(this.cmi,mElt,"unknown");}if (mElt=="completion_threshold"){var objDansitem=XML_filsNS(this.activite,"adlcp","completionThreshold");if (objDansitem==null){this.errorCode="403";return "";}if (objDansitem.attributes.length>0){if (PF_attr(objDansitem,"completedByMeasure")=="true"){return attributOuDefaut(objDansitem,"minProgressMeasure","1.0");} else {this.errorCode="403";return "";}}return XML_texteNoeud(objDansitem);}if (mElt=="credit"){if (lesson_mode=="browse"||lesson_mode=="review"){return "no-credit";}return "credit";}if (mElt=="entry"){return attributOuDefaut(this.cmi,mElt,"ab-initio");}if (mElt=="exit"||mElt=="session_time"){this.errorCode="405";return "";}if (mElt=="interactions._children"){return "id,type,objectives,timestamp,correct_responses,weighting,learner_response,result,latency,description";}if (mElt=="interactions._count"){return this.compteCollection(this.cmi,"interactions");}indTemp=mElt.indexOf("interactions.");if (indTemp==0){var oInter=this.donneObjetDansCollection(this.cmi,mElt,"get");if (oInter==null){this.errorCode="301";return "";}var indCollSub=mElt.indexOf(".objectives.");if (indCollSub>0){mElt=mElt.substring(indCollSub+1);if (mElt=="objectives._count"){return this.compteCollection(oInter,"objectives");}if (mElt.indexOf("id")>0){return this.donneValeurDansCollection(oInter,mElt,"");}this.errorCode="201";return "";}indCollSub=mElt.indexOf(".correct_responses.");if (indCollSub>0){mElt=mElt.substring(indCollSub+1);if (mElt=="correct_responses._count"){return this.compteCollection(oInter,"correct_responses");}if (mElt.indexOf("pattern")>0){return this.donneValeurDansCollection(oInter,mElt,"");}this.errorCode="201";return "";}if (mElt.indexOf(".learner_response")>0){var oReponse=XML_fils(oInter,"learner_response");if (oReponse==null){this.errorCode="403";return "";}return XML_texteNoeud(oReponse);}return this.donneValeurDansCollection(this.cmi,mElt,"");}if (mElt=="launch_data"){var objDansitem=XML_filsNS(this.activite,"adlcp","dataFromLMS");if (objDansitem==null){this.errorCode="403";return "";}return XML_texteNoeud(objDansitem);}if (mElt=="learner_id"){return serveur.vMos_id;}if (mElt=="learner_name"){if (serveur.vMos_nom==""){return "";}return (serveur.vMos_nom +", "+serveur.vMos_prenom);} if (mElt=="learner_preference._children"){return "audio_level,language,delivery_speed,audio_captioning";}if (mElt=="learner_preference.audio_level"){return attributOuDefaut(this.cmi,"pref_audio_level","1");}if (mElt=="learner_preference.language"){return attributOuDefaut(this.cmi,"pref_language",serveur.vMos_lang);}if (mElt=="learner_preference.delivery_speed"){return attributOuDefaut(this.cmi,"pref_delivery_speed","1");}if (mElt=="learner_preference.audio_captioning"){return attributOuDefaut(this.cmi,"pref_audio_captioning","0");}if (mElt=="max_time_allowed"){var mt=window.planLMS.limitConditions(this.activite,"attemptAbsoluteDurationLimit");if (mt=="0.0"){this.errorCode="403";return "";}return mt;}if (mElt=="mode"){if (!this.depiste){return "browse";}return lesson_mode;} if (mElt=="objectives._children"){return "id,completion_status,success_status,description,progress_measure,score";}if (mElt=="objectives._count"){return this.compteCollection(this.cmi,"objectives");} var indTemp=mElt.indexOf("objectives.");if (indTemp==0){var indColl=mElt.substring(11);try {var finp=indColl.indexOf(".");if (finp>0){indColl=indColl.substring(0,finp);} else {indColl=="";}if (indColl=="" || isNaN(indColl)){this.errorCode="401";return "";}} catch(e){}var oObj=this.donneObjetDansCollection(this.cmi,mElt,"get");if (oObj==null){this.errorCode="301";return "";}if (mElt.indexOf(".score.")>0){if (mElt.indexOf(".score._children")>0){return "min,max,scaled,raw";}mElt=nomAttrScore(mElt);if (window.planLMS.OBJECTIFS_ADLSEQ && mElt.indexOf("score.scaled")<0){var champAdl=nomChampScoreAdl(mElt);var objseq0=window.planLMS.donneObjectifId(this.activite,oObj.getAttribute("id"));if (window.planLMS.peutLireValeurAdlObj(champAdl,this.activite,objseq0)){this.errorCode="0";return window.planLMS.lireValeurAdlObj(champAdl,this.activite,objseq0);}}}if (window.planLMS.OBJECTIFS_ADLSEQ && mElt.indexOf(".progress_measure")>0){var objseq0=window.planLMS.donneObjectifId(this.activite,oObj.getAttribute("id"));if (window.planLMS.peutLireValeurAdlObj("attemptProgressMeasure",this.activite,objseq0)){return window.planLMS.lireValeurAdlObj("attemptProgressMeasure",this.activite,objseq0);}}if (window.planLMS.OBJECTIFS_ADLSEQ && mElt.indexOf(".completion_status")>0){var objseq0=window.planLMS.donneObjectifId(this.activite,oObj.getAttribute("id"));if (window.planLMS.peutLireValeurAdlObj("attemptCompletionStatus",this.activite,objseq0)){var res0=window.planLMS.lireValeurAdlObj("attemptCompletionStatus",this.activite,objseq0);if (res0=="false"){return "incomplete";}else if (res0=="true"){return "completed";}}}return this.donneValeurDansCollection(this.cmi,mElt,"");}if (mElt=="location"){return this.attributOuErreur(mElt);}if (mElt=="progress_measure"){return this.attributOuErreur(mElt);}if (mElt=="scaled_passing_score"){var objPrim=this.objectifCible;if (objPrim!=null){var satisfm=window.planLMS.attrObj(objPrim,"satisfiedByMeasure");if (satisfm=="true"){var mnm=XML_filsNS(objPrim,"imsss","minNormalizedMeasure");if (mnm==null){return "1.0";} else {return XML_texteNoeud(mnm);}}}this.errorCode="403";return "";}if (mElt.indexOf("score._children")==0){return "scaled,raw,min,max";}if (mElt.indexOf("score.")==0){if (mElt!="score.scaled"){var champAdl=nomChampScoreAdl(mElt);if (window.planLMS.peutLireValeurAdlObj(champAdl,this.activite,null)){return window.planLMS.lireValeurAdlObj(champAdl,this.activite,null);}}return this.attributOuErreur(nomAttrScore(mElt));}if (mElt=="suspend_data"){var oReponse=XML_fils(this.cmi,"suspend_data");if (oReponse==null){this.errorCode="403";return "";}return XML_texteNoeud(oReponse);}if (mElt=="time_limit_action"){var objDansitem=XML_filsNS(this.activite,"adlcp","timeLimitAction");if (objDansitem==null){this.errorCode="403";return "";}return XML_texteNoeud(objDansitem);}if (mElt=="total_time"){return attributOuDefaut(this.cmi,"total_time","PT0S");}if (mElt.indexOf("nav.request")==0){if (mElt=="nav.request"){return attributOuDefaut(this.cmi,"nav_request","_none_");}if (mElt=="nav.request_valid.continue"){return window.haut.NAVIG_requete("continue",true);}if (mElt=="nav.request_valid.previous"){return window.haut.NAVIG_requete("previous",true);}if (mElt.indexOf("nav.request_valid.choice")==0){var inf=mElt.indexOf("{target=");var sup=mElt.indexOf("}");if (inf>0 && inf<sup){window.planLMS.activiteSpecifieParChoixPreemptif=mElt.substring(inf+8,sup);return window.haut.NAVIG_requete("choice",true);} else {this.errorCode="301";return "";}}if (mElt.indexOf("nav.request_valid.jump")==0){var inf=mElt.indexOf("{target=");var sup=mElt.indexOf("}");if (inf>0 && inf<sup){window.planLMS.activiteSpecifieParChoixPreemptif=mElt.substring(inf+8,sup);return window.haut.NAVIG_requete("jump",true);} else {this.errorCode="301";return "";}}}if (mElt=="data._count" || mElt=="ssp._count"){return this.compteCollection(this.ssp,"allocations");}if (mElt.indexOf("ssp.")==0){mElt=mElt.replace("ssp.","allocations.");var indIdbk=mElt.indexOf("{bucketID=");if (indIdbk>0){var num=donneNumeroBucket(this.ssp,mElt);if (num<0){this.errorCode="301";return "";}mElt=mElt.replace("allocations.","allocations."+num+".");}if (mElt.indexOf(".bucket_state")>0){var oAlloc=this.donneObjetDansCollection(this.ssp,mElt,"get");if (oAlloc){var donnee=XML_texteNoeud(oAlloc);var letat="{totalSpace="+oAlloc.getAttribute("requested")+"}{used="+donnee.length*2+"}";var ltype=PF_attr(oAlloc,"type");if (ltype!=""){letat+="{type="+ltype+"}";}return letat;}} else if (mElt.indexOf(".data")>0){var oAlloc=this.donneObjetDansCollection(this.ssp,mElt,"get");if (oAlloc){var offset=paramParenthese("offset",mElt);var size=paramParenthese("size",mElt);var donnees=chargerAllocation(oAlloc);if (offset!=""){offset=parseInt(offset)/2;if (offset<=donnees.length){donnees=donnees.substring(offset);} else {this.errorCode="301";infoLMSSpe="The requested data exceeds available data";}}if (size!=""){size=parseInt(size)/2;if (donnees.length>=size){donnees=donnees.substring(0,size);} else {this.errorCode="301";infoLMSSpe="The requested data exceeds available data";}}return donnees;}} else {return this.donneValeurDansCollection(this.ssp,mElt,"");}}if (mElt.indexOf("data.")==0){if (mElt=="data._children"){return "id,store";}mElt=mElt.replace("data.","allocations.");if (mElt.indexOf(".id")>0){return this.donneValeurDansCollection(this.ssp,mElt,"");}if (mElt.indexOf(".store")>0){var oAlloc=this.donneObjetDansCollection(this.ssp,mElt,"get");if (oAlloc){if (PF_attr(oAlloc,"read")=="false"){this.errorCode="405";return "";}var resA=chargerAllocation(oAlloc);if (resA==""){this.errorCode="403";}return resA;} else {this.errorCode="301";return "";}}}this.errorCode="201";return "";}function LMS_SetValue(mElt,strValeur){infoLMSSpe="";devineErreur="";this.derniereAffectation="";window.planLMS.MODE_PREEMPTIF=false;if (this.etatCommunication=="pasInitialise"){this.errorCode="132";return "false";}if (this.etatCommunication=="termine"){this.errorCode="133";return "false";}if (mElt==""){this.errorCode="351";return "false";}if (mElt.indexOf("cmi.")!=0 && mElt.indexOf("adl.")!=0 && mElt.indexOf("ssp.")!=0){this.errorCode="401";return "false";}if (mElt.indexOf("ssp.")!=0){mElt=mElt.substring(4);}this.errorCode="0";this.modifications=true;if (mElt=="interactions" || mElt=="learner_preference" || mElt=="objectives" || mElt=="comments_from_learner" || mElt=="comments_from_lms"){this.errorCode="401";return "false";}if (mElt=="_version"||mElt.indexOf("._children")>0||mElt.indexOf("._count")>0||mElt.indexOf("comments_from_lms")==0||mElt=="completion_threshold"||mElt=="credit"||mElt=="entry"||mElt=="time_limit_action"||mElt=="launch_data"||mElt=="scaled_passing_score"||mElt=="total_time"){this.errorCode="404";return "false";}if (mElt=="learner_id"||mElt=="learner_name"||mElt=="max_time_allowed"||mElt=="mode"||mElt.indexOf("nav.request_valid")==0){this.errorCode="404";return "false";}if (mElt.indexOf("comments_from_learner")==0){if (mElt.indexOf(".comment")>0){return this.affecteDansCollection(this.cmi,mElt,strValeur,true);}if (mElt.indexOf(".location")>0||mElt.indexOf(".timestamp")>0){return this.affecteDansCollection(this.cmi,mElt,strValeur,true);}}if (mElt!="session_time"){window.planLMS.dateDerniereActionLMS=(new Date()).getTime();}if (mElt=="completion_status"){var ancVal=PF_attr(this.cmi,"completion_status");var resSet=this.affecteDansVocab(this.cmi,mElt,strValeur,"completed,incomplete,not attempted,unknown");if (resSet=="false"){return "false";}this.impacteCompletion(ancVal);if (strValeur!=""){this.activite.setAttribute("affecteEtatCompletion","1");}this.errorCode="0";return "true";}if (mElt=="exit"){var resS=this.affecteDansVocab(this.cmi,mElt,strValeur,"time-out,suspend,logout,,normal");if (resS && (strValeur=="time-out"||strValeur=="logout")){this.cmi.setAttribute("nav_request","_none_");} return resS;}if (mElt.indexOf("interactions.")==0){var lespossibles=",id,type,timestamp,objectives,correct_responses,weighting,learner_response,result,latency,description,pattern,";var verifAttr=mElt.substring(mElt.lastIndexOf(".")+1);if (lespossibles.indexOf(","+verifAttr+",")>=0){var creer=false;this.changementInteraction=true;var oInter=this.donneObjetDansCollection(this.cmi,mElt,"set");if (mElt.indexOf(".id")>0){creer=true;} else if ((mElt.indexOf(".learner_response")>0)||(mElt.indexOf(".pattern")>0)){if (oInter==null){this.errorCode="408";if (devineErreur=="depasseIndex0"){this.errorCode="351";}return "false";}if (PF_attr(oInter,"type")==""){this.errorCode="408";return "false";}}var indObj=mElt.indexOf(".objectives.");if (indObj<0){indObj=mElt.indexOf(".correct_responses.");}if (indObj>0){mElt=mElt.substring(indObj+1);if (oInter==null){this.errorCode="408";if ((mElt.indexOf(".id")>0)&&(devineErreur=="depasseIndex0")){this.errorCode="351";}return "false";}return this.affecteDansCollection(oInter,mElt,strValeur,true);}if (mElt.indexOf(".type")>0){var lestypes=",true-false,choice,fill-in,long-fill-in,matching,performance,sequencing,likert,numeric,other,";if (lestypes.indexOf(","+strValeur+",")<0){this.errorCode="406";return "false";}}if (mElt.indexOf(".result")>0){if (strValeur==""){this.errorCode="406";return "false";}var lestypes=",correct,incorrect,neutral,unanticipated,";if (lestypes.indexOf(","+strValeur+",")<0){if (isNaN(Number(strValeur))){this.errorCode="406";return "false";}}}return this.affecteDansCollection(this.cmi,mElt,strValeur,creer);}infoLMSSpe="Invalid argument";}if (mElt=="learner_preference.audio_level"){this.errorCode=verifReelBorne(strValeur,0,"*");if (this.errorCode=="0"){niveauAudio=strValeur;this.cmi.setAttribute("pref_audio_level",strValeur);return "true";}return "false";}if (mElt=="learner_preference.language"){if (!verifFormatLangue(strValeur)){this.errorCode="406";return "false";}this.cmi.setAttribute("pref_language",strValeur);return "true";}if (mElt=="learner_preference.delivery_speed"){this.errorCode=verifReelBorne(strValeur,0,"*");if (this.errorCode=="0"){this.cmi.setAttribute("pref_delivery_speed",strValeur);return "true";}return "false";}if (mElt=="learner_preference.audio_captioning"){return this.affecteDansVocab(this.cmi,"pref_audio_captioning",strValeur,"-1,0,1");}if (mElt=="location"){this.cmi.setAttribute("location",strValeur);return "true";}if (mElt.indexOf("objectives.")==0){var lespossibles=",id,scaled,min,raw,max,success_status,completion_status,progress_measure,description,";var verifAttr=mElt.substring(mElt.lastIndexOf(".")+1);if (lespossibles.indexOf(","+verifAttr+",")>=0){var creer=false;var oObj=this.donneObjetDansCollection(this.cmi,mElt,"set");if (verifAttr=="id"){creer=true;} else if (oObj==null){this.errorCode="351";/*if (mElt.indexOf(".score.")>0){this.errorCode="408";}*/var indColl=mElt.substring(11);indColl=indColl.substring(0,indColl.indexOf("."));if (indColl=="0"){this.errorCode="408";}return "false";}if (mElt.indexOf(".score.")>0){mElt=nomAttrScore(mElt);if (mElt.indexOf(".score_scaled")>0){this.errorCode=verifReelBorne(strValeur,-1,1);if (this.errorCode!="0"){return "false";}var strAncien=PF_attr(oObj,"score_scaled");oObj.setAttribute("score_scaled",strValeur);if (strAncien!=strValeur){this.impacteSuccesCollObj(oObj);}return "true";} else if (window.planLMS.OBJECTIFS_ADLSEQ){if (isNaN(Number(strValeur))){this.errorCode="406";return "false";}window.planLMS.appliqueValeurAdlObj(nomChampScoreAdl(mElt),strValeur,this.activite,window.planLMS.donneObjectifId(this.activite,PF_attr(oObj,"id")));}}if (mElt.indexOf(".success_status")>0){var strAncien=PF_attr(oObj,"success_status");var resSet=this.affecteDansVocab(oObj,"success_status",strValeur,"passed,failed,unknown");if (resSet=="false"){return "false";}if (strAncien!=strValeur){this.impacteSuccesCollObj(oObj);}if (window.planLMS.deliveryControls(this.activite,"objectiveSetByContent")=="false"){if (strValeur=="unknown" && oObj.getAttribute("id")==PF_attr(this.objectifCible,"objectiveID")){this.objectifCible.setAttribute("affecteInconnu","1");}}return "true";}if (mElt.indexOf(".completion_status")>0){if (window.planLMS.OBJECTIFS_ADLSEQ && PF_attr(oObj,"completion_status")!=strValeur){this.impacteSuccesCollObj(oObj);}return this.affecteDansVocab(oObj,"completion_status",strValeur,"completed,incomplete,not attempted,unknown");}if (mElt.indexOf(".progress_measure")>0){this.errorCode=verifReelBorne(strValeur,0,1);if (this.errorCode!="0"){return "false";}if (window.planLMS.OBJECTIFS_ADLSEQ){this.impacteSuccesCollObj(oObj);}}return this.affecteDansCollection(this.cmi,mElt,strValeur,creer);}infoLMSSpe="Invalid argument";}if (mElt=="progress_measure"){this.errorCode=verifReelBorne(strValeur,0,1);if (this.errorCode!="0"){return "false";}this.cmi.setAttribute("progress_measure",strValeur);this.impacteCompletion(PF_attr(this.cmi,"completion_status"));if (this.depiste){this.activite.setAttribute("attemptCompletionAmount",strValeur);this.activite.setAttribute("attemptCompletionAmountStatus","true");}this.errorCode="0";return "true";}if (mElt.indexOf("score.")==0){mElt=nomAttrScore(mElt);if (mElt=="score_scaled"){this.errorCode=verifReelBorne(strValeur,-1,1);if (this.errorCode!="0"){return "false";}var ancienScore=PF_attr(this.cmi,"score_scaled");this.cmi.setAttribute("score_scaled",strValeur);if (this.depiste){if (ancienScore!=strValeur){this.changementScore=true;this.cmi.setAttribute("modifObjPrinc","oui");this.impacteSucces(PF_attr(this.cmi,"success_status"));}var scoreTrans=reelScore(strValeur);window.planLMS.enregistrerObjectif(this.objectifCible,"objectiveNormalizedMeasure",scoreTrans,true);}this.errorCode="0";return "true";}if (mElt=="score_raw"||mElt=="score_max"||mElt=="score_min"){if (isNaN(Number(strValeur))){this.errorCode="406";return "false";}window.planLMS.appliqueValeurAdlObj(nomChampScoreAdl(mElt),strValeur,this.activite,null);this.cmi.setAttribute(mElt,strValeur);return "true";}}if (mElt=="session_time"){strValeur=sansZeroAvant(strValeur);if (verifIntervalleTemps(strValeur)){this.cmi.setAttribute(mElt,strValeur);return "true";} else {this.errorCode="406";return "false";}}if (mElt=="success_status"){var ancienEtat=PF_attr(this.cmi,"success_status");var resSet=this.affecteDansVocab(this.cmi,"success_status",strValeur,"passed,failed,unknown");if (resSet=="false"){return "false";}this.impacteSucces(ancienEtat);if (strValeur!=""){this.activite.setAttribute("affecteEtatSucces","1");}this.errorCode="0";return "true";}if (mElt=="suspend_data"){var oSusp=XML_fils(this.cmi,"suspend_data");if (oSusp==null){oSusp=creerElementCP(this.cmi,"suspend_data");this.cmi.appendChild(oSusp);}XML_modifTexteNoeud(oSusp,strValeur);return "true";}if (mElt=="nav.request"){if (strValeur.indexOf("}choice")>0||strValeur.indexOf("}jump")>0){var inf=strValeur.indexOf("{target=");var sup=strValeur.indexOf("}");if (inf==0&&sup>inf){var cible=strValeur.substring(inf+8,sup);if (cible.length>0){this.cmi.setAttribute("nav_request",strValeur);this.cibleChoix=cible;return "true";}}this.errorCode="406";return "false";} else {this.cibleChoix="";if (strValeur=="suspendAll"){this.cmi.setAttribute("exit","");}return this.affecteDansVocab(this.cmi,"nav_request",strValeur,"continue,previous,choice,jump,exit,exitAll,abandon,abandonAll,suspendAll,_none_");}}if (mElt=="ssp.allocate"){var bucketID=paramParenthese("bucketID",strValeur);if (!verifFormatID(bucketID)){this.errorCode="406";return "false";}var requested=paramParenthese("requested",strValeur);if (requested=="" || parseInt(requested)<=0){this.errorCode="406";return "false";}requested=parseInt(requested);var persistence=paramParenthese("persistence",strValeur);if (persistence==""){persistence="learner";}var type=paramParenthese("type",strValeur);var oExiste=donneBucket(this.ssp,bucketID);var recopieDepuisGlobal=false;if (oExiste==null){recopieDepuisGlobal=true;oExiste=XML_trouveNoeud(window.planLMS.allocationsGlobales,"allocation","id",bucketID);}if (oExiste){if (oExiste.getAttribute("persistence")==persistence && type==PF_attr(oExiste,"type")){if (recopieDepuisGlobal){this.affecteDansCollection(this.ssp,"allocations."+this.GetValue("ssp._count")+".id",bucketID,true);var oAlloc=donneBucket(this.ssp,bucketID);oAlloc.parentNode.replaceChild(oExiste.cloneNode(true),oAlloc);oExiste=donneBucket(this.ssp,bucketID);}oExiste.setAttribute("allocation_success","requested");return "true";} else {if (!recopieDepuisGlobal){oExiste.setAttribute("allocation_success","failure");}infoLMSSpe="Allocation failure";return "false";}} else {this.affecteDansCollection(this.ssp,"allocations."+this.GetValue("ssp._count")+".id",bucketID,true);var oAlloc=donneBucket(this.ssp,bucketID);oAlloc.setAttribute("allocation_success","requested");oAlloc.setAttribute("requested",requested);oAlloc.setAttribute("persistence",persistence);if (type!=""){oAlloc.setAttribute("type",type);}return "true";}}if (mElt.indexOf("ssp.")==0){infoLMSSpe="";mElt=mElt.replace("ssp.","allocations.");if (mElt=="allocations.data" || mElt=="allocations.appendData"){var indIdbk=donneNumeroBucket(this.ssp,strValeur);if (indIdbk<0){this.errorCode="351";infoLMSSpe="Bucket not found";return "false";}mElt=mElt.replace("allocations.","allocations."+indIdbk+".");var oReg=new RegExp("{bucketID=[^}]+}");strValeur=strValeur.replace(oReg,"");}if (mElt.indexOf(".data")>0 || mElt.indexOf(".appendData")>0){var oAlloc=this.donneObjetDansCollection(this.ssp,mElt,"get");if (oAlloc){var offset=0;var tailleMax=parseInt(PF_attr(oAlloc,"requested"))/2;var resDonne="";if (mElt.indexOf(".data")>0){offset=paramParenthese("offset",strValeur);if (offset!=""){offset=parseInt(offset)/2;var oReg=new RegExp("{offset=[^}]+}");strValeur=strValeur.replace(oReg,"");}}if (offset>0 || mElt.indexOf(".appendData")>0){var valInit=chargerAllocation(oAlloc);if (offset>0){if (offset>valInit.length){this.errorCode="351";infoLMSSpe="The bucket was not packed";return "false";}var valDeb=valInit.substring(0,offset);var valFin="";var indFin=offset+strValeur.length;if (indFin<valInit.length){valFin=valInit.substring(indFin);}resDonne=valDeb+strValeur+valFin;}if (mElt.indexOf(".appendData")>0){resDonne=valInit+strValeur;}} else {resDonne=strValeur;}/*if (resDonne.length>tailleMax){this.errorCode="351";infoLMSSpe="Exceeds bucket size";return "false";*/if (oAlloc.getAttribute("persistence")!="session"){var oExisteGlob=XML_trouveNoeud(window.planLMS.allocationsGlobales,"allocation","id",oAlloc.getAttribute("id"));if (oExisteGlob==null){var oNouv=ajouterAllocationGlobale(oAlloc);oNouv.setAttribute("modif","oui");XML_modifTexteNoeud(oNouv,resDonne);} else {XML_modifTexteNoeud(oExisteGlob,resDonne);oExisteGlob.setAttribute("modif","oui");}this.modificationAlloc=true;persisteSSP=true;} else {XML_modifTexteNoeud(oAlloc,resDonne);}return "true";}}}if (mElt.indexOf("data.")==0){mElt=mElt.replace("data.","allocations.");if (mElt.indexOf(".id")>0){this.errorCode="404";return "false";}if (mElt.indexOf(".store")>0){var oAlloc=this.donneObjetDansCollection(this.ssp,mElt,"get");if (oAlloc){if (strValeur.length>64000){this.errorCode="406";return "false";}if (PF_attr(oAlloc,"write")=="false"){this.errorCode="404";return "false";}var oExiste=XML_trouveNoeud(window.planLMS.allocationsGlobales,"allocation","id",PF_attr(oAlloc,"id"));if (oExiste==null){oExiste=ajouterAllocationGlobale(oAlloc);oExiste.setAttribute("modif","oui");this.modificationAlloc=true;persisteSSP=true;} else {if (XML_texteNoeud(oExiste)!=strValeur){oExiste.setAttribute("modif","oui");this.modificationAlloc=true;persisteSSP=true;}}strValeur=new String(strValeur);XML_modifTexteNoeud(oExiste,strValeur);this.derniereAffectation=mElt;this.valeurDerniereAffectation=strValeur;return "true";} else {this.errorCode="351";return "false";}}}/*this.errorCode="351";*/this.errorCode="401";return "false";}function donneBucket(obj,lid){return XML_trouveNoeud(obj,"allocation","id",lid);}function donneNumeroBucket(obj,str){var obk=donneBucket(obj,paramParenthese("bucketID",str));if (obk){var num=0;var oprec=obk.previousSibling;while (oprec){num++;oprec=oprec.previousSibling;}return num;}return -1;}function paramParenthese(attr,str){var indeB=str.indexOf("{"+attr+"=");if (indeB>=0){str=str.substring(indeB+attr.length+2);return str.substring(0,str.indexOf("}"));}return "";}function LMS_compteCollection(objR,nomColl){var lesobjs=XML_fils(objR,nomColl);if (lesobjs!=null){return lesobjs.childNodes.length+"";} return "0";}function peutEnregistrerTentative(oCmi){if (modeTentative=="aucune"){return false}/*if (PF_attr(oCmi,"exit")!="suspend"){return true;}*/if (PF_attr(oCmi,"score_scaled")=="" || (PF_attr(oCmi,"success_status")!="failed" && PF_attr(oCmi,"success_status")!="passed")){var existeInconnu=XML_trouveNoeud(oCmi,"objective","success_status","unknown");if (existeInconnu==null){return false;}}if (PF_attr(oCmi,"completion_status")=="completed"){return true;}if (PF_attr(oCmi,"exit")=="suspend"){return false;}return true;}function LMS_Commit(strParametre){if (this.etatCommunication=="pasInitialise"){this.errorCode="142";return "false";}if (this.etatCommunication=="termine"){this.errorCode="143";return "false";}if (strParametre!=""){this.errorCode="201";return "false";}if (abandonEnCours){return false;}this.errorCode="0"; if (this.modifications){this.appliquerResultatDansSeq();this.errorCode="0";parcoursEnregistre=false;if (peutEnregistrerTentative(this.cmi)){var existeInteractions=(this.compteCollection(this.cmi,"interactions")>0);var nbObjectifs=this.compteCollection(this.cmi,"objectives");var existeObjectifs=(nbObjectifs>1);var tentaObjSansInter=false;if (existeObjectifs && PF_attr(this.cmi,"completion_status")=="completed"){tentaObjSansInter=true;}if (existeInteractions || tentaObjSansInter){var oScSauve=XML_fils(this.cmi.ownerDocument.documentElement,"gardeReponses");if (oScSauve==null){oScSauve=creerElementCP(this.cmi,"gardeReponses");this.cmi.ownerDocument.documentElement.appendChild(oScSauve);}var idItemCourant=this.activite.getAttribute("identifier");var oExiste=XML_trouveNoeud(oScSauve,"tentative","idItem",idItemCourant);var tempsSession=PF_attr(this.cmi,"session_time");var tempsPasse0=0;if (tempsSession!=""){tempsPasse0=Math.round(intervalleEnMS(tempsSession)/1000);}var memeTentative=false;if (oExiste!=null){if (PF_attr(this.cmi,"score_scaled")==PF_attr(oExiste,"score_scaled")){if (tempsPasse0==PF_attr(oExiste,"tempsPasse")){memeTentative=true;}}}if (this.dateTentativeEnvoi!=""){if (!this.changementInteraction && !this.changementEtatObjectif&& !this.changementScore && !this.changementObjectifSecondaire){memeTentative=true;}}if (!memeTentative){if (SUR_CHORUS && oExiste){oScSauve.removeChild(oExiste);}var oRep=creerElementCP(this.cmi,"tentative");oRep.setAttribute("idItem",idItemCourant);if (this.dateTentativeEnvoi==""){this.dateTentativeEnvoi=getDateServeur('');}oRep.setAttribute("dateTentative",this.dateTentativeEnvoi);oRep.setAttribute("tempsPasse",tempsPasse0);oRep.setAttribute("etatItem",PF_attr(this.cmi,"success_status"));oRep.setAttribute("score_scaled",PF_attr(this.cmi,"score_scaled"));oRep.setAttribute("score_raw",PF_attr(this.cmi,"score_raw"));oRep.setAttribute("score_max",PF_attr(this.cmi,"score_max"));if (oRep.getAttribute("score_raw")==""){oRep.setAttribute("score_raw",Number(PF_attr(this.cmi,"score_scaled"))*100);}if (oRep.getAttribute("score_max")==""){oRep.setAttribute("score_max","100");}if (nbObjectifs>0){oRep.appendChild(XML_fils(this.cmi,"objectives").cloneNode(true));}if (existeInteractions){oRep.appendChild(XML_fils(this.cmi,"interactions").cloneNode(true));}oScSauve.appendChild(oRep);oScSauve.setAttribute("modifGR","oui");}this.changementInteraction=false;}}if (this.changementEtatCompletion || this.changementEtatObjectif || this.changementScore || this.changementObjectifSecondaire || this.modificationAlloc){if (this.pointeurTimeoutPersiste!=null){window.clearTimeout(this.pointeurTimeoutPersiste);}this.pointeurTimeoutPersiste=window.setTimeout("LMS_persisteParcours(true)",3000);}if (this.changementEtatObjectif){this.changementEtatSession=true;window.planLMS.nettoyerDejaFait(this.activite);}if (!this.scoEnAttente && this.changementEtatObjectif && this.GetValue("adl.nav.request")=="_none_"){setTimeout("window.planLMS.majBoutonsInit('enCours')",1100);}this.changementEtatCompletion=false;this.changementEtatObjectif=false;this.changementObjectifSecondaire=false;this.changementScore=false;this.modificationAlloc=false;if (this.depiste){this.activite.setAttribute("dateRemonte",getDateServeur('milli'));}} return "true";}function LMS_Terminate(strParametre) {infoLMSSpe="";if (this.etatCommunication=="pasInitialise"){this.errorCode="112";return "false";}if (this.etatCommunication=="termine"){this.errorCode="113";return "false";}if (strParametre!=""){this.errorCode="201";return "false";} this.errorCode="0"; var valTempsSession=PF_attr(this.cmi,"session_time");if (valTempsSession!=""){var tempTotalPrec=this.GetValue("cmi.total_time");if (tempTotalPrec!="PT0S"){var sTotal=ajouterIntervalle(valTempsSession,tempTotalPrec);this.cmi.setAttribute("total_time",sTotal);this.activite.setAttribute("attemptAbsoluteDuration",sTotal);} else {this.cmi.setAttribute("total_time",valTempsSession);this.activite.setAttribute("attemptAbsoluteDuration",ajouterIntervalle(valTempsSession,PF_attr(this.activite,"attemptAbsoluteDuration")));}}var sequenceProposee="";var valExit=PF_attr(this.cmi,"exit");if (!this.scoEnAttente){var valReq=this.GetValue("adl.nav.request");if (valReq!="_none_"){if (valReq.indexOf("}choice")>0){window.planLMS.activiteSpecifieParChoix=this.cibleChoix;sequenceProposee="choice";} else if (valReq.indexOf("}jump")>0){window.planLMS.activiteSpecifieParChoix=this.cibleChoix;sequenceProposee="jump";} else {sequenceProposee=valReq;if (sequenceProposee=="suspendAll" && (valExit==""||valExit=="normal")){this.SetValue("cmi.exit","suspend");valExit=PF_attr(this.cmi,"exit");}}}}if (valExit=="time-out" || valExit=="logout"){sequenceProposee="exitAll";this.scoEnAttente=false;}if (sequenceProposee=="abandonAll" || sequenceProposee=="abandon"){abandonEnCours=true;}if (valTempsSession!=""){remonterTempsTot(this.activite);}this.cmi.removeAttribute("session_time");if (valExit!="suspend"){this.cmi.parentNode.removeChild(this.cmi);} else {this.activite.setAttribute("activityIsSuspended","true");this.modifications=true;planLMS.affecteActiviteSuspendue(this.activite);this.cmi.removeAttribute("nav_request");}this.Commit("");this.etatCommunication="termine";this.errorCode="0"; if (this.scoEnAttente){this.etatCommunication="pasInitialise";this.scoEnAttente=false;} else if(sequenceProposee!=""){this.etatCommunication="pasInitialise"; if (sequenceProposee=="exit"){chargerPageDefaut();}window.haut.NAVIG_requete(sequenceProposee,false);} else {}return "true";}function chargerPageDefaut(){if (SUR_CHORUS){window.contenuLMS.location=window.planLMS.adrPageDefaut("susp");} else {setTimeout("window.planLMS.ecritMsgBlanc(21)",500);window.contenuLMS.location=RACINE_stage+"MosMtr/gen/blanc.htm";}}function LMS_GetLastError(){ return this.errorCode;}function LMS_GetDiagnostic(numStr){ return this.GetErrorString(numStr)+"\n"+infoLMSSpe;}function LMS_GetErrorString(c){var r="";if(c=="0"){r="No Error";}if(c=="101"){r="General Exception";}if(c=="102"){r="General Initialization Failure";}if(c=="103"){r="Already Initialized";}if(c=="104"){r="Content Instance Terminated";}if(c=="111"){r="General Termination Failure";}if(c=="112"){r="Termination Before Initialization";}if(c=="113"){r="Termination After Termination";}if(c=="122"){r="Retrieve Data Before Initialization";}if(c=="123"){r="Retrieve Data After Termination";}if(c=="132"){r="Store Data Before Initialization";}if(c=="133"){r="Store Data After Termination";}if(c=="142"){r="Commit Before Initialization";}if(c=="143"){r="Commit After Termination";}if(c=="201"){r="General Argument Error";}if(c=="301"){r="General Get Failure";}if(c=="351"){r="General Set Failure";}if(c=="391"){r="General Commit Failure";}if(c=="401"){r="Undefined Data Model Element";}if(c=="402"){r="Unimplemented Data Model Element";}if(c=="403"){r="Data Model Element Value Not Initialized";}if(c=="404"){r="Data Model Element Is Read Only";}if(c=="405"){r="Data Model Element Is Write Only";}if(c=="406"){r="Data Model Element Type Mismatch";}if(c=="407"){r="Data Model Element Value Out Of Range";}if(c=="408"){r="Data Model Dependency Not Established";}return r;}function LMS_donneValeurDansCollection(objR,mElt,nomContenuNoeud){var tabParams=mElt.split(".");var objetDansColl=this.donneObjetDansCollection(objR,mElt,"get");if (objetDansColl==null){this.errorCode="301";return "";}if (tabParams[2]==nomContenuNoeud){return XML_texteNoeud(objetDansColl);}var attr=objetDansColl.getAttribute(tabParams[2]);if (attr==null){if (tabParams[2]=="completion_status" || tabParams[2]=="success_status"){attr="unknown";}else {this.errorCode="403";if (mElt.indexOf(".pattern")>0){this.errorCode="301";}return "";}}return attr;}function LMS_donneObjetDansCollection(objR,mElt,transfert){var tabParams=mElt.split(".");if (tabParams.length<3){infoLMSSpe="Not enough arguments";this.errorCode="201";return null;}var oContainer=XML_fils(objR,tabParams[0]);if (oContainer==null){if (transfert=="get"){infoLMSSpe=tabParams[0]+" not found";} else if (tabParams[1]>0) {devineErreur="depasseIndex0";}return null;}var indColl=parseInt(tabParams[1]);if (indColl>=oContainer.childNodes.length){if (transfert=="get"){infoLMSSpe="Index "+indColl+" greater than '"+tabParams[0]+"' collection size";this.errorCode="301";} else {devineErreur="depasseTailleIndex";}return null;}return oContainer.childNodes.item(indColl);}function attributOuDefaut(obj,nomAttr,valDefaut){var attr=obj.getAttribute(nomAttr);if (attr==null){attr=valDefaut;}return attr; }function LMS_attributOuErreur(nomAttr,valDefaut){var attr=this.cmi.getAttribute(nomAttr);if (attr==null){this.errorCode="403";return "";}return attr; }function LMS_affecteDansVocab(obj,nomAttr,valAttr,lsVocab){lsVocab=","+lsVocab+",";if (lsVocab.indexOf(","+valAttr+",")>=0){obj.setAttribute(nomAttr,valAttr);return "true";}infoLMSSpe="Value '"+valAttr+"' not in vocabulary";this.errorCode="406";return "false"; }function nomAttrScore(mElt){mElt=mElt.replace(/score\.scaled/,"score_scaled");mElt=mElt.replace(/score\.min/,"score_min");mElt=mElt.replace(/score\.max/,"score_max");mElt=mElt.replace(/score\.raw/,"score_raw");return mElt;}function LMS_affecteDansCollection(objR,mElt,valStr,peutCreer){var tabParams=mElt.split(".");if (tabParams.length<3){infoLMSSpe="Not enough arguments";this.errorCode="351";return "false";}var oContainer=XML_fils(objR,tabParams[0]);var indColl=parseInt(tabParams[1]);if (oContainer==null){if (peutCreer){if (indColl>0){this.errorCode="351";return "false";}oContainer=creerElementCP(objR,tabParams[0]);objR.appendChild(oContainer);} else {infoLMSSpe="Object '"+tabParams[0]+"' doesn't exist";this.errorCode="408";if (indColl>0){this.errorCode="351";}return "false";}}var oFinal=null;var nomFils=tabParams[0].replace(/s/,"");var nomAttr=tabParams[2];if (nomAttr=="id"){if (valStr.length>4000){valStr=valStr.substring(0,4000);}if (!verifFormatID(valStr)){this.errorCode="406";return "false";}this.errorCode="0";if (mElt.indexOf("objectives")>=0){var existeDeja=false;for (var k=0;k<oContainer.childNodes.length;k++){if (PF_attr(oContainer.childNodes.item(k),"id")==valStr && indColl!=k){existeDeja=true;}}if (existeDeja){infoLMSSpe="Id '"+valStr+"' already exists in collection";this.errorCode="351";return "false";}}} var ajouteDansConteneur=false;if (indColl==oContainer.childNodes.length){if (peutCreer){oFinal=creerElementCP(objR,nomFils);ajouteDansConteneur=true;} else {infoLMSSpe="Can't create '"+nomFils+"'";this.errorCode="408";}} else if (indColl>oContainer.childNodes.length){this.errorCode="351";return "false";infoLMSSpe="Index too high";} else {oFinal=oContainer.childNodes.item(indColl);}if (oFinal==null){return "false";}if (nomAttr.length<1){infoLMSSpe="'"+nomAttr+"' is an invalid attribute name";this.errorCode="351";return "false";}if ((nomAttr=="pattern")||(nomAttr=="learner_response")){var ltype=PF_attr(objR,"type");if (nomAttr=="learner_response"){ltype=PF_attr(oFinal,"type");}if (peutCreer && nomAttr=="pattern"){if ((ltype=="true-false")||(ltype=="likert")||(ltype=="numeric")||(ltype=="other")){if (ajouteDansConteneur && oContainer.childNodes.length>0){this.errorCode="351";infoLMSSpe="Can only have one correct reponse";return "false";}} else if (ltype=="choice" || ltype=="sequencing"){for (var p=0;p<oContainer.childNodes.length;p++){var lRep=PF_attr(oContainer.childNodes[p],"pattern");if (lRep==valStr){this.errorCode="351";infoLMSSpe="Duplicate correct reponse";return "false";}}}}if (!verifFormatReponse(valStr,ltype,nomAttr)){this.errorCode="406";return "false";}}if (nomAttr=="weighting"){if (!verifReel(valStr)){this.errorCode="406";return "false";}}if (nomAttr=="comment"){if (!verifInfoLangue(valStr)){this.errorCode="406";return "false";}XML_modifTexteNoeud(oFinal,valStr);} else if (nomAttr=="learner_response"){var oNouv=XML_fils(oFinal,nomAttr);if (oNouv==null){oNouv=creerElementCP(oFinal,nomAttr);oFinal.appendChild(oNouv);}XML_modifTexteNoeud(oNouv,valStr);} else {if (nomAttr=="id" && mElt.indexOf("objectives")==0 && objR.nodeName!="interaction"){var iddef=oFinal.getAttribute("id");if (iddef!=null && iddef!="" && iddef!=valStr){infoLMSSpe="Can't change objective ID.";this.errorCode="351";return "false";}} else if (nomAttr=="timestamp"){if (!verifFormatTemps(valStr)){this.errorCode="406";return "false";}} else if (nomAttr=="latency"){if (!verifIntervalleTemps(valStr)){this.errorCode="406";return "false";}} else if (nomAttr.indexOf("score_")==0){this.errorCode=verifReelBorne(valStr,"*","*");if (this.errorCode!="0"){return "false";}}oFinal.setAttribute(nomAttr,new String(valStr));}if (ajouteDansConteneur){oContainer.appendChild(oFinal);}if (mElt.indexOf("objectives")!=0 || mElt.indexOf(".description")>0){this.derniereAffectation=mElt;this.valeurDerniereAffectation=valStr;}return "true";}function verifFormatTemps(dateS){var indT=dateS.indexOf("T");infoLMSSpe="Invalid time format";var partieTZ="";if (indT>0){var temp=dateS.substring(indT);var indTZ=temp.indexOf("Z");if (indTZ<0){indTZ=temp.indexOf("+");}if (indTZ<0){indTZ=temp.indexOf("-");}if (indTZ>0){indTZ+=indT;partieTZ=dateS.substring(indTZ);dateS=dateS.substring(0,indTZ);if (dateS.length<21 || dateS.indexOf(".")<0){return false;}}}var resm=dateS.match(/^\d{4}(-\d{2}(-\d{2}(T\d{2}(:\d{2}(:\d{2}(\.\d{1,2})?)?)?)?)?)?$/);if (resm==null){return false;}if (partieTZ!=""){if (partieTZ!="Z"&& partieTZ.match(/^[+-]\d{2}(:\d{2})?$/)==null){return false;}if (partieTZ!="Z"){var tabp=partieTZ.substring(1).split(":");var val0=parseInt(tabp[0],10);if (val0<0||val0>23){return false;}if (tabp.length>1){val0=parseInt(tabp[1],10);if (val0<0||val0>59){return false;}}}}var queDate=dateS;if (indT>0){queDate=dateS.substring(0,indT);}var tabQueDate=queDate.split("-");var val=parseInt(tabQueDate[0]);if (val<1970||val>2038){return false;}if (tabQueDate.length>1){val=parseInt(tabQueDate[1],10);if (val<1||val>12){return false;}}if (tabQueDate.length>2){val=parseInt(tabQueDate[2],10);if (val<1||val>31){return false;}}if (indT>0){var queTemps=dateS.substring(indT+1);var tabQueDate=queTemps.split(":");var val=parseInt(tabQueDate[0],10);if (val<0||val>23){return false;}if (tabQueDate.length>1){val=parseInt(tabQueDate[1],10);if (val<0||val>59){return false;}}if (tabQueDate.length>2){var val=tabQueDate[2];if (val.length>2){val=val.substring(0,2);}val=parseInt(val,10);if (val<0||val>59){return false;}}}infoLMSSpe="";return true;}function verifIntervalleTemps(dateS){if (dateS.indexOf(".")>0 && dateS.indexOf("S")>0){dateS=dateS.substring(0,dateS.indexOf("."))+"S";}var indT=dateS.indexOf("T");if (indT>0 && indT==(dateS.length-1)){return false;}var resm=dateS.match(/^P(\d+Y)?(\d+M)?(\d+D)?(T(\d+H)?(\d+M)?(\d+S)?)?$/);if (resm==null){infoLMSSpe="Invalid time interval format";}return (resm!=null);}function sansZeroAvant(val){var oReg=new RegExp("([A-Z])0([0-9]+)([A-Z])","g");val=val.replace(oReg,"$1$2$3");val=val.replace(oReg,"$1$2$3");val=val.replace(oReg,"$1$2$3");return val;}function verifFormatReponse(reponse,type,nomAttr){if (type==""){alert("Interaction type not set");}if (type=="true-false"){if ((reponse!="true")&&(reponse!="false")){return false;}} else if (type=="numeric"){if (nomAttr=="pattern"){if (reponse==""){return false;}var tabRep=reponse.split("[:]");if (tabRep.length>2){return false;}if (tabRep.length==1){if (!verifReel(tabRep[0])){return false;}} else if (tabRep.length==2){if (!verifReel(tabRep[0])){return false;}if (!verifReel(tabRep[1])){return false;}if (Number(tabRep[0])> Number(tabRep[1])){return false;}}} else {if (!verifReel(reponse)){return false;}}}if (type=="choice"){if (reponse==""){return true;}var tabsId=reponse.split("[,]");var existeDeja=false;for (var n=0;n<tabsId.length;n++){if (verifFormatPetitID(tabsId[n])){for (var k=0;k<tabsId.length;k++){if (n!=k && tabsId[n]==tabsId[k]){existeDeja=true;}}} else {return false;}}if (existeDeja){infoLMSSpe="Id not unique";return false;}}if (type=="likert"){if (!verifFormatPetitID(reponse)){return false;}}if (type=="matching"){var lesreps=reponse.split("[,]");for (var n=0;n<lesreps.length;n++){var paire=lesreps[n].split("[.]");if (paire.length!=2){infoLMSSpe="Not a pair";return false;}if (!verifFormatPetitID(paire[0])){return false;}if (!verifFormatPetitID(paire[1])){return false;}}}if (type=="performance"){var lesreps=reponse.split("[,]");for (var n=0;n<lesreps.length;n++){if (lesreps[n].indexOf("[.]")<0){infoLMSSpe="Perf. Not a pair";return false;}var paire=lesreps[n].split("[.]");if (paire.length!=2){return false;}if (paire[0]!=""){if (!verifFormatPetitID(enleveDelimOrdre(paire[0]))){return false;}}if (nomAttr=="pattern"){if (paire[1].indexOf("[:]")>0){return verifInterNum(paire[1]);}}}}if (type=="fill-in"){if (nomAttr=="learner_response" && reponse=="[,]"){return true;}var tabsId=reponse.split("[,]");for (var n=0;n<tabsId.length;n++){if (!verifInfoLangue(tabsId[n])){return false;}}}if (type=="long-fill-in"){if (!verifInfoLangue(reponse)){return false;}}if (type=="sequencing"){if (reponse==""){return false;}var lesreps=reponse.split("[,]");for (var n=0;n<lesreps.length;n++){if (!verifFormatPetitID(lesreps[n])){return false;}}}var resFinal=true;if (type=="fill-in" || type=="long-fill-in" || type=="performance"){resFinal=verifDelimOrdre(reponse,"order_matters");}if (resFinal && (type=="fill-in" || type=="long-fill-in")){resFinal=verifDelimOrdre(reponse,"case_matters");}return resFinal;}function verifReelBorne(val,b0,b1){var erreur="0";var num=Number(val);if (isNaN(num)){erreur="406";infoLMSSpe="Not a number";}if (b0!="*"){if (num<Number(b0)){erreur="407";infoLMSSpe="Less than range";}}if (b1!="*"){if (num>Number(b1)){erreur="407";infoLMSSpe="Greater than range";}}return erreur;}function verifReel(val){var num=Number(val);if (isNaN(num)){infoLMSSpe="Not a number";return false;}val=new String(val);var resm=val.match(/^-?\d+(\.\d+)?$/);return resm!=null;}function intervalleEnMS(t){ var strTemps=new String(t); var indLettreT=strTemps.indexOf('T'); var ajoutDate=0; if (indLettreT<0){indLettreT=strTemps.length;} if (indLettreT>1){ var strDate=strTemps.substring(1,indLettreT); var annee=0; var indY=strDate.indexOf("Y"); if (indY>0){ annee=parseInt(strDate.substring(0,indY)); strDate=strDate.substring(indY+1); } var mois=0; indY=strDate.indexOf("M"); if (indY>0){ mois=parseInt(strDate.substring(0,indY),10); strDate=strDate.substring(indY+1); } var jours=0; indY=strDate.indexOf("D"); if (indY>0){ jours=parseInt(strDate.substring(0,indY),10); } var multiJ=3600*24*1000; ajoutDate=jours*multiJ+ mois*multiJ*30 + annee*multiJ*365; } strTemps=strTemps.substring(indLettreT+1); var indY=strTemps.indexOf("H"); var heures=0; if (indY>0){ heures=parseInt(strTemps.substring(0,indY),10); strTemps=strTemps.substring(indY+1); } indY=strTemps.indexOf("M"); var min=0; if (indY>0){ min=parseInt(strTemps.substring(0,indY),10); strTemps=strTemps.substring(indY+1); } indY=strTemps.indexOf("S"); var sec=0; if (indY>0){ sec=Number(strTemps.substring(0,indY)); } return (((heures*3600)+(min*60)+sec)*1000)+ajoutDate;}function ajouterIntervalle(ajoutrvl,intvrl){if (intvrl=="PT0S"||intvrl==""){return ajoutrvl;}var totalms=intervalleEnMS(ajoutrvl)+intervalleEnMS(intvrl);return formaterSecondes(totalms/1000);}function formaterSecondes(ts){var sansDeci=Math.floor(ts);var partieDeci=ts-sansDeci;ts=sansDeci; var sec = (ts % 60); ts -= sec; if (partieDeci>0){ sec+=partieDeci; sec=new String(sec); var indp=sec.indexOf("."); if ((sec.length-indp)>3){ sec=sec.substring(0,indp+3); } } var tmp = (ts % 3600); ts -= tmp; var hour,min; if ((ts % 3600) != 0 ) hour = 0; else hour = (ts / 3600); if ( (tmp % 60) != 0 ) min = 0; else min = (tmp / 60); var jour=0; if (hour>=24){ var resth= (hour % 24); jour = parseInt(hour/24); hour=resth;} return intervalleTemps(jour,hour,min,sec);}function intervalleTemps(jour,strHour, strMin, strSec){var strTime = "P";if (jour>0){strTime+=jour+"D";}var intHour=parseInt(strHour,10);var intMin=parseInt(strMin,10);var intSec=Number(strSec,10); if (intHour>0 || intMin>0 || intSec>0){ strTime += "T"; if (intHour>0)strTime += intHour + "H"; if (intMin>0)strTime += intMin + "M"; if (intSec>0){strTime += ( intSec + "S");}} if (strTime == "P") strTime = "PT0H0M0S"; return strTime;}function LMS_impacteSucces(ancienEtat){var seuil=this.GetValue("cmi.scaled_passing_score");if (seuil!=""){var valProg=this.GetValue("cmi.score.scaled");if (valProg==""){this.cmi.setAttribute("success_status","unknown");} else {if (Number(seuil)>Number(valProg)){this.cmi.setAttribute("success_status","failed");} else if (Number(seuil)<=Number(valProg)){ this.cmi.setAttribute("success_status","passed");}}}if (ancienEtat!=PF_attr(this.cmi,"success_status") || (this.objectifCible && PF_attr(this.objectifCible,"objectiveProgressStatus")!="true")){this.changementEtatObjectif=true;this.cmi.setAttribute("modifObjPrinc","oui");}this.errorCode="0";}function LMS_impacteCompletion(ancienneValeur){var seuil=this.GetValue("cmi.completion_threshold");if (seuil!=""){var valProg=this.GetValue("cmi.progress_measure");if (valProg!=""){if (Number(seuil)>Number(valProg)){this.cmi.setAttribute("completion_status","incomplete");} else if (Number(seuil)<=Number(valProg)){ this.cmi.setAttribute("completion_status","completed");}} else {this.cmi.setAttribute("completion_status","unknown");}}if (ancienneValeur!=PF_attr(this.cmi,"completion_status") || PF_attr(this.activite,"attemptProgressStatus")==""){this.changementEtatCompletion=true;}this.errorCode="0";}function LMS_impacteSuccesCollObj(oObj){oObj.setAttribute("modifObj","oui");this.changementObjectifSecondaire=true;}function LMS_appliquerResultatDansSeq(){if (!this.depiste){return ;}window.planLMS.MODE_PREEMPTIF=false;var objectifPrimairePris=false;var objectives=XML_fils(this.cmi,"objectives");if (objectives!=null){var lesobjs=XML_listeParBalise(objectives,"objective");for (var u=0;u<lesobjs.length;u++){var oObj=lesobjs[u];if (PF_attr(oObj,"modifObj")=="oui"){oObj.removeAttribute("modifObj");var objSeq=window.planLMS.donneObjectifId(this.activite,PF_attr(oObj,"id"));if (objSeq!=null){resSet=PF_attr(oObj,"success_status");if (resSet=="unknown" || resSet==""){window.planLMS.enregistrerEtatObjectif(objSeq,"objectiveProgressStatus","false");} else {var etatO="false";if (resSet=="passed"){etatO="true";}window.planLMS.enregistrerObjectif(objSeq,"objectiveSatisfiedStatus",etatO,true);}resSet=PF_attr(oObj,"score_scaled");if (resSet==""){window.planLMS.enregistrerObjectif(objSeq,"objectiveMeasureStatus","false",true);} else {window.planLMS.enregistrerObjectif(objSeq,"objectiveNormalizedMeasure",resSet,true);}if (objSeq.getAttribute("objectiveID")==PF_attr(this.objectifCible,"objectiveID")){objectifPrimairePris=true;}if (window.planLMS.OBJECTIFS_ADLSEQ){resSet=PF_attr(oObj,"completion_status");if (resSet!=""){window.planLMS.appliqueValeurAdlObj("attemptCompletionStatus",resSet,this.activite,objSeq);}resSet=PF_attr(oObj,"progress_measure");if (resSet!=""){window.planLMS.appliqueValeurAdlObj("attemptProgressMeasure",resSet,this.activite,objSeq);if (PF_attr(oObj,"completion_status")!="unknown"){if (window.planLMS.etatAppliqueValeurAdlObj && objSeq.getAttribute("objectiveID")==PF_attr(this.objectifCible,"objectiveID")){var ancp=PF_attr(this.cmi,"progress_measure");this.cmi.setAttribute("progress_measure",resSet);this.impacteCompletion(PF_attr(this.cmi,"completion_status"));if (PF_attr(this.cmi,"completion_status")!=""){window.planLMS.appliqueValeurAdlObj("attemptCompletionStatus",PF_attr(this.cmi,"completion_status"),this.activite,objSeq);}if (ancp==""){this.cmi.removeAttribute("progress_measure");}}if (PF_attr(oObj,"completion_status")!="incomplete" && PF_attr(oObj,"completion_status")!="completed"){window.planLMS.appliqueValeurAdlObj("attemptCompletionStatus","incomplete",this.activite,objSeq);}}}resSet=PF_attr(oObj,"score_raw");if (resSet!=""){window.planLMS.appliqueValeurAdlObj("attemptRawScore",resSet,this.activite,objSeq);}resSet=PF_attr(oObj,"score_min");if (resSet!=""){window.planLMS.appliqueValeurAdlObj("attemptMinScore",resSet,this.activite,objSeq);}resSet=PF_attr(oObj,"score_max");if (resSet!=""){window.planLMS.appliqueValeurAdlObj("attemptMaxScore",resSet,this.activite,objSeq);}}}}}}if (!objectifPrimairePris){if (PF_attr(this.cmi,"modifObjPrinc")=="oui"){this.cmi.removeAttribute("modifObjPrinc");resSet=this.GetValue("cmi.success_status");if (resSet=="unknown"){window.planLMS.enregistrerEtatObjectif(this.objectifCible,"objectiveProgressStatus","false");} else {var etatO="false";if (resSet=="passed"){etatO="true";}window.planLMS.enregistrerObjectif(this.objectifCible,"objectiveSatisfiedStatus",etatO,true);}resSet=this.GetValue("cmi.score.scaled");if (resSet==""){window.planLMS.enregistrerObjectif(this.objectifCible,"objectiveMeasureStatus","false");} else {window.planLMS.enregistrerObjectif(this.objectifCible,"objectiveNormalizedMeasure",resSet,true);}}}var valSimpleAcheve=PF_attr(this.cmi,"completion_status");var resSet=this.GetValue("cmi.completion_status");if (resSet=="unknown"){if (!window.planLMS.FIGER_ETAT_ITEM){this.activite.setAttribute("attemptProgressStatus","false");}} else if (resSet=="completed"){window.planLMS.enregistrerCompletion(this.activite,true);} else if (resSet=="incomplete" || resSet=="not attempted"){window.planLMS.enregistrerCompletion(this.activite,false);}if (window.planLMS.OBJECTIFS_ADLSEQ){resSet=this.GetValue("cmi.progress_measure");if (resSet!=""){window.planLMS.appliqueValeurAdlObj("attemptProgressMeasure",resSet,this.activite,null);}if (valSimpleAcheve!="" && this.objectifCible!=null && window.planLMS.peutLireValeurAdlObj("attemptCompletionStatus",this.activite,null)){window.planLMS.appliqueValeurAdlObj("attemptCompletionStatus",valSimpleAcheve,this.activite,null);}}this.errorCode="0";}function PF_attr(obj,nomAttr){if (obj==null){alert("Null Element for "+nomAttr);}var val=obj.getAttribute(nomAttr);if (val==null){val="";}return val;}function reelScore(val){val=new String(val);if (val.length>9){val=val.substring(0,9);}return val;}function verifFormatID(valStr){valStr=new String(valStr);if (valStr.length==0){infoLMSSpe="ID can't be empty";return false;}if (valStr.replace(/\s+/g,"").length==0){return false;}if (valStr.indexOf("urn:")==0 && valStr.indexOf(" ")>0){return false;}var oRegCarSpeciaux=new RegExp("[!'\"\\{}\\()\\[\\]]");if (valStr.match(oRegCarSpeciaux)!=null){infoLMSSpe="Bad chars";return false;}var taParts=valStr.match(oRegUri);var estURN=false;if (taParts==null || taParts[5]==""){infoLMSSpe="Bad URI";return false;}if (new String(taParts[2]).toLowerCase()=="urn"){estURN=true;}if (estURN && taParts[5]==""){infoLMSSpe="Bad URN";return false;}if (taParts[5]!=""){if (estURN){infoLMSSpe="Bad URN";var indP=taParts[5].indexOf(":");if (indP<0){return false;}var nid=taParts[5].substring(0,indP);var nss=taParts[5].substring(indP+1);if (nid.length<0|| nid.length>31){return false;}nid=nid.replace(/\w/g,"");nid=nid.replace(/-/g,"");if (nid!=""){return false;}infoLMSSpe="";}}return true;}function verifFormatPetitID(valStr){if (valStr.length>250){valStr=valStr.substring(0,250);}return verifFormatID(valStr);}function verifInfoLangue(val){if (val=="{lang=}"){return false;}var indLang=val.indexOf("{lang=");if (indLang==0){val=val.substring(indLang+6);val=val.substring(0,val.indexOf('}'));return verifFormatLangue(val);}return true;}function verifFormatLangue(val){if (val==""){return true;}var resm=val.match(/^\w{2,3}(-\w{2,8})?$/);if (resm==null){var res=false;var mIANALangauges = ",i,x,art-lojban,az-arab,az-cyrl,az-latn,cel-gaulish,de-1901,de-1996,de-at-1901,de-at-1996,de-ch-1901,de-ch-1996,de-de-1901,de-de-1996,en-boont,en-gb-oed,en-scouse,i-ami,i-bnn,i-default,i-enochian,i-hak,i-klingon,i-lux,i-mingo,i-navajo,i-pwn,i-tao,i-tay,i-tsu,no-bok,no-nyn,sgn-be-fr,sgn-be-nl,sgn-br,sgn-ch-de,sgn-co,sgn-de,sgn-dk,sgn-es,sgn-fr,sgn-gb,sgn-gr,sgn-ie,sgn-it,sgn-jp,sgn-mx,sgn-nl,sgn-no,sgn-pt,sgn-se,sgn-us,sgn-za,sl-rozaj,sr-cyrl,sr-latn,uz-cyrl,uz-latn,yi-latn,zh-hans,zh-hant,zh-gan,zh-guoyu,zh-hakka,zh-min,zh-min-nan,zh-wuu,zh-xiang,";if (mIANALangauges.indexOf(","+val.toLowerCase()+",")>=0){res=true;}return res;} else {var bloqueCodes =",frl,exg,sp,ruq-jm,";if (bloqueCodes.indexOf(","+val.toLowerCase()+",")>=0){return false;}}return true;}function verifDelimOrdre(val,nomDelim){var indLangue=val.indexOf("{lang=");if (indLangue==0){return true;}if (val.indexOf("{")==0){var indOrdre=val.indexOf("{"+nomDelim+"=");if (indOrdre>=0){var res=false;val=val.substring(indOrdre+nomDelim.length+2);var fin=val.indexOf("}");if (fin>0){val=val.substring(0,fin);if ((val=="true")||(val=="false")){res=true;}}if (!res){infoLMSSpe="Bad delimiter: "+nomDelim;}return res;}}return true;}function enleveDelimOrdre(str){str=str.replace(/^\{order_matters=true\}/,"");str=str.replace(/^\{order_matters=false\}/,"");return str;}function chargerAllocation(oAlloc){var persit=PF_attr(oAlloc,"persistence");if (persit=="session"){return XML_texteNoeud(oAlloc);}var oExiste=XML_trouveNoeud(window.planLMS.allocationsGlobales,"allocation","id",PF_attr(oAlloc,"id"));if (oExiste){return XML_texteNoeud(oExiste);} else {if (SUR_CHORUS){if (ENTREE_PARCOURS && persit!="learner"){return "";}var ajStg="";if (persit=="course"){ajStg=" codeStage=\""+serveur.codeStage+"\"";}var reqx="<operation action=\"donneAllocation\" ncnx=\""+serveur.numCnx+"\" type=\""+PF_attr(oAlloc,"type")+"\" persistance=\""+persit+"\""+ajStg+" idAlloc=\""+PF_attr(oAlloc,"id")+"\"></operation>";cibleASP=RACINE_MOS+"MosSrv/aspx/SRV_parcours.aspx";var oRetour=SYS_lancerOperationsRetour(reqx,"enregistrerParcours");if (oRetour!=null){var contenuVar=XML_texteNoeud(oRetour);if (contenuVar!=""){oExiste=ajouterAllocationGlobale(oAlloc);XML_modifTexteNoeud(oExiste,contenuVar);return contenuVar;}}}}return "";}function ajouterAllocationGlobale(oAlloc){var oN=creerElementCP(window.planLMS.DOMManifest,"allocation");oN.setAttribute("id",PF_attr(oAlloc,"id"));oN.setAttribute("persistence",PF_attr(oAlloc,"persistence"));oN.setAttribute("requested",PF_attr(oAlloc,"requested"));if (PF_attr(oAlloc,"type")!=""){oN.setAttribute("type",PF_attr(oAlloc,"type"));}window.planLMS.allocationsGlobales.appendChild(oN);return oN;}function donneNumeroObj(obj,id0){if (obj==null){return -1;}for (var i=0;i<obj.childNodes.length;i++){if (obj.childNodes[i].getAttribute("id")==id0){return i;}}return -1;}function creerElementCP(obj,nom){var oDoc=obj;if (oDoc.nodeType==1){oDoc=obj.ownerDocument;}var oN=null;if (oDoc.createElementNS){oN=oDoc.createElementNS("http://www.imsglobal.org/xsd/imscp_v1p1",nom);} else {if (progIDMSXML=="Msxml2.DOMDocument.3.0"){oN=oDoc.createElement(nom);} else {oN=oDoc.createNode(1,nom,"http://www.imsglobal.org/xsd/imscp_v1p1");}}return oN;}function changeNiveauAudio(au){niveauAudio=au;if (API_1484_11.cmi && API_1484_11.etatCommunication=="enCours"){API_1484_11.SetValue("cmi.learner_preference.audio_level",au);}}function nomChampScoreAdl(mElt){var champAdl="attemptRawScore";if (mElt.indexOf("score.min")>=0||mElt.indexOf("score_min")>=0){champAdl="attemptMinScore";}if (mElt.indexOf("score.max")>=0||mElt.indexOf("score_max")>=0){champAdl="attemptMaxScore";}return champAdl;}

