﻿// JScript File 
function GetElementId(id)
{
    return document.getElementById(id);
}

function activateLink(prefix, prid)
{
    var e = getElement(prefix + 'Link');
    var cible = $('#hiddenLink_' + prid).val();

    if(e != null)
        e.innerHTML = '<a href="' + cible + '" title="Pour&nbsp;ajouter&nbsp;un&nbsp;avis&nbsp;sur&nbsp;ce&nbsp;produit,&nbsp;merci&nbsp;de&nbsp;lui&nbsp;donner&nbsp;d&#145;abord&nbsp;une&nbsp;note">Ajouter&nbsp;un&nbsp;avis</a>';
}

function activateLinkPopin(prefix, prid)
{
    var e = getElement(prefix + 'Link');
    var cible = $('#hiddenLink_' + prid).val();

    if(e != null)
        e.innerHTML = '<a onclick="' + cible + '" title="Pour&nbsp;ajouter&nbsp;un&nbsp;avis&nbsp;sur&nbsp;ce&nbsp;produit,&nbsp;merci&nbsp;de&nbsp;lui&nbsp;donner&nbsp;d&#145;abord&nbsp;une&nbsp;note">Ajouter&nbsp;un&nbsp;avis</a>';
}

function desactivateLink(prefix)
{
    var e = getElement(prefix + 'Link');

    if(e != null)
        e.innerHTML = '<span " title="Pour&nbsp;ajouter&nbsp;un&nbsp;avis&nbsp;sur&nbsp;ce&nbsp;produit,&nbsp;merci&nbsp;de&nbsp;lui&nbsp;donner&nbsp;d&#145;abord&nbsp;une&nbsp;note">Ajouter&nbsp;un&nbsp;avis</span>';
}

function activateLinkWebApp(prefix, prid) {
    var e = getElement(prefix + 'Link');
    var cible = $('#hiddenLink_' + prid).val();

    if (e != null)
        e.innerHTML = '<a href="' + cible + '">Ajouter&nbsp;un&nbsp;avis (Link WebApp Actif)</a>';
}

function desactivateLinkWebApp(prefix) {
    var e = getElement(prefix + 'Link');

    if (e != null)
        e.innerHTML = '<span " title="Pour&nbsp;ajouter&nbsp;un&nbsp;avis&nbsp;sur&nbsp;ce&nbsp;produit,&nbsp;merci&nbsp;de&nbsp;lui&nbsp;donner&nbsp;d&#145;abord&nbsp;une&nbsp;note">Ajouter&nbsp;un&nbsp;avis (No WebApp link) </span>';
}

