var QuestionMarquage = Class.create({

    //settings
    sRepAct: '', //Réponse actuelle
    mustGiveAllGoodAnswers: false,

    currentSequence: null,
    currentScore: 0,
    ponderation: 0,
    triesCount: 0,
    status: '',
    iFautePond: 1,
    removeHiliteLabel:'',
    
    initialize: function(quiz, page, questionNb){

        this.quiz = quiz;
        this.page = page;
        this.questionNb = questionNb;

        this.colors = new Array();
        this.colorsTag = new Array();
        this.retroPos = new Array();
        this.retroNeg = new Array();
        this.retroInc = new Array();

        this.choicesStart = new Array();
        this.choicesEnd = new Array();
        this.choicesColor = new Array();

        this.tinyId = 'elm' + questionNb;
        this.tinyIdIndex = 0;
           
        this.status = this.quiz.statusToDo;
    },

    initTinyMce: function(theTextAreaId){
        tinyMCE.init({
            /*ON LAISSE CERTAINS ÉLÉMENTS PAR DÉFAUTS MÊMES SI PAS APPLICABLES DANS NOTRE TEXTAREA*/
            // General options
            mode : "exact",
            elements : theTextAreaId,
            theme : "advanced",
            readonly : true,
            plugins : "style,layer,table,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,advlist",

            // Theme options
            theme_advanced_buttons1 : "",
            theme_advanced_buttons2 : "",
            theme_advanced_buttons3 : "",
            theme_advanced_buttons4 : "",
            theme_advanced_toolbar_location : "",
            theme_advanced_toolbar_align : "left",
            theme_advanced_statusbar_location : "none",
            theme_advanced_path : false,
            theme_advanced_resizing : false,

            // Drop lists for link/image/media/template dialogs
            template_external_list_url : "lists/template_list.js",
            external_link_list_url : "lists/link_list.js",
            external_image_list_url : "lists/image_list.js",
            media_external_list_url : "lists/media_list.js",

            setup : function(ed) {
                ed.onInit.add(function(ed) {
                
                   //POUR UNE RAISON INCONNUE, LORSQUE L'ON FAIT RÉAFFCHICHER TINYMCE, LE CONTROLE PREND PAS LA CLASS ET MET 100X100
                   document.getElementById(ed.id + '_tbl').style.width = '550px';
                   document.getElementById(ed.id + '_tbl').style.height = '300px';

                   document.getElementById(ed.id + '_ifr').style.width = '550px';
                   document.getElementById(ed.id + '_ifr').style.height = '300px';

                   $('question').show();


                   //POUR ARRANGER UN BOGUE BIZARRE SUR SAFARI 5 (4 = OK) LORSQUE QUE L'ON NAVIGUE AVEC LES FLÈCHES À LA QUESTION
                   document.getElementById(ed.id + '_ifr').contentWindow.scrollTo(0,10);
                   document.getElementById(ed.id + '_ifr').contentWindow.scrollTo(0,0);
                
                   var objDiv = document.getElementById("scrollwrapper");
                   objDiv.scrollTop = 0;
                   /******************************************************************/
                });
            },

            forced_root_block : false,
            force_br_newlines : true,
            force_p_newlines : false
        });
    },

    addColor: function(color, tag, retroPos, retroNeg, retroInc){
        this.colors[this.colors.length] = color;
        this.colorsTag[this.colorsTag.length] = tag;
        this.retroPos[this.retroPos.length] = retroPos;
        this.retroNeg[this.retroNeg.length] = retroNeg;
        this.retroInc[this.retroInc.length] = retroInc;
    },

    addMainText: function(mainText){
        this.initialMainText = mainText;
    },

    addChoice: function(posStart, posEnd, color){
        this.choicesStart[this.choicesStart.length] = posStart;
        this.choicesEnd[this.choicesEnd.length] = posEnd;
        this.choicesColor[this.choicesColor.length] = color;
    },

    display : function(){
        var htmlColors = '';
        var putText = this.initialMainText;

        /* DOIT CHANGER LE NOM DU CONTROLE CAR DANS IE 8, BOGUE QUAND ON REVIENT COMME SI CETAIT PAS REMOVED GENRE...L'IDEE EST DE CREER UN NOUVEAU AVEC UN NOUVEAU ID*/
        var idTinyTxt = this.tinyId + "_" + this.tinyIdIndex;

        if (this.sRepAct != ''){
            putText = this.sRepAct;
            tinyMCE.execCommand('mceRemoveControl', false, idTinyTxt);
        }

        this.tinyIdIndex = this.tinyIdIndex + 1;
        /**************************************/

        $('question').update('');
        $('question').hide();

        var divAnswerChoices = document.createElement('div');
        divAnswerChoices.id = 'divAnswerChoices';
        $('question').appendChild(divAnswerChoices);

        for (i = 0; i < this.colors.length; i++) {
            htmlColors = htmlColors + '<div class="colorButtonsOuter"><a href="javascript:;" class="aColorButtons" title="' + this.colorsTag[i] + '" onmousedown="tinyMCE.get(\'' + idTinyTxt + '\').execCommand(\'HiliteColor\', false, \'#' + this.colors[i] + '\'); top.ccdmd.nq4.pages[top.ccdmd.nq4.currentPageIndex].question.getTheFocus(\'' +  idTinyTxt + '\');"><div class="colorButtonsInner" style="background-color:#' + this.colors[i] + '"><img src="images/base/spacer.gif" width="19" height="19" border="0" /></div></a></div>';
            htmlColors = htmlColors + '<div style="width:10px;height:21px;float:left;"></div>';
        }

        htmlColors = htmlColors + '<div style="height:23px;float:left;"><table height="23" cellpadding="0" cellspacing="0" border="0"><tr><td valign="bottom"><a href="javascript:;" class="aMarquage" onmousedown="top.ccdmd.nq4.pages[top.ccdmd.nq4.currentPageIndex].question.removeHilite();">' + this.removeHiliteLabel + '</a></td></tr></table></div>';

        $('divAnswerChoices').update(htmlColors);
        divAnswerChoices.style.clear = 'both';

        var divSpacer = document.createElement('div');
        divSpacer.id = 'divSpacer1';
        $('question').appendChild(divSpacer);
        divSpacer.style.height = '7px'
        divSpacer.style.clear = 'both';

        this.input = tcals_createElement('textarea',idTinyTxt);
        this.input.id = idTinyTxt;
        this.input.className = 'txtMarquage';
        this.input.value = putText;
        $('question').appendChild(this.input);

        this.initTinyMce(idTinyTxt);
    },

    removeHilite: function(){
        var textSearch;
        var cleanSpaces;
        var selectedContent;
        var selectedTXT;
        var selectedHTML;
        var selectedElement;
        var spanReplacement;
        var re;
        var colorHiliteRemove;
        var removedAllHilite = false;
        var somethingWrong = 0;
        var theBrowser = detectBrowser();
        var idTinyTxt = this.tinyId + "_" + (this.tinyIdIndex - 1);


        selectedElement = tinyMCE.get(idTinyTxt).selection.getNode().nodeName;
        selectedHTML = tinyMCE.get(idTinyTxt).selection.getContent();

        /***PLUSIEURS TESTS SONT ET FACONS D'ENLEVER LE HILITE SONT NÉCESSAIRES CAR DIFFÉRENTS FURETEURS NE RETOURNENT PAS LES MÊMES VALEURS ET ONT UN COMPORTEMENT DIFFERENTS***/
        if (selectedHTML != ''){
           if (selectedElement.toLowerCase() == 'span'){
               colorHiliteRemove = '#000000';

               //met en hilite noir peu importe ce qui a déjà été hilite
               tinyMCE.get(idTinyTxt).execCommand('HiliteColor', false, colorHiliteRemove);

               //une fois en noir, rappeler la fonction hilite car en tinymce, on gère automatiquement si déjà en hilite d'une couleur et qu'on hilite à nouveau avec la même couleur, ça enlève le hilite.
               tinyMCE.get(idTinyTxt).execCommand('HiliteColor', false, colorHiliteRemove);
           }
           else{
               if (theBrowser.indexOf("Firefox") != -1 || theBrowser.indexOf("firefox") != -1){
                   //VA SEULEMENT FAIRE PARTIE DU BAS
               }
               else{
                  if (selectedHTML.charAt(0) == "<" && selectedHTML.charAt(1) == "s" && selectedHTML.charAt(2) == "p"){
                      if (selectedHTML.charAt(selectedHTML.length - 1) == ">" && selectedHTML.charAt(selectedHTML.length - 2) == "n"){

                          for (i = 0; i < this.colors.length; i++) {
                              if (selectedHTML.indexOf(this.colors[i]) > -1){
                                  colorHiliteRemove = "#" + this.colors[i];
                                  break;
                              }
                          }

                          while (removedAllHilite == false){
                              tinyMCE.get(idTinyTxt).execCommand('HiliteColor', false, colorHiliteRemove);
                              selectedHTML = tinyMCE.get(idTinyTxt).selection.getContent();

                              if (selectedHTML.charAt(0) == "<" && selectedHTML.charAt(1) == "s" && selectedHTML.charAt(2) == "p"){
                                  removedAllHilite = false;
                              }
                              else{
                                  removedAllHilite = true;
                              }

                              if (somethingWrong == 10){
                                  //a bit ugly mais, devrait jamais rentré ici mais si quelque chose s'est mal passé, on veut pas que ca plante la question / quiz...
                                  removedAllHilite = true;
                              }

                              somethingWrong++;
                          }
                      }
                  }
              }
           }

           //code supplémentaire pour enlever du hilite qui a pas été enlevé
           //D'abord, enlever ce qui est hilited avec la selection HTML de tinyMCE
           for (i = 0; i < this.colors.length; i++) {
               spanReplacement = '<span style="background-color: #' + this.colors[i] + ';">';
               re = new RegExp(spanReplacement, 'gi');

               selectedHTML = selectedHTML.replace(re, "");

               spanReplacement = '</span>';
               re = new RegExp(spanReplacement, 'gi');

               selectedHTML = selectedHTML.replace(re, "");
           }

           tinyMCE.execCommand('mceReplaceContent',false,selectedHTML);

           //Enlever ce qui reste qui a mal été enlevé, (s'il y a lieu)
           selectedContent = tinyMCE.get(idTinyTxt).getContent();

           for (i = 0; i < this.colors.length; i++) {
               spanReplacement = '<span style="background-color: #' + this.colors[i] + ';"></span>';
               re = new RegExp(spanReplacement, 'gi');

               selectedContent = selectedContent.replace(re, "");
           }

           tinyMCE.getInstanceById(idTinyTxt).setContent(selectedContent);
        }
    },

    getTheFocus: function(editor_id){
        //fonctionne, mais donne une erreur javascript relié au tinymec... cependant, ça ne semble pas causé de bogues.
        //on doit "remettre" le contenu car si juste : tinyMCE.execInstanceCommand(editor_id, "mceFocus"); , fonctionnera pas...

        var selectedContent = tinyMCE.get(editor_id).getContent();
        tinyMCE.getInstanceById(editor_id).setContent(selectedContent);

        tinyMCE.execInstanceCommand(editor_id, "mceFocus");
    },

    save: function(){
        var idTinyTxt = this.tinyId + "_" + (this.tinyIdIndex - 1);
        this.sRepAct = tinyMCE.get(idTinyTxt).getContent();
    },

    validate: function(){
        this.save();
        this.triesCount++;

        var idTinyTxt = this.tinyId + "_" + (this.tinyIdIndex - 1);
        var spanFeedbackHTML = 0;
        var strSpanFeedbackHTML = '';
        var feedbackHTML = '';
        var goodAnswerCount = 0;
        var wrongAnswerCount = 0;
        var bulletImage = '';
        var feedback = '';

        var userAnswer = tinyMCE.get(idTinyTxt).getContent();

        var userChoicesStart = new Array();
        var userChoicesEnd = new Array();
        var userChoicesColor = new Array();

        var userAnswerHTML = new Array();
        var goodAnswersColorGroup = new Array();
        var wrongAnswersColorGroup = new Array();
        var retroTxt;

        var startRemoveCount = false;
        var removeNbChars = 0;
        var foundHilite = false;


        for (i = 0; i < this.colors.length; i++){
            userAnswerHTML[i] = '';
            retroTxt = '';
            goodAnswersColorGroup[i] = 0;
            wrongAnswersColorGroup[i] = 0;
        }

        for (i = 0; i < userAnswer.length; i++){
            if (userAnswer.charAt(i) == '<'){
                if (userAnswer.charAt(i + 1) == 's' && userAnswer.charAt(i + 2) == 'p'){
                    //found span -> start hilite
                    startRemoveCount = true;
                    foundHilite = true;
                }
                else{
                    //found end </span>
                    if (userAnswer.charAt(i + 1) == '/' && userAnswer.charAt(i + 2) == 's'){
                        userChoicesEnd[userChoicesEnd.length] = i - (removeNbChars + 1);

                        if (this.initialMainText.charAt(userChoicesEnd[userChoicesEnd.length - 1]) == ' '){
                            //SI A CHOISI AVEC ESPACE EN AVANT, C'EST OK. DONC, AJUSTER
                            userChoicesEnd[userChoicesEnd.length - 1] = userChoicesEnd[userChoicesEnd.length - 1] - 1;
                        }

                        removeNbChars = removeNbChars + 7;
                    }
                }
            }
            else if (userAnswer.charAt(i) == '#'){
                //get color
                userChoicesColor[userChoicesColor.length] = userAnswer.charAt(i + 1) + userAnswer.charAt(i + 2) + userAnswer.charAt(i + 3) + userAnswer.charAt(i + 4) + userAnswer.charAt(i + 5) + userAnswer.charAt(i + 6);
            }
            else if (userAnswer.charAt(i) == ';'){
                if (userAnswer.charAt(i + 1) == '"' && userAnswer.charAt(i + 2) == '>'){
                    userChoicesStart[userChoicesStart.length] = i - removeNbChars;

                    if (this.initialMainText.charAt(userChoicesStart[userChoicesStart.length - 1]) == ' '){
                        //SI A CHOISI AVEC ESPACE EN AVANT, C'EST OK. DONC, AJUSTER
                        userChoicesStart[userChoicesStart.length - 1] = userChoicesStart[userChoicesStart.length - 1] + 1;
                    }

                    removeNbChars = removeNbChars + 3;
                    startRemoveCount = false;
                }
            }

            if (startRemoveCount == true){
                removeNbChars++;
            }
        }

        for (i = 0; i < userChoicesStart.length; i++){
            var mot = '';
            var colorIndex;
            var foundGoodAnswer = false;

            for (j = 0; j < this.initialMainText.length; j++){
                if (j >= userChoicesStart[i] && j <= userChoicesEnd[i]){
                    mot += this.initialMainText.charAt(j);
                }
            }

            for (j = 0; j < this.colors.length; j++){
                if (userChoicesColor[i] == this.colors[j]){
                    colorIndex = j;
                }
            }

            for (x = 0; x < this.choicesStart.length; x++){
                if ((this.choicesStart[x] == userChoicesStart[i]) && (this.choicesEnd[x] == userChoicesEnd[i]) && (this.choicesColor[x] == userChoicesColor[i])){
                    foundGoodAnswer = true;
                }
            }

            if (foundGoodAnswer == true){
                goodAnswerCount++;
                goodAnswersColorGroup[colorIndex]++;
                bulletImage = 'bullet_green.jpg';
            }
            else{
                wrongAnswerCount++;
                wrongAnswersColorGroup[colorIndex]++;
                bulletImage = 'bullet_red.jpg';
            }

            userAnswerHTML[colorIndex] += '<table cellpadding="0" cellspacing="0" border="0">';
              userAnswerHTML[colorIndex] += '<tr>';
                userAnswerHTML[colorIndex] += '<td width="17" valign="top" style="padding-top: 1px;">';
                  userAnswerHTML[colorIndex] += '<img src="images/base/' + bulletImage + '" />';
                userAnswerHTML[colorIndex] += '</td>';
                userAnswerHTML[colorIndex] += '<td valign="top">';
                  userAnswerHTML[colorIndex] += mot;
                userAnswerHTML[colorIndex] += '</td>';
              userAnswerHTML[colorIndex] += '</tr>';
              userAnswerHTML[colorIndex] += '<tr>';
                userAnswerHTML[colorIndex] += '<td height="5">';
                userAnswerHTML[colorIndex] += '</td>';
              userAnswerHTML[colorIndex] += '</tr>';
            userAnswerHTML[colorIndex] += '</table>';
        }


        var nbLigne = 0;
        var statusCompleted = true;

        for (i = 0; i < this.colors.length; i++) {
            var goodAnswersColorsTotal = 0;

            for (j = 0; j < this.choicesStart.length; j++){
                if (this.choicesColor[j] == this.colors[i]){
                    goodAnswersColorsTotal++;
                }
            }

            if (wrongAnswersColorGroup[i] > 0){
                retroTxt = this.retroNeg[i];

                this.status = this.quiz.statusToRedo;
                statusCompleted  = false;

                spanFeedbackHTML = 1;
            }
            else{
                if (goodAnswersColorGroup[i] == goodAnswersColorsTotal){
                    retroTxt = this.retroPos[i];
                }
                else{
                    retroTxt = this.retroInc[i];

                    this.status = this.quiz.statusToRedo;
                    statusCompleted  = false;

                    if (spanFeedbackHTML != 1){
                        spanFeedbackHTML = 2;
                    }
                }
            }

            if (statusCompleted == true){
                this.status = this.quiz.statusCompleted;
            }

            if (this.colors.length == 1){
                feedbackHTML += '<table cellpadding="0" cellspacing="0" border="0">';
                  feedbackHTML += '<tr>';
                    feedbackHTML += '<td valign="top">';
                      feedbackHTML += '<table style="min-width:150px;max-width:700px; cellpadding="0" cellspacing="0" border="0">';
                        feedbackHTML += '<tr>';
                          feedbackHTML += '<td height="21" align="left" valign="middle">';
                            feedbackHTML += '<div class="colorButtonsOuter"><div class="colorButtonsInner" style="background-color:#' + this.colors[i] + '"></div></div>';
                            feedbackHTML += '<table height="21" cellpadding="0" cellspacing="0" border="0"><tr><td valign="middle" style="padding-left:9px">' + this.colorsTag[i] + '</td></td></table>';
                          feedbackHTML += '</td>';
                          feedbackHTML += '</tr>';
                          feedbackHTML += '<tr>'
                            feedbackHTML += '<td height="5" align="left">';
                          feedbackHTML += '</td>';
                          feedbackHTML += '</tr>';
                          feedbackHTML += '<tr>';
                            feedbackHTML += '<td height="120" align="left" valign="top" style="border:solid 1px gray;padding-left:10px;padding-top:8px;padding-right:10px;min-width:150px;max-width:700px;">';
                              feedbackHTML += userAnswerHTML[i];
                            feedbackHTML += '</td>';
                          feedbackHTML += '</tr>';
                          feedbackHTML += '<tr>';
                            feedbackHTML += '<td align="left" valign="top" class="tdRetro" style="padding-top:2px;">';
                              feedbackHTML += retroTxt;
                            feedbackHTML += '</td>';
                          feedbackHTML += '</tr>';
                        feedbackHTML += '</table>';
                      feedbackHTML += '</td>';
                    feedbackHTML += '</tr>';
                feedbackHTML += '</table>';
            }
            else{
                if (nbLigne == 0){
                    feedbackHTML += '<table width="100%" cellpadding="0" cellspacing="0" border="0">';
                    feedbackHTML += '<tr>';
                }

                feedbackHTML += '<td width="330" valign="top">';
                  feedbackHTML += '<table width="330" cellpadding="0" cellspacing="0" border="0">';
                    feedbackHTML += '<tr>';
                      feedbackHTML += '<td width="30" height="21" align="left">';
                        feedbackHTML += '<div class="colorButtonsOuter"><div class="colorButtonsInner" style="background-color:#' + this.colors[i] + '"></div></div>';
                      feedbackHTML += '</td>';
                      feedbackHTML += '<td width="300" height="21" align="left" valign="middle">';
                        feedbackHTML += this.colorsTag[i];
                      feedbackHTML += '</td>';
                    feedbackHTML += '</tr>';
                    feedbackHTML += '<tr>'
                      feedbackHTML += '<td width="30" height="5" align="left">';
                      feedbackHTML += '</td>';
                      feedbackHTML += '<td width="300" height="5" align="left">';
                      feedbackHTML += '</td>';
                    feedbackHTML += '</tr>';
                    feedbackHTML += '<tr>';
                      feedbackHTML += '<td width="330" height="120" colspan="2" align="left" valign="top" style="border:solid 1px gray;padding-left:10px;padding-top:8px;padding-right:10px;">';
                        feedbackHTML += userAnswerHTML[i];
                      feedbackHTML += '</td>';
                    feedbackHTML += '</tr>';
                    feedbackHTML += '<tr>';
                      feedbackHTML += '<td width="330" colspan="2" align="left" valign="top" class="tdRetro" style="padding-top:2px;">';
                        feedbackHTML += retroTxt;
                      feedbackHTML += '</td>';
                    feedbackHTML += '</tr>';
                  feedbackHTML += '</table>';
                feedbackHTML += '</td>';
                feedbackHTML += '<td width="20" height="141">';
                feedbackHTML += '</td>';

                nbLigne++;

                if (nbLigne == 2){
                    feedbackHTML += '</tr>';

                    feedbackHTML += '<tr>';
                      feedbackHTML += '<td width="700" height="35" align="left" colspan="4">';
                      feedbackHTML += '</td>';
                    feedbackHTML += '</tr>';

                    feedbackHTML += '</table>';

                    nbLigne = 0;
                }
            }
        }

        if (this.colors.length%2 && this.colors.length > 1){
            //nb impair de classeur

            feedbackHTML += '</tr>';
            feedbackHTML += '<tr>';
              feedbackHTML += '<td width="700" height="35" align="left" colspan="4">';
              feedbackHTML += '</td>';
            feedbackHTML += '</tr>';

            feedbackHTML += '</table>';
        }


        var goodAnswerCountRequired = this.choicesStart.length;
        var wrongAnswerCountPossible = this.choicesStart.length;

        if (wrongAnswerCount > wrongAnswerCountPossible){
            wrongAnswerCount = wrongAnswerCountPossible;
        }

        if(this.mustGiveAllGoodAnswers == false){
            var goodAnswerPonderation = this.ponderation / goodAnswerCountRequired;
            this.currentScore = (goodAnswerCount * goodAnswerPonderation) - (wrongAnswerCount * this.iFautePond);

            if (this.currentScore < 0){
                this.currentScore = 0;
            }

        }else{
            if (statusCompleted == true){
                this.currentScore = this.ponderation;
            }
            else{
                this.currentScore = 0;
            }
        }


        switch (spanFeedbackHTML){
            case 0:
                strSpanFeedbackHTML = '<span class="Green">' + this.quiz.goodAnswerLabel + '</span><br /><br />';
            break;

            case 1:
                strSpanFeedbackHTML = '<span class="Red">' + this.quiz.wrongAnswerLabel + '</span><br /><br />';
            break;

            case 2:
                strSpanFeedbackHTML = '<span class="Yellow">' + this.quiz.incompleteAnswerLabel + '</span><br /><br />';
                this.currentScore = 0;
            break;
        }

        if (foundHilite == true){
            feedbackHTML = strSpanFeedbackHTML + feedbackHTML;
        }
        else{
            feedbackHTML = strSpanFeedbackHTML;
        }

        feedbackHTML = feedbackHTML + '<br /><br />';


        setFeedback(feedbackHTML);
        openFeedback();

        return this.currentScore;
    },

    showSolution: function(){
        var solutionTxt = '';
        var putSpanStart = false;
        var putSpanEnd = false;
        var txtSpanToPut;

        var solutionHTML =  this.quiz.solutionLabel + '<br /><br />';
	
        for (i = 0; i < this.initialMainText.length; i++){
            for (j = 0; j < this.choicesStart.length; j++){
                if (i == this.choicesStart[j]){
                    txtSpanToPut = '<span style="background-color: #' + this.choicesColor[j] + '">';
                    putSpanStart = true;
                }
                if (i == this.choicesEnd[j]){
                    putSpanEnd = true;
                }
            }
			if ((putSpanStart == true) && (putSpanEnd == true)){
                solutionTxt = solutionTxt + txtSpanToPut + this.initialMainText.charAt(i) + '</span>';
                 putSpanStart = false;
                 putSpanEnd = false;
            }
            else if (putSpanStart == true){
                solutionTxt = solutionTxt + txtSpanToPut + this.initialMainText.charAt(i);
                putSpanStart = false;
            }
            else if (putSpanEnd == true){
                solutionTxt = solutionTxt + this.initialMainText.charAt(i) + '</span>';
                putSpanEnd = false;
            }
            else{
                solutionTxt = solutionTxt + this.initialMainText.charAt(i);
            }
        }
        putSpanStart = false;
        putSpanEnd = false;
        solutionHTML = solutionHTML + '<div class="solutionMarquage">' + solutionTxt + '</div>';

        setFeedback(solutionHTML);
        openFeedback();
    },

    redo: function(){
        this.sRepAct = '';
        this.currentScore = 0;
        this.redoQuestion = true;
        this.status = this.quiz.statusToRedo;

        closeFeedback();
        this.display();
    },

    redoQuiz: function(){
        this.currentScore = 0;
        this.redoQuestion = true;
        this.status = this.quiz.statusToRedo;
    },

    trim : function(myString){
         return myString.replace(/^\s+/g,'').replace(/\s+$/g,'')
    },

    getConsigne: function(){
        return this.quiz.consigneMarquage;
    }

});

