var apiHandle= null;var APIfindLMSinstanceTries= 0;var noAPIFound= "false";var terminated= "false";var initok= "false";var _debug=false;function MosSCO(identifiant,titre,titreStage,nomModuleCourant,nomEntreprise,codeStage,langue) { this.titre=titre; this.tabPages; this.tabPosDocs; this.numPageCourante=0; this.version="xml"; this.identifiant=identifiant; this.codeStage=codeStage; this.exoBloquant; this.bloquantSaufAcheve=false; this.idUtil=''; this.langue=langue; this.dateMAJ=''; this.autorisePrecedent; this.dejaReussi=false; this.config_plateforme=""; this.config_navigateur=""; this.navigIE6=false; this.titreStage=titreStage; this.nomModuleCourant=nomModuleCourant; this.nomEntreprise=nomEntreprise; this.dateCourante=''; this.indexPremierePage=0; this.exoSolutions=false; this.nbTotalPages=0; this.exoValideChoixUnique=false; this.scoreBinaire=false; this.scoreNegatif=false; this.penaliserMauvaiseReponse=true; this.forcerReponse=false; this.autoriserReprise=false; this.passageEntreActivites=true; this.niveauIncomplet=30; this.niveauComplete=100; this.refGlo=''; this.refGloExt="xml"; this.maxTempsPage=0; this.ordrePlan=""; this.tabDonneesDemarrage=null; this.afficherSolutionsDirect=false; this.notesCharge=false; this.premierePageSco=true; this.evaluation=null; this.etatEvaluation=false; this.posFenLocale; this.init = csSCO_init; this.numeroPage = csSCO_numeroPage; this.donneDate = csSCO_donneDate; this.donneNumeroPageGnr = csSCO_donneNumeroPageGnr; this.donnePourcentEffectue = csSCO_donnePourcentEffectue; this.donnePage= csSCO_donnePage; this.nombrePages= csSCO_nombrePages; this.nbExercices= csSCO_nbExercices; this.csSCO_paramDoc= csSCO_paramDoc;}function csSCO_init(exoBloquant,versionPages,dateMAJ,objEval){this.tabPages = new Array();this.tabPosDocs = new Array(); this.exoBloquant=exoBloquant; if (versionPages!=''){this.version=versionPages;} this.dateMAJ=dateMAJ;var oDate = new Date();var mois=oDate.getMonth()+1;if (mois<10){mois='0'+mois;}var jour=oDate.getDate();if (jour<10){jour='0'+jour;} this.dateCourante=oDate.getFullYear()+'-'+mois+'-'+jour; var deb=window.location.href; deb=deb.substring(0,deb.lastIndexOf("/sco/")); this.codeStage=deb.substring(deb.lastIndexOf("/")+1); if (navigator.appName.indexOf('Microsoft')>=0 && window.XMLHttpRequest==null){ this.navigIE6=true; }}function csSCO_numeroPage(codePage){var numPg=-1;for (var n=0;n<this.tabPages.length;n++){if (this.tabPages[n].code==codePage){numPg=n;}}return numPg;}function csSCO_donneDate(date0){var res='';var indexD=0;var annee=date0.substring(indexD,indexD+4);indexD=5;var mois=date0.substring(indexD,indexD+2);indexD=8;var jour=date0.substring(indexD,indexD+2);var sep="/";if (this.langue=='de'||donnePays()=="CH"){sep=".";}res=jour+sep+mois+sep+annee;if (donnePays()=="US"){res=mois+sep+jour+sep+annee;}return res;}function donnePays(){var lang="";if (oSco.langue.indexOf("-")>0){return oSco.langue.substring(3);}if (navigator.userLanguage){lang=navigator.userLanguage;}else {lang=navigator.language;}var indT=lang.indexOf("-");if (indT>0){return lang.substring(indT+1).toUpperCase();}return "";}function csSCO_donneNumeroPageGnr(){return (this.indexPremierePage+this.numPageCourante);}function csSCO_nombrePages(){return (this.tabPages.length);} function csSCO_nbExercices(){var res=0;for (var n=0;n<this.tabPages.length;n++){if (this.tabPages[n].estExercice()){res++;}}return res;}function csSCO_donnePourcentEffectue(){var res=(this.numPageCourante+1)/this.tabPages.length*100;return (Math.round(res));}function csSCO_donnePage(numP){var res=null;if ((numP<this.tabPages.length)&&(numP>=0)){ res=this.tabPages[numP];}return res;}function csSCO_paramDoc(refDoc,numParam){var res='';for (var n=0;n<this.tabPosDocs.length;n++){var laPos=this.tabPosDocs[n];var tabparam=laPos.split(";");if (tabparam[0]==refDoc){if (numParam<tabparam.length){res=tabparam[numParam];}}}return res;}function PageContenu(titre,code,type,prerequis,score,dateMAJ,typeExo,theme){ this.titre=titre;this.code=code; this.type=type; this.prerequis=prerequis; this.score=score;this.dateMAJ=dateMAJ;this.typeExo=typeExo;this.notes="";this.theme=theme;this.dateNotes="";this.etatVisite=false;this.premiereVisite=true;this.validePrerequis=csPAGE_validePrerequis;this.estExercice=csPAGE_estExercice;}function csPAGE_validePrerequis(){if (this.prerequis=="SKIP"){return false;}if (oSco.etatEvaluation && !evalVerifPrerequis(this.prerequis)){return false;}return true;}function csPAGE_estExercice(){return (this.type=="exercice" && this.prerequis.indexOf("RESULT")!=0);}function APIinitialize(){ var strReturnVal= "false"; var hAPI= APIgetHandle(); if (hAPI != null){ strReturnVal = hAPI.Initialize("");if (strReturnVal != "true"){ APIdisplayErrorInfo(hAPI.GetLastError(),"Initialize","");} else {initok="true";} } return strReturnVal;}function APIisRunning(){var strReturnVal= "false";var hAPI=APIgetHandle();if (hAPI && initok=="true" && APIisTerminated()!="true")strReturnVal = "true";return strReturnVal;}function APIisTerminated(){return terminated;}function APIterminate(){ var strReturnVal = "false"; var hAPI= APIgetHandle(); if (hAPI!= null){ if (APIisTerminated()!="true"){ strReturnVal = hAPI.Terminate(""); if (strReturnVal!="true"){ APIdisplayErrorInfo(hAPI.GetLastError(),"Terminate",""); } else { terminated="true"; temps0=0; } } }return strReturnVal;}function APIfindLMSinstance(win){ while (win.API_1484_11==null && win.parent!=null && win.parent!=win) { APIfindLMSinstanceTries++; if (APIfindLMSinstanceTries >80){ alert("Error finding API -- too deeply nested."); return null; } win = win.parent; } return win.API_1484_11;}function APIget(){var hAPI = null;try {hAPI=APIfindLMSinstance(window);if (hAPI==null && window.opener!=null && (typeof(window.opener)!="undefined")) { hAPI = APIfindLMSinstance(window.opener);}} catch(e){} if (hAPI == null){ if (_debug){alert("Unable to find an API adapter");} noAPIFound = "true";}return hAPI;}function APIgetHandle(){ if (apiHandle == null){if (noAPIFound == "false") apiHandle = APIget(); } return apiHandle;}function APIgetValue(name){ var strReturnVal= ""; var strErrorCode= "0"; var hAPI= null; if (APIisRunning()=="true"){ hAPI = APIgetHandle(); if (hAPI != null){ strReturnVal = hAPI.GetValue(name); strErrorCode = hAPI.GetLastError(); if (strErrorCode != "0"){ APIdisplayErrorInfo(strErrorCode,name,""); } } } return strReturnVal;}function APIsetValue(strName,strVal){ var strReturnVal= "false"; var strErrorCode= "0"; var hAPI= null; if (APIisRunning()=="true"){ hAPI = APIgetHandle(); if (hAPI != null){ strReturnVal = hAPI.SetValue(strName,strVal); if (strReturnVal!="true"){ APIdisplayErrorInfo(hAPI.GetLastError(),strName,strVal); } } } return strReturnVal;}function APIcommit(){var strReturnVal= "false"; if (APIisRunning()== "true" ){var hAPI = APIgetHandle();if (hAPI!= null)strReturnVal = hAPI.Commit(""); } return strReturnVal;}function APIdisplayErrorInfo(errCode,attr,val){var hAPI=APIgetHandle();var resc="ERROR: " +errCode+"\n"+hAPI.GetDiagnostic(errCode);if (val!=""){val=" / "+val;}if (attr!=""){resc+="\n"+attr+val;} if (_debug){ alert(resc); }}function XML_texteNoeud(obj){var s = "";if (obj==null){return "";}for(var i=0;i<obj.childNodes.length;i++){var oNode = obj.childNodes[i];if(oNode.nodeType == 3)s += oNode.nodeValue;else if(oNode.nodeType == 1)s += XML_texteNoeud(oNode);}return s;}