var connector = new function()
{
    //var gai=this; //permet d'accéder aux attribut publiques de l'objet depuis la fonction via un simple gai.monattribut

    /*** Variables  de paramétrage du GAI ***/
    this.XMLUrl = ""; //url du XML paramétrable dans la page

    /* attributs privés */
    var XML = null; //variable qui contient le résultat de la requête XHR qui a été faite. cet objet est privé et ne peux être utilisé que par des méthodes du GAI
    var initiated = false;
    this.init = function()
    {

        try
        {
            if(!initiated)
                XML = getXHR();
            initiated = true;
        }
        catch(ex) { }
    };

    this.putValuation = function(articleId, userId, valuation, prefix)
    {

        this.init();
        var UrlToCall = this.XMLUrl;
        // Method
        UrlToCall += 'PutValuation?'
        // Parameters
        UrlToCall += 'ArticleId=' + articleId + '&UserId=' + userId + '&Valuation=' + valuation

        XML.open("GET", UrlToCall, true);
        XML.send(null);

        getElement(prefix + "ref").value = valuation;
    };
    this.putValuation2 = function(articleId, userId, valuation, prefix)
    {
        getElement(prefix + "ref").value = valuation;
    };
    this.putRelation = function(articleId, userId, relationId)
    {

        this.init();
        var UrlToCall = this.XMLUrl;
        var action;
        if(document.getElementById('action') != null)
            action = document.getElementById('action').value;
        // Method
        UrlToCall += 'PutRelation?'
        // Parameters
        UrlToCall += 'ArticleId=' + articleId + '&UserId=' + userId + '&RelationId=' + relationId
        XML.open("GET", UrlToCall, true);
        XML.send(null);
        XML.onreadystatechange = function()
        {
            if(this.readyState == 4)
            { /* 4 : état "complete"  */
                if(this.status == 200)
                {/* 200 : code HTTP pour OK */
                    //debugger
                    if(document.getElementById('NodeParent') != null)
                    {
                        var NodeParent = document.getElementById('NodeParent').value;
                        RefreshMenu(NodeParent, userId, action);
                    }
                } else
                {
                    alert("Une erreur est survenue")
                };
            }
        }
    };
    this.putInterestRelation = function(nodeId, userId, relationId, control)
    {
        if(control.checked)
        {
            this.init();
            var UrlToCall = this.XMLUrl;
            var action;
            if(document.getElementById('action') != null)
                action = document.getElementById('action').value;

            // Method
            UrlToCall += 'PutInterestRelation?'
            // Parameters
            UrlToCall += 'NodeId=' + nodeId + '&UserId=' + userId + '&RelationId=' + relationId
            XML.open("GET", UrlToCall, true);
            XML.send(null);
            // debugger	
            XML.onreadystatechange = function()
            {
                if(XML.readyState == 4)
                { /* 4 : état "complete"  */
                    if(XML.status == 200)
                    {/* 200 : code HTTP pour OK */
                        //debugger
                        if(document.getElementById('NodeParent') != null)
                        {
                            var NodeParent = document.getElementById('NodeParent').value;
                            RefreshMenu(NodeParent, userId, action);
                        }
                    } else
                    {
                        alert("Une erreur est survenue")
                    };
                }
            }
        }
    };
}
function RefreshMenu(nodeId, userId, action)
{
    httpRequest = getXHR();
    var UrlToCall = document.getElementById('MenuRender').value;
    var menuType = document.getElementById('MenuRenderParam').value;
    waitingMsg.show();
    waitingMsg.setHideTimer();
    var laps = new Date();
    // Parameters		
    UrlToCall += '?MenuType=' + menuType + '&NodeId=' + nodeId + '&UserId=' + userId + "&action=" + action + "&date=" + laps
    httpRequest.open("GET", UrlToCall, true);
    httpRequest.send(null);

    httpRequest.onreadystatechange = function()
    {
        // debugger        
        if(httpRequest.readyState == 4 || httpRequest.readyState == "complete")
        {
            waitingMsg.hide();
            if(document.getElementById('MenuRenderContent') != null)
            {
                x = document.getElementById('MenuRenderContent')
                if(httpRequest.status == 200)
                    x.innerHTML = httpRequest.responseText;
            }
        }
    }
};
function getXHR()
{
    function xmlpref()
    {
        if(xmlpref.prefix) return xmlpref.prefix;
        var prefixes = ['MSXML2', 'Microsoft', 'MSXML', 'MSXML3'];
        for(var i = 0;i < prefixes.length;i++)
        {
            try
            {
                return xmlpref.prefix = prefixes[i];
            }
            catch(ex) { }
        }
    }
    if(window.XMLHttpRequest)
    {
        return new XMLHttpRequest();
    }
    if(window.ActiveXObject)
    {
        return new ActiveXObject(xmlpref() + '.XmlHttp');
    }
    return null;
}


/* Opinion Functions*/
function HightLight(prefix, index, pathImg)
{
    for(var i = 1;i <= 5;i++)
    {
        if(i <= index)
            getElement(prefix + 'StarL' + i).src = pathImg + 'MyFnac/deco/starIn.png';
        else
            getElement(prefix + 'StarL' + i).src = pathImg + 'MyFnac/deco/starOut.png';
    }
}

function getStartPos(prefix, pathImg)
{
    if(getElement(prefix + 'ref') != null)
    {
        var initPos = getElement(prefix + 'ref').value;
        for(var i = 1;i <= 5;i++)
        {
            if(i <= initPos)
            {
                getElement(prefix + 'StarL' + i).src = pathImg + 'MyFnac/deco/starIn.png';
            } else
            {
                getElement(prefix + 'StarL' + i).src = pathImg + 'MyFnac/deco/starOut.png';
            }
        }
    }
}

/* POUR NOTATION COMMUNAUTAIRE */
function HightLightCom(prefix, index, pathImg)
{
    for(var i = 1;i <= 5;i++)
    {
        if(i <= index)
            getElement(prefix + 'StarL' + i).src = pathImg + 'communautaire/pictos/star-In-big.png';
        else
            getElement(prefix + 'StarL' + i).src = pathImg + 'communautaire/pictos/star-Out-big.png';
    }
}

function getStartPosCom(prefix, pathImg)
{
    if(getElement(prefix + 'ref') != null)
    {
        var initPos = getElement(prefix + 'ref').value;
        for(var i = 1;i <= 5;i++)
        {
            if(i <= initPos)
            {
                getElement(prefix + 'StarL' + i).src = pathImg + 'communautaire/pictos/star-In-big.png';
            } else
            {
                getElement(prefix + 'StarL' + i).src = pathImg + 'communautaire/pictos/star-Out-big.png';
            }
        }
    }
}

/* POUR MAIL AVIS CONSO */
function HightLightPurchaseArticlePopin(prefix, index, pathImg)
{
    for(var i = 1;i <= 5;i++)
    {
        if(i <= index)
            getElement(prefix + 'StarL' + i).src = pathImg + 'MyFnac/avis-conso/starIn-white.png';
        else
            getElement(prefix + 'StarL' + i).src = pathImg + 'MyFnac/avis-conso/starOut-white.png';
    }
}

function getStartPosPurchaseArticlePopin(prefix, pathImg)
{
    if(getElement(prefix + 'ref') != null)
    {
        var initPos = getElement(prefix + 'ref').value;
        for(var i = 1;i <= 5;i++)
        {
            if(i <= initPos)
            {
                getElement(prefix + 'StarL' + i).src = pathImg + 'MyFnac/avis-conso/starIn-white.png';
            } else
            {
                getElement(prefix + 'StarL' + i).src = pathImg + 'MyFnac/avis-conso/starOut-white.png';
            }
        }
    }
}

function putRelation(Relation, Checkbox, SisterCheckbox, pathImg)
{
    var returnvalue = 0;
    if(Checkbox.src.substr(Checkbox.src.length - 6, 12) == 'on.gif')
    {
        Checkbox.src = pathImg + 'MyFnac/deco/caseoff.gif';
        returnvalue = -1 * parseInt(Relation.substr(1, 1));
    }
    else
    {
        returnvalue = parseInt(Relation.substr(1, 1));
        Checkbox.src = pathImg + 'MyFnac/deco/caseon.gif';
        if(SisterCheckbox)
            SisterCheckbox.src = pathImg + 'MyFnac/deco/caseoff.gif';
    }

    return returnvalue;
}

function popValidation(prefix)
{

    var initPos = getElement(prefix + 'StarL1');

    var deja = document.getElementById('valid_rating');
    if(deja) { document.body.removeChild(deja); }
    var pos = findPos(initPos);
    var content = "<p class='gras mrg_no pdg_sm' style='background-color:#fff;border:1px solid #ccc'>";
    content += "Note prise en compte";
    content += "</p>";

    var popin = document.createElement("DIV");
    popin.id = "valid_rating";
    popin.className = "valid_rating";
    popin.innerHTML = content;
    document.body.appendChild(popin);

    if(popin.style.display != "block") { popin.style.display = "block"; }
    popin.style.position = "absolute";
    popin.style.zIndex = "300";
    popin.style.left = (pos[0] + 15) + "px";
    popin.style.top = (pos[1] - 40) + "px";

    setTimeout(function()
    {
        deja = document.getElementById('valid_rating');
        if(deja) { document.body.removeChild(deja); }
    }, 2000);
    return false;
}
function notationtip()
{
    $(document).ready(function()
    {
        if($.browser.safari || $.browser.mozilla)
        {
            $("img#StarL").hover(function()
            {
                var note = $(this).attr("alt");
                var objId = $(this).attr("id");
                var notation = document.createElement("DIV");
                notation.id = "notes";
                notation.className = "notationtip";
                notation.innerHTML = note;
                notation.style.display = "block";
                notation.style.position = "absolute";
                notation.style.zIndex = "300";
                notation.style.backgroundColor = "#ffffe1";
                notation.style.padding = "2px";
                notation.style.border = "1px solid #000";
                notation.style.height = "14px";
                notation.style.color = "black";
                notation.style.fontSize = "10px";
                notation.style.left = mouseX + "px";
                notation.style.top = (mouseY + 15) + "px";
                notation.style.whiteSpace = "nowrap";
                document.body.appendChild(notation);
            },
	function()
	{
	    var meurs = $("div#notes");
	    if(meurs) { meurs.remove(); }
	});
        }
    });
}
function deleteSelection(id)
{
    for(var i in selection)
    {
        if(selection[i] == id)
        {
            selection.splice(i, 1);
            break;
        }
    }
}
function deleteAll(table)
{
    for(var i in selection)
    {
        selection.splice(i, selection.length);
    }
}
function ifAlreadySelected(id)
{
    var drapeau = false;
    for(var i in selection)
    {
        if(selection[i] == id)
        {
            drapeau = true;
            break;
        }
    }
    return drapeau;
}

var divOpen = false;
var selection = new Array();
function redraw(param, bId, from)
{

    var attrObj = document.getElementById(bId);
    var fnClick = attrObj.parentNode.attributes["onclick"].nodeValue;

    function recupArgs(phrase)
    {
        // fn spécifique à la fn de lRasle
        var rawArgs = phrase.split("(");
        var args = rawArgs[1].split(",");
        return [args[0], args[1]];
    }
    var checkB = $("img#" + bId);
    var checkBsrc = checkB.attr("src");
    var state = checkBsrc.indexOf("caseon.gif", 0);

    var id = bId;
    var img = checkB.parents("div").siblings("a[title='En savoir plus']").children("img");
    var title = checkB.parents("div").siblings("h3").text();
    var author = checkB.parents("div").siblings("h4").text();
    var ok = false;
    if(from == "img")
    {
        if(state == -1 && param == "oui")
        {
            ok = true;
        }
        else if(state != -1 && param == "oui")
        {
            param = "non";
            ok = true;
        }
        else if(state == -1 && param == "non")
        {
            ok = true;
        } else if(state != -1 && param == "non")
        {
            ok = true;
        }
    } else if(from == "label")
    {
        if(state == -1 && param == "oui")
        {
            ok = true;
        }
        else if(state != -1 && param == "oui")
        {
            param = "non";
            ok = true;
        }
        else if(state == -1 && param == "non")
        {
            ok = true;

        }
        else if(state != -1 && param == "non")
        {
            ok = true;

        }
    }

    if(param == "oui" && ok == true)
    {
        if(ifAlreadySelected(id))
        {
            return;
        }
        else
        {
            selection.push(id);

            if(!divOpen)
            {

                $("#collectionAdded").css("display", "block");
                divOpen = true;

            }
            var html = "<div class='iHave pdg txt_c'><a href='#' title='" + id + "'></a><img src='" + img.attr("src") + "' alt='' /><h3>" + title + "</h3><h4>" + author + "</h4></div>";
            $("#collectionAdded .content").prepend(html);
            $("#collectionAdded .content .iHave a").ready(function()
            {
                $(".iHave a").click(function()
                {
                    var croix = $(this);
                    var id = croix.attr("title");
                    // ici on supprime le conteneur cible qui contient ce 'a'
                    croix.parent("div.iHave").remove();
                    deleteSelection(id);
                    // on décoche la case dans la colonne gauche
                    var arguments = recupArgs(fnClick);
                    connector.putRelation(arguments[0], arguments[1], putRelation('r3', document.getElementById(id), getElement(id), globalImgPath));
                    if($("#collectionAdded .content div.iHave").length < 1)
                    {
                        $("#collectionAdded").hide();
                        //$("#collectionEmpty").show();
                        divOpen = false;
                    }
                    return false;
                });
            });
        }
    }
    else if(param == "non" && ok == true)
    {
        if(divOpen)
        {
            for(var i in selection)
            {
                if(selection[i] == id)
                {
                    selection.splice(i, 1);
                    $("#collectionAdded .content div.iHave a[title='" + id + "']").parent("div.iHave").remove();

                    if($("#collectionAdded .content").children().length < 1)
                    {
                        $("#collectionAdded").hide();
                        //$("#collectionEmpty").show();
                        divOpen = false;
                    }
                }
            }
        }
        return false;
    }
}

function checkBmanager()
{
    $(document).ready(function()
    {
        $("img[alt='oui']").click(function()
        {
            redraw("oui", $(this).attr("id"), "img");
        });
        $("img[alt='non']").click(function()
        {
            redraw("non", $(this).parent("li").prev("li").children("img").attr("id"), "img");
        });
        $("label.souligner").click(function()
        {
            var prevAlt = $(this).prev().attr("alt");
            if(prevAlt == "non")
            {
                var previous = $(this).parent("li").prev("li").children("img").attr("id");
                redraw(prevAlt, previous, "label");
            }
            else if(prevAlt == "oui")
            {
                var previous = $(this).attr("for");
                redraw(prevAlt, previous, "label");
            }
        });
    });
}

function callLabel(reference, prefix, identity, imgPath, xml)
{
    connector.XMLUrl = xml + "/"

    $("#" + prefix + "choice1").next().click(function()
    {
        connector.putRelation(reference, identity, putRelation('r3', getElement(prefix + 'choice1'), getElement(prefix + 'choice2'), imgPath))
    });
    $("#" + prefix + "choice2").next().click(function()
    {
        connector.putRelation(reference, identity, putRelation('r3', getElement(prefix + 'choice2'), getElement(prefix + 'choice1'), imgPath))
    });

    /* Ajout du pointeur sur les labels */
    $("#" + prefix + "choice1").next().mouseover(function()
    {
        $(this).css("cursor", "pointer");
    });
    $("#" + prefix + "choice2").next().mouseover(function()
    {
        $(this).css("cursor", "pointer");
    });
}

/* NLA -- 20091214 -- Popin pour votes utiles */
function popChoice(control, message)
{

    var initPos = this.getElement(control);

    var deja = document.getElementById('valid_choice');
    if(deja) { document.body.removeChild(deja); }

    var waiting = document.getElementById('wait_choice');
    if(waiting) { document.body.removeChild(waiting); }

    var pos = findPos(initPos);
    var content = "<p class='gras mrg_no pdg_sm' style='background-color:#fff;border:1px solid #ccc'>";
    content += message;
    content += "</p>";

    var popin = document.createElement("DIV");
    popin.id = "valid_choice";
    popin.className = "valid_choice";
    popin.innerHTML = content;
    document.body.appendChild(popin);

    if(popin.style.display != "block") { popin.style.display = "block"; }
    popin.style.position = "absolute";
    popin.style.zIndex = "300";
    popin.style.left = (pos[0] + 15) + "px";
    popin.style.top = (pos[1] - 40) + "px";

    setTimeout(function()
    {
        deja = document.getElementById('valid_choice');
        if(deja) { document.body.removeChild(deja); }
    }, 2000);
    return false;
}

function popOutWait(ctrlId)
{
    var popinId = ctrlId + "_wait_choice";
    //var ctrl = this.getElement(ctrlId);
    var waiting = document.getElementById(popinId);
    if(waiting) { document.body.removeChild(waiting); }
}

function popInWait(ctrlId, imgPath)
{
    var ctrl = this.getElement(ctrlId);
    var pos = findPos(ctrl);

    var content = "<p class='gras mrg_no pdg_sm' style='background-color:#fff;border:1px solid #ccc'>";
    content += "<img src=\"" + imgPath + "\" />";
    content += "</p>";

    var popinId = ctrlId + "_wait_choice";
    var waiting = document.getElementById(popinId);
    if(waiting) { document.body.removeChild(waiting); }

    var popin = document.createElement("DIV");
    popin.id = popinId;
    popin.className = "wait_choice";
    popin.innerHTML = content;
    popin.style.position = "absolute";
    popin.style.zIndex = "300";
    popin.style.left = (pos[0] + 15) + "px";
    popin.style.top = (pos[1] - 40) + "px";
    document.body.appendChild(popin);
    popin.style.display = "block";


    setTimeout(function() { popOutWait(ctrlId); }, 30000);

    return false;
}

function popWait(control, sourcePath)
{

    var initPos = this.getElement(control);

    var deja = document.getElementById('valid_choice');
    if(deja) { document.body.removeChild(deja); }

    var waiting = document.getElementById('wait_choice');
    if(waiting) { document.body.removeChild(waiting); }

    var pos = findPos(initPos);
    var content = "<p class='gras mrg_no pdg_sm' style='background-color:#fff;border:1px solid #ccc'>";
    content += "<img src=\"" + sourcePath + "\" />";
    content += "</p>";

    var popin = document.createElement("DIV");
    popin.id = "wait_choice";
    popin.className = "wait_choice";
    popin.innerHTML = content;
    document.body.appendChild(popin);

    if(popin.style.display != "block") { popin.style.display = "block"; }
    popin.style.position = "absolute";
    popin.style.zIndex = "300";
    popin.style.left = (pos[0] + 15) + "px";
    popin.style.top = (pos[1] - 40) + "px";

    return false;
}

function applyCheckIsGift(control, uniqueId, rowId)
{

    var cbo = this.getElement(control);
    var NewValue;
    if(cbo)
    {
        NewValue = cbo.checked;
        return WebForm_DoCallback(uniqueId, 'GIFT|' + rowId + '|' + NewValue, JSHandlerStructWithMsg, null, null, true);
    }
    return false;
}

function ValidePuchaseArticleAddComment(UniqueId, puchaseArticleInfoId, rating)
{
    var CommentTilte = jQuery.trim($('#Impression').val()).replace(/\|/g, '').replace(/\'/g, '\\\'');
    var CommentText = jQuery.trim($('#AddedComment').val()).replace(/\|/g, '').replace(/\'/g, '\\\'');
    CommentText = CommentText.replace(/\n/g, '');

    var CommentLocation = jQuery.trim($('#Location').val()).replace(/\|/g, '').replace(/\'/g, '\\\'');
    var CommentNickname = jQuery.trim($('#Nickname').val()).replace(/\|/g, '').replace(/\'/g, '\\\'');

    var separator = '|';
    var chTotal = 'SAVECOMMENT' + separator + puchaseArticleInfoId + separator + CommentTilte + separator + CommentText + separator + CommentLocation + separator + CommentNickname + separator + rating;
    var msg = 'WebForm_DoCallback(\'' + UniqueId + '\',\'' + chTotal + '\',JSHandlerStructWithMsg,null,null,true)';
    return DirectRenderingWithMsg(msg);
}

function ValidePurchaseArticleSendFriend(UniqueID, UniqueIdEpure, puchaseArticleInfoId)
{
    var _MailExpe = jQuery.trim($('#_MailExpe' + UniqueIdEpure).val()).replace(/\|/g, '').replace(/\'/g, '\\\'');
    var _NomExpe = jQuery.trim($('#_NomExpe' + UniqueIdEpure).val()).replace(/\|/g, '').replace(/\'/g, '\\\'');

    var _Contenu = jQuery.trim($('#_Contenu' + UniqueIdEpure).val()).replace(/\|/g, '').replace(/\'/g, '\\\'');
    _Contenu = _Contenu.replace(/\n/g, '\\n');

    var Mail = '';
    var Nom = '';

    var separator;
    for(var i = 0;i < 4;i++)
    {
        if(i == 0)
            separator = '';
        else
            separator = '¤';
        Mail += separator + jQuery.trim($('#Mail' + i + UniqueIdEpure).val()).replace(/\|/g, '').replace(/\'/g, '\\\'');
        Nom += separator + jQuery.trim($('#Nom' + i + UniqueIdEpure).val()).replace(/\|/g, '').replace(/\'/g, '\\\'');
    }
    separator = '|';
    var chTotal = 'SENDMAILFRIEND' + separator + puchaseArticleInfoId + separator + _MailExpe + separator + _NomExpe + separator + Mail + separator + Nom + separator + _Contenu;
    var msg = 'WebForm_DoCallback(\'' + UniqueID + '\',\'' + chTotal + '\',JSHandlerStructWithMsg,null,null,true)';
    return DirectRenderingWithMsg(msg);
}

function limiteMaxPopin(zone, max)
{
    if(zone.value.length > max)
    {
        zone.value = zone.value.substring(0, max);
        alert("Vous ne pouvez dépasser " + max + " caractères.");
    }
    valeur = zone.value.length;
    var reste = (max - valeur);
}

function limiteMinPopin(zone, div, inputText, valeurMin)
{
    var valeur = zone.value.length;
    var reste = (valeurMin - valeur);

    if(reste < 0) reste = 0;
    document.getElementById('' + inputText + '').value = reste;
    if(reste > 1)
    {
        txt = "Caractères manquants :";
        document.getElementById('' + div + '').innerHTML = txt;
    }
    else if(reste < 2 && reste > -1)
    {
        txt = "Caractère manquant :";
        document.getElementById('' + div + '').innerHTML = txt;
    }
}
function chValidation(prefix)
{
    var who = prefix + "StarL0";
    var p = $("#" + who).parent();
    p.children("span").fadeIn("slow").addClass("vert").text("enregistré");
}

