//////////////////////////////////////////////////////////////////////////
//COMMON
//////////////////////////////////////////////////////////////////////////
//var g_WebSiteUrl = new String("http://dev.utopiapolis.eu");
/*var g_WebSiteUrl = new String("http://127.0.0.1/dev.utopiapolis.eu/");
var g_WebSiteUrlFunction = new String(g_WebSiteUrl+"/index.php?FUNCTION=");*/
/*
function ffalse() {
    return false;
}
function ftrue() {
    return true;
}
document.onselectstart = new Function("return false");
if (window.sidebar) {
    document.onmousedown = ffalse;
    document.onclick = ftrue;
}    */

var g_IdWindowTmp;
var g_KeyJobTmp;
var g_KeyToolsTmp;
var g_OldDesktop;
var g_ChatMaximised;
var g_UpdatePlante = false;
var g_WindowsHeight;
//////////////////////////////////////////////////////////////////////////
//ADD WINDOW SHORCUT
//////////////////////////////////////////////////////////////////////////
function AddWindowUserMission(KeyUser, KeyMission) {
    AddWindow(g_WebSiteUrl + '/index.php?PAGE=108&RENDER_MODE=WINDOW&KEY_USER=' + KeyUser + '&KEY_MISSION=' + KeyMission, 0);
}


//////////////////////////////////////////////////////////////////////////
//PLANTE
//////////////////////////////////////////////////////////////////////////
function UpdatePlante() 
{
    HttpPostRequest(g_WebSiteUrlFunction + '195', '', OnUpdatePlante);
}
//////////////////////////////////////////////////////////////////////////
function OnClickPot(KeyPot) {
    HttpPostRequest(g_WebSiteUrlFunction + '194','KEY_POT='+KeyPot, OnUpdatePlante);
    SafeHideObjectById('PLANTE_COMMAND');
}
//////////////////////////////////////////////////////////////////////////
function OnClickArroser() 
{
    HttpPostRequest(g_WebSiteUrlFunction + '192', '', OnUpdatePlante);
    SafeHideObjectById('PLANTE_COMMAND');
}
//////////////////////////////////////////////////////////////////////////
function OnClickBoost() {
    HttpPostRequest(g_WebSiteUrlFunction + '193', '', OnUpdatePlante);
    SafeHideObjectById('PLANTE_COMMAND');
}
//////////////////////////////////////////////////////////////////////////
function OnUpdatePlante(Result) {
    document.getElementById("PLANTE").innerHTML = Result;
}
//////////////////////////////////////////////////////////////////////////
function UserBlockUser(KeyUser, KeyUserTarget) 
{
    var Justification = prompt('Veuillez indiquer la raison', 'raison');
    if (Justification != null)
        HttpPostRequest(g_WebSiteUrlFunction + '180', "KEY_TARGET=" + KeyUserTarget + "&INFORMATION=" + Justification + "&KEY_ORIGIN=" + KeyUser, null);

}
//////////////////////////////////////////////////////////////////////////
function OnCheckCode(IdWindow) 
{
    var _Code1 = document.getElementById("CODE_CADEAU_PART_1_" + IdWindow).value;
    var _Code2 = document.getElementById("CODE_CADEAU_PART_2_" + IdWindow).value;
    var _Code3 = document.getElementById("CODE_CADEAU_PART_3_" + IdWindow).value;
    var _Code4 = document.getElementById("CODE_CADEAU_PART_4_" + IdWindow).value;
    var _Code5 = document.getElementById("CODE_CADEAU_PART_5_" + IdWindow).value;

    HttpPostRequest(g_WebSiteUrlFunction + '181', "CODE_1=" + _Code1 + "&CODE_2=" + _Code2 + "&CODE_3=" + _Code3 + "&CODE_4=" + _Code4 + "&CODE_5=" + _Code5, OnCheckCodeUpdate);
    
    g_IdWindowTmp = IdWindow;
    document.getElementById("WIN_CADEAU_" + IdWindow).innerHTML = "Verification en cours...";
}
//////////////////////////////////////////////////////////////////////////
function OnCheckCodeUpdate(Result) 
{
    document.getElementById("WIN_CADEAU_" + g_IdWindowTmp).innerHTML = Result;

}
//////////////////////////////////////////////////////////////////////////
function AddJobFiles(IdWindow, KeyTarget)
{
    var _Text = document.getElementById("TEXT_ADD_JOB_FILES_" + IdWindow).value;
    var _KeyJob = document.getElementById("SELECT_JOB_ADD_JOB_FILES_" + IdWindow).value;
    if (_Text == "") {
        alert('Le texte ne peut pas etre vide');
        return;
    }
    if (_KeyJob == 0) {
        alert('Vous devez choisir un metier');
        return;
    }
    HttpPostRequest(g_WebSiteUrlFunction + '176', "KEY_JOB="+_KeyJob+"&KEY_TARGET="+ KeyTarget +"&INFORMATION=" + _Text, UpdateChat);

    document.getElementById("TEXT_ADD_JOB_FILES_" + IdWindow).value = "";
    alert('Message ajoute');
}
//////////////////////////////////////////////////////////////////////////
//NEWS
//////////////////////////////////////////////////////////////////////////
function SaveNews(IdWindow, KeyNews) 
{
    var _Rubrique = document.getElementById("NEWS_RUBRIQUE_" + IdWindow + "_" + KeyNews).value;
    var _News = document.getElementById("NEWS_TEXT_" + IdWindow + "_" + KeyNews).value;
    var _Color = document.getElementById("NEWS_COLOR_" + IdWindow + "_" + KeyNews).value;
    HttpPostRequest(g_WebSiteUrlFunction + '200', "KEY_NEWS=" + KeyNews + "&RUBRIQUE=" + _Rubrique + "&NEWS=" + _News + "&COLOR=" + _Color, null);
    alert('Modification ok');
}
//////////////////////////////////////////////////////////////////////////
//GOODIES
//////////////////////////////////////////////////////////////////////////
function OnClickOrderGoodies(KeyGoodies)
{
    if(confirm('Confirmez vous votre commande?'))
    {
        alert('Votre demande est transferee a un agent qui vous contactera prochainement');
        HttpPostRequest(g_WebSiteUrlFunction + '175', "KEY_GOODIES=" + KeyGoodies, null);
    }
}
//////////////////////////////////////////////////////////////////////////
//WELCOME
//////////////////////////////////////////////////////////////////////////
function OnClickWelcomeTab(IdWindow, TabIndex) 
{
    HttpPostRequest(g_WebSiteUrlFunction + '173', "TAB=" + TabIndex + "&ID_WINDOW=" + IdWindow, OnUpdateClickWelcomeTab);
    g_IdWindowTmp = IdWindow;
    document.getElementById("NEWS_LIST_" + g_IdWindowTmp).innerHTML = "Chargement...";
}
//////////////////////////////////////////////////////////////////////////
function OnUpdateClickWelcomeTab(Result) 
{
    document.getElementById("NEWS_LIST_" + g_IdWindowTmp).innerHTML = Result;
}
//////////////////////////////////////////////////////////////////////////
//CHAT
//////////////////////////////////////////////////////////////////////////
function SmileyChat() 
{
    if (document.getElementById("SMILEY_CHAT_LIST").style.display == "none")
    {
        SafeShowObjectById('SMILEY_CHAT_LIST');
    }
    else 
    {
        SafeHideObjectById('SMILEY_CHAT_LIST');
    }

    
}
//////////////////////////////////////////////////////////////////////////
function AddBBCodeChat(Code) {
    document.getElementById("INSTANT_CHAT_FORM_TEXT").value += Code;
    SafeHideObjectById('SMILEY_CHAT_LIST');
}
//////////////////////////////////////////////////////////////////////////
function DesactivateUserChat(ReactivateUserChat) 
{
    var Justification = prompt('Veuillez indiquer la raison', 'raison');
    if (Justification != null)
        HttpPostRequest(g_WebSiteUrlFunction + '178', "KEY_TARGET=" + KeyTarget + "&JUSTIFICATION="+Justification,null);
}
//////////////////////////////////////////////////////////////////////////
function DesactivateUserChat(KeyTarget) 
{
    var Justification = prompt('Veuillez indiquer la raison', 'raison');
    if (Justification != null)
        HttpPostRequest(g_WebSiteUrlFunction + '177', "KEY_TARGET=" + KeyTarget + "&JUSTIFICATION=" + Justification, null);
}
//////////////////////////////////////////////////////////////////////////
function HideChat() 
{
    //RemoveTimer('TimerElephant'); //TODO pause timer
    SafeHideObjectById('BOTTOM_BAR_BUTTON_HIDE_CHAT');
    SafeHideObjectById('DESKTOP_CHAT');
    SafeShowObjectById('BOTTOM_BAR_BUTTON_SHOW_CHAT');
}
//////////////////////////////////////////////////////////////////////////
function ShowChat() 
{
    SafeShowObjectById('BOTTOM_BAR_BUTTON_HIDE_CHAT');
    SafeShowObjectById('DESKTOP_CHAT');
    SafeHideObjectById('BOTTOM_BAR_BUTTON_SHOW_CHAT');
    
}
//////////////////////////////////////////////////////////////////////////
function InitChat()
{
    TimerChat = new CTimer() ;
    TimerChat.SetNumberRepeate( 100000 );
    TimerChat.SetInterval( 5 );
    TimerChat.SetFirstExecutionOnStart( true );
    TimerChat.SetOnTimeFunction(function () { HttpPostRequest(g_WebSiteUrlFunction + '171', "", UpdateChat); });
    TimerChat.SetName('Chat');
    AddTimer ( TimerChat );
}
//////////////////////////////////////////////////////////////////////////
function SendChat()
{
    var _Text = document.getElementById("INSTANT_CHAT_FORM_TEXT").value;
    HttpPostRequest(g_WebSiteUrlFunction + '170', "TEXT="+_Text,UpdateChat);
    
    document.getElementById("INSTANT_CHAT_FORM_TEXT").value="";
}
//////////////////////////////////////////////////////////////////////////
function UpdateChat(Result)
{
    var chaine = Result;
    var reg = new RegExp("#MAGICWORD#", "g");
    var option_value = chaine.split(reg);
    _ChatContent = option_value[0];
    _ChatOnline = option_value[1];

    document.getElementById("INSTANT_CHAT_CONTENT").innerHTML = _ChatContent;
    if (_ChatOnline != undefined) {
        document.getElementById("INSTANT_CHAT_ONLINE").innerHTML = _ChatOnline;
    }

}
//////////////////////////////////////////////////////////////////////////
function MaximizeChat() 
{
    g_ChatMaximised = !g_ChatMaximised;
    var ie = document.all ? 1 : 0
    var plok = 0;
    if (ie) {
        _width = document.documentElement.clientWidth;
        _height = document.documentElement.clientHeight;
    } else {
        _width = window.innerWidth;
        _height = window.innerHeight;
    }


    _height = _height - 180;
    _height2 = _height+90

    if (g_ChatMaximised) 
    {
        document.getElementById("INSTANT_CHAT_CONTENT").style.height = _height+"px";
        document.getElementById("INSTANT_CHAT_FORM").style.bottom = _height2 + "px";
        document.getElementById("INSTANT_CHAT_ONLINE").style.height = _height + "px";
        document.getElementById("DESKTOP_ICONE").style.left = "540px";
    } else 
    {
        document.getElementById("INSTANT_CHAT_CONTENT").style.height = "160px";
        document.getElementById("INSTANT_CHAT_ONLINE").style.height = "160px";
        document.getElementById("INSTANT_CHAT_FORM").style.bottom = "250px";
        document.getElementById("DESKTOP_ICONE").style.left = "0px";
        
    }
}
//////////////////////////////////////////////////////////////////////////
//ROSE
//////////////////////////////////////////////////////////////////////////
function InitRose() 
{
    CleanRose(); 
    var _Pos = 0;
    for (var _IndexRose = 0; _IndexRose < 10; _IndexRose++) 
    {
        _Pos = 100 + (Math.random() * window.document.body.clientWidth);
        _PosStart = -Math.random() * 200;
        document.getElementById("DESKTOP_ROSE").innerHTML += '<img width="60" id="ROSE_' + _IndexRose + '" src="' + g_WebSiteUrl + 'RESSOURCE/DESKTOP_OVERLAY/rose.png" style="cursor:pointer;position:absolute;top:' + _PosStart + 'px;left:' + _Pos + 'px;z-index:12000">';
    }

    TimerRose = new CTimer();
    TimerRose.SetNumberRepeate(1000);
    TimerRose.SetInterval(0.01);
    TimerRose.SetFirstExecutionOnStart(true);
    TimerRose.SetOnTimeFunction(MoveRose);
    TimerRose.SetName('TimerRose');
    AddTimer(TimerRose);
}
//////////////////////////////////////////////////////////////////////////
function CleanRose() 
{
    document.getElementById("DESKTOP_ROSE").innerHTML = "";
    RemoveTimer('TimerRose');
}
//////////////////////////////////////////////////////////////////////////
function MoveRose() 
{
    var _RoseHiddenCount = 0;
    var Pos =0;

    for (var _IndexRose = 0; _IndexRose < 10; _IndexRose++) 
    {
        Pos = parseInt(RemovePxFromStyle(document.getElementById("ROSE_" + _IndexRose).style.top)) + (Math.random()*5);
        if (Pos > 1200) {
            _RoseHiddenCount++;
        }
        else {
            document.getElementById("ROSE_" + _IndexRose).style.top = Pos + "px";
        }
    }

    if (_RoseHiddenCount > 3) 
    {
        CleanRose();
        
    }


    
    

    /*
    var Pos = parseInt(RemovePxFromStyle(document.getElementById("ROSE_2").style.left)) + 15 * Math.random();
    if (Pos > window.document.body.clientWidth) Pos = 0;
    document.getElementById("ROSE_2").style.left = Pos + "px";
    var Pos = parseInt(RemovePxFromStyle(document.getElementById("ROSE_2").style.top)) + 30 * Math.random() - 15;
    if (Pos < 30) Pos = 30;
    document.getElementById("ROSE_2").style.top = Pos + "px";

    var Pos = parseInt(RemovePxFromStyle(document.getElementById("ROSE_3").style.left)) + 20 * Math.random();
    if (Pos > window.document.body.clientWidth) Pos = 0;
    document.getElementById("ROSE_3").style.left = Pos + "px";
    var Pos = parseInt(RemovePxFromStyle(document.getElementById("ROSE_3").style.top)) + 30 * Math.random() - 15;
    if (Pos < 30) Pos = 30;
    document.getElementById("ROSE_3").style.top = Pos + "px";

    var Pos = parseInt(RemovePxFromStyle(document.getElementById("ROSE_4").style.left)) + 25 * Math.random();
    if (Pos > window.document.body.clientWidth) Pos = 0;
    document.getElementById("ROSE_4").style.left = Pos + "px";
    var Pos = parseInt(RemovePxFromStyle(document.getElementById("ROSE_4").style.top)) + 30 * Math.random() - 15;
    if (Pos < 30) Pos = 30;
    document.getElementById("ROSE_4").style.top = Pos + "px";*/

}
//////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////
//ELEPHANT
//////////////////////////////////////////////////////////////////////////
function CleanElephantRose()
{
    document.getElementById("DESKTOP_ELEPHANT").innerHTML ="";
    RemoveTimer('TimerElephant');
}
//////////////////////////////////////////////////////////////////////////
function OverElephantRose(Element) 
{
    //Element.src = g_WebSiteUrl + 'RESSOURCE/DESKTOP_OVERLAY/elephant_rose_over.gif';
}
//////////////////////////////////////////////////////////////////////////
function OutElephantRose(Element) {
    //Element.src = g_WebSiteUrl + 'RESSOURCE/DESKTOP_OVERLAY/elephant_rose.gif';
}
//////////////////////////////////////////////////////////////////////////
function InitElephantRose()
{


    /*onMouseOver = "this.src=' + g_WebSiteUrl + 'RESSOURCE/DESKTOP_OVERLAY/elephant_rose_over.gif"
    onMouseOver = "this.src=' + g_WebSiteUrl + 'RESSOURCE/DESKTOP_OVERLAY/elephant_rose_over.gif"
    onMouseOver = "this.src=' + g_WebSiteUrl + 'RESSOURCE/DESKTOP_OVERLAY/elephant_rose_over.gif"
    onMouseOver = "this.src=' + g_WebSiteUrl + 'RESSOURCE/DESKTOP_OVERLAY/elephant_rose_over.gif"*/

    document.getElementById("DESKTOP_ELEPHANT").innerHTML += '<img onmouseover="OverElephantRose(this);" onmouseout="OutElephantRose(this);" onclick="OnClickElephant();" id="ELEPHANT_ROSE_1" src="' + g_WebSiteUrl + 'RESSOURCE/DESKTOP_OVERLAY/elephant_rose.gif" style="cursor:pointer;position:absolute;top:160px;left:0px;z-index:25">';
    document.getElementById("DESKTOP_ELEPHANT").innerHTML += '<img onmouseover="OverElephantRose(this);" onmouseout="OutElephantRose(this);" onclick="OnClickElephant();" id="ELEPHANT_ROSE_2" src="' + g_WebSiteUrl + 'RESSOURCE/DESKTOP_OVERLAY/elephant_rose.gif" style="cursor:pointer;position:absolute;top:240px;left:20px;z-index:25">';
    document.getElementById("DESKTOP_ELEPHANT").innerHTML += '<img onmouseover="OverElephantRose(this);" onmouseout="OutElephantRose(this);" onclick="OnClickElephant();" id="ELEPHANT_ROSE_3" src="' + g_WebSiteUrl + 'RESSOURCE/DESKTOP_OVERLAY/elephant_rose.gif" style="cursor:pointer;position:absolute;top:320px;left:40px;z-index:25">';
    document.getElementById("DESKTOP_ELEPHANT").innerHTML += '<img onmouseover="OverElephantRose(this);" onmouseout="OutElephantRose(this);" onclick="OnClickElephant();" id="ELEPHANT_ROSE_4" src="' + g_WebSiteUrl + 'RESSOURCE/DESKTOP_OVERLAY/elephant_rose.gif" style="cursor:pointer;position:absolute;top:400px;left:30px;z-index:25">';

   
    TimerEleph = new CTimer() ;
    TimerEleph.SetNumberRepeate( 100000 );
    TimerEleph.SetInterval( 0.1 );
    TimerEleph.SetFirstExecutionOnStart( true );
    TimerEleph.SetOnTimeFunction( MoveElephant);
    TimerEleph.SetName('TimerElephant');
    AddTimer ( TimerEleph );

}
//////////////////////////////////////////////////////////////////////////
function MoveElephant()
{
    var Pos = parseInt(RemovePxFromStyle(document.getElementById("ELEPHANT_ROSE_1").style.left)) + 10 *Math.random();
    if(Pos > window.document.body.clientWidth)  Pos=0;
    document.getElementById("ELEPHANT_ROSE_1").style.left=Pos+"px";
    var Pos = parseInt(RemovePxFromStyle(document.getElementById("ELEPHANT_ROSE_1").style.top)) + 30*Math.random() -15;
    if(Pos <30)Pos=30; 
    document.getElementById("ELEPHANT_ROSE_1").style.top=Pos+"px";
    
    var Pos = parseInt(RemovePxFromStyle(document.getElementById("ELEPHANT_ROSE_2").style.left)) + 15*Math.random();
    if(Pos > window.document.body.clientWidth)  Pos=0; 
    document.getElementById("ELEPHANT_ROSE_2").style.left=Pos+"px";
    var Pos = parseInt(RemovePxFromStyle(document.getElementById("ELEPHANT_ROSE_2").style.top)) + 30*Math.random() -15;
    if(Pos <30)Pos=30; 
    document.getElementById("ELEPHANT_ROSE_2").style.top=Pos+"px";
    
    var Pos = parseInt(RemovePxFromStyle(document.getElementById("ELEPHANT_ROSE_3").style.left)) + 20*Math.random();
    if(Pos > window.document.body.clientWidth)  Pos=0;
    document.getElementById("ELEPHANT_ROSE_3").style.left=Pos+"px";
    var Pos = parseInt(RemovePxFromStyle(document.getElementById("ELEPHANT_ROSE_3").style.top)) + 30*Math.random() -15;
    if(Pos <30)Pos=30; 
    document.getElementById("ELEPHANT_ROSE_3").style.top=Pos+"px";

    var Pos = parseInt(RemovePxFromStyle(document.getElementById("ELEPHANT_ROSE_4").style.left)) + 25*Math.random();
    if(Pos > window.document.body.clientWidth)  Pos=0; 
    document.getElementById("ELEPHANT_ROSE_4").style.left=Pos+"px";
    var Pos = parseInt(RemovePxFromStyle(document.getElementById("ELEPHANT_ROSE_4").style.top)) + 30*Math.random() -15;
    if(Pos <30)Pos=30; 
    document.getElementById("ELEPHANT_ROSE_4").style.top=Pos+"px";
    
}
//////////////////////////////////////////////////////////////////////////
function OnClickElephant()
{
    var _Message="";
    switch(Math.floor(Math.random()*57))
    {
        case 0:_Message ="Allo Police ! Je viens d'écraser un poulet. Que dois-je faire ? \n Et bien , plumez-le et faites-le cuire		à thermostat 6. \n Ah bon ! Et qu'est-ce que je fais de la moto ?";break;
        case 1:_Message ="Je suis inquiet, je vois des points noirs.\n Tu as vu l'oculiste?\n Non, des points noirs !";break;
        case 2:_Message ="A ma droite, il y avait un lion féroce,\n à ma gauche, un tigre prêt à bondir,\n derrière, des éléphants énormes,...\n Alors ? Qu'as-tu fait pour t'en sortir ?\n J'ai sauté au bas du manège !";break;
        case 3:_Message ="Chéri, dis-moi ce que tu préfères,\n une femme jolie, ou une femme intelligente?\n Ni l'une, ni l'autre, chérie,\n tu sais bien que je n'aime que toi.";break;
        case 4:_Message ="Ecoute, dit la maman à sa petite fille,\n si tu es sage, tu iras au ciel,\n et si tu n'es pas sage, tu iras en enfer.\n Et qu'est-ce que je dois faire pour aller au cirque?";break;
        case 5:_Message ="J'ai battu un record.\n Ah bon, lequel ?\n J'ai reussi à faire en 15 jours un puzzle\n sur lequel il y avait écrit de 3 a 5 ans.";break;
        case 6:_Message ="Je vais acheter cette toile dit le client au peintre. \n C'est une affaire Monsieur. J'y ai passé dix ans de ma vie.\n Dix ans? Quel travail!\n Eh oui: deux jours pour la peindre et le reste pour réussir à la vendre!";break;
        case 7:_Message ="Les gens devraient tout le temps dormir la fenêtre ouverte.\n Pourquoi, vous êtes médecin? \n Non, je suis cambrioleur.";break;
        case 8:_Message ="Vous avez eu beau temps pendant vos vacances? \n Super! Il n'a plu que deux fois.\n La première fois, pendant une demi-journée,\n et la deuxième, pendant 29 jours.";break;
        case 9:_Message ="A combien rouliez-vous? Demande le gendarme.\n A deux seulement, mais si vous voulez monter, il reste de la place.";break;
        case 10:_Message ="Au cinéma, deux bavardes n'arrêtent pas de discuter.\n  Excédé, leur voisin proteste\n S'il vous plait, je n'entend rien du tout.\n Et alors, ca vous regarde, ce que nous disons?";break;
        case 11:_Message ="Au restaurant, le garcon demande au client\n Comment avez-vous trouvé le beefsteak?\n Tout à fait par hasard, en soulevant une frite!";break;
        case 12:_Message ="Au restaurant, Monsieur Dupont s'écrie\n Garcon, il y a une mouche qui nage dans mon assiette.\n Oh, c'est encore le chef qui a mis trop de potage.\n D'habitude, elles ont pieds!";break;
        case 13:_Message ="Cela fait une semaine que je vous soigne pour une jaunisse,\n dit le médecin à son client,\n et c'est maintenant que vous me dites que vous êtes chinois!";break;
        case 14:_Message ="Dans la rue, un homme demande à Madame Dupont :\n Vous n'auriez pas vu un policier ? \n Non.\n Alors donnez-moi votre sac à main. ";break;
        case 15:_Message ="Dans le grand océan, une petite vague est amoureuse du vent.\n Celui-ci lui demande tendrement:\n Tu veux que je te fasse une bourrasque ou un ouragan?\n Oh non, je veux juste une petite bise...";break;
        case 16:_Message ="Deux anges font la causette :\n Quel temps fera-t-il demain ?\n Nuageux.\n Ah tant mieux, on pourra s'asseoir !  ";break;
        case 17:_Message ="Deux escargots arrivent sur une plage et apercoivent une limace :\n Demi-tour ! Nous sommes sur une plage nudiste !";break;
        case 18:_Message ="Deux microbes se rencontrent:\n Tu es pâle, qu'est-ce que tu as?\n Je suis malade, j'ai avalé une aspirine.";break;
        case 19:_Message ="Deux passants se croisent dans la rue :\n Tiens, Jean, comme tu as changé : les cheveux, les yeux...\n Mais monsieur, je ne m'appelle pas Jean.\n Ah bon ! Tu as même changé de nom !";break;
        case 20:_Message ="Deux voyageurs de commerce discutent:\n Moi, fait l'un, je traite mes clients comme mes cigarettes.\n Comment cela?\n Je les roule toujours moi-même!";break;
        case 21:_Message ="Julien demande 2€ à son père.\n Celui-ci questionne:c'est pour quoi faire ?\n Pour donner à une vieille dame.\n Bravo, c'est très bien de vouloir l'aider. Et où est-elle cette dame?\n Là-bas, elle vend des glaces !";break;
        case 22:_Message ="Julien rentre de l'école. Il a le genou écorché.\n Pauvre chou, tu as dû beaucoup pleurer, compâtit sa maman.\n Pas la peine, y'avait personne.";break;
        case 23:_Message ="La maman demande à Julien:\n Que fais-tu?\n Rien!\n Et ton frère?\n Il m'aide!";break;
        case 24:_Message ="La maman dit à Julien :\n Tu as encore mis tes doigts sales sur la porte!\n Même pas vrai ! Moi, je l'ouvre à coup de pied !";break;
        case 25:_Message ="La postière dit à Charlotte :\n Cette lettre est trop lourde. Il faut ajouter un timbre.\n Oui, mais si j'ajoute un timbre, elle sera encore plus lourde !";break;
        case 26:_Message ="Le dentiste demande au patient:De quel coté mangez-vous?\n Du coté de la gare, mais je me demande bien ce que ca peut vous faire.";break;
        case 27:_Message ="Le papa dit à Emilie :\n Tu travailles lentement, tu comprends lentement,tu marches lentement.\n Y a-t-il quelque chose que tu fasses vite ?\n Oui, je me fatigue vite.";break;
        case 28:_Message ="Le roi souffre des dents. Son dentiste lui dit :\n Sire, il faudrait changer votre couronne.\n Ah ca jamais ! répond le roi.";break;
        case 29:_Message ="Lors d'un sondage sur les après-rasages, on demande à un homme dans la rue:\n Monsieur, que mettez-vous après vous être rasé?\n Mon pantalon!";break;
        case 30:_Message ="Madame Dupont dit à son mari: Bouge un peu que je passe un coup de balai!\n Il faut que tout soit propre pour la nouvelle femme de ménage!";break;
        case 31:_Message ="On demande à un grand explorateur :\n Quelle est la peau de l'animal que vous avez eu le plus de mal à rapporter de vos chasses ?\n La mienne !";break;
        case 32:_Message ="Oui monsieur le commissaire, mon père est maire, ma tante est soeur.\n J'ai un cousin qui est frère et mon frère est masseur.";break;
        case 33:_Message ="Proverbe chinois:\n Si tu tapes ta tête contre une cruche et que ca sonne creux,\n n'en déduis pas forcément que c'est la cruche qui est vide.";break;
        case 34:_Message ="Prudente, la maman allumette recommande à ses enfants:\n Et surtout ne vous grattez pas la tête!";break;
        case 35:_Message ="Quel est le sport le plus fruité ?\n La boxe :tu prends des pêches plein la poire,\n tu tombes dans les pommes\n et tout ca pour des prunes.";break;
        case 36:_Message ="Un casse-pieds demande à un peintre:\n Pourquoi ne peignez-vous que des paysages?\n Parce que jamais un arbre n'est venu me dire qu'il n'était pas ressemblant!";break;
        case 37:_Message ="Un clochard discute avec un autre :\n Grâce à ma trompette, je suis très riche.\n Les gens te donnent beaucoup d'argent pour que tu joues ?\n Non justement, pour que je ne joue pas.";break;
        case 38:_Message ="Un commercant demande à un client:\n Qu'est-ce que je vous sers?\n Serrez-moi la main!";break;
        case 39:_Message ="Un cuisinier dit au serveur:\n Supprime le cassoulet maison sur les menus. Je viens de casser l'ouvre-boîtes.";break;
        case 40:_Message ="Un gendarme fait stopper une automobiliste:\n Vous n'avez pas vu le feu rouge ?\n Si si. C'est vous que je n'avais pas vu !";break;
        case 41:_Message ="Un homme raconte :\n Je suis parti en voyage.\n J'ai écrit tous les jours à ma fiancée.\n A mon retour, elle s'est mariée.\n Eh bien, bravo !\n Non, sniff, elle s'est mariée avec le facteur !";break;
        case 42:_Message ="Un homme se présente chez le médecin:\n Voi-voilà-doc-docteur, je bébé, je bégaie.\n Alors le médecin: Bien, nous zazaa, nous zalons a-a-arran, arranger ca!";break;
        case 43:_Message ="Un invité murmure à sa voisine: Le champagne vous rend jolie.\n Je n'en ai pas bu une seule coupe.\n Oui, mais moi j'en suis à ma dixième!";break;
        case 44:_Message ="Un touriste visite un château en Ecosse:\n On m'a dit que votre château est hanté, dit-il au châtelain.\n C'est faux! Je n'y ai jamais vu aucun fantome et pourtant je vis ici depuis 300 ans.";break;
        case 45:_Message ="C'est une jolie petite antenne de T.V. qui est tombée amoureuse d'un paratonnerre.\n Elle murmure: dis, tu y crois toi, au coup de foudre?";break;
        case 46:_Message ="Un vendeur de journaux clame le titre de son quotidien:\n Scandale! 60 personnes se sont fait escroquer.\n Un passant achète le journal. Alors le vendeur dit:\n Scandale! 61 personnes se sont fait escroquer.";break;
        case 47:_Message ="Une dame dit à un oculiste : Docteur, ma vue baisse.\n Ah ! fait l'oculiste, et que faites-vous dans la vie ?\n ben justement, je suis voyante !";break;
        case 48:_Message ="Une jeune femme demande à une autre : Alors, toujours amoureuse de ton parachutiste ?\n Non, je l'ai laissé tomber.";break;
        case 49:_Message ="Une jeune fille se plaint à son amie :\n A tous nos rendez-vous, il m'offre des fleurs fanées.\n Eh bien, essaye d'arriver à l'heure.";break;
        case 50:_Message ="Chauffeur, soyez prudent, à chaque virage j'ai peur de tomber dans le ravin!\n Madame n'a qu'à faire comme moi, fermer les yeux!";break;
        case 51:_Message ="Moi j'ai toute l'année des ampoules dans les mains.\n Vous faites un travail difficile?\n Non, je suis vendeur au rayon électricité.";break;
        case 52:_Message ="Alors mon cher, ces vacances? Où étiez-vous?\n Oh, la première semaine, j'étais dans les Alpes\n Les deux suivantes,j'étais dans le plâtre.";break;
        case 53:_Message ="Charlotte part à la visite médicale avec son petit flacon d'urine.\n Elle demande :c'est pour quoi faire ?\n A ton avis ? répond sa maman \n C'est pour remercier le docteur?";break;
        case 54:_Message ="Charlotte va voir sa maman et demande :\n Est-ce que je pourrais avoir du chocolat ?\n On dit comment ? S'il... s'il ?\n S'il en reste encore ?";break;
        case 55:_Message ="C'est une jolie petite antenne de T.V. qui est tombée amoureuse d'un paratonnerre.\n Elle murmure: dis, tu y crois toi, au coup de foudre?";break;
        case 56:_Message = "Un couple est en pleine action, la pression commence à monter.\nElle: Vas y sauvagement\nLui: oui! Oui!\nElle: continue, continue\nLui; Oui!Oui\nElle: Ne sois pas timide\nLui: Oui!Oui\nElle: montre que tu es un homme\nLui: Oui! Oui!\nElle: dis moi des choses sales\nLui: la cuisine, la salle de bain, le salon, la bagnole.....";
    }
      _Message=_Message.replace("ê","\340");
      _Message=_Message.replace("è","\350");
      _Message=_Message.replace("é","\351");
      _Message=_Message.replace("à","\352");
      _Message=_Message.replace("ë","\353");
      _Message=_Message.replace("ì","\354");
      _Message=_Message.replace("í","\355");
      _Message=_Message.replace("î","\356");
      _Message=_Message.replace("ï","\357");

     alert(_Message);
 }
 //////////////////////////////////////////////////////////////////////////
 function Reactivate(KeyTarget) {
     var Justification = prompt('Veuillez indiquer la raison', 'raison');
     if (Justification != null)
        HttpPostRequest(g_WebSiteUrlFunction + '174', "KEY_TARGET=" + KeyTarget + "&JUSTIFICATION=" + Justification, null);

 }
//////////////////////////////////////////////////////////////////////////
function Desactivate(KeyTarget)
{
    var Justification = prompt('Veuillez indiquer la raison', 'raison');
    if (Justification != null)
        HttpPostRequest(g_WebSiteUrlFunction + '160', "KEY_TARGET=" + KeyTarget + "&JUSTIFICATION="+Justification,null);

}
//////////////////////////////////////////////////////////////////////////
function AddMaster(KeyJob)
{
   KeyTarget = document.getElementById('CHEF_ADD_MAITRE_KEY_USER_'+KeyJob).value;
   HttpPostRequest(g_WebSiteUrlFunction + '166', "KEY_TARGET=" + KeyTarget + "&KEY_JOB="+KeyJob,OnUpdateAddMaster);
   
}
//////////////////////////////////////////////////////////////////////////
function OnUpdateAddMaster(Result)
{
    if(Result !="")
    {
        alert(Result);
    }else
    {
        alert('Citoyen nom\363');
    }
}
//////////////////////////////////////////////////////////////////////////
function PreviewDesktopColorBackground(Color, IdWindow) {
    document.body.style.background = Color;
}
//////////////////////////////////////////////////////////////////////////
function RestorDesktopBackground(IdWindow) {
    document.getElementById("DESKTOP_BACKGROUND_IMAGE").innerHTML = g_OldDesktop;
}
//////////////////////////////////////////////////////////////////////////
function PreviewDesktopBackground(IdWindow, BackgroundUrl) 
{
    //alert('ici');
    g_OldDesktop = document.getElementById("DESKTOP_BACKGROUND_IMAGE").innerHTML;
    var ie = document.all ? 1 : 0
    var plok = 0;
    if (ie) {
        _width = document.documentElement.clientWidth;
        _height = document.documentElement.clientHeight;
    } else {
        _width = window.innerWidth;
        _height = window.innerHeight;
    }
    document.getElementById("DESKTOP_BACKGROUND_IMAGE").innerHTML = '<img src="'+g_WebSiteUrl+BackgroundUrl + '" width="' + _width + '"  height="' + _height + '"/>';
    //document.getElementById("DESKTOP_BACKGROUND_IMAGE").innerHTML = '';
}
//////////////////////////////////////////////////////////////////////////
function ChangeDesktopBackground(IdWindow, BackgroundUrl) 
{
    //document.body.style.backgroundImage = 'url("' + BackgroundUrl + '")';
    //alert(BackgroundUrl);

    var ie = document.all ? 1 : 0
    var plok = 0;
    if (ie) {
        _width = document.documentElement.clientWidth;
        _height = document.documentElement.clientHeight;
    } else {
        _width = window.innerWidth;
        _height = window.innerHeight;
    }

    document.getElementById("DESKTOP_BACKGROUND_IMAGE").innerHTML = '<img src="' + g_WebSiteUrl + BackgroundUrl + '" width="' + _width + '"  height="' + _height + '"/>';
    HttpPostRequest(g_WebSiteUrlFunction + '182', "BACKGROUND=" + BackgroundUrl, null);
    g_OldDesktop = document.getElementById("DESKTOP_BACKGROUND_IMAGE").innerHTML;

    SafeHideObjectById("CONFIG_DESKTOP_FREE_" + IdWindow);

}
//////////////////////////////////////////////////////////////////////////
function ChangeDesktopColorBackground(Color, IdWindow) {
    //HttpPostRequest(g_WebSiteUrlFunction + '172', "COLOR=" + Color, null);
    document.body.style.background = Color;
    alert('Changement sauvegard\351');
}
//////////////////////////////////////////////////////////////////////////
function PreviewCoverColorBackground(Color, IdWindow) {
    document.getElementById('CADRE_USER_' + IdWindow).style.background = Color;
}
//////////////////////////////////////////////////////////////////////////
function ChangeCoverColorBackground(Color,IdWindow)
{
    HttpPostRequest(g_WebSiteUrlFunction + '172', "COLOR=" + Color ,null);
    document.getElementById('CADRE_USER_' + IdWindow).style.background = Color;
    alert('Changement sauvegard\351');
}
//////////////////////////////////////////////////////////////////////////
//WEAPON
//////////////////////////////////////////////////////////////////////////
function UseWeapon(IdWindow,KeyWeapon,KeyTarget)
{
    HttpPostRequest(g_WebSiteUrlFunction + '154', "KEY_TARGET=" + KeyTarget + "&KEY_WEAPON="+KeyWeapon ,OnUpdateUseWeapon);
    SafeHideObjectById('USE_WEAPON_'+KeyWeapon+'_'+IdWindow+'_BUTTON');
}
//////////////////////////////////////////////////////////////////////////
function OnUpdateUseWeapon(Result)
{
    if(Result !="")
    {
        alert(Result);
    }
}
//////////////////////////////////////////////////////////////////////////
//HOME PAGE FLASH
//////////////////////////////////////////////////////////////////////////
function ShowCGUWindow()
{
    var ie 	= document.all?1:0
    var plok=0;
    if (ie)
    {
        plok = (document.body.clientWidth - 600 ) /2;
    }else
    {
        plok = ( window.innerWidth - 600 ) /2;
    }
    AddWindowByPosition( g_WebSiteUrl + "/index.php?PAGE=63&RENDER_MODE=WINDOW", plok , 50 );
}
//////////////////////////////////////////////////////////////////////////
function ShowRegisterWindow()
{
    var ie 	= document.all?1:0
    var plok=0;
    if (ie)
    {
        plok = (document.body.clientWidth - 350 ) /2;
    }else
    {
        plok = ( window.innerWidth - 350 ) /2;
    }
    AddWindowByPosition( g_WebSiteUrl + "/index.php?PAGE=58&RENDER_MODE=WINDOW", plok , 250 );
}
//////////////////////////////////////////////////////////////////////////
function ShowLoginWindow()
{
    var ie 	= document.all?1:0
    var plok=0;
    if (ie)
    {
        plok = (document.body.clientWidth - 350 ) /2;
    }else
    {
        plok = ( window.innerWidth - 350 ) /2;
    }
    AddWindowByPosition( g_WebSiteUrl + "/index.php?PAGE=56&RENDER_MODE=WINDOW", plok , 250 );
}
//////////////////////////////////////////////////////////////////////////
//ACCEPT CGU
//////////////////////////////////////////////////////////////////////////
function AcceptCGU(IdWindow) {
    HttpPostRequest(g_WebSiteUrlFunction + '149', "", null);
    g_WindowArray[IdWindow].Destroy();
}
//////////////////////////////////////////////////////////////////////////
function RejectCGU(IdWindow) {
    HttpPostRequest(g_WebSiteUrlFunction + '150', "", OnRejectCGU);
    
}
//////////////////////////////////////////////////////////////////////////
function OnRejectCGU(Result) {
    window.location.replace(g_WebSiteUrl);
}
//////////////////////////////////////////////////////////////////////////
//PHOTOMATON
//////////////////////////////////////////////////////////////////////////
function CheckCoverPicture(IdWindow, KeyTarget) {


    var PhotoLoad = document.getElementById('CHECK_PHOTO_LOAD_' + IdWindow).checked;
    var PhotoVisible = document.getElementById('CHECK_PHOTO_USER_VISIBLE_' + IdWindow).checked;
    var PhotoRules = document.getElementById('CHECK_PHOTO_RULES_OK_' + IdWindow).checked;
    //alert(PhotoLoad + PhotoVisible + PhotoRules);
    HttpPostRequest(g_WebSiteUrlFunction + '148', "KEY_TARGET=" + KeyTarget + "&CHECK_PHOTO_LOAD=" + PhotoLoad + "&CHECK_PHOTO_USER_VISIBLE=" + PhotoVisible + "&CHECK_PHOTO_RULES_OK=" + PhotoRules, null);

    SafeHideObjectById('CHECK_PHOTO_' + IdWindow + '_' +KeyTarget);
}
//////////////////////////////////////////////////////////////////////////
//HELP DESK
//////////////////////////////////////////////////////////////////////////
function AddHelpDeskAgent(IdWindow, KeyTarget) 
{
    var KeyUserHelpDesk = document.getElementById('ADD_HELP_DESK_AGENT_' + IdWindow).value;
    HttpPostRequest(g_WebSiteUrlFunction + '146', "KEY_TARGET=" + KeyTarget + "&KEY_USER_HELP_DESK=" + KeyUserHelpDesk, OnAddHelpDeskAgent);
}
//////////////////////////////////////////////////////////////////////////
function OnAddHelpDeskAgent(Result) {
    alert('Agent ajoute');
}
//////////////////////////////////////////////////////////////////////////
function RemoveHelpDeskAgent(IdWindow, KeyTarget) 
{
    var KeyUserHelpDesk = document.getElementById('REMOVE_HELP_DESK_AGENT_' + IdWindow).value;
    HttpPostRequest(g_WebSiteUrlFunction + '147', "KEY_TARGET=" + KeyTarget + "&KEY_USER_HELP_DESK=" + KeyUserHelpDesk, null);
}
//////////////////////////////////////////////////////////////////////////
//PANNEAU CONFIG
//////////////////////////////////////////////////////////////////////////
function OnSaveMailNotification(IdWindow) 
{
    var _MailMessage = document.getElementById('MAIL_MESSAGE_' + IdWindow).value;
    var _MailContact = document.getElementById('MAIL_CONTACT_' + IdWindow).value;
    var _MailGroupe = document.getElementById('MAIL_GROUPE_' + IdWindow).value;
    var _MailNotification = document.getElementById('MAIL_NOTIFICATION_' + IdWindow).value;
    var _MailNews = document.getElementById('MAIL_NEWSLETTER_' + IdWindow).value;
    _MailNews == "on" ? _MailNews = 1 : _MailNews = 0;
    
    HttpPostRequest(g_WebSiteUrlFunction + '142', "MAIL_MESSAGE=" + _MailMessage + "&MAIL_CONTACT=" + _MailContact + "&MAIL_GROUPE=" + _MailGroupe + "&MAIL_NOTIFICATION=" + _MailNotification + "&MAIL_NEWS=" + _MailNews, null);

    SafeHideObjectById('MAIL_SAVE_BUTTON_' + IdWindow);
}
//////////////////////////////////////////////////////////////////////////
//COMMAND PP
//////////////////////////////////////////////////////////////////////////
function ConfirmPayement(IdWindow, Payement, KeyCommand, KeyTarget) 
{

    alert('Les informations pour le payement sont accessibles dans votre messagerie');
    HttpPostRequest(g_WebSiteUrlFunction + '140', "KEY_TARGET=" + KeyTarget + "&KEY_COMMAND=" + KeyCommand + "&PAYEMENT=" + Payement, null);
    g_WindowArray[IdWindow].Destroy();
}
//////////////////////////////////////////////////////////////////////////
function OnCommandPP(IdWindow) 
{
    var _PPCount = document.getElementById('ALI_BABA_COMMAND_PP_' + IdWindow).value;
    var _PPTarget = document.getElementById('ALI_BABA_COMMAND_PP_TARGET_' + IdWindow).value;
    var _PPPayement = document.getElementById('ALI_BABA_COMMAND_PP_PAYEMENT_' + IdWindow).value;
    switch (_PPCount) {
        case "1": //60000 = 10€
            _Command = '1';
            break;
        case "2": //250000 = 30€
            _Command = '2';
            break;
        case "3": //500000 = 60€
            _Command = '3';
            break;
        case "4": //1000000 = 100€
            _Command = '4';
            break;
    }
    AddWindowToCenter(g_WebSiteUrl + 'index.php?PAGE=93&RENDER_MODE=WINDOW&ID_PARENT=' + IdWindow + '&KEY_TARGET=' + _PPTarget + '&KEY_COMMAND=' + _Command + '&PAYEMENT=' + _PPPayement, 400);
}
//////////////////////////////////////////////////////////////////////////
function OnCommandAccount(IdWindow) 
{
    var _AccountType = document.getElementById('ALI_BABA_COMMAND_ACCOUNT_TYPE_' + IdWindow).value;
    var _AccountTime = document.getElementById('ALI_BABA_COMMAND_ACCOUNT_LONG_' + IdWindow).value;
    var _PPTarget = document.getElementById('ALI_BABA_COMMAND_ACCOUNT_TARGET_' + IdWindow).value;
    var _PPPayement = document.getElementById('ALI_BABA_COMMAND_ACCOUNT_PAYEMENT_' + IdWindow).value;

    switch (_AccountType) {
        case "1": //Bronze
            switch (_AccountTime) {
                case "1": //3 mois 
                    _Command = 5;
                    break;
                case "2": //6 mois
                    _Command = 6;
                    break;
                case "3": //12 mois
                    _Command = 7;
                    break;
            }
            break;
        case "2": //Argent
            switch (_AccountTime) {
                case "1": //3 mois
                    _Command = 8;
                    break;
                case "2": //6 mois
                    _Command = 9;
                    break;
                case "3": //12 mois
                    _Command = 10;
                    break;
            }
            break;
        case "3": //Or
            switch (_AccountTime) {
                case "1": //3 mois
                    _Command = 11;
                    break;
                case "2": //6 mois
                    _Command = 12;
                    break;
                case "3": //12 mois
                    _Command = 13;
                    break;
            }
            break;
        case "4": //Platine
            switch (_AccountTime) {
                case "1": //3 mois
                    _Command = 14;
                    break;
                case "2": //6 mois
                    _Command = 15;
                    break;
                case "3": //12 mois
                    _Command = 16;
                    break;
            }
            break;
    }
    
    AddWindowToCenter(g_WebSiteUrl + 'index.php?PAGE=93&RENDER_MODE=WINDOW&ID_PARENT=' + IdWindow + '&KEY_TARGET=' + _PPTarget + '&KEY_COMMAND=' + _Command + '&PAYEMENT=' + _PPPayement, 400);
} 
//////////////////////////////////////////////////////////////////////////
function OnCommandPPInfoChange(IdWindow) 
{
    var _PPCount = document.getElementById('ALI_BABA_COMMAND_PP_' + IdWindow).value;
    var _Prix = 0;
    switch (_PPCount) 
    {
        case "1": 
            _Prix = 10;
            break;
        case "2": 
            _Prix = 30;
            break;
        case "3": 
            _Prix = 60;
            break;
        case "4": 
            _Prix = 100;
            break;
    }

    document.getElementById('ALI_BABA_COMMAND_PP_TOTAL_' + IdWindow).value = _Prix + " EUR";
}
//////////////////////////////////////////////////////////////////////////
function OnAccountInfoChange(IdWindow) 
{
    var _AccountType = document.getElementById('ALI_BABA_COMMAND_ACCOUNT_TYPE_' + IdWindow).value;
    var _AccountTime = document.getElementById('ALI_BABA_COMMAND_ACCOUNT_LONG_' + IdWindow).value;
    var _Prix = 0;
    switch(_AccountType)
    {
        case "1": //Bronze
            switch (_AccountTime) 
            {
                case "1": //3 mois soit 5400 pp pour 1€
                    _Prix = 6;
                    break;
                case "2": //6 mois
                    _Prix = 10;
                    break;
                case "3": //12 mois
                    _Prix = 18;
                    break;
            }
            break;
        case "2": //Argent
            switch (_AccountTime) 
            {
                case "1": //3 mois
                    _Prix = 12;
                    break;
                case "2": //6 mois
                    _Prix = 20;
                    break;
                case "3": //12 mois
                    _Prix = 36;
                    break;
            }
            break;
        case "3": //Or
            switch (_AccountTime) 
            {
                case "1": //3 mois
                    _Prix = 24;
                    break;
                case "2": //6 mois
                    _Prix = 40;
                    break;
                case "3": //12 mois
                    _Prix = 72;
                    break;
            }
            break;
        case "4": //Platine
            switch (_AccountTime) 
            {
                case "1": //3 mois
                    _Prix = 48;
                    break;
                case "2": //6 mois
                    _Prix = 80;
                    break;
                case "3": //12 mois
                    _Prix = 144;
                    break;
            }
            break;
    }
    document.getElementById('ALI_BABA_COMMAND_ACCOUNT_TOTAL_' + IdWindow).value = _Prix+" EUR";
}
//////////////////////////////////////////////////////////////////////////
//UPS PACKET
//////////////////////////////////////////////////////////////////////////
function FallRose() 
{
    PosX = RemovePxFromStyle(document.getElementById("UPS_ROSE_0").style.top);
    PosX > window.document.body.clientHeight ? PosX = 0 : PosX = PosX + 6;
    document.getElementById("UPS_ROSE_0").style.top = PosX + "px";
    setTimeout("FallRose()", 500);
}

//////////////////////////////////////////////////////////////////////////
//USER NEWS
//////////////////////////////////////////////////////////////////////////
function OnClickRemoveUserAction(IdWindow, KeyAction)
{
    HttpPostRequest(g_WebSiteUrlFunction + '191', "KEY_ACTION=" + KeyAction + "&ID_WINDOW=" + IdWindow, null);
    SafeHideObjectById('USER_ACTION_NEWS_' + IdWindow + '_' + KeyAction);
}
//////////////////////////////////////////////////////////////////////////
function OnClickRemoveCommentUserAction(IdWindow, KeyComment) 
{
    HttpPostRequest(g_WebSiteUrlFunction + '158', "KEY_COMMENT=" + KeyComment + "&ID_WINDOW=" + IdWindow, null);
    SafeHideObjectById('USER_ACTION_COMMENT_'+IdWindow+'_'+KeyComment);
}
//////////////////////////////////////////////////////////////////////////
function OnClickUserCommentUserAction(IdWindow, KeyUserAction) 
{
    //alert('FORM_COMMENT_' + KeyUserAction + "_" + IdWindow);
    ShowElement('FORM_COMMENT_' + KeyUserAction + "_" + IdWindow);
    
}
//////////////////////////////////////////////////////////////////////////
function UserLoveUserAction(IdWindow, KeyUserAction)
{
    g_IdWindowTmp = IdWindow;
    g_KeyUserActionTmp = KeyUserAction;
    HttpPostRequest(g_WebSiteUrlFunction + '124', "KEY_USER_ACTION=" + KeyUserAction + "&ID_WINDOW=" + IdWindow, function() {
        HttpPostRequest(g_WebSiteUrlFunction + '127', "KEY_USER_ACTION=" + KeyUserAction + "&ID_WINDOW=" + IdWindow, UpdateUserActionComment);
    });
}
//////////////////////////////////////////////////////////////////////////
function UserNotLoveUserAction(IdWindow, KeyUserAction) 
{
    g_IdWindowTmp = IdWindow;
    g_KeyUserActionTmp = KeyUserAction;
    HttpPostRequest(g_WebSiteUrlFunction + '125', "KEY_USER_ACTION=" + KeyUserAction + "&ID_WINDOW=" + IdWindow, function() {
    HttpPostRequest(g_WebSiteUrlFunction + '127', "KEY_USER_ACTION=" + KeyUserAction + "&ID_WINDOW=" + IdWindow, UpdateUserActionComment);
    });
}
//////////////////////////////////////////////////////////////////////////
function UserCommentUserAction(IdWindow, KeyUserAction) 
{
    g_IdWindowTmp = IdWindow;
    g_KeyUserActionTmp = KeyUserAction;
    
    Text = document.getElementById('FORM_COMMENT_' + KeyUserAction + '_' + IdWindow + '_TEXT').value;
    document.getElementById('FORM_COMMENT_' + KeyUserAction + '_' + IdWindow + '_TEXT').value ="";
    HttpPostRequest(g_WebSiteUrlFunction + '126', "KEY_USER_ACTION=" + KeyUserAction + "&ID_WINDOW=" + IdWindow + "&TEXT=" + Text, function() {
        HttpPostRequest(g_WebSiteUrlFunction + '127', "KEY_USER_ACTION=" + KeyUserAction + "&ID_WINDOW=" + IdWindow, UpdateUserActionComment);
    });
}
//////////////////////////////////////////////////////////////////////////
function UpdateUserActionComment(Result) 
{
    document.getElementById("LIST_COMMENT_" + g_KeyUserActionTmp + "_" + g_IdWindowTmp).innerHTML = Result;
    
}
//////////////////////////////////////////////////////////////////////////
//JOB TOOLS
//////////////////////////////////////////////////////////////////////////
function SendGuildeMessageToUser(IdWindow, KeyJob) 
{
    var Message = document.getElementById("SEND_MESSAGE_GUILD_TEXT_" + IdWindow).value;
    var KeyTarget = document.getElementById("SEND_MESSAGE_GUILD_KEY_TARGET_" + IdWindow).value;
    if (KeyTarget == "") return;
    if (Message == "") return;
    HttpPostRequest(g_WebSiteUrlFunction + '179', "KEY_JOB=" + KeyJob + "&MESSAGE=" + Message + "&KEY_TARGET=" + KeyTarget, null);
    alert('Message transmis ' );
}
//////////////////////////////////////////////////////////////////////////
function SetBirdthDayDate(KeyJob)
{
    var DateDay = document.getElementById("DAY_BIRDTH_DAY_" + KeyJob).value;
    var DateMounth = document.getElementById("MOUNTH_BIRDTH_DAY_" + KeyJob).value;
    var DateYear = document.getElementById("YEAR_BIRDTH_DAY_" + KeyJob).value;
    var DateSQL = DateYear+"-"+DateMounth+"-"+DateDay;
    
    var KeyUser = document.getElementById("BIRDTH_DAY_KEY_USER_" + KeyJob ).value;
    
    HttpPostRequest(g_WebSiteUrlFunction + '167', "KEY_JOB=" + KeyJob + "&KEY_USER=" + KeyUser + "&DATE=" + DateSQL, null);
    alert('Date mise a jour');
}
//////////////////////////////////////////////////////////////////////////
function SendMessageToGuilde(IdWindow, KeyJob) 
{
    var Message = document.getElementById("SEND_MESSAGE_GUILD_TEXT_" + IdWindow).value;
    var Rank = document.getElementById("SEND_MESSAGE_GUILD_RANK_" + IdWindow ).value;
    HttpPostRequest(g_WebSiteUrlFunction + '138', "KEY_JOB=" + KeyJob + "&MESSAGE=" + Message + "&RANK=" + Rank, null);
    alert('Message transmis' + Message + Rank);
}
//////////////////////////////////////////////////////////////////////////
function SendMessageToAllGuilde(IdWindow, KeyJob) {
    var Message = document.getElementById("SEND_MESSAGE_GUILD_TEXT_" + IdWindow).value;
    var Rank = document.getElementById("SEND_MESSAGE_GUILD_RANK_" + IdWindow).value;
    HttpPostRequest(g_WebSiteUrlFunction + '138', "KEY_JOB=" + KeyJob + "&MESSAGE=" + Message + "&RANK=" + Rank, null);
    alert('Message transmis' + Message + Rank);
}
//////////////////////////////////////////////////////////////////////////
function ResolveBug(IdWindow, KeyBug) 
{
    HttpPostRequest(g_WebSiteUrlFunction + '135', "KEY_BUG=" + KeyBug , null);
    document.getElementById("TOOLS_LIST_BUG_" + KeyBug + "_" + IdWindow).innerHTML = '';
}
//////////////////////////////////////////////////////////////////////////
function OnClickJobTools(IdWindow,KeyTools,KeyJob)
{
    g_IdWindowTmp = IdWindow;
    g_KeyJobTmp = KeyJob;
    HttpPostRequest( g_WebSiteUrlFunction+'113' , "KEY_TOOLS="+KeyTools+"&KEY_JOB="+KeyJob+"&ID_WINDOW="+IdWindow, OnClickJobToolsUpdate );
    document.getElementById("JOB_TOOLS_CONTENT_"+KeyJob+"_"+g_IdWindowTmp).innerHTML='Chargement...';
    HttpPostRequest( g_WebSiteUrlFunction+'114' , "KEY_TOOLS="+KeyTools+"&KEY_JOB="+KeyJob+"&ID_WINDOW="+IdWindow, OnClickJobToolsUpdateTitle );
}
//////////////////////////////////////////////////////////////////////////
function OnClickJobToolsUpdate(Result)
{
    document.getElementById("JOB_TOOLS_CONTENT_"+g_KeyJobTmp+"_"+g_IdWindowTmp).innerHTML=Result;
}
//////////////////////////////////////////////////////////////////////////
function OnClickJobToolsUpdateTitle(Result)
{
    document.getElementById("JOB_TOOLS_TITLE_"+g_KeyJobTmp+"_"+g_IdWindowTmp).innerHTML=Result;
}
//////////////////////////////////////////////////////////////////////////
function OnClickProcessQCMTools(IdWindow,KeyQCM,KeyJob,State)
{
    g_IdWindowTmp = IdWindow;
    g_KeyJobTmp = KeyJob;
    HttpPostRequest( g_WebSiteUrlFunction+'119' , "KEY_QCM="+KeyQCM+"&STATE="+State+"&ID_WINDOW="+IdWindow, OnClickProcessQCMToolsUpdate );
    //document.getElementById("JOB_TOOLS_CONTENT_5_"+g_IdWindowTmp).innerHTML="Chargement...";
}
//////////////////////////////////////////////////////////////////////////
function OnClickProcessQCMToolsUpdate(Result)
{
    OnClickJobTools(g_IdWindowTmp,5,g_KeyJobTmp);
}
//////////////////////////////////////////////////////////////////////////
function OnClickC4Tools(IdWindow,KeyUserJob)
{
    Info = document.getElementById('JOB_TOOLS_6_INFO_'+IdWindow+"_"+KeyUserJob).value;
    document.getElementById("JOB_TOOLS_6_"+IdWindow+"_"+KeyUserJob).innerHTML="";
    HttpPostRequest( g_WebSiteUrlFunction+'120' , "KEY_USER_JOB="+KeyUserJob+"&INFO="+Info+"&ID_WINDOW="+IdWindow, null );
    
}
//////////////////////////////////////////////////////////////////////////
function OnClickJobGenerateObjectTools(IdWindow,KeyObject,Count,Element)
{
    document.getElementById(Element).innerHTML="Objet g&eacute;n&eacute;r&eacute;";
    HttpPostRequest( g_WebSiteUrlFunction+'121' , "KEY_OBJECT="+KeyObject+"&OBJECT_COUNT="+Count+"&ID_WINDOW="+IdWindow, null );
    
}
//////////////////////////////////////////////////////////////////////////
//FOREM
//////////////////////////////////////////////////////////////////////////
function OnClickValidateQCM(IdWindow,KeyJob)
{
    g_IdWindowTmp = IdWindow;
    Reply = document.getElementById('ANSWER_QUESTION_0').value;
    Reply += ';'+document.getElementById('ANSWER_QUESTION_1').value;
    Reply += ';'+document.getElementById('ANSWER_QUESTION_2').value;
    Reply += ';'+document.getElementById('ANSWER_QUESTION_3').value;
    Reply += ';'+document.getElementById('ANSWER_QUESTION_4').value;
    Reply += ';'+document.getElementById('ANSWER_QUESTION_5').value;
    Reply += ';'+document.getElementById('ANSWER_QUESTION_6').value;
    Reply += ';'+document.getElementById('ANSWER_QUESTION_7').value;
    Reply += ';'+document.getElementById('ANSWER_QUESTION_8').value;
    Reply += ';'+document.getElementById('ANSWER_QUESTION_9').value;
    
    KeyQuestion = document.getElementById('KEY_QUESTION_0').value;
    KeyQuestion += ';'+document.getElementById('KEY_QUESTION_1').value;
    KeyQuestion += ';'+document.getElementById('KEY_QUESTION_2').value;
    KeyQuestion += ';'+document.getElementById('KEY_QUESTION_3').value;
    KeyQuestion += ';'+document.getElementById('KEY_QUESTION_4').value;
    KeyQuestion += ';'+document.getElementById('KEY_QUESTION_5').value;
    KeyQuestion += ';'+document.getElementById('KEY_QUESTION_6').value;
    KeyQuestion += ';'+document.getElementById('KEY_QUESTION_7').value;
    KeyQuestion += ';'+document.getElementById('KEY_QUESTION_8').value;
    KeyQuestion += ';'+document.getElementById('KEY_QUESTION_9').value;
    
    HttpPostRequest( g_WebSiteUrlFunction+'112' , "KEY_JOB="+KeyJob+"&ID_WINDOW="+IdWindow+"&REPLY="+Reply+"&KEYQUESTION="+KeyQuestion, OnClickStartQCMUpdate );
    document.getElementById("JOB_QCM_"+g_IdWindowTmp).innerHTML='Chargement...';
}
//////////////////////////////////////////////////////////////////////////
function OnClickValidateQCMUpdate(Result)
{
    document.getElementById("JOB_QCM_"+g_IdWindowTmp).innerHTML=Result;
}
//////////////////////////////////////////////////////////////////////////
function OnClickStartQCM(IdWindow,KeyJob)
{
    g_IdWindowTmp = IdWindow;
    HttpPostRequest( g_WebSiteUrlFunction+'111' , "KEY_JOB="+KeyJob+"&ID_WINDOW="+IdWindow, OnClickStartQCMUpdate );
    document.getElementById("JOB_QCM_"+g_IdWindowTmp).innerHTML='Chargement...';
}
//////////////////////////////////////////////////////////////////////////
function OnClickStartQCMUpdate(Result)
{
    document.getElementById("JOB_QCM_"+g_IdWindowTmp).innerHTML=Result;
}
//////////////////////////////////////////////////////////////////////////
function OnClickJobPostulation(IdWindow,KeyJob)
{
    g_IdWindowTmp = IdWindow;
    HttpPostRequest( g_WebSiteUrlFunction+'110' , "KEY_JOB="+KeyJob+"&ID_WINDOW="+IdWindow, OnJobPostulationUpdate );
    document.getElementById("JOB_QCM_"+g_IdWindowTmp).innerHTML='Chargement...';
}
//////////////////////////////////////////////////////////////////////////
function OnJobPostulationUpdate(Result)
{
    document.getElementById("JOB_QCM_"+g_IdWindowTmp).innerHTML=Result;
}
//////////////////////////////////////////////////////////////////////////
function OnClickJobInfo(IdWindow,KeyJob)
{
    g_IdWindowTmp = IdWindow;
    HttpPostRequest( g_WebSiteUrlFunction+'109' , "KEY_JOB="+KeyJob, OnJobInfoUpdate );
}
//////////////////////////////////////////////////////////////////////////
function OnJobInfoUpdate(Result)
{
    document.getElementById("JOB_INFO_"+g_IdWindowTmp).innerHTML=Result;
}
//////////////////////////////////////////////////////////////////////////
//BUG REPPORT
//////////////////////////////////////////////////////////////////////////
function SendBug(IdWindow)
{
    Type = document.getElementById('BUG_TYPE_'+IdWindow).value;
    Level = document.getElementById('BUG_LEVEL_'+IdWindow).value;
    Repetitive = document.getElementById('BUG_REPETITIVE_'+IdWindow).value;
    Localisation = document.getElementById('BUG_LOCALISATION_'+IdWindow).value;
    Description = document.getElementById('BUG_DESCRIPTION_'+IdWindow).value;
    Other = document.getElementById('BUG_OTHER_'+IdWindow).value;

    HttpPostRequest( g_WebSiteUrlFunction+'108' , "TYPE="+Type+"&LEVEL="+Level+"&REPETITIVE="+Repetitive+"&LOCALISATION="+Localisation+"&DESCRIPTION="+Description+"&OTHER="+Other, null );
    document.getElementById("BUG_WINDOW_"+IdWindow).innerHTML="Bug transmis";
}
//////////////////////////////////////////////////////////////////////////
//GALLERY
//////////////////////////////////////////////////////////////////////////
function OnClickNextPictureGalery(IdWindow, KeyCurrentPicture, KeyCurrentGallery) {
    
    PositionY = document.getElementById("WINDOW_" + IdWindow).style.top;
    PositionX = document.getElementById("WINDOW_" + IdWindow).style.left;

    HttpPostRequest(g_WebSiteUrlFunction + '133', "KEY_CURRENT_PICTURE=" + KeyCurrentPicture + "&KEY_CURRENT_GALLERY=" + KeyCurrentGallery + "&DIR=NEXT", OnUpdatePictureGalery);
    g_WindowArray[IdWindow].Destroy();
}
//////////////////////////////////////////////////////////////////////////
function OnClickPreviousPictureGalery(IdWindow, KeyCurrentPicture, KeyCurrentGallery) {
    
    PositionY = document.getElementById("WINDOW_" + IdWindow).style.top;
    PositionX = document.getElementById("WINDOW_" + IdWindow).style.left;
    HttpPostRequest(g_WebSiteUrlFunction + '133', "KEY_CURRENT_PICTURE=" + KeyCurrentPicture + "&KEY_CURRENT_GALLERY=" + KeyCurrentGallery + "&DIR=PREV", OnUpdatePictureGalery);
    g_WindowArray[IdWindow].Destroy();
}
//////////////////////////////////////////////////////////////////////////
function OnUpdatePictureGalery(Result) {
    var chaine = Result;
    var reg = new RegExp("[#]", "g");
    var option_value = chaine.split(reg);
    key_gallery = option_value[0];
    key_picture = option_value[1];
    AddWindowToCenter(g_WebSiteUrl + 'index.php?PAGE=76&RENDER_MODE=WINDOW&KEY_GALLERY=' + key_gallery + '&KEY_PICTURE=' + key_picture, 540);
}

//////////////////////////////////////////////////////////////////////////
function UpdatePictureAccess(IdWindow,KeyPicture)
{
    var _UserAllowed = document.getElementById('EDIT_PICTURE_ACCESS_'+KeyPicture+'_'+IdWindow).value;

    HttpPostRequest( g_WebSiteUrlFunction+'155' , "KEY_PICTURE="+KeyPicture+"&USER_ALLOWED="+_UserAllowed, null );
    alert('modification enregistrée');
}
//////////////////////////////////////////////////////////////////////////
function DeletePicture(IdWindow,KeyPicture)
{
    HttpPostRequest( g_WebSiteUrlFunction+'97' , "KEY_PICTURE="+KeyPicture, null );
    document.getElementById("EDIT_PICTURE_INFO_"+IdWindow).innerHTML="Photo &eacute;ffac&eacute;e";
    
}
//////////////////////////////////////////////////////////////////////////
function SavePictureInfo(IdWindow,KeyPicture)
{
    Description = document.getElementById('EDIT_PICTURE_SAVE_INFO_'+IdWindow+'_DESCRIPTION').value;
    Tag = document.getElementById('EDIT_PICTURE_SAVE_INFO_'+IdWindow+'_TAG').value;
   
    HttpPostRequest( g_WebSiteUrlFunction+'96' , "KEY_PICTURE="+KeyPicture+"&ID_WINDOW="+IdWindow+"&DESCRIPTION="+Description+"&TAG="+Tag, null );

    HideElement('EDIT_PICTURE_SAVE_INFO_'+IdWindow);
}
//////////////////////////////////////////////////////////////////////////
function EditGalleryInfo(IdWindow,KeyGallery)
{
    Description = document.getElementById('GALLERY_EDITOR_DESCRIPTION_'+KeyGallery+'_'+IdWindow).value;
    Name = document.getElementById('GALLERY_EDITOR_NAME_'+KeyGallery+'_'+IdWindow).value;
    Tag = "";// document.getElementById('GALLERY_EDITOR_TAG_'+KeyGallery+'_'+IdWindow).value;
    HttpPostRequest( g_WebSiteUrlFunction+'95' , "KEY_GALLERY="+KeyGallery+"&ID_WINDOW="+IdWindow+"&DESCRIPTION="+Description+"&NAME="+Name+"&TAG="+Tag, UpdateGalleryForEdit );
    g_IdWindowTmp = IdWindow;
    
    document.getElementById('GALLERY_EDITOR_SAVE_'+KeyGallery+'_'+IdWindow).style.color='#ffffff';
}
//////////////////////////////////////////////////////////////////////////
function ActivateGalleryForEdit(IdWindow,KeyGallery)
{
    HttpPostRequest( g_WebSiteUrlFunction+'94' , "KEY_GALLERY="+KeyGallery+"&ID_WINDOW="+IdWindow, UpdateGalleryForEdit );
    g_IdWindowTmp = IdWindow;
}
//////////////////////////////////////////////////////////////////////////
function UpdateGalleryForEdit(Result)
{
    document.getElementById("GALLERY_EDITOR_CONTENT_"+g_IdWindowTmp).innerHTML=Result;
}
//////////////////////////////////////////////////////////////////////////
//ASCENSION
//////////////////////////////////////////////////////////////////////////
function GotoToNextGrade(IdWindow)
{
    HttpPostRequest( g_WebSiteUrlFunction+'92' , "ID_WINDOW="+IdWindow, null );
}
//////////////////////////////////////////////////////////////////////////
//TUTORIAL
//////////////////////////////////////////////////////////////////////////
function TutorialSaveTheme(IdWindow)
{
    HttpPostRequest( g_WebSiteUrlFunction+'90' , "THEME="+g_CurrentTheme+"&ID_WINDOW="+IdWindow, null );
}
//////////////////////////////////////////////////////////////////////////
function TutorialSaveName(IdWindow) 
{
/*
    SaveProfilInfo( 'Nom' , document.getElementById('NOM_'+IdWindow ).value );
    SaveProfilInfo( 'Prenom' , document.getElementById('PRENOM_'+IdWindow ).value );
    SaveProfilInfo('Surnom', document.getElementById('SURNOM_' + IdWindow).value);
*/

    
        RequestPost = new CHttpRequest();
        RequestPost.SetURLTarget(g_WebSiteUrl + '/index.php?FUNCTION=16');
        RequestPost.SetMethod('POST');
        RequestPost.m_Data = "NOM=" + document.getElementById('NOM_'+IdWindow ).value 
    + "&PRENOM=" + document.getElementById('PRENOM_'+IdWindow ).value 
    + "&SURNOM=" + document.getElementById('SURNOM_' + IdWindow).value;

        RequestPost.Open();
        RequestPost.m_OnComplete = UpdateProfilPourcent;
    
}
//////////////////////////////////////////////////////////////////////////
function TutorialGotoStep(IdWindow,Step)
{
    //3 passage a la suite
    document.getElementById('TUTO_STEP_1'+IdWindow ).style.display = 'none';
    document.getElementById('TUTO_STEP_2'+IdWindow ).style.display = 'none';
    document.getElementById('TUTO_STEP_3'+IdWindow ).style.display = 'none';
    document.getElementById('TUTO_STEP_4'+IdWindow ).style.display = 'none';
    document.getElementById('TUTO_STEP_5'+IdWindow ).style.display = 'none';
    document.getElementById('TUTO_STEP_6'+IdWindow ).style.display = 'none';
    document.getElementById('TUTO_STEP_7'+IdWindow ).style.display = 'none';
    document.getElementById('TUTO_STEP_8'+IdWindow ).style.display = 'none';
    document.getElementById('TUTO_STEP_'+Step+IdWindow ).style.display = 'block';

    document.getElementById('BUTTON_TUTO_STEP_'+Step+IdWindow).style.backgroundColor = '#22BB00';
    HttpPostRequest( g_WebSiteUrlFunction+'91' , "STEP="+Step+"&ID_WINDOW="+IdWindow, null );
}
//////////////////////////////////////////////////////////////////////////
//CAVERNE 
//////////////////////////////////////////////////////////////////////////
function BuyItems(IdWindow,KeyObject)
{
    
    
    var Count = document.getElementById('CAVERNE_SELECT_CHECK_OBJECT_'+KeyObject+'_'+IdWindow ).value; 
    var option = document.getElementById('CAVERNE_SELECT_CHECK_OBJECT_'+KeyObject+'_'+IdWindow );
    //alert(document.getElementsByName('CAVERNE_SELECT_CHECK_OBJECT_'+KeyObject+'_'+IdWindow ));
    //alert('CAVERNE_SELECT_CHECK_OBJECT_'+KeyObject+'_'+IdWindow);
    //alert(document.getElementById('CAVERNE_SELECT_CHECK_OBJECT_'+KeyObject+'_'+IdWindow ));
    //alert(option);
    //alert(option.index);
    //alert(option.selected);
    
    var myselect=document.getElementById('CAVERNE_SELECT_CHECK_OBJECT_'+KeyObject+'_'+IdWindow );
    for (var i=0; i<myselect.options.length; i++)
    {
        if (myselect.options[i].selected==true)
        {
            Count = myselect.options[i].value;
            //alert("Selected Option's index: "+myselect.options[i].value);
            break;
        }
    }
    
    for(var _index = 0; _index < Count ; _index++)
    {
        option.remove(option.length-1);
    }

    if(Count=="")
        Count = 1;

    HttpPostRequest( g_WebSiteUrlFunction+'89' , "KEY_OBJET="+KeyObject+"&ID_WINDOW="+IdWindow+"&COUNT="+Count, null );
}
//////////////////////////////////////////////////////////////////////////
//CONFIG
//////////////////////////////////////////////////////////////////////////
function ChangeAllowAccess(IdWindow) {
    var Access1Val = document.getElementById('ALLOW_ACCESS_PICTURE_MISSION_' + IdWindow);
    var Access2Val = document.getElementById('ALLOW_ACCESS_PICTURE_HOME_' + IdWindow);

    if (!Access1Val.checked) {
        Access1 = 0;
    } else {
        Access1 = 1;
    }

    if (!Access2Val.checked) {
        Access2 = 0;
    } else {
        Access2 = 1;
    }


    HttpPostRequest(g_WebSiteUrlFunction + '145', "ACCESS1=" + Access1 + "&ACCESS2=" + Access2);
    alert('Changement sauvegardé' + Access1Val + " " + Access2Val);
}
//////////////////////////////////////////////////////////////////////////
function ChangePassword(IdWindow) 
{
    var Pass = document.getElementById('PASSWORD_1_' + IdWindow).value;
    var Pass2 = document.getElementById('PASSWORD_2_' + IdWindow).value;

    if (Pass != Pass2 && Pass != ""  ) 
    {
        alert('Password incorecte');
    } else 
    {

        HttpPostRequest(g_WebSiteUrlFunction + '137', "PASSWORD=" + Pass);
        alert('Mot de passe modifié');
    }
}
//////////////////////////////////////////////////////////////////////////
//INVITATION
//////////////////////////////////////////////////////////////////////////
function EditMail(IdWindow)
{
    var Mail = document.getElementById('MAIL_' + IdWindow).value;
    alert(Mail);
    if(!CheckMail(Mail))
    {
        alert('Mail:'+Mail+' non valide');
    }else
    {
        HttpPostRequest( g_WebSiteUrlFunction+'153' , "MAIL="+Mail, OnChangeMail );
    }
}
//////////////////////////////////////////////////////////////////////////
function OnChangeMail(Result)
{
    alert('Un mail de verification vous a été envoyé');
}
//////////////////////////////////////////////////////////////////////////
function SendCheckMail()
{
    HttpPostRequest(g_WebSiteUrlFunction + '152');
    alert('Mail transmis');
}
//////////////////////////////////////////////////////////////////////////
function FreeInvitation()
{
    var Mail = document.getElementById('REGISTER_FREE_LOGIN_FORM_MAIL').value;
    if(CheckMail(Mail))
    {
        HttpPostRequest( g_WebSiteUrlFunction+'88' , "MAIL="+Mail, UpdateInvit );
    }else
    {
        alert('Mail non valide');
    }
}
//////////////////////////////////////////////////////////////////////////
function OpenInscription()
{
    

    var Mail = document.getElementById('REGISTER_LOGIN_FORM_MAIL').value;
    var Pass = document.getElementById('REGISTER_LOGIN_FORM_PASS').value;
    var Pass2 = document.getElementById('REGISTER_LOGIN_FORM_PASS2').value;

    if(!CheckMail(Mail))
    {
        alert('Mail:'+Mail+' non valide');
    }else
    if(Pass =="")
    {
       alert('Password incorecte');
    }else
    if (Pass != Pass2) 
    {
        alert('Password incorecte');
    } else 
    {
        HttpPostRequest(g_WebSiteUrlFunction + '151', "MAIL=" + Mail + "&PASS=" + Pass, UpdateCheckInscription);
        SafeHideObjectById('REGISTER_FORM');
        SafeShowObjectById('REGISTER_FORM_CHARGEMENT');
    }
    
    
    
}
//////////////////////////////////////////////////////////////////////////
function CheckInscription()
{
    var Mail = document.getElementById('REGISTER_LOGIN_FORM_MAIL').value;
    var Pass = document.getElementById('REGISTER_LOGIN_FORM_PASS').value;
    var Pass2 = document.getElementById('REGISTER_LOGIN_FORM_PASS2').value;
    var Key = document.getElementById('REGISTER_LOGIN_KEY').value;

    if(Pass =="")
    {
       alert('Password incorecte');
    }else
    if(Pass != Pass2) 
    {
        alert('Password incorecte');
    } else 
    {
        HttpPostRequest(g_WebSiteUrlFunction + '123', "MAIL=" + Mail + "&PASS=" + Pass + "&KEY=" + Key, UpdateCheckInscription);
    }
    
    
    
}
//////////////////////////////////////////////////////////////////////////
function UpdateCheckInscription(State) 
{
    if (State == 1) {
        alert('Votre compte est active');
        window.location.replace(g_WebSiteUrl + "index.php?PAGE=1");

        return;
    }
    if (State == 2) {
        alert('Vous etes deja inscrits vous pouvez vous logez normalement');
        SafeShowObjectById('REGISTER_FORM');
        SafeHideObjectById('REGISTER_FORM_CHARGEMENT');
        return;
    }
    //alert('Une erreur est survenue contactez l\'administration');
}

//////////////////////////////////////////////////////////////////////////
function SendInvit(IdWindow)
{
    var Mail = document.getElementById('INVIT_MAIL_'+IdWindow).value;
    if(CheckMail(Mail))
    {
        HttpPostRequest( g_WebSiteUrlFunction+'87' , "MAIL="+Mail+"&ID_WINDOW="+IdWindow, UpdateSendInvit );
        g_IdWindowTmp = IdWindow;
    }else
    {
        alert('Mail non valide');
    }
}
//////////////////////////////////////////////////////////////////////////
function SendInvitAgain(IdWindow,KeyInvit)
{
    HttpPostRequest( g_WebSiteUrlFunction+'86' , "KEY_INVIT="+KeyInvit, UpdateInvit );
}
//////////////////////////////////////////////////////////////////////////
function DeleteInvit(IdWindow,KeyInvit)
{
    HttpPostRequest( g_WebSiteUrlFunction+'85' , "KEY_INVIT="+KeyInvit, null );
    document.getElementById('TABLE_INVIT_LINE_'+KeyInvit+'_'+IdWindow).innerHTML="";
}
//////////////////////////////////////////////////////////////////////////
function UpdateInvit(Result)
{
    alert(Result);
}
//////////////////////////////////////////////////////////////////////////
function UpdateSendInvit(Result)
{
    var BufferString = Result; 
    var EndIndex = BufferString.indexOf('#');
    ExtractID = BufferString.substr(0,EndIndex);
    IdWindow = ExtractID;
    Result = BufferString.substr(EndIndex+1);
    document.getElementById('TABLE_INVIT_'+IdWindow).innerHTML+=Result;
}
//////////////////////////////////////////////////////////////////////////
//MSN
//////////////////////////////////////////////////////////////////////////
function MsnSendContactInvit(IdWindow)
{
    var ListContact = "";
    var ListInvitation= "";
    var CountCheck = 0;
    CountCheck = document.getElementById('MSN_LIST_CONTACT_CHECK_COUNT_'+IdWindow).value;
    for(index = 0 ; index < CountCheck ; index++)
    {
        if(document.getElementById('MSN_LIST_CONTACT_CHECK_'+index+'_'+IdWindow)==null)
            continue;
        if(document.getElementById('MSN_LIST_CONTACT_CHECK_'+index+'_'+IdWindow).checked)
        {
            ListContact += document.getElementById('MSN_LIST_CONTACT_CHECK_'+index+'_'+IdWindow).value +";";
            document.getElementById('MSN_LIST_CONTACT_FORM_'+index+'_'+IdWindow).innerHTML='<span style="color:yellow">&agrave; re&ccedil;u une invition</span>';
            
        }
    }

    CountCheck = document.getElementById('MSN_LIST_CONTACT_CHECK_COUNT_NOT_ON_SITE_' + IdWindow).value;
    for (index = 0; index < CountCheck; index++) {
        if (document.getElementById('MSN_LIST_CONTACT_CHECK_NOT_ON_SITE_' + index + '_' + IdWindow) == null)
            continue;
        if (document.getElementById('MSN_LIST_CONTACT_CHECK_NOT_ON_SITE_' + index + '_' + IdWindow).checked) {
            ListInvitation += document.getElementById('MSN_LIST_CONTACT_CHECK_NOT_ON_SITE_' + index + '_' + IdWindow).value + ";";
            document.getElementById('MSN_LIST_CONTACT_FORM_NOT_ON_SITE_' + index + '_' + IdWindow).innerHTML = '<span style="color:yellow">&agrave; re&ccedil;u une invitation</span>';

        }
    }

    //if(ListContact!="")
    {
        HttpPostRequest(g_WebSiteUrlFunction + '84', "LIST_CONTACT=" + ListContact + "&LIST_INVIT=" + ListInvitation, null);
    }

    alert("Invitations reussies");
}
//////////////////////////////////////////////////////////////////////////
function MsnFriendListChange(IdWindow) {
    
    var CountCheck = 0;
    var TotalInvit = 0;
    CountCheck = document.getElementById('MSN_LIST_CONTACT_CHECK_COUNT_NOT_ON_SITE_' + IdWindow).value;
    
    for (index = 0; index < CountCheck; index++) 
    {
        if (document.getElementById('MSN_LIST_CONTACT_CHECK_NOT_ON_SITE_' + index + '_' + IdWindow) == null)
            continue;
        if (document.getElementById('MSN_LIST_CONTACT_CHECK_NOT_ON_SITE_' + index + '_' + IdWindow).checked) 
        {
            TotalInvit++;
        }
    }

    TotalInvit = 100 * TotalInvit;
    document.getElementById('MSN_LIST_CONTACT_WIN_PP_' + IdWindow).innerHTML = TotalInvit;
    
}
//////////////////////////////////////////////////////////////////////////
function MsnFriendListSelectAll(IdWindow)
{
    var CountCheck = 0;
    CountCheck = document.getElementById('MSN_LIST_CONTACT_CHECK_COUNT_' + IdWindow).value;
    for (index = 0; index < CountCheck; index++) {
        if (document.getElementById('MSN_LIST_CONTACT_CHECK_' + index + '_' + IdWindow) == null)
            continue;
        document.getElementById('MSN_LIST_CONTACT_CHECK_' + index + '_' + IdWindow).checked = "checked";
    }

    CountCheck = document.getElementById('MSN_LIST_CONTACT_CHECK_COUNT_NOT_ON_SITE_' + IdWindow).value;
    for (index = 0; index < CountCheck; index++) {
        if (document.getElementById('MSN_LIST_CONTACT_CHECK_NOT_ON_SITE_' + index + '_' + IdWindow) == null)
            continue;
        document.getElementById('MSN_LIST_CONTACT_CHECK_NOT_ON_SITE_' + index + '_' + IdWindow).checked = "checked";
    }
    MsnFriendListChange(IdWindow);
}
//////////////////////////////////////////////////////////////////////////
function MsnFriendListUnSelectAll(IdWindow)
{
    var CountCheck = 0;
    CountCheck = document.getElementById('MSN_LIST_CONTACT_CHECK_COUNT_'+IdWindow).value;
    for(index = 0 ; index < CountCheck ; index++)
    {
        if(document.getElementById('MSN_LIST_CONTACT_CHECK_'+index+'_'+IdWindow)==null)
            continue;
        document.getElementById('MSN_LIST_CONTACT_CHECK_'+index+'_'+IdWindow).checked="";
    }

    CountCheck = document.getElementById('MSN_LIST_CONTACT_CHECK_COUNT_NOT_ON_SITE_' + IdWindow).value;
    for (index = 0; index < CountCheck; index++) {
        if (document.getElementById('MSN_LIST_CONTACT_CHECK_NOT_ON_SITE_' + index + '_' + IdWindow) == null)
            continue;
        document.getElementById('MSN_LIST_CONTACT_CHECK_NOT_ON_SITE_' + index + '_' + IdWindow).checked = "";
    }
    MsnFriendListChange(IdWindow);
}
//////////////////////////////////////////////////////////////////////////
function ConnectMsn(IdWindow)
{
    
    Login = document.getElementById('LOGIN_MSN_'+IdWindow).value;
    Pass = document.getElementById('PASS_MSN_'+IdWindow).value;
    
    if(Login=="")
    {
        alert('Vous devez entrer une adresse mail');
        return;
    }
    
    if(Pass=="")
    {
        alert('Vous devez entrer un mot de pass');
        return;
    }
    
    AddWindow(g_WebSiteUrl+'/index.php?PAGE=54&RENDER_MODE=WINDOW','LOGIN='+Login+'&PASS='+Pass);

    g_WindowArray[IdWindow].Destroy();
}
//////////////////////////////////////////////////////////////////////////
//CLAN
//////////////////////////////////////////////////////////////////////////
function ReplyArticleClan(IdWindow,KeyArticle)
{
    var Text = document.getElementById('TEXT_REPLY_ARTICLE_CLAN_'+IdWindow).value;
    var reg=new RegExp("(')", "g");
    Text= Text.replace(reg," ");
    HttpPostRequest( g_WebSiteUrlFunction+'83' , "KEY_ARTICLE="+KeyArticle+"&TEXT="+Text, ReloadWindow( IdWindow ) );
}
//////////////////////////////////////////////////////////////////////////
function EditClanInfo(IdWindow,KeyClan)
{
    var Devise = document.getElementById('CLAN_DEVISE_'+IdWindow).value;
    var Description = document.getElementById('CLAN_DESCRIPTION_'+IdWindow).value;
    var Secret = document.getElementById('CLAN_SECRET_'+IdWindow).checked;
    var reg=new RegExp("(')", "g");
    
    Description = Description.replace(reg," " );
    Devise= Devise.replace(reg," ");
    
    HttpPostRequest( g_WebSiteUrlFunction+'82' , "KEY_CLAN="+KeyClan+"&SECRET="+Secret+"&DEVISE="+Devise+"&DESCRIPTION="+Description, UpdateClanMember );
}
//////////////////////////////////////////////////////////////////////////
function DeletteArticle(IdWindow,KeyClan,KeyArticle)
{
    document.getElementById('LIST_CLAN_ARTICLE_'+IdWindow).style.display ="none";
    HttpPostRequest( g_WebSiteUrlFunction+'81' , "KEY_CLAN="+KeyClan+"&KEY_ARTICLE="+KeyArticle, UpdateClanMember );
}
//////////////////////////////////////////////////////////////////////////
function PostClanArticle(IdWindow,KeyClan)
{
    var reg=new RegExp("(')", "g");

    Title = document.getElementById('CLAN_ADD_ARTICLE_TITLE_'+IdWindow).value;
    Private = document.getElementById('CLAN_ADD_ARTICLE_PRIVATE_'+IdWindow).checked;
    Text = document.getElementById('CLAN_ADD_ARTICLE_TEXT_'+IdWindow).value;
    
    Text = Text.replace(reg," ");
    Title = Title.replace(reg," ");
    
    HttpPostRequest( g_WebSiteUrlFunction+'80' , "KEY_CLAN="+KeyClan+"&TITLE="+Title+"&TEXT="+Text+"&PRIVATE="+Private, UpdateClanMember );
}
//////////////////////////////////////////////////////////////////////////
function RejectClanInvitation(IdWindow,KeyClan)
{
    HttpPostRequest( g_WebSiteUrlFunction+'79' , "KEY_CLAN="+KeyClan, UpdateTaskBar );
    g_WindowArray[IdWindow].Destroy();
}
//////////////////////////////////////////////////////////////////////////
function JoinClan(IdWindow,KeyClan)
{
    HttpPostRequest( g_WebSiteUrlFunction+'78' , "KEY_CLAN="+KeyClan, UpdateTaskBar );
    g_WindowArray[IdWindow].Destroy();
}
//////////////////////////////////////////////////////////////////////////
function LeaveMemberClan(IdWindow,KeyClan)
{
    KeyMember = document.getElementById('CLAN_EJECT_MEMBER_KEY_'+IdWindow).value;
    HttpPostRequest( g_WebSiteUrlFunction+'77' , "KEY_CLAN="+KeyClan+"&KEY_MEMBER="+KeyMember, UpdateClanMember );
}
//////////////////////////////////////////////////////////////////////////
function EjectMemberClan(IdWindow,KeyClan)
{
    KeyMember = document.getElementById('CLAN_EJECT_MEMBER_KEY_'+IdWindow).value;
    HttpPostRequest( g_WebSiteUrlFunction+'76' , "KEY_CLAN="+KeyClan+"&KEY_MEMBER="+KeyMember, UpdateClanMember );
}
//////////////////////////////////////////////////////////////////////////
function EditMemberClan(IdWindow,KeyClan)
{
    KeyMember = document.getElementById('CLAN_CHANGE_RANG_MEMBER_KEY_'+IdWindow).value;
    Rang = parseInt(document.getElementById('CLAN_CHANGE_RANG_MEMBER_RANG_'+IdWindow).value);
    if (Rang == NaN )
        Rang = 10;
    
    HttpPostRequest( g_WebSiteUrlFunction+'75' , "KEY_CLAN="+KeyClan+"&KEY_MEMBER="+KeyMember+"&RANG="+Rang, UpdateClanMember );
}
//////////////////////////////////////////////////////////////////////////
function AddMemberToClan(IdWindow,KeyClan)
{
    KeyMember = document.getElementById('CLAN_ADD_MEMBER_KEY_'+IdWindow).value;
    Rang = parseInt(document.getElementById('CLAN_ADD_MEMBER_RANG_'+IdWindow).value);
    if (Rang == NaN )
        Rang = 10;
    
    HttpPostRequest( g_WebSiteUrlFunction+'74' , "KEY_CLAN="+KeyClan+"&KEY_MEMBER="+KeyMember+"&RANG="+Rang, UpdateClanMember );
}
//////////////////////////////////////////////////////////////////////////
function ChangeLeader(IdWindow,KeyClan)
{
    KeyLeader = document.getElementById('CLAN_CHANGE_LEADER_KEY_'+IdWindow).value;
    HttpPostRequest( g_WebSiteUrlFunction+'73' , "KEY_CLAN="+KeyClan+"&KEY_LEADER="+KeyLeader, null );
    alert('Nouveau leader :'+KeyLeader);
    g_WindowArray[IdWindow].Destroy();
}
//////////////////////////////////////////////////////////////////////////
function UpdateClanMember(Result)
{
    alert(Result);   
}
//////////////////////////////////////////////////////////////////////////
//GROUPE
//////////////////////////////////////////////////////////////////////////
function AddGroup(IdWindow)
{
    var Title = document.getElementById('NEW_GROUPE_TITLE_'+IdWindow).value;
    var Description = document.getElementById('NEW_GROUPE_DESCRIPTION_'+IdWindow).value;
    var reg=new RegExp("(')", "g");
    Description = Description.replace(reg," " );
    Title= Title.replace(reg," ");
    
    HttpPostRequest( g_WebSiteUrlFunction+'72' , "NAME="+Title+"&DESCRIPTION="+Description, null );
    document.getElementById('GROUP_ADD_'+IdWindow).innerHTML="Proposition en attente de validation.";
}
//////////////////////////////////////////////////////////////////////////
function RejectGroup(IdWindow,KeyGroup)
{
    document.getElementById('GROUP_JOIN_'+KeyGroup+'_'+IdWindow).innerHTML="Groupe refus&eacute;";
    HttpPostRequest( g_WebSiteUrlFunction+'70' , "KEY_GROUP="+KeyGroup, null );
}
//////////////////////////////////////////////////////////////////////////
function JoinGroup(IdWindow,KeyGroup)
{
    document.getElementById('GROUP_JOIN_'+KeyGroup+'_'+IdWindow).innerHTML="Groupe rejoint";
    HttpPostRequest( g_WebSiteUrlFunction+'71' , "KEY_GROUP="+KeyGroup, null );
}
//////////////////////////////////////////////////////////////////////////
function SearchGroup(IdWindow)
{
    Group = document.getElementById('SEARCH_GROUPE_TITLE_'+IdWindow).value;
    HttpPostRequest( g_WebSiteUrlFunction+'69' , "GROUP_NAME="+Group, UpdateSearchGroup );
    document.getElementById('SEARCH_GROUPE_RESULT_'+IdWindow).innerHTML="Recherche en cours";
    g_IdWindowTmp = IdWindow;
}
//////////////////////////////////////////////////////////////////////////
function UpdateSearchGroup(Result)
{
    document.getElementById("SEARCH_GROUPE_RESULT_"+g_IdWindowTmp).innerHTML=Result;
}
//////////////////////////////////////////////////////////////////////////
function InvitInGroup(IdWindow,KeyGroup,KeyTarget)
{
    HttpPostRequest( g_WebSiteUrlFunction+'68' , "KEY_TARGET="+KeyTarget+"&KEY_GROUPE="+KeyGroup, null );
    document.getElementById('MENU_CITOYEN_GROUPE_INVIT_'+KeyGroup+'_'+KeyTarget+'_'+IdWindow).innerHTML="Invitation Envoy&eacute;e";
}
//////////////////////////////////////////////////////////////////////////
//WINDOW CREATOR
//////////////////////////////////////////////////////////////////////////
function PreviewWindow(IdWindow)
{
    _PositionX = 50;
    _PositionY = 50;
    _SizeX = document.getElementById('SIZE_X_'+IdWindow).value;
    _SizeY = document.getElementById('SIZE_Y_'+IdWindow).value;
    _Title = document.getElementById('TITLE_'+IdWindow).value;
    _Icone =  document.getElementById('ICONE_'+IdWindow).selectedIndex;
    _IconeValue = document.getElementById('ICONE_'+IdWindow).options[_Icone].value;
    _Theme =  document.getElementById('THEME_'+IdWindow).selectedIndex;
    _ThemeValue = document.getElementById('THEME_'+IdWindow).options[_Theme].value;
    _Text = document.getElementById('TEXT_WINDOW_'+IdWindow).value;
    
    AddWindowByPosition(g_WebSiteUrl+'index.php?PAGE=44&RENDER_MODE=WINDOW&SIZE_Y='+_SizeY+'&SIZE_X='+_SizeX+'&TITLE='+_Title+'&ICONE='+_IconeValue+'&THEME='+_ThemeValue+'&ID_PARENT='+IdWindow,_PositionX,_PositionY);
    
    document.getElementById('SIZE_X_'+IdWindow).value = _SizeX;
    document.getElementById('SIZE_Y_'+IdWindow).value = _SizeY; 
    document.getElementById('TITLE_'+IdWindow).value = _Title;
    document.getElementById('ICONE_'+IdWindow).selectedIndex = _Icone;
    document.getElementById('THEME_'+IdWindow).selectedIndex = _Theme;
    document.getElementById('TEXT_WINDOW_'+IdWindow).value = _Text;
}
//////////////////////////////////////////////////////////////////////////
//VISUDROME
//////////////////////////////////////////////////////////////////////////
function PreviewEvent(IdWindow)
{
    
    _Text = document.getElementById('TEXT_EVENT_'+IdWindow).value;
    _Title = document.getElementById('TITLE_EVENT_'+IdWindow).value;
    _Number = document.getElementById('NUMBER_EVENT_'+IdWindow).value;
    _Street = document.getElementById('STREET_EVENT_'+IdWindow).value;
    _CodePostal = document.getElementById('CP_EVENT_'+IdWindow).value;
    _Town = document.getElementById('TOWN_EVENT_'+IdWindow).value;
    _Pays =  document.getElementById('PAYS_EVENT_'+IdWindow).value;
    
    _Day =  document.getElementById('DAY_EVENT_'+IdWindow).selectedIndex;
    _Mounth =  document.getElementById('MOUNTH_EVENT_'+IdWindow).selectedIndex;
    _Year =  document.getElementById('YEAR_EVENT_'+IdWindow).selectedIndex;
    
    _PositionX = g_MouseInformation.m_Position.m_X -320;
    _PositionY = g_MouseInformation.m_Position.m_Y -535;
    AddWindowByPosition(g_WebSiteUrl+'index.php?PAGE=42&RENDER_MODE=WINDOW&TEXT='+_Text+'&TITLE='+_Title+'&ID_PARENT='+IdWindow,_PositionX,_PositionY);

    //restor form data
    document.getElementById('TEXT_EVENT_'+IdWindow).value = _Text;
    document.getElementById('TITLE_EVENT_'+IdWindow).value = _Title;
    document.getElementById('NUMBER_EVENT_'+IdWindow).value = _Number;
    document.getElementById('STREET_EVENT_'+IdWindow).value = _Street;
    document.getElementById('CP_EVENT_'+IdWindow).value = _CodePostal;
    document.getElementById('TOWN_EVENT_'+IdWindow).value = _Town;
    document.getElementById('PAYS_EVENT_'+IdWindow).value = _Pays;
    
    document.getElementById('DAY_EVENT_'+IdWindow).selectedIndex = _Day;
    document.getElementById('MOUNTH_EVENT_'+IdWindow).selectedIndex = _Mounth;
    document.getElementById('YEAR_EVENT_'+IdWindow).selectedIndex = _Year;

}
//////////////////////////////////////////////////////////////////////////
//MENU CITOYEN
//////////////////////////////////////////////////////////////////////////
function VoteTrophy(IdWindow, KeyTarget, KeyTrophy) 
{
    Point = document.getElementById('TROPHY_VOTE_' + KeyTrophy + '_' + IdWindow).value;
    HttpPostRequest(g_WebSiteUrlFunction + '199', "KEY_TROPHY=" + KeyTrophy + "&KEY_TARGET=" + KeyTarget + "&POINT=" + Point, OnUpdateVoteTrophy);
    alert('Vote ok');
}
//////////////////////////////////////////////////////////////////////////
function OnUpdateVoteTrophy(Result) 
{
   /* if (Result != "") 
    {
        alert(Result);
    }*/
}
//////////////////////////////////////////////////////////////////////////
function SaveMemo(IdWindow,KeyTarget)
{
    document.getElementById('TEXT_SAVE_MEMO_'+IdWindow).innerHTML="M&eacute;mo sauv&eacute;";
    Memo=document.getElementById('TEXT_MEMO_'+IdWindow).value;
    HttpPostRequest( g_WebSiteUrlFunction+'66' , "MEMO="+Memo+"&KEY_TARGET="+KeyTarget, null );
}
//////////////////////////////////////////////////////////////////////////
//WELCOME
//////////////////////////////////////////////////////////////////////////
function OnClickAddLink(IdWindow) 
{
    var _URL = prompt("Quelle est l'URL");
    var _Text = prompt("Indiquez le texte du lien");
    if (_URL != null && _Text != null)
    {
        document.getElementById('UPDATE_STATUT_' + IdWindow).value += '[LINK::' + _URL + ']';
        document.getElementById('UPDATE_STATUT_' + IdWindow).value += _Text + '[#LINK]';

        HttpPostRequest(g_WebSiteUrlFunction + '185', "URL=" + encodeURIComponent(_URL) + "&TEXT=" + _Text, null);
    }
}
//////////////////////////////////////////////////////////////////////////
function OnClickAddWebcam(IdWindow) 
{
    document.getElementById('UPDATE_STATUT_' + IdWindow).value += '[WEBCAM_GALERY]';
}
//////////////////////////////////////////////////////////////////////////
function OnClickAddGalery(IdWindow)
{
    g_IdWindowTmp = IdWindow;
    var _Text = prompt("Indiquez le titre de la galerie");
    if (_Text != null) 
    {
        HttpPostRequest(g_WebSiteUrlFunction + '189', "TEXT=" + _Text, OnUpdateOnClickAddGalery);
    }

    

}
//////////////////////////////////////////////////////////////////////////
function OnUpdateOnClickAddGalery(Result) 
{
    if (document.getElementById('GALLERY_EDITOR_LIST_GALERY_' + g_IdWindowTmp)) 
    {
        HttpPostRequest(g_WebSiteUrlFunction + '190', "ID_WINDOW=" + g_IdWindowTmp, OnUpdateGaleryList);
    }
    AddWindowToCenter(g_WebSiteUrl + 'index.php?PAGE=110&RENDER_MODE=WINDOW&KEY_GALLERY=' + Result, 700);
}
//////////////////////////////////////////////////////////////////////////
function OnUpdateGaleryList(Result) 
{
    if (document.getElementById('GALLERY_EDITOR_LIST_GALERY_' + g_IdWindowTmp))
    {
        document.getElementById('GALLERY_EDITOR_LIST_GALERY_' + g_IdWindowTmp).innerHTML = Result;
    }
}


//////////////////////////////////////////////////////////////////////////
function OnClickAddVideo(IdWindow)
{
    //http://www.dailymotion.com/video/xeynin_lapsus-dati-confond-inflation-et-fe_news#hp-sc-p-1
    //http://www.youtube.com/watch?v=nFAOTb0FBDI&feature=related

    var _URL = prompt("Quelle est l'URL");
    var regex = new RegExp("(youtube)","g");
    if(_URL.match(regex) )
    {
        var regex = /\?v=([a-z0-9-]+)\&?/i;
        id = _URL.match(regex)[1];
        //alert("Youtube :" + id);
        document.getElementById('UPDATE_STATUT_' + IdWindow).value += '[VIDEO_YOUTUBE::' + id + ']';
        HttpPostRequest(g_WebSiteUrlFunction + '186', "URL=" + encodeURIComponent(_URL), null);
        return;
    }

    var regex = new RegExp("(dailymotion)","g");
    if(_URL.match(regex) )
    {
        var regex = new RegExp("http://(?:www.|)dailymotion.com/(?:.*?)video/([a-z0-9]{1,8})(?:.*?)$");
      
        id = _URL.match(regex)[1];
        //alert("dailymotion:" + id);
        document.getElementById('UPDATE_STATUT_' + IdWindow).value += '[VIDEO_DAILYMOTION::' + id + ']';
        HttpPostRequest(g_WebSiteUrlFunction + '186', "URL=" + encodeURIComponent(_URL) , null);
        return;
    }

    alert("Ce site de video n'est pas encore prits en charge");


}
//////////////////////////////////////////////////////////////////////////
function OnClickAddNews(IdWindow) 
{
    g_IdWindowTmp = IdWindow;
    Statut = document.getElementById('UPDATE_STATUT_' + IdWindow).value;
    if (Statut == "") {
        alert('Vous ne pouvez pas publier un statut vide');
        return;
    }

    HttpPostRequest(g_WebSiteUrlFunction + '64', "STATUT=" + encodeURIComponent(Statut), OnUpdateAddNews);
    document.getElementById('UPDATE_STATUT_' + IdWindow).value="";
}
//////////////////////////////////////////////////////////////////////////
function OnUpdateAddNews(Result) 
{
    document.getElementById('NEWS_LIST_' + g_IdWindowTmp).innerHTML = Result
    + document.getElementById('NEWS_LIST_' + g_IdWindowTmp).innerHTML;
}

//////////////////////////////////////////////////////////////////////////
//AGORA
//////////////////////////////////////////////////////////////////////////
function SetAgoraSize( IdWindow , Size )
{
    document.getElementById('AGORA_'+IdWindow+'_CURRENT_SIZE').innerHTML=Size;
    document.getElementById('AGORA_'+IdWindow+'_CURRENT_PAGE').innerHTML=0;
    
    var CurrentPage = document.getElementById('AGORA_'+IdWindow+'_CURRENT_PAGE').innerHTML;
    var CurrentScan = document.getElementById('AGORA_'+IdWindow+'_CURRENT_SCAN').innerHTML;
    var CurrentSize = document.getElementById('AGORA_'+IdWindow+'_CURRENT_SIZE').innerHTML;
    var CurrentParameter = document.getElementById('AGORA_'+IdWindow+'_CURRENT_PARAMETER').innerHTML;
    
    reg=new RegExp("(&amp;)", "g");
    CurrentParameter = CurrentParameter.replace(reg,"&");
    
    document.getElementById('AGORA_RIGHT_PANEL_'+IdWindow).innerHTML="Recherche en cours...";
    HttpPostRequest( g_WebSiteUrlFunction+'63'+CurrentParameter , "SCAN="+CurrentScan+"&SIZE="+CurrentSize+"&PAGE="+CurrentPage , UpdateAgora );
    HttpPostRequest( g_WebSiteUrlFunction+'67'+CurrentParameter , "SCAN="+CurrentScan+"&SIZE="+CurrentSize+"&PAGE="+CurrentPage , UpdateAgoraTitle );
    g_IdWindowTmp = IdWindow;
}
//////////////////////////////////////////////////////////////////////////
function SetAgoraSearch(IdWindow) 
{
    var PostData = "";
    var Nom = document.getElementById('AGORA_SEARCH_NOM_' + IdWindow).value;
    PostData += "&NOM=" + Nom;
    var Prenom = document.getElementById('AGORA_SEARCH_PRENOM_' + IdWindow).value;
    PostData += "&PRENOM=" + Prenom;
    var Surnom = document.getElementById('AGORA_SEARCH_SURNOM_' + IdWindow).value;
    PostData += "&SURNOM=" + Surnom;
    
    var Peau = document.getElementById('AGORA_SEARCH_PEAU_' + IdWindow).value;
    PostData += "&PEAU=" + Peau;
    var Taille = document.getElementById('AGORA_SEARCH_TAILLE_' + IdWindow).value;
    PostData += "&TAILLE=" + Taille;
    var Corpulance = document.getElementById('AGORA_SEARCH_CORPULANCE_' + IdWindow).value;
    PostData += "&CORPULANCE=" + Corpulance;
    var Age = document.getElementById('AGORA_SEARCH_AGE_' + IdWindow).value;
    PostData += "&AGE=" + Age;
    var Cheveux = document.getElementById('AGORA_SEARCH_CHEVEUX_' + IdWindow).value;
    PostData += "&CHEVEUX=" + Cheveux;
    var CheveuxCouleur = document.getElementById('AGORA_SEARCH_CHEVEU_COULEUR_' + IdWindow).value;
    PostData += "&CHEVEUX_COULEUR=" + CheveuxCouleur;
    var Religion = document.getElementById('AGORA_SEARCH_RELIGION_' + IdWindow).value;
    PostData += "&RELIGION=" + Religion;
    var Zodiac = document.getElementById('AGORA_SEARCH_ZODIAC_' + IdWindow).value;
    PostData += "&ZODIAC=" + Zodiac;
    var Chinois = document.getElementById('AGORA_SEARCH_CHINOIS_' + IdWindow).value;
    PostData += "&CHINOIS=" + Chinois;
    var Sexe = document.getElementById('AGORA_SEARCH_SEXE_' + IdWindow).value;
    PostData += "&SEXE=" + Sexe;
    var Attirance = document.getElementById('AGORA_SEARCH_ATTIRANCE_' + IdWindow).value;
    PostData += "&ATTIRANCE=" + Attirance;
    var Enfant = document.getElementById('AGORA_SEARCH_ENFANT_' + IdWindow).value;
    PostData += "&ENFANT=" + Enfant;
    var Etat = document.getElementById('AGORA_SEARCH_ETAT_' + IdWindow).value;
    PostData += "&ETAT=" + Etat;

    var Pays = document.getElementById('AGORA_SEARCH_PAYS_' + IdWindow).value;
    PostData += "&PAYS=" + Pays;
    var Ville = document.getElementById('AGORA_SEARCH_VILLE_' + IdWindow).value;
    PostData += "&VILLE=" + Ville;
    var IdUser = document.getElementById('AGORA_SEARCH_ID_' + IdWindow).value;
    PostData += "&KEY_USER=" + IdUser;
    
    var CurrentPage = document.getElementById('AGORA_' + IdWindow + '_CURRENT_PAGE').innerHTML;
    var CurrentSize = document.getElementById('AGORA_' + IdWindow + '_CURRENT_SIZE').innerHTML;
    CurrentScan = document.getElementById('AGORA_' + IdWindow + '_CURRENT_SCAN').innerHTML = 13;
    
    document.getElementById('AGORA_RIGHT_PANEL_' + IdWindow).innerHTML = "Recherche en cours...";
    HttpPostRequest(g_WebSiteUrlFunction + '63', "SCAN=" + CurrentScan + "&SIZE=" + CurrentSize + "&PAGE=" + CurrentPage + PostData, UpdateAgora);
    HttpPostRequest(g_WebSiteUrlFunction + '67', "SCAN=" + CurrentScan + "&SIZE=" + CurrentSize + "&PAGE=" + CurrentPage, UpdateAgoraTitle);
    g_IdWindowTmp = IdWindow;
}
//////////////////////////////////////////////////////////////////////////
function SetAgoraScan( IdWindow , Scan ,Parameter)
{
    if(Parameter == undefined )
        Parameter ='';
        
    document.getElementById('AGORA_'+IdWindow+'_CURRENT_SCAN').innerHTML=Scan;
    
    var CurrentPage = document.getElementById('AGORA_'+IdWindow+'_CURRENT_PAGE').innerHTML;
    var CurrentScan = document.getElementById('AGORA_'+IdWindow+'_CURRENT_SCAN').innerHTML;
    var CurrentSize = document.getElementById('AGORA_'+IdWindow+'_CURRENT_SIZE').innerHTML;
    document.getElementById('AGORA_'+IdWindow+'_CURRENT_PARAMETER').innerHTML =Parameter;
    
    document.getElementById('AGORA_RIGHT_PANEL_'+IdWindow).innerHTML="Recherche en cours...";
    HttpPostRequest( g_WebSiteUrlFunction+'63'+Parameter , "SCAN="+CurrentScan+"&SIZE="+CurrentSize+"&PAGE="+CurrentPage , UpdateAgora );
    HttpPostRequest( g_WebSiteUrlFunction+'67'+Parameter , "SCAN="+CurrentScan+"&SIZE="+CurrentSize+"&PAGE="+CurrentPage , UpdateAgoraTitle );
    g_IdWindowTmp = IdWindow;
}
//////////////////////////////////////////////////////////////////////////
function SetAgoraPage( IdWindow , PageNext )
{
    var CurrentPage = document.getElementById('AGORA_'+IdWindow+'_CURRENT_PAGE').innerHTML;
    var CurrentScan = document.getElementById('AGORA_'+IdWindow+'_CURRENT_SCAN').innerHTML;
    var CurrentSize = document.getElementById('AGORA_'+IdWindow+'_CURRENT_SIZE').innerHTML;
    var CurrentParameter = document.getElementById('AGORA_'+IdWindow+'_CURRENT_PARAMETER').innerHTML;
    
    reg=new RegExp("(&amp;)", "g");
    CurrentParameter = CurrentParameter.replace(reg,"&");
    
    if(PageNext)
    {
        CurrentPage++;
    }
    else
    {
        CurrentPage --;
        if( CurrentPage < 0)
            CurrentPage = 0;
    }
    document.getElementById('AGORA_'+IdWindow+'_CURRENT_PAGE').innerHTML=CurrentPage;
    
    
    document.getElementById('AGORA_RIGHT_PANEL_'+IdWindow).innerHTML="Recherche en cours...";
    HttpPostRequest( g_WebSiteUrlFunction+'63'+CurrentParameter , "SCAN="+CurrentScan+"&SIZE="+CurrentSize+"&PAGE="+CurrentPage , UpdateAgora );
    HttpPostRequest( g_WebSiteUrlFunction+'67'+CurrentParameter , "SCAN="+CurrentScan+"&SIZE="+CurrentSize+"&PAGE="+CurrentPage , UpdateAgoraTitle );
    g_IdWindowTmp = IdWindow;
}
//////////////////////////////////////////////////////////////////////////
function UpdateAgora( Result )
{
    document.getElementById('AGORA_RIGHT_PANEL_'+g_IdWindowTmp).innerHTML=Result;
}
//////////////////////////////////////////////////////////////////////////
function UpdateAgoraTitle( Result )
{
    document.getElementById('AGORA_TITLE_'+g_IdWindowTmp).innerHTML=Result;
}
//////////////////////////////////////////////////////////////////////////
//MISSION
//////////////////////////////////////////////////////////////////////////
function OnClickShowUserMissionExemple(IdWindow, KeyMission, KeyTarget,KeyUserMission,Extend)
{
    var DivId = "MISSION_EXEMPLE_" + KeyMission + '_' + KeyTarget + '_' + IdWindow + '_' + KeyUserMission + '_' + Extend;
    SafeShowObjectById(DivId);
    document.getElementById(DivId).innerHTML = 'Chargement ...';
    HttpPostRequest(g_WebSiteUrlFunction + '184', "KEY_MISSION=" + KeyMission + "&KEY_TARGET=" + KeyTarget + "&KEY_USER_MISSION=" + KeyUserMission + "&DIV_ID=" + DivId, OnUptateClickShowUserMissionExemple);
}
//////////////////////////////////////////////////////////////////////////
function OnUptateClickShowUserMissionExemple(Result) 
{
    var chaine=Result;
    var reg = new RegExp("(###)", "g");
    var tableau = chaine.split(reg);
    /*    
    alert(Result);
    alert(tableau[0]);
    alert(tableau[1]);
    alert(tableau[2]);     */
    /*
    var chaine=tableau[i];
    var reg=new RegExp("[#]", "g");
    var option_value=chaine.split(reg);
    g_ElementEnAttente[i] = option_value[1];
    */
    SafeShowObjectById(tableau[0]);
    document.getElementById(tableau[0]).innerHTML = tableau[2];
}
//////////////////////////////////////////////////////////////////////////
function OnClickResetMission(IdWindow,KeyUserMission) {
    var justification = prompt('Veuillez indiquer la raison du reset', 'raison du reset ');
    HttpPostRequest(g_WebSiteUrlFunction + '159', "KEY_USER_MISSION=" + KeyUserMission+ "&JUSTIFICATION=" + justification , null);
    HideMenuInfobulle();
    SafeHideObjectById('JOB_TOOLS_23_'+KeyUserMission+'_'+IdWindow);
    

}
//////////////////////////////////////////////////////////////////////////
function OnClickRetryMission(KeyUserMission) {
    HttpPostRequest(g_WebSiteUrlFunction + '132', "KEY_USER_MISSION=" + KeyUserMission , null);
    HideMenuInfobulle();
}
//////////////////////////////////////////////////////////////////////////
function OnClickConfirmVetoForMission( KeyUserMission) {
    var justification = prompt('Veuillez indiquer la raison', 'raison du refus');
    HttpPostRequest(g_WebSiteUrlFunction + '130', "KEY_USER_MISSION=" + KeyUserMission + "&JUSTIFICATION=" + justification, null);
    
    HideMenuInfobulle();
}
//////////////////////////////////////////////////////////////////////////
function OnClickCancelVetoForMission(KeyUserMission) {
    HttpPostRequest(g_WebSiteUrlFunction + '131', "KEY_USER_MISSION=" + KeyUserMission, null);
    HideMenuInfobulle();
}
//////////////////////////////////////////////////////////////////////////
function OnClickVetoForMission(IdWindow, KeyUserMission) {
    g_IdWindowTmp = IdWindow;
    var Justification = prompt("Pourquoi?");
    if (Justification != null) {
        HttpPostRequest(g_WebSiteUrlFunction + '129', "KEY_USER_MISSION=" + KeyUserMission + "&JUSTIFICATION=" + Justification, OnUptateClickVoteForMission);
    }
    HideMenuInfobulle();
}
//////////////////////////////////////////////////////////////////////////
function OnClickVoteForMission(IdWindow, KeyUserMission) {
    g_IdWindowTmp = IdWindow;
    Vote = document.getElementById('RATING_BAR_DATA_VOTE_MISSION_SCORE_' + IdWindow).innerHTML;
    //Vote = document.getElementById('VOTE_MISSION_SCORE_' + IdWindow).value;
    HttpPostRequest(g_WebSiteUrlFunction + '122', "KEY_USER_MISSION=" + KeyUserMission + "&VOTE=" + Vote , OnUptateClickVoteForMission);
}
//////////////////////////////////////////////////////////////////////////
function OnUptateClickVoteForMission()
{
    document.getElementById('VOTE_MISSION_'+g_IdWindowTmp).innerHTML="Vote enregistr&eacute;";
}
//////////////////////////////////////////////////////////////////////////
function ActivateUserMissionMenu(IdWindow,IdRubrique,Title)
{
document.getElementById("MISSION_USER_RUBRIQUE_DESCRIPTION_"+IdWindow).style.display ="none";
document.getElementById("MISSION_USER_RUBRIQUE_INSTRUCTION_"+IdWindow).style.display ="none";
document.getElementById("MISSION_USER_RUBRIQUE_EXEMPLE_"+IdWindow).style.display ="none";
document.getElementById("MISSION_USER_RUBRIQUE_CONTENT_"+IdWindow).style.display ="none";
document.getElementById("MISSION_RUBRIQUE_USER_SUCCESS_" + IdWindow).style.display = "none";
document.getElementById("MISSION_RUBRIQUE_HELP_DESK_" + IdWindow).style.display = "none";
document.getElementById("MISSION_RUBRIQUE_STAT_" + IdWindow).style.display = "none";
document.getElementById("MISSION_RUBRIQUE_JOURNALIERE_" + IdWindow).style.display = "none";

document.getElementById(IdRubrique+IdWindow).style.display ="block";
document.getElementById('MISSION_TITLE_'+IdWindow).innerHTML=Title;
}
//////////////////////////////////////////////////////////////////////////
function ActivateMissionMenu(IdWindow,IdRubrique,Title)
{
document.getElementById("MISSION_RUBRIQUE_DESCRIPTION_"+IdWindow).style.display ="none";
document.getElementById("MISSION_RUBRIQUE_INSTRUCTION_"+IdWindow).style.display ="none";
document.getElementById("MISSION_RUBRIQUE_EXEMPLE_"+IdWindow).style.display ="none";
document.getElementById("MISSION_RUBRIQUE_CATEGORIE_"+IdWindow).style.display ="none";
document.getElementById("MISSION_RUBRIQUE_FORM_" + IdWindow).style.display = "none";
document.getElementById("MISSION_RUBRIQUE_USER_SUCCESS_" + IdWindow).style.display = "none";
document.getElementById("MISSION_RUBRIQUE_HELP_DESK_" + IdWindow).style.display = "none";
document.getElementById("MISSION_RUBRIQUE_JOURNALIERE_" + IdWindow).style.display = "none";

document.getElementById(IdRubrique+IdWindow).style.display ="block";
document.getElementById('MISSION_TITLE_'+IdWindow).innerHTML=Title;
}
//////////////////////////////////////////////////////////////////////////
function ValiderMission( IdWindow , KeyMission )
{
    HttpPostRequest(g_WebSiteUrlFunction + '93', "KEY_MISSION=" + KeyMission, null);
    alert('10 gardiens des sceaux doivent voter pour votre mission. En attendant, pourquoi ne pas réaliser une autre mission ? ');
    SafeHideObjectById('USER_MISSION_MISSION_FORM_ACK_' + IdWindow + '_' + KeyMission);
    SafeHideObjectById('USER_MISSION_MISSION_FORM_VAL_' + IdWindow + '_' + KeyMission);
}
//////////////////////////////////////////////////////////////////////////
function AccepterMission( IdWindow , KeyMission )
{
    HttpPostRequest( g_WebSiteUrlFunction+'61' , "KEY_MISSION="+KeyMission,null );
    //document.getElementById('OK_MISSION_'+IdWindow).innerHTML="Mission en cours...";
    SafeHideObjectById('USER_MISSION_MISSION_FORM_ACK_' + IdWindow + '_' + KeyMission);
    SafeShowObjectById('USER_MISSION_MISSION_FORM_VAL_' + IdWindow + '_' + KeyMission);
    SafeShowObjectById('USER_MISSION_MISSION_FORM_FIL_' + IdWindow + '_' + KeyMission);

}
//////////////////////////////////////////////////////////////////////////
function AbandonnerMission( IdWindow , KeyMission )
{
    if (confirm('Attention si vous abandonnez cette mission \nVous devrez attendre 7 jours pour la recomencer. \n\n Confirmez vous votre choix?'))
    {
        HttpPostRequest( g_WebSiteUrlFunction+'62' , "KEY_MISSION="+KeyMission, null );
        SafeHideObjectById('USER_MISSION_MISSION_FORM_ACK_' + IdWindow + '_' + KeyMission);
        SafeHideObjectById('USER_MISSION_MISSION_FORM_VAL_' + IdWindow + '_' + KeyMission);
        SafeHideObjectById('USER_MISSION_MISSION_FORM_FIL_' + IdWindow + '_' + KeyMission);
    }
}
//////////////////////////////////////////////////////////////////////////
//JOURNAL
//////////////////////////////////////////////////////////////////////////
function EditJournal( IdWindow , KeyJournal )
{

    Groupe=document.getElementById('GROUPE_EDIT_JOURNAL_'+IdWindow+'_'+KeyJournal).value;
    Id=document.getElementById('ID_EDIT_JOURNAL_'+IdWindow+'_'+KeyJournal).value;
    Acred=document.getElementById('ACRED_EDIT_JOURNAL_'+IdWindow+'_'+KeyJournal).value;

    HttpPostRequest( g_WebSiteUrlFunction+'60' , "KEY_JOURNAL="+KeyJournal +"&GROUPE="+Groupe+"&ID="+Id+"&ACRED="+Acred, null );


    HideElement('ACRED_EDIT_JOURNAL_'+IdWindow+'_'+KeyJournal+'_SAVE');
    //ReloadWindow( IdWindow );
}
//////////////////////////////////////////////////////////////////////////
function DeletteJournal( IdWindow , KeyJournal )
{
    HttpPostRequest( g_WebSiteUrlFunction+'59' , "KEY_JOURNAL="+KeyJournal , null );
    
    document.getElementById("LIST_JOURNAL_"+IdWindow+"_"+KeyJournal).innerHTML="";
    document.getElementById("LIST_JOURNAL_"+IdWindow+"_"+KeyJournal).style.display = 'none';


}
//////////////////////////////////////////////////////////////////////////
function AddJournal( IdWindow )
{
    Text=document.getElementById('TEXT_ADD_JOURNAL_'+IdWindow).value;
    Groupe=document.getElementById('GROUPE_ADD_JOURNAL_'+IdWindow).value;
    Id=document.getElementById('ID_ADD_JOURNAL_'+IdWindow).value;
    Acred=document.getElementById('ACRED_ADD_JOURNAL_'+IdWindow).value;
    
    HttpPostRequest( g_WebSiteUrlFunction+'58' , "TEXT="+Text+"&GROUPE="+Groupe+"&ID="+Id+"&ACRED="+Acred, ReloadWindow( IdWindow ) );
    
    //ReloadWindow( IdWindow );
}
//////////////////////////////////////////////////////////////////////////
//CONTACT/AMIS
//////////////////////////////////////////////////////////////////////////
function DemandeDeContact( IdWindow ,KeyContact )
{
    HttpPostRequest( g_WebSiteUrlFunction+'65' , "KEY_CONTACT="+KeyContact , null );
    document.getElementById("DEMANDE_CONTACT_"+IdWindow).innerHTML="Demande envoy&eacute;e.";
}
//////////////////////////////////////////////////////////////////////////
function AccepterContact( IdWindow ,KeyContact )
{
    HttpPostRequest( g_WebSiteUrlFunction+'56' , "KEY_CONTACT="+KeyContact , UpdateTaskBar );
    HideElement('CONTACT_ADD_'+KeyContact+'_BLOCK_'+IdWindow);
}
//////////////////////////////////////////////////////////////////////////
function IgnorerContact(IdWindow, KeyContact) {
    HttpPostRequest(g_WebSiteUrlFunction + '141', "KEY_CONTACT=" + KeyContact, UpdateTaskBar);
    HideElement('CONTACT_ADD_' + KeyContact + '_BLOCK_' + IdWindow);
}
//////////////////////////////////////////////////////////////////////////
function ReffuserContact( IdWindow ,KeyContact )
{
    HttpPostRequest( g_WebSiteUrlFunction+'55' , "KEY_CONTACT="+KeyContact , UpdateTaskBar );
    HideElement('CONTACT_ADD_'+KeyContact+'_BLOCK_'+IdWindow);
}
//////////////////////////////////////////////////////////////////////////
function EffacerContact( IdWindow ,KeyContact )
{
    HttpPostRequest( g_WebSiteUrlFunction+'53' , "KEY_CONTACT="+KeyContact , null );
    HideElement('CONTACT_'+KeyContact+'_BLOCK_'+IdWindow);
}
//////////////////////////////////////////////////////////////////////////
function RompreContact( IdWindow ,KeyContact )
{
    HttpPostRequest( g_WebSiteUrlFunction+'57' , "KEY_CONTACT="+KeyContact , null );
    HideElement('CONTACT_'+KeyContact+'_BLOCK_'+IdWindow);
}
//////////////////////////////////////////////////////////////////////////
function SaveContactChange( IdWindow ,KeyContact )
{
    Level = document.getElementById('CONTACT_'+KeyContact+'_LEVEL_'+IdWindow).value;
    Groupe = document.getElementById('CONTACT_'+KeyContact+'_GROUPE_'+IdWindow).value;
    HttpPostRequest( g_WebSiteUrlFunction+'54' , "KEY_CONTACT="+KeyContact+"&LEVEL="+Level+"&GROUPE="+Groupe , null );
    
    HideElement('CONTACT_'+KeyContact+'_SAVE_'+IdWindow);
}
//////////////////////////////////////////////////////////////////////////
//PLACE PUBLIQUE
//////////////////////////////////////////////////////////////////////////
function PlacePubliciGoToPage(IdWindow,KeyArticle,Page )
{
    g_IdWindowTmp = IdWindow;
    HttpPostRequest( g_WebSiteUrlFunction+'157' , "KEY_ARTICLE="+KeyArticle+"&PAGE_ARTICLE="+Page+"&ID_WINDOW="+IdWindow , OnPlacePubliciGoToPage);
    document.getElementById('PLACE_PUBLIC_ANSWERS_'+IdWindow).innerHTML='Chargement...';
}
//////////////////////////////////////////////////////////////////////////
function OnPlacePubliciGoToPage( Result )
{
    document.getElementById('PLACE_PUBLIC_ANSWERS_'+g_IdWindowTmp).innerHTML=Result;
}
//////////////////////////////////////////////////////////////////////////
function DeletePlacePubliqueAnswers(IdWindow,KeyAnswers )
{
    document.getElementById('PLACE_PUBLIC_ANSWERS_'+IdWindow+'_'+KeyAnswers).innerHTML='';
    var justification = prompt('Veuillez indiquer la raison', 'Justification');
    HttpPostRequest( g_WebSiteUrlFunction+'156' , "KEY_ANSWERS="+KeyAnswers+"&JUSTIFICATION="+justification , null);
}
//////////////////////////////////////////////////////////////////////////
function UnlockArticlePlacePublique(IdWindow,KeyArticle,ElementToHide )
{
    document.getElementById(ElementToHide).innerHTML='';
    HttpPostRequest( g_WebSiteUrlFunction+'118' , "KEY_ARTICLE="+KeyArticle, null);
}
//////////////////////////////////////////////////////////////////////////
function LockArticlePlacePublique(IdWindow,KeyArticle,ElementToHide )
{
    document.getElementById(ElementToHide).innerHTML='';
    HttpPostRequest( g_WebSiteUrlFunction+'117' , "KEY_ARTICLE="+KeyArticle, null);
}
//////////////////////////////////////////////////////////////////////////
function DeleteArticlePlacePublique(IdWindow,KeyArticle,ElementToHide )
{
    document.getElementById(ElementToHide).innerHTML='';
    HttpPostRequest( g_WebSiteUrlFunction+'116' , "KEY_ARTICLE="+KeyArticle, null);
}
//////////////////////////////////////////////////////////////////////////
function PublishArticlePlacePublique(IdWindow,KeyArticle )
{
    document.getElementById("JOB_TOOLS_1_"+g_IdWindowTmp+"_"+KeyArticle).innerHTML='';
    HttpPostRequest( g_WebSiteUrlFunction+'115' , "KEY_ARTICLE="+KeyArticle, null);
}
//////////////////////////////////////////////////////////////////////////
function OnClickTopicPlacePublique( Topic , IdWindow)
{
    g_IdWindowTmp = IdWindow;
    document.getElementById("LIST_ARTICLE_PLACE_PUBLIQUE_"+g_IdWindowTmp).innerHTML='<fieldset><legend>'+Topic+'</legend><div style="width:655px; height:365px;overflow-x:hidden;">Chargement...</div></fieldset>';
    HttpPostRequest( g_WebSiteUrlFunction+'50' , "TOPIC="+Topic , UpdateArticleListPlacePublique );
}
//////////////////////////////////////////////////////////////////////////
function UpdateArticleListPlacePublique( ListArticle )
{
    document.getElementById("LIST_ARTICLE_PLACE_PUBLIQUE_"+g_IdWindowTmp).innerHTML=ListArticle;
}
//////////////////////////////////////////////////////////////////////////
function PreviewArticle(IdWindow, KeyArticle) 
{
    //Text = document.getElementById('TEXT_EDIT_PLACE_PUBLIC_' + IdWindow).value;
    Title = document.getElementById('TEXT_EDIT_TITLE_PLACE_PUBLIC_' + IdWindow).value;
    Text = "";
    //Title = "";
    AddWindow(g_WebSiteUrl + '/index.php?PAGE=105&RENDER_MODE=WINDOW&TEXT=' + Text + '&TITLE=' + Title, 0);
}
//////////////////////////////////////////////////////////////////////////
function EditArticle(IdWindow, KeyArticle) 
{
    Text = document.getElementById('TEXT_EDIT_PLACE_PUBLIC_' + IdWindow).value;
    Title = document.getElementById('TEXT_EDIT_TITLE_PLACE_PUBLIC_' + IdWindow).value;
    Topic = document.getElementById('TEXT_EDIT_TOPIC_PLACE_PUBLIC_' + IdWindow).value;
    
    if (document.getElementById('TEXT_EDIT_POSTIT_PLACE_PUBLIC_' + IdWindow).checked) {
        PostIt = 1;
    } else {
        PostIt = 0;
    }


    HttpPostRequest(g_WebSiteUrlFunction + '143', "KEY_ARTICLE=" + KeyArticle + "&TEXT=" + Text+ "&TITLE=" + Title+"&TOPIC=" + Topic+"&POSTIT=" + PostIt, null);
    alert('Article sauv\351');
    //document.getElementById("FORM_EDIT_BUTTON_PLACE_PUBLIC_" + IdWindow).innerHTML = "Article sauv&eacute;.";
}
//////////////////////////////////////////////////////////////////////////
function ReplyPlacePublique( IdWindow ,KeyArticle )
{
    Text = document.getElementById('TEXT_REPLY_PLACE_PUBLIC_'+IdWindow).value;
    HttpPostRequest( g_WebSiteUrlFunction+'52' , "KEY_ARTICLE="+KeyArticle+"&TEXT="+Text , null );
    
    document.getElementById("FORM_REPLY_PLACE_PUBLIC_"+IdWindow).innerHTML="R&eacute;ponse envoy&eacute;e.";
}
//////////////////////////////////////////////////////////////////////////
function AddArticlePlacePublique( IdWindow )
{
    Title = document.getElementById('TEXT_TITLE_SEND_ARTICLE_PLACE_PUBLIQUE_'+IdWindow).value;
    Text = document.getElementById('TEXT_SEND_ARTICLE_PLACE_PUBLIQUE_'+IdWindow).value;
    
    HttpPostRequest( g_WebSiteUrlFunction+'51' , "TITLE="+Title+"&TEXT="+Text , null );
    
    document.getElementById("SEND_ARTICLE_PLACE_PUBLIC_"+IdWindow).innerHTML="Article envoy&eacute;.";
}
//////////////////////////////////////////////////////////////////////////
//SANCTUAIRE
//////////////////////////////////////////////////////////////////////////
function OnClickTopicSanctuaire( Topic , IdWindow)
{
    g_IdWindowTmp = IdWindow;
    document.getElementById("LIST_ARTICLE_SANCTUAIRE_"+g_IdWindowTmp).innerHTML='<fieldset><legend>'+Topic+'</legend><div style="width:690px; height:365px;overflow-x:hidden;">Chargement...</div></fieldset>';
    HttpPostRequest( g_WebSiteUrlFunction+'99' , "TOPIC="+Topic , UpdateArticleListSanctuaire );
}
//////////////////////////////////////////////////////////////////////////
function UpdateArticleListSanctuaire( ListArticle )
{
    document.getElementById("LIST_ARTICLE_SANCTUAIRE_"+g_IdWindowTmp).innerHTML=ListArticle;
}
//////////////////////////////////////////////////////////////////////////
function ReplySanctuaire( IdWindow ,KeyArticle )
{
    Text = document.getElementById('TEXT_REPLY_SANCTUAIRE_'+IdWindow).value;
    
    HttpPostRequest( g_WebSiteUrlFunction+'101' , "KEY_ARTICLE="+KeyArticle+"&TEXT="+Text, null );
    
    document.getElementById("FORM_REPLY_SANCTUAIRE_"+IdWindow).innerHTML="R&eacute;ponse envoy&eacute;e.";
}
//////////////////////////////////////////////////////////////////////////
function AddArticleSanctuaire( IdWindow )
{
    Title = document.getElementById('TEXT_TITLE_SEND_ARTICLE_SANCTUAIRE_'+IdWindow).value;
    Text = document.getElementById('TEXT_SEND_ARTICLE_SANCTUAIRE_'+IdWindow).value;
    Topic = document.getElementById('TEXT_TOPIC_SEND_ARTICLE_SANCTUAIRE_'+IdWindow).value;
    HttpPostRequest( g_WebSiteUrlFunction+'100' , "TITLE="+Title+"&TEXT="+Text+"&TOPIC="+Topic , null );
    
    document.getElementById("SEND_ARTICLE_SANCTUAIRE_"+IdWindow).innerHTML="Legende envoy&eacute;.";
}
//////////////////////////////////////////////////////////////////////////
function DeleteArticleSanctuaire(IdWindow,KeyArticle,ElementToHide )
{
    document.getElementById(ElementToHide).innerHTML='';
    HttpPostRequest( g_WebSiteUrlFunction+'169' , "KEY_ARTICLE="+KeyArticle, null);
}
//////////////////////////////////////////////////////////////////////////
function PublishArticleSanctuaire(IdWindow,KeyArticle )
{
    document.getElementById("JOB_TOOLS_44_"+g_IdWindowTmp+"_"+KeyArticle).innerHTML='';
    HttpPostRequest( g_WebSiteUrlFunction+'168' , "KEY_ARTICLE="+KeyArticle, null);
}
//////////////////////////////////////////////////////////////////////////
//PARLEMENT
//////////////////////////////////////////////////////////////////////////
function OnClickTopicParlement( Topic , IdWindow)
{
    g_IdWindowTmp = IdWindow;
    document.getElementById("LIST_ARTICLE_PARLEMENT_"+g_IdWindowTmp).innerHTML='<fieldset><legend>'+Topic+'</legend><div style="width:690px; height:365px;overflow-x:hidden;">Chargement...</div></fieldset>';
    HttpPostRequest( g_WebSiteUrlFunction+'102' , "TOPIC="+Topic , UpdateArticleListParlement );
}
//////////////////////////////////////////////////////////////////////////
function UpdateArticleListParlement( ListArticle )
{
    document.getElementById("LIST_ARTICLE_PARLEMENT_"+g_IdWindowTmp).innerHTML=ListArticle;
}
//////////////////////////////////////////////////////////////////////////
function ReplyParlement( IdWindow ,KeyArticle )
{
    Text = document.getElementById('TEXT_REPLY_PARLEMENT_'+IdWindow).value;
    
    HttpPostRequest( g_WebSiteUrlFunction+'104' , "KEY_ARTICLE="+KeyArticle+"&TEXT="+Text, null );
    
    document.getElementById("FORM_REPLY_PARLEMENT_"+IdWindow).innerHTML="R&eacute;ponse envoy&eacute;e.";
}
//////////////////////////////////////////////////////////////////////////
function AddArticleParlement( IdWindow )
{
    Title = document.getElementById('TEXT_TITLE_SEND_ARTICLE_PARLEMENT_'+IdWindow).value;
    Text = document.getElementById('TEXT_SEND_ARTICLE_PARLEMENT_'+IdWindow).value;
    Topic = document.getElementById('TEXT_TOPIC_SEND_ARTICLE_PARLEMENT_'+IdWindow).value;
    HttpPostRequest( g_WebSiteUrlFunction+'103' , "TITLE="+Title+"&TEXT="+Text+"&TOPIC="+Topic , null );
    
    document.getElementById("SEND_ARTICLE_PARLEMENT_"+IdWindow).innerHTML="Article envoy&eacute;.";
}
//////////////////////////////////////////////////////////////////////////
//HALL_GUILD
//////////////////////////////////////////////////////////////////////////
function DeleteArticleHallGuild(IdWindow, KeyArticle) 
{
    HttpPostRequest(g_WebSiteUrlFunction + '165', "KEY_ARTICLE=" + KeyArticle , null);
    alert('Article effac\351');
}
//////////////////////////////////////////////////////////////////////////
function ArchiveArticleHallGuild(IdWindow, KeyArticle) 
{
    HttpPostRequest(g_WebSiteUrlFunction + '164', "KEY_ARTICLE=" + KeyArticle , null);
    alert('Article Archiv\351');
}
//////////////////////////////////////////////////////////////////////////
function UnLockArticleHallGuild(IdWindow, KeyArticle) 
{
    HttpPostRequest(g_WebSiteUrlFunction + '163', "KEY_ARTICLE=" + KeyArticle , null);
    alert('Article d\351verouill\351');
}
//////////////////////////////////////////////////////////////////////////
function LockArticleHallGuild(IdWindow, KeyArticle) 
{
    HttpPostRequest(g_WebSiteUrlFunction + '162', "KEY_ARTICLE=" + KeyArticle , null);
    alert('Article verouill\351');
}
//////////////////////////////////////////////////////////////////////////
function EditArticleHallGuild(IdWindow, KeyArticle) 
{
    Text = document.getElementById('TEXT_EDIT_HALL_GUILD_' + IdWindow).value;
    Title = document.getElementById('TEXT_EDIT_TITLE_HALL_GUILD_' + IdWindow).value;
    HttpPostRequest(g_WebSiteUrlFunction + '161', "KEY_ARTICLE=" + KeyArticle + "&TEXT=" + Text+ "&TITLE=" + Title, null);
    alert('Article sauv\351');
}
//////////////////////////////////////////////////////////////////////////
function OnClickTopicHallGuild( Topic , IdWindow)
{
    g_IdWindowTmp = IdWindow;
    document.getElementById("LIST_ARTICLE_HALL_GUILD_"+g_IdWindowTmp).innerHTML='<fieldset><legend>'+Topic+'</legend><div style="width:680px; height:365px;overflow-x:hidden;">Chargement...</div></fieldset>';
    HttpPostRequest( g_WebSiteUrlFunction+'105' , "TOPIC="+Topic , UpdateArticleListHallGuild );
}
//////////////////////////////////////////////////////////////////////////
function UpdateArticleListHallGuild( ListArticle )
{
    document.getElementById("LIST_ARTICLE_HALL_GUILD_"+g_IdWindowTmp).innerHTML=ListArticle;
}
//////////////////////////////////////////////////////////////////////////
function ReplyHallGuild( IdWindow ,KeyArticle )
{
    Text = document.getElementById('TEXT_REPLY_HALL_GUILD_'+IdWindow).value;
    
    HttpPostRequest( g_WebSiteUrlFunction+'107' , "KEY_ARTICLE="+KeyArticle+"&TEXT="+Text, null );
    
    document.getElementById("FORM_REPLY_HALL_GUILD_"+IdWindow).innerHTML="R&eacute;ponse envoy&eacute;e.";
}
//////////////////////////////////////////////////////////////////////////
function AddArticleHallGuild( IdWindow )
{
    Title = document.getElementById('TEXT_TITLE_SEND_ARTICLE_HALL_GUILD_'+IdWindow).value;
    Text = document.getElementById('TEXT_SEND_ARTICLE_HALL_GUILD_'+IdWindow).value;
    Key_Job = document.getElementById('TEXT_KEY_JOB_SEND_ARTICLE_HALL_GUILD_' + IdWindow).value;
    Rank = document.getElementById('TEXT_RANK_SEND_ARTICLE_HALL_GUILD_' + IdWindow).value;
    HttpPostRequest(g_WebSiteUrlFunction + '106', "TITLE=" + Title + "&TEXT=" + Text + "&KEY_JOB=" + Key_Job + "&RANK=" + Rank, null);
    
    document.getElementById("SEND_ARTICLE_HALL_GUILD_"+IdWindow).innerHTML="Article envoy&eacute;.";
}
//////////////////////////////////////////////////////////////////////////
//MESSAGERIE
//////////////////////////////////////////////////////////////////////////
function OnClickOpenUPS(KeyMessage) 
{
    HttpPostRequest(g_WebSiteUrlFunction + '134', "KEY_MESSAGE=" + KeyMessage, OnUpdateClickOpenUPS);
}
//////////////////////////////////////////////////////////////////////////
function OnUpdateClickOpenUPS(Result) 
{
    document.getElementById("UPS_CONTENT").innerHTML = Result;
}
//////////////////////////////////////////////////////////////////////////
function ArchiveSelectFolder(IdWindow)
{
    document.getElementById("MESSAGE_LIST_CONTENT_ARCHIVER_"+IdWindow).innerHTML="Chargement ...";
    Folder=document.getElementById('MESSAGE_SELECT_ARCHIVER_'+IdWindow).value;;
    HttpPostRequest( g_WebSiteUrlFunction+'98' , "FOLDER="+Folder+"&ID_WINDOW="+IdWindow, UpdateMessageArchiveList );
    g_IdWindowTmp = IdWindow;
}
//////////////////////////////////////////////////////////////////////////
function UpdateMessageArchiveList(Result) {
    document.getElementById("MESSAGE_LIST_CONTENT_ARCHIVER_"+g_IdWindowTmp).innerHTML=Result;
}
//////////////////////////////////////////////////////////////////////////
function SendMessage(IdWindow,KeyMessageOrigne,KeyTarget)
{
    var Message = document.getElementById('TEXT_SEND_MESSAGE_'+IdWindow).value;
    var reg=new RegExp("(')", "g");
    Message = Message.replace(reg, " ");

    if (document.getElementById('TEXT_SEND_ADMIN_' + IdWindow)&&document.getElementById('TEXT_SEND_UPS_' + IdWindow)) 
    {

        KeyUPS = document.getElementById('TEXT_SEND_UPS_' + IdWindow).value;
        KeyJob = document.getElementById('TEXT_SEND_ADMIN_' + IdWindow).value;
        HttpPostRequest(g_WebSiteUrlFunction + '26', "KEY_MESSAGE_ORIGINE=" + KeyMessageOrigne + "&KEY_TARGET=" + KeyTarget + "&MESSAGE=" + Message + "&KEY_UPS=" + KeyUPS + "&KEY_JOB=" + KeyJob, null);
    } else 
    {
        HttpPostRequest(g_WebSiteUrlFunction + '26', "KEY_MESSAGE_ORIGINE=" + KeyMessageOrigne + "&KEY_TARGET=" + KeyTarget + "&MESSAGE=" + Message, null);
    }
    
    
    
    HideMenuInfobulle();
    document.getElementById("SEND_MESSAGE_CONTENT_"+IdWindow).innerHTML="<div style=\"text-align:center;\">Message envoy&eacute;</div>";
}
//////////////////////////////////////////////////////////////////////////
function ArchiverMessage(IdWindow,IdWindowParent,KeyMessage)
{
 /*   RequestPost = new CHttpRequest();
    RequestPost.SetURLTarget( g_WebSiteUrlFunction+'25');
    RequestPost.SetMethod( 'POST' );
    RequestPost.m_Data="KEY_MESSAGE="+KeyMessage+"&FOLDER="+document.getElementById(IdWindow+'_TARGET_FOLDER').value;
    RequestPost.Open();


    document.getElementById("MESSAGE_"+IdWindowParent+"_"+KeyMessage).innerHTML="";
    document.getElementById("MESSAGE_"+IdWindowParent+"_"+KeyMessage).style.display = 'none';
    
    document.getElementById("MESSAGE_CONTENT_"+IdWindowParent).innerHTML="Message archiv&eacute;";
    document.getElementById("MESSAGE_OPTION_"+IdWindowParent).innerHTML="Message archiv&eacute;";
*/
    HttpPostRequest(g_WebSiteUrlFunction + '25', "KEY_MESSAGE=" + KeyMessage + "&FOLDER=" + document.getElementById(IdWindow + '_TARGET_FOLDER').value, null);
    HideMenuInfobulle();
    SafeHideObjectById('MESSAGE_' + KeyMessage);
    
    g_WindowArray[ IdWindow ].Destroy();
}
//////////////////////////////////////////////////////////////////////////
function ArchiverMessage2(IdWindow,IdWindowParent,KeyMessage)
{
    /*RequestPost = new CHttpRequest();
    RequestPost.SetURLTarget( g_WebSiteUrlFunction+'25');
    RequestPost.SetMethod( 'POST' );
    RequestPost.m_Data="KEY_MESSAGE="+KeyMessage+"&FOLDER="+document.getElementById(IdWindow+'_TARGET_NEW_FOLDER').value;
    RequestPost.Open();
    document.getElementById("MESSAGE_"+IdWindowParent+"_"+KeyMessage).innerHTML="";
    document.getElementById("MESSAGE_"+IdWindowParent+"_"+KeyMessage).style.display = 'none';
    
    document.getElementById("MESSAGE_CONTENT_"+IdWindowParent).innerHTML="Message archiv&eacute;";
    document.getElementById("MESSAGE_OPTION_" + IdWindowParent).innerHTML = "Message archiv&eacute;";      */

    SafeHideObjectById('MESSAGE_' + KeyMessage);
    HttpPostRequest(g_WebSiteUrlFunction + '25', "KEY_MESSAGE=" + KeyMessage + "&FOLDER=" + document.getElementById(IdWindow + '_TARGET_NEW_FOLDER').value, null);
    HideMenuInfobulle();
    g_WindowArray[ IdWindow ].Destroy();
}
//////////////////////////////////////////////////////////////////////////
function DeletteMessage(IdWindow,KeyMessage)
{
    g_IdWindowTmp = IdWindow;
    HttpPostRequest(g_WebSiteUrlFunction + '24', "KEY_MESSAGE=" + KeyMessage + "&ID_WINDOW=" + IdWindow, null);
    SafeHideObjectById('MESSAGE_' + KeyMessage);
    HideMenuInfobulle();
}
//////////////////////////////////////////////////////////////////////////
function OnClickMessage(IdWindow, KeyMessage, KeyUser)
{
    g_IdWindowTmp = IdWindow;
    HttpPostRequest( g_WebSiteUrlFunction+'22' , "KEY_MESSAGE="+KeyMessage+"&ID_WINDOW="+IdWindow, UpdateMessageContent );
    HttpPostRequest(g_WebSiteUrlFunction + '23', "KEY_MESSAGE=" + KeyMessage + "&ID_WINDOW=" + IdWindow, UpdateMessageOption);
    HttpPostRequest(g_WebSiteUrlFunction + '128', "KEY_USER=" + KeyUser + "&ID_WINDOW=" + IdWindow, UpdateMessageOrigine);
    document.getElementById("MESSAGE_CONTENT_"+g_IdWindowTmp).innerHTML="Chargement du message...";
    document.getElementById("MESSAGE_OPTION_" + g_IdWindowTmp).innerHTML = "Chargement des options...";
    document.getElementById("MESSAGE_ORIGINE_" + g_IdWindowTmp).innerHTML = "Chargement...";
}
//////////////////////////////////////////////////////////////////////////
function OnClickMessageOutBox(IdWindow,KeyMessage)
{
    g_IdWindowTmp = IdWindow;
    HttpPostRequest( g_WebSiteUrlFunction+'22' , "KEY_MESSAGE="+KeyMessage+"&ID_WINDOW="+IdWindow, UpdateMessageContentOutBox );
    document.getElementById("MESSAGE_CONTENT_OUTBOX_"+IdWindow).innerHTML="Chargement du message...";
}
//////////////////////////////////////////////////////////////////////////
function OnClickMessageArchive(IdWindow,KeyMessage)
{
    g_IdWindowTmp = IdWindow;
    HttpPostRequest( g_WebSiteUrlFunction+'22' , "KEY_MESSAGE="+KeyMessage+"&ID_WINDOW="+IdWindow, UpdateMessageContentArchiver );
    HttpPostRequest( g_WebSiteUrlFunction+'23' , "KEY_MESSAGE="+KeyMessage+"&ID_WINDOW="+IdWindow, UpdateMessageOptionArchiver );
    document.getElementById("MESSAGE_CONTENT_ARCHIVER_"+g_IdWindowTmp).innerHTML="Chargement du message...";
    document.getElementById("MESSAGE_OPTION_ARCHIVER_"+g_IdWindowTmp).innerHTML="Chargement des options...";
}
//////////////////////////////////////////////////////////////////////////
function UpdateMessageContentOutBox(Result)
{
    document.getElementById("MESSAGE_CONTENT_OUTBOX_"+g_IdWindowTmp).innerHTML=Result;
}
//////////////////////////////////////////////////////////////////////////
function UpdateMessageContent(Result)
{
    document.getElementById("MESSAGE_CONTENT_"+g_IdWindowTmp).innerHTML=Result;
    UpdateTaskBar();
}
//////////////////////////////////////////////////////////////////////////
function UpdateMessageOrigine(Result) {
    document.getElementById("MESSAGE_ORIGINE_" + g_IdWindowTmp).innerHTML = Result;
}
//////////////////////////////////////////////////////////////////////////
function UpdateMessageOption(Result)
{
    document.getElementById("MESSAGE_OPTION_"+g_IdWindowTmp).innerHTML=Result;
}
//////////////////////////////////////////////////////////////////////////
function UpdateMessageContentArchiver(Result)
{
    document.getElementById("MESSAGE_CONTENT_ARCHIVER_"+g_IdWindowTmp).innerHTML=Result;
}
//////////////////////////////////////////////////////////////////////////
function UpdateMessageOptionArchiver(Result)
{
    document.getElementById("MESSAGE_OPTION_ARCHIVER_"+g_IdWindowTmp).innerHTML=Result;
}
//////////////////////////////////////////////////////////////////////////
//MENUBAR TASKBAR
//////////////////////////////////////////////////////////////////////////
var g_ElementEnAttente = new Array;
g_ElementEnAttente[0]=0;
g_ElementEnAttente[1]=0;
g_ElementEnAttente[2]=0;
g_ElementEnAttente[3]=0;
g_ElementEnAttente[4]=0;
g_ElementEnAttente[5]=0;
g_ElementEnAttente[6] = 0;
g_ElementEnAttente[7] = 0;
var g_ElementEnAttenteHighlight = new Array;
g_ElementEnAttenteHighlight[0] = 0;
g_ElementEnAttenteHighlight[1] = 0;
g_ElementEnAttenteHighlight[2] = 0;
g_ElementEnAttenteHighlight[3] = 0;
g_ElementEnAttenteHighlight[4] = 0;
g_ElementEnAttenteHighlight[5] = 0;
g_ElementEnAttenteHighlight[6] = 0;
g_ElementEnAttenteHighlight[7] = 0;
var g_ElementEnAttenteButtonID = new Array;
g_ElementEnAttenteButtonID [0] = 'DEDICACE';
g_ElementEnAttenteButtonID [1] = 'MESSAGE';
g_ElementEnAttenteButtonID [2] = 'AMIS';
g_ElementEnAttenteButtonID [3] = 'GROUPE';
g_ElementEnAttenteButtonID [4] = 'CLAN';
g_ElementEnAttenteButtonID [5] = 'EVENT';
g_ElementEnAttenteButtonID [6] = 'INVIT';
g_ElementEnAttenteButtonID [7] = 'NOTIFICATION';


//////////////////////////////////////////////////////////////////////////
function UpdateTaskBar()
{
    RequestPost = new CHttpRequest();
    RequestPost.SetURLTarget( g_WebSiteUrlFunction+'2000');
    RequestPost.SetMethod( 'POST' );
    RequestPost.Open();
    RequestPost.m_OnComplete = UpdateTaskBarElement;
}
//////////////////////////////////////////////////////////////////////////
function UpdateTaskBarElement(Result)
{
    var chaine=Result;
    var reg=new RegExp("[;]", "g");
    var tableau=chaine.split(reg);

    for (var i=0; i<tableau.length; i++) 
    {
        //alert("tableau[" + i + "] = " + tableau[i] );
        if(tableau[i]!="")
        {
            var chaine=tableau[i];
            var reg=new RegExp("[#]", "g");
            var option_value=chaine.split(reg);
            g_ElementEnAttente[i] = option_value[1];
/*            if (g_ElementEnAttente[i] != option_value[1])
            {
                g_ElementEnAttente[i] = option_value[1];
               /* //la valeur a changé
                Timer = new CTimer();
                Timer.SetNumberRepeate(5);
                Timer.SetInterval(1);
                Timer.SetFirstExecutionOnStart(true);
                Timer.SetOnTimeFunction(
                function ButtonChangeColor() {
                    var ObjectId = 'TASK_BAR_BUTTON_' + g_ElementEnAttenteButtonID[i];
                    //alert(g_ElementEnAttenteHighlight[i] + ' ' + option_value[0] + ' ' + 'TASK_BAR_BUTTON_' + g_ElementEnAttenteButtonID[i] + ' ' + i);

                    if (g_ElementEnAttenteHighlight[i] == 0) {
                        if (document.getElementById(ObjectId) != null)
                            document.getElementById(ObjectId).style.backgroundColor = '#196fb7';
                        g_ElementEnAttenteHighlight[i] = 1;
                    } else {
                        if (document.getElementById(ObjectId) != null)
                            document.getElementById(ObjectId).style.backgroundColor = '#ff0000';
                        g_ElementEnAttenteHighlight[i] = 0;
                    }
                }
            );
                AddTimer(Timer);*/
            //}

            if(option_value[1]>0)
            {
                ShowTaskBarElement(option_value[0]);
            }else
            {
                HideTaskBarElement(option_value[0]);
            }
        }
    }

    var ie = document.all ? 1 : 0
    var plok = 0;
    if (ie) 
    {
        _width = document.documentElement.clientWidth;
        _height = document.documentElement.clientHeight;
    } else {
        _width = window.innerWidth;
        _height = window.innerHeight;
    }

    if (g_WindowsHeight != _height) {
        g_UpdatePlante = true;
    }

    g_WindowsHeight = _height;

    if (g_UpdatePlante) {
        g_UpdatePlante = false;
        UpdatePlante();
    }

    if (document.images["DESKTOP_BACKGROUND_IMAGE_IMG"] == null) return;
    document.images["DESKTOP_BACKGROUND_IMAGE_IMG"].width = _width;
    document.images["DESKTOP_BACKGROUND_IMAGE_IMG"].height = _height;


}
//////////////////////////////////////////////////////////////////////////
function ShowTaskBarElement( Element )
{
    //document.getElementById('TASK_BAR_BUTTON_' + Element).style.display = 'block';
    SafeShowObjectById('TASK_BAR_BUTTON_' + Element);
    if (Element == "MESSAGE") 
    {
        SafeShowObjectById('NOTIFICATION_MESSAGE');
    }
}
//////////////////////////////////////////////////////////////////////////
function HideTaskBarElement( Element )
{
    //document.getElementById('TASK_BAR_BUTTON_' + Element).style.display = 'none';
    SafeHideObjectById('TASK_BAR_BUTTON_' + Element);
    if (Element == "MESSAGE") 
    {
        SafeHideObjectById('NOTIFICATION_MESSAGE');
    }
}
//////////////////////////////////////////////////////////////////////////
function UpdatePowerPoint(Point,NewPoint) 
{
    if (Point > 0) 
    {
        document.getElementById('POINT_POUVOIR_ADD').innerHTML = '<span style="color:#00ff00;">+' + Point + '</span>';
    } else 
    {
        document.getElementById('POINT_POUVOIR_ADD').innerHTML = '<span style="color:#ff0000;">' + Point + '</span>';
    }
    document.getElementById('POINT_POUVOIR').innerHTML = NewPoint;


    if (NewPoint < 1000)
    {
        document.getElementById('NOTIFICATION_BOX_PP').style.display = 'block';
    } else
    {
        document.getElementById('NOTIFICATION_BOX_PP').style.display = 'none';
    }

    Timer = new CTimer();
    Timer.SetNumberRepeate(2);
    Timer.SetInterval(5);
    Timer.SetFirstExecutionOnStart(false);
    Timer.SetOnTimeFunction(
    function TestFunction() {
                document.getElementById('POINT_POUVOIR_ADD').innerHTML = '';
            }
            );
    AddTimer(Timer);
}

//////////////////////////////////////////////////////////////////////////
//DEDICACES
//////////////////////////////////////////////////////////////////////////
function EnvoyerDedicace( IdWindow , KeyTarget )
{
    if( document.getElementById('TEXTE_ADD_DEDICACE_'+IdWindow ).value != "")
    {
        document.getElementById('ADD_DEDICACE_BUTTON_'+IdWindow).innerHTML="D&eacute;dicace envoy&eacute;e";
        HttpPostRequest( g_WebSiteUrlFunction+'21' , "KEY_TARGET="+KeyTarget+"&TEXT="+document.getElementById('TEXTE_ADD_DEDICACE_'+IdWindow ).value, null );
    }
}
//////////////////////////////////////////////////////////////////////////
function SupprimerDedicace( IdWindow , KeyDedicace )
{
    RequestPost = new CHttpRequest();
    RequestPost.SetURLTarget( g_WebSiteUrlFunction+'20');
    RequestPost.SetMethod( 'POST' );
    RequestPost.m_Data="KEY_DEDICACE="+KeyDedicace;
    RequestPost.Open();
   // RequestPost.m_OnComplete = ReloadWindow( IdWindow );
    
    document.getElementById('DEDICACE_'+KeyDedicace+'_'+IdWindow ).style.display = 'none';
}
//////////////////////////////////////////////////////////////////////////
function ValiderDedicace( IdWindow , KeyDedicace )
{
    RequestPost = new CHttpRequest();
    RequestPost.SetURLTarget( g_WebSiteUrlFunction+'19');
    RequestPost.SetMethod( 'POST' );
    RequestPost.m_Data="KEY_DEDICACE="+KeyDedicace;
    RequestPost.Open();
   // RequestPost.m_OnComplete = ReloadWindow( IdWindow );
    
    document.getElementById('DEDICACE_'+KeyDedicace+'_'+IdWindow ).style.display = 'none';
}
//////////////////////////////////////////////////////////////////////////
//WINDOW THEME
//////////////////////////////////////////////////////////////////////////
function SaveWindowTheme( IdWindow , NewTheme )
{
    RequestPost = new CHttpRequest();
    RequestPost.SetURLTarget( g_WebSiteUrl+'/index.php?FUNCTION=18');
    RequestPost.SetMethod( 'POST' );
    RequestPost.m_Data="NEW_THEME="+NewTheme;
    RequestPost.Open();
    //RequestPost.m_OnComplete = ReloadWindow( IdWindow );
}
//////////////////////////////////////////////////////////////////////////
//YOUTUBE
//////////////////////////////////////////////////////////////////////////
function SaveYouTubeAccount( IdWindow )
{
    var form = document.getElementById( 'EDIT_YOUTUBE_FORM_'+IdWindow );
    
    RequestPost = new CHttpRequest();
    RequestPost.SetURLTarget( g_WebSiteUrl+'/index.php?FUNCTION=17');
    RequestPost.SetMethod( 'POST' );
    RequestPost.m_Data="ACCOUNT="+form.COMPTE_YOUTUBE.value;
    RequestPost.Open();
    RequestPost.m_OnComplete = ReloadWindow( IdWindow );
}
//////////////////////////////////////////////////////////////////////////
//LOCALISATION
//////////////////////////////////////////////////////////////////////////
function SaveLocalisation(IdWindow,Avatar)
{
    var form = document.getElementById( 'EDIT_LOCALISATION_'+IdWindow );
    
    //alert('Pays:'+form.pays.value+' Ville:'+form.ville.value+' Code:'+form.code.value+' Rue:'+form.rue.value+' Logement:'+form.logement.value );
    Adress ="";
    Adress += ' '+form.rue.value;
    Adress += ' '+form.code.value;
    Adress += ' '+form.ville.value;
    Adress += ' '+form.pays.value;
    
    LoadGoogleMapUserInfo( Adress , Avatar ,IdWindow);
    
    RequestPost = new CHttpRequest();
    RequestPost.SetURLTarget( g_WebSiteUrl+'/index.php?FUNCTION=9');
    RequestPost.SetMethod( 'POST' );
    RequestPost.m_Data="RUE="+form.rue.value+"&CODE="+form.code.value;
    RequestPost.m_Data+="&VILLE="+form.ville.value+"&PAYS="+form.pays.value;
    RequestPost.m_Data+="&LOGEMENT="+form.logement.value;
    
    RequestPost.Open();
    RequestPost.m_OnComplete = UpdateProfilPourcent;
}
//////////////////////////////////////////////////////////////////////////
//GOOGLE MAP
//////////////////////////////////////////////////////////////////////////
function LoadGoogleMapOnDiv( IdWindow ) 
{
    if (GBrowserIsCompatible()) 
    {
        map = new GMap2(document.getElementById(IdWindow));
        map.setCenter(new GLatLng(47.64, 5.57), 5);
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());
        map.addControl(new GOverviewMapControl());
        map.setMapType(G_SATELLITE_MAP);
        //map.setCenter(new GLatLng(37.4419, -122.1419), 13);
    }
}
////////////////////////////////////////////
function LoadGoogleMapUserInfo(Adress,Picture,IdWindow)
{

    //alert(Adress);
	var map = null;
	var geocoder = new GClientGeocoder();
	
	if (GBrowserIsCompatible()) {
	map = new GMap2(document.getElementById("MAP_GOOGLE_"+IdWindow));
	map.setCenter(new GLatLng(47.64, 5.57), 5);
	map.addControl(new GLargeMapControl());
	map.addControl(new GMapTypeControl());
	map.addControl(new GOverviewMapControl());
	map.setMapType(G_SATELLITE_MAP);
	//Création du marqueur au centre de la carte. 
	if (geocoder) 
	{
		geocoder.getLatLng(Adress,
		function(point)
		{
			if(!point)
			{
				//alert('Adresse invalide');
				return;
			}
			map.setCenter(point, 13);
			var iconRed = new GIcon(); 
			iconRed.image =Picture;
			iconRed.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			iconRed.iconSize = new GSize(15, 20);
			iconRed.shadowSize = new GSize(22, 20);
			iconRed.iconAnchor = new GPoint(6, 20);
			iconRed.infoWindowAnchor = new GPoint(5, 1);
					
			var options = { 
			icon: iconRed,
			draggable: false,
			bouncy: false,
			title: " titre "
			};
				
			var marqueur_ID = new GMarker(point, options);
			map.addOverlay(marqueur_ID);
			GEvent.addListener(marqueur_ID, 
								"click", 
								function() 
			 					{
									map.setCenter(point, 15);
			 					}
								);
			}
			

				);
			}
	  }

}
//////////////////////////////////////////////////////////////////////////
//ABOUT
//////////////////////////////////////////////////////////////////////////
function EditAbout(IdWindow) 
{
    var Text = document.getElementById('ABOUT_USER_' + IdWindow).value;
    HttpPostRequest(g_WebSiteUrlFunction + '3', "FIELD=" + "About" + "&VALUE=" + Text, null);
    alert("Sauvegarde réussie");
}
//////////////////////////////////////////////////////////////////////////
//SPORT
//////////////////////////////////////////////////////////////////////////
function EditSport( IdWindow )
{
    var form = document.getElementById( 'EDIT_SPORT_'+IdWindow );
    //alert('editsport'+IdWindow+' '+form.sport_pratiquez.value+' '+form.sport_preferer.value);
    
    RequestPost = new CHttpRequest();
    RequestPost.SetURLTarget( g_WebSiteUrlFunction+'15');
    RequestPost.SetMethod( 'POST' );
    RequestPost.m_Data="SPORT="+form.sport_pratiquez.value+"&SPORT_2="+form.sport_preferer.value;
    
    RequestPost.Open();
    RequestPost.m_OnComplete = UpdateProfilPourcent;
}
//////////////////////////////////////////////////////////////////////////
//WORK
//////////////////////////////////////////////////////////////////////////
function AddWorkGoToStep2( IdWindow , IdWindowParent )
{
    var form = document.getElementById( 'AJOUT_EMPLOIS_STEP_1_'+IdWindow );
    //1 verif si remplis
    if( form.pays.value == "")
    {
        form.pays.style.borderColor = "#ff0000";
        form.pays.style.borderStyle = "solid"; 
        alert('Vous devez remplir la cases pays avant de passer \340 la suite');
        return;
    }
    if( form.ville.value == "")
    {
        form.ville.style.borderColor = "#ff0000";
        form.ville.style.borderStyle = "solid"; 
        alert('Vous devez remplir la cases ville avant de passer \340 la suite');
        return;
    }
    //2 verif si modifier valeur de def
    if( form.pays.value == "Le pays de votre entreprise")
    {
        form.pays.style.borderColor = "#ff0000";
        form.pays.style.borderStyle = "solid"; 
        alert('Vous devez remplir la cases pays avant de passer \340 la suite');
        return;
    }
    if( form.ville.value == "La ville de votre entreprise")
    {
        form.ville.style.borderColor = "#ff0000";
        form.ville.style.borderStyle = "solid"; 
        alert('Vous devez remplir la cases ville avant de passer \340 la suite');
        return;
    }
    //3 passage a la suite
    document.getElementById('AJOUT_EMPLOIS_FREQUENTE_1'+IdWindow ).style.display = 'none';
    document.getElementById('AJOUT_EMPLOIS_FREQUENTE_2'+IdWindow ).style.display = 'block';
    document.getElementById('AJOUT_EMPLOIS_FREQUENTE_3'+IdWindow ).style.display = 'none';
    document.getElementById('AJOUT_EMPLOIS_FREQUENTE_4'+IdWindow ).style.display = 'none';

    document.getElementById('BUTTON_AJOUT_EMPLOIS_FREQUENTE_1'+IdWindow).style.backgroundColor = '#196fb7';
    document.getElementById('BUTTON_AJOUT_EMPLOIS_FREQUENTE_2'+IdWindow).style.backgroundColor = '#22BB00';

    //4 
    RequestPost = new CHttpRequest();
    RequestPost.SetURLTarget( g_WebSiteUrlFunction+'10');
    RequestPost.SetMethod( 'POST' );
    RequestPost.m_Data="PAYS="+form.pays.value+"&VILLE="+form.ville.value;
    
    RequestPost.Open(); 
    RequestPost.m_OnComplete = UpdateWorkList;
}
//////////////////////////////////////////////////////////////////////////
function AddWorkGoToStep3( IdWindow , IdWindowParent )
{
    var form = document.getElementById( 'AJOUT_EMPLOIS_STEP_2_'+IdWindow );
    //1 verif si remplis
    if( form.NOM_ENTREPRISE.value == "")
    {
        form.NOM_ENTREPRISE.style.borderColor = "#ff0000";
        form.NOM_ENTREPRISE.style.borderStyle = "solid"; 
        alert('Vous devez introduire un nom pour votre entreprise.');
        return;
    }
    //2 verif si modifier valeur de def
    if( form.NOM_ENTREPRISE.value == "Choisissez dans la liste si dessu.")
    {
        form.LIST_ENTREPRISE.style.borderColor = "#ff0000";
        form.LIST_ENTREPRISE.style.borderStyle = "solid"; 
        alert('Vous devez choisir une entreprise dans la liste d\roulente.');
        return;
    }
    //3 passage a la suite
    document.getElementById('AJOUT_EMPLOIS_FREQUENTE_1'+IdWindow ).style.display = 'none';
    document.getElementById('AJOUT_EMPLOIS_FREQUENTE_2'+IdWindow ).style.display = 'none';
    document.getElementById('AJOUT_EMPLOIS_FREQUENTE_3'+IdWindow ).style.display = 'block';
    document.getElementById('AJOUT_EMPLOIS_FREQUENTE_4'+IdWindow ).style.display = 'none';

    document.getElementById('BUTTON_AJOUT_EMPLOIS_FREQUENTE_2'+IdWindow).style.backgroundColor = '#196fb7';
    document.getElementById('BUTTON_AJOUT_EMPLOIS_FREQUENTE_3'+IdWindow).style.backgroundColor = '#22BB00';

}
//////////////////////////////////////////////////////////////////////////
function AddWorkGoToStep4( IdWindow , IdWindowParent )
{
    var form = document.getElementById( 'AJOUT_EMPLOIS_STEP_3_'+IdWindow );
    //1 verif si remplis
    if( form.FONCTION.value == "")
    {
        form.FONCTION.style.borderColor = "#ff0000";
        form.FONCTION.style.borderStyle = "solid"; 
        alert('Vous devez choisir une orientation.');
        return;
    }
    
    //2 verif si modifier valeur de def
    if( form.annee_debut.value == "1900")
    {
        form.annee_debut.style.borderColor = "#ff0000";
        form.annee_debut.style.borderStyle = "solid"; 
        alert('Vous devez choisir une date de d/351but.');
        return;
    }
    if( form.annee_fin.value == "1900")
    {
        form.annee_fin.style.borderColor = "#ff0000";
        form.annee_fin.style.borderStyle = "solid"; 
        alert('Vous devez choisir une date de fin.');
        return;
    }
    if( form.FONCTION.value == "Exemple:Programmeur")
    {
        form.FONCTION.style.borderColor = "#ff0000";
        form.FONCTION.style.borderStyle = "solid"; 
        alert('Vous devez choisir une fonction.');
        return;
    }
    //3 passage a la suite
    document.getElementById('AJOUT_EMPLOIS_FREQUENTE_1'+IdWindow ).style.display = 'none';
    document.getElementById('AJOUT_EMPLOIS_FREQUENTE_2'+IdWindow ).style.display = 'none';
    document.getElementById('AJOUT_EMPLOIS_FREQUENTE_3'+IdWindow ).style.display = 'none';
    document.getElementById('AJOUT_EMPLOIS_FREQUENTE_4'+IdWindow ).style.display = 'block';

    document.getElementById('BUTTON_AJOUT_EMPLOIS_FREQUENTE_3'+IdWindow).style.backgroundColor = '#196fb7';
    document.getElementById('BUTTON_AJOUT_EMPLOIS_FREQUENTE_4'+IdWindow).style.backgroundColor = '#22BB00';

    //5 résumé    
    var form_1 = document.getElementById( 'AJOUT_EMPLOIS_STEP_1_'+IdWindow );
    var form_2 = document.getElementById( 'AJOUT_EMPLOIS_STEP_2_'+IdWindow );
    var form_3 = document.getElementById( 'AJOUT_EMPLOIS_STEP_3_'+IdWindow );
    document.getElementById( 'AJOUT_EMPLOIS_RESUME_'+IdWindow ).innerHTML ="";
    document.getElementById( 'AJOUT_EMPLOIS_RESUME_'+IdWindow ).innerHTML +=new String(form_2.NOM_ENTREPRISE.value);
    document.getElementById( 'AJOUT_EMPLOIS_RESUME_'+IdWindow ).innerHTML +="<br>En "+form_1.pays.value+" \340 "+form_1.ville.value;
    document.getElementById( 'AJOUT_EMPLOIS_RESUME_'+IdWindow ).innerHTML +="<br>De "+form_3.annee_debut.value+" \340 "+form_3.annee_fin.value;
    document.getElementById( 'AJOUT_EMPLOIS_RESUME_'+IdWindow ).innerHTML +="<br>Fonction:"+form_3.FONCTION.value;

}
//////////////////////////////////////////////////////////////////////////
function AddWorkGoToStep5( IdWindow , IdWindowParent )
{
    var form_1 = document.getElementById( 'AJOUT_EMPLOIS_STEP_1_'+IdWindow );
    var form_2 = document.getElementById( 'AJOUT_EMPLOIS_STEP_2_'+IdWindow );
    var form_3 = document.getElementById( 'AJOUT_EMPLOIS_STEP_3_'+IdWindow );

    RequestPost = new CHttpRequest();
    RequestPost.SetURLTarget( g_WebSiteUrl+'/index.php?FUNCTION=11');
    RequestPost.SetMethod( 'POST' );

    RequestPost.m_Data="KEY_ENTREPRISE="+form_2.KEY_ENTREPRISE.value+"&DEBUT="+form_3.annee_debut.value+"&FIN="+form_3.annee_fin.value+"&FONCTION="+form_3.FONCTION.value+"&PAYS="+form_1.pays.value+"&VILLE="+form_1.ville.value+"&NOM="+form_2.NOM_ENTREPRISE.value;
    RequestPost.Open(); 
    RequestPost.m_OnComplete = RefreshUserWorkList;

    g_WindowArray[IdWindow].Destroy();
    g_WindowArray[ IdWindowParent ].BringToTop();
}

//////////////////////////////////////////////////////////////////////////
function UpdateWorkList( Result )
{
    var chaine=Result;
    var reg=new RegExp("[;]", "g");
    var tableau=chaine.split(reg);

    for (var i=0; i<tableau.length; i++) 
    {
        //alert("tableau[" + i + "] = " + tableau[i] );
        if(tableau[i]!="")
        {
            var chaine=tableau[i];
            var reg=new RegExp("[#]", "g");
            var option_value=chaine.split(reg);
            AddToList("LIST_ENTREPRISE",option_value[0],new String(option_value[1]));
        }
    }
}
//////////////////////////////////////////////////////////////////////////
function ChangeWorkList(FormSource)
{
    var form = document.getElementById( FormSource );
    if(form.LIST_ENTREPRISE.options[form.LIST_ENTREPRISE.options.selectedIndex].value != -1)
    {
        form.NOM_ENTREPRISE.value = form.LIST_ENTREPRISE.options[form.LIST_ENTREPRISE.options.selectedIndex].text;
        form.NOM_ENTREPRISE.disabled="disabled";
        form.KEY_ENTREPRISE.value = form.LIST_ENTREPRISE.options[form.LIST_ENTREPRISE.options.selectedIndex].value;
    }else
    {
        form.NOM_ENTREPRISE.value ="";
        form.NOM_ENTREPRISE.disabled="";
        form.KEY_ENTREPRISE.value="-1";
    }
}
//////////////////////////////////////////////////////////////////////////
function RefreshUserWorkList()
{
    makeRequest(g_WebSiteUrl+'/index.php?FUNCTION=12','WORK_LIST');
}
//////////////////////////////////////////////////////////////////////////
function DeletteUserWork( KeyUserEntreprise )
{
   
    RequestPost = new CHttpRequest();
    RequestPost.SetURLTarget( g_WebSiteUrl+'/index.php?FUNCTION=13');
    RequestPost.SetMethod( 'POST' );
    RequestPost.m_Data="KEY="+KeyUserEntreprise;
    RequestPost.Open(); 
    RequestPost.m_OnComplete = RefreshUserWorkList;
    HideMenuInfobulle();
}
//////////////////////////////////////////////////////////////////////////
//SCHOOL
//////////////////////////////////////////////////////////////////////////
var g_SchoolNewLineBuffer;
var g_SchoolIdParentBuffer;
//////////////////////////////////////////////////////////////////////////
function AddSchoolGoToStep2( IdWindow , IdWindowParent )
{
    var form = document.getElementById( 'AJOUT_ECOLE_STEP_1_'+IdWindow );
    //1 verif si remplis
    if( form.pays.value == "")
    {
        form.pays.style.borderColor = "#ff0000";
        form.pays.style.borderStyle = "solid"; 
        alert('Vous devez remplir la cases pays avant de passer \340 la suite');
        return;
    }
    if( form.ville.value == "")
    {
        form.ville.style.borderColor = "#ff0000";
        form.ville.style.borderStyle = "solid"; 
        alert('Vous devez remplir la cases ville avant de passer \340 la suite');
        return;
    }
    //2 verif si modifier valeur de def
    if( form.pays.value == "Le pays de votre \351cole")
    {
        form.pays.style.borderColor = "#ff0000";
        form.pays.style.borderStyle = "solid"; 
        alert('Vous devez remplir la cases pays avant de passer \340 la suite');
        return;
    }
    if( form.ville.value == "La ville de votre \351cole")
    {
        form.ville.style.borderColor = "#ff0000";
        form.ville.style.borderStyle = "solid"; 
        alert('Vous devez remplir la cases ville avant de passer \340 la suite');
        return;
    }
    
    //3 passage a la suite
    document.getElementById('AJOUT_ECOLE_FREQUENTE_1'+IdWindow ).style.display = 'none';
    document.getElementById('AJOUT_ECOLE_FREQUENTE_2'+IdWindow ).style.display = 'block';
    document.getElementById('AJOUT_ECOLE_FREQUENTE_3'+IdWindow ).style.display = 'none';
    document.getElementById('AJOUT_ECOLE_FREQUENTE_4'+IdWindow ).style.display = 'none';

    document.getElementById('BUTTON_AJOUT_ECOLE_FREQUENTE_1'+IdWindow).style.backgroundColor = '#196fb7';
    document.getElementById('BUTTON_AJOUT_ECOLE_FREQUENTE_2'+IdWindow).style.backgroundColor = '#22BB00';
    
    RequestPost = new CHttpRequest();
    RequestPost.SetURLTarget( g_WebSiteUrlFunction+'5');
    RequestPost.SetMethod( 'POST' );
    RequestPost.m_Data="PAYS="+form.pays.value+"&VILLE="+form.ville.value;
    
    RequestPost.Open(); 
    RequestPost.m_OnComplete = UpdateSchoolList;
}
//////////////////////////////////////////////////////////////////////////
function AddSchoolGoToStep3( IdWindow , IdWindowParent )
{

    var form = document.getElementById( 'AJOUT_ECOLE_STEP_2_'+IdWindow );
    //1 verif si remplis
    if( form.nom_ecole.value == "")
    {
        form.nom_ecole.style.borderColor = "#ff0000";
        form.nom_ecole.style.borderStyle = "solid"; 
        alert('Vous devez introduire un nom pour votre \351cole.');
        return;
    }
    //2 verif si modifier valeur de def
    if( form.nom_ecole.value == "Choisissez dans la liste si dessu.")
    {
        form.LIST_ECOLE.style.borderColor = "#ff0000";
        form.LIST_ECOLE.style.borderStyle = "solid"; 
        alert('Vous devez choisir une \351cole dans la liste d\roulente.');
        return;
    }
    //3 passage a la suite
    document.getElementById('AJOUT_ECOLE_FREQUENTE_1'+IdWindow ).style.display = 'none';
    document.getElementById('AJOUT_ECOLE_FREQUENTE_2'+IdWindow ).style.display = 'none';
    document.getElementById('AJOUT_ECOLE_FREQUENTE_3'+IdWindow ).style.display = 'block';
    document.getElementById('AJOUT_ECOLE_FREQUENTE_4'+IdWindow ).style.display = 'none';

    document.getElementById('BUTTON_AJOUT_ECOLE_FREQUENTE_2'+IdWindow).style.backgroundColor = '#196fb7';
    document.getElementById('BUTTON_AJOUT_ECOLE_FREQUENTE_3'+IdWindow).style.backgroundColor = '#22BB00';
}
//////////////////////////////////////////////////////////////////////////
function AddSchoolGoToStep4( IdWindow , IdWindowParent )
{
    var form = document.getElementById( 'AJOUT_ECOLE_STEP_3_'+IdWindow );
    //1 verif si remplis
    if( form.orientation.value == "")
    {
        form.orientation.style.borderColor = "#ff0000";
        form.orientation.style.borderStyle = "solid"; 
        alert('Vous devez choisir une orientation.');
        return;
    }
    
    //2 verif si modifier valeur de def
    if( form.annee_debut.value == "1900")
    {
        form.annee_debut.style.borderColor = "#ff0000";
        form.annee_debut.style.borderStyle = "solid"; 
        alert('Vous devez choisir une date de d/351but.');
        return;
    }
    if( form.annee_fin.value == "1900")
    {
        form.annee_fin.style.borderColor = "#ff0000";
        form.annee_fin.style.borderStyle = "solid"; 
        alert('Vous devez choisir une date de fin.');
        return;
    }
    if( form.orientation.value == "Exemple:Scientifique")
    {
        form.orientation.style.borderColor = "#ff0000";
        form.orientation.style.borderStyle = "solid"; 
        alert('Vous devez choisir une orientation.');
        return;
    }
    //3 passage a la suite
    document.getElementById('AJOUT_ECOLE_FREQUENTE_1'+IdWindow ).style.display = 'none';
    document.getElementById('AJOUT_ECOLE_FREQUENTE_2'+IdWindow ).style.display = 'none';
    document.getElementById('AJOUT_ECOLE_FREQUENTE_3'+IdWindow ).style.display = 'none';
    document.getElementById('AJOUT_ECOLE_FREQUENTE_4'+IdWindow ).style.display = 'block';

    document.getElementById('BUTTON_AJOUT_ECOLE_FREQUENTE_3'+IdWindow).style.backgroundColor = '#196fb7';
    document.getElementById('BUTTON_AJOUT_ECOLE_FREQUENTE_4'+IdWindow).style.backgroundColor = '#22BB00';

    var form_1 = document.getElementById( 'AJOUT_ECOLE_STEP_1_'+IdWindow );
    var form_2 = document.getElementById( 'AJOUT_ECOLE_STEP_2_'+IdWindow );
    var form_3 = document.getElementById( 'AJOUT_ECOLE_STEP_3_'+IdWindow );
    


    
    document.getElementById( 'AJOUT_ECOLE_RESUME_'+IdWindow ).innerHTML ="";
    document.getElementById( 'AJOUT_ECOLE_RESUME_'+IdWindow ).innerHTML +=new String(form_2.nom_ecole.value);
    document.getElementById( 'AJOUT_ECOLE_RESUME_'+IdWindow ).innerHTML +="<br>En "+form_1.pays.value+" \340 "+form_1.ville.value;
    document.getElementById( 'AJOUT_ECOLE_RESUME_'+IdWindow ).innerHTML +="<br>De "+form_3.annee_debut.value+" \340 "+form_3.annee_fin.value;
    document.getElementById( 'AJOUT_ECOLE_RESUME_'+IdWindow ).innerHTML +="<br>Orientation:"+form_3.orientation.value;
}
//////////////////////////////////////////////////////////////////////////
function AddSchoolGoToStep5(IdWindow , IdWindowParent)
{
    var form_1 = document.getElementById( 'AJOUT_ECOLE_STEP_1_'+IdWindow );
    var form_2 = document.getElementById( 'AJOUT_ECOLE_STEP_2_'+IdWindow );
    var form_3 = document.getElementById( 'AJOUT_ECOLE_STEP_3_'+IdWindow );

    RequestPost = new CHttpRequest();
    RequestPost.SetURLTarget( g_WebSiteUrl+'/index.php?FUNCTION=6');
    RequestPost.SetMethod( 'POST' );

    RequestPost.m_Data="KEY_ECOLE="+form_2.key_ecole.value+"&DEBUT="+form_3.annee_debut.value+"&FIN="+form_3.annee_fin.value+"&ORIENTATION="+form_3.orientation.value+"&PAYS="+form_1.pays.value+"&VILLE="+form_1.ville.value+"&NOM="+form_2.nom_ecole.value;
    RequestPost.Open(); 
    RequestPost.m_OnComplete = RefreshUserSchoolList;
/*
    g_SchoolNewLineBuffer ="";
    g_SchoolNewLineBuffer +='<td>'+form_2.nom_ecole.value+'</td>';
    g_SchoolNewLineBuffer +='<td>'+form_1.pays.value+'</td>';
    g_SchoolNewLineBuffer +='<td>'+form_1.ville.value+'</td>';
    g_SchoolNewLineBuffer +='<td>'+form_3.annee_debut.value+'-'+form_3.annee_fin.value+'</td>';
    g_SchoolNewLineBuffer +='<td>'+form_3.orientation.value+'</td>';
    g_SchoolIdParentBuffer = IdWindowParent;
    alert("avant:"+g_SchoolIdParentBuffer);*/
    

    g_WindowArray[IdWindow].Destroy();
    g_WindowArray[ IdWindowParent ].BringToTop();
}
//////////////////////////////////////////////////////////////////////////
function DeletteUserSchool( KeyUserSchool )
{
   
    RequestPost = new CHttpRequest();
    RequestPost.SetURLTarget( g_WebSiteUrl+'/index.php?FUNCTION=7');
    RequestPost.SetMethod( 'POST' );
    RequestPost.m_Data="KEY="+KeyUserSchool;
    RequestPost.Open(); 
    RequestPost.m_OnComplete = RefreshUserSchoolList;
    HideMenuInfobulle();
}
//////////////////////////////////////////////////////////////////////////
function RefreshUserSchoolList()
{
    makeRequest(g_WebSiteUrl+'/index.php?FUNCTION=8','SCHOOL_LIST');
}
//////////////////////////////////////////////////////////////////////////
function UpdateUserSchoolList( Result )
{
    if(Result == -1)
        return;
    var newline;
    newline ='<tr id="SCHOOL_REC_'+Result+'">';
    newline +=g_SchoolNewLineBuffer;
    newline +='<td><img style="vertical-align:middle;" src="'+g_WebSiteUrl+'/RESSOURCE/ICONE/cross.png"/';
    newline +='onmouseover="ShowMenuInfobulle(\'Supprimer\');"';
    newline +='onmouseout="HideMenuInfobulle();"';
    newline +='onmousedown="DeletteUserSchool('+Result+');"></td>';
    newline +='</tr>';
   // alert(g_SchoolIdParentBuffer);
   // document.getElementById( g_SchoolIdParentBuffer+'_TABLE_ECOLE').innerHTML+=newline;
}
//////////////////////////////////////////////////////////////////////////
function GetSchoolList(FormSource)
{
    var form = document.getElementById( FormSource );
    Pays=form.pays.value;
    Ville =form.ville.value;
    RequestPost = new CHttpRequest();
    RequestPost.SetURLTarget( g_WebSiteUrl+'/index.php?FUNCTION=5');
    RequestPost.SetMethod( 'POST' );
    RequestPost.m_Data="PAYS="+Pays+"&VILLE="+Ville;
    
    RequestPost.Open(); 
    RequestPost.m_OnComplete = UpdateSchoolList;
}
//////////////////////////////////////////////////////////////////////////
function UpdateSchoolList( Result )
{
    var chaine=Result;
    var reg=new RegExp("[;]", "g");
    var tableau=chaine.split(reg);

    for (var i=0; i<tableau.length; i++) 
    {
        //alert("tableau[" + i + "] = " + tableau[i] );
        if(tableau[i]!="")
        {
            var chaine=tableau[i];
            var reg=new RegExp("[#]", "g");
            var option_value=chaine.split(reg);
            AddToList("LIST_ECOLE",option_value[0],new String(option_value[1]));
        }
    }
}
//////////////////////////////////////////////////////////////////////////
function ChangeSchoolList(FormSource)
{
    var form = document.getElementById( FormSource );
    if(form.LIST_ECOLE.options[form.LIST_ECOLE.options.selectedIndex].value != -1)
    {
        form.nom_ecole.value = form.LIST_ECOLE.options[form.LIST_ECOLE.options.selectedIndex].text;
        form.nom_ecole.disabled="disabled";
        form.key_ecole.value = form.LIST_ECOLE.options[form.LIST_ECOLE.options.selectedIndex].value;
    }else
    {
        form.nom_ecole.value ="";
        form.nom_ecole.disabled="";
        form.key_ecole.value="-1";
    }
}
//////////////////////////////////////////////////////////////////////
//EVENT UPDATE
//////////////////////////////////////////////////////////////////////
var g_EventUpdateResponse=true;
function EventUpdate(Key_User) {
    if (g_EventUpdateResponse) 
    {
        HttpPostRequest(g_WebSiteUrlFunction + '10000', "KEY_USER=" + Key_User, OnEventUpdate);
        g_EventUpdateResponse = false;
    }
}
//////////////////////////////////////////////////////////////////////
function OnEventUpdate(Result) {
    g_EventUpdateResponse = true;
    UpdateTaskBar();

    var _ResultArray = Result.split(new RegExp("[$]", "g"));

    document.getElementById("EVENT_UPDATE_INFO").innerHTML = _ResultArray[0];

    _ResultArray[1] == 0 ? SafeHideObjectById('BOTTOM_BAR_BUTTON_STATE_PILS_GREEN') : SafeShowObjectById('BOTTOM_BAR_BUTTON_STATE_PILS_GREEN');
    _ResultArray[2] == 0 ? SafeHideObjectById('BOTTOM_BAR_BUTTON_STATE_PILS_YELLOW') : SafeShowObjectById('BOTTOM_BAR_BUTTON_STATE_PILS_YELLOW');
    _ResultArray[3] == 0 ? SafeHideObjectById('BOTTOM_BAR_BUTTON_STATE_PILS_RED') : SafeShowObjectById('BOTTOM_BAR_BUTTON_STATE_PILS_RED');
    _ResultArray[4] == 0 ? SafeHideObjectById('BOTTOM_BAR_BUTTON_STATE_PILS_BLUE') : SafeShowObjectById('BOTTOM_BAR_BUTTON_STATE_PILS_BLUE');
    _ResultArray[5] == 0 ? SafeHideObjectById('BOTTOM_BAR_BUTTON_STATE_PILS_PINK') : SafeShowObjectById('BOTTOM_BAR_BUTTON_STATE_PILS_PINK');
    _ResultArray[6] == 0 ? SafeHideObjectById('BOTTOM_BAR_BUTTON_STATE_COLOR') : SafeShowObjectById('BOTTOM_BAR_BUTTON_STATE_COLOR');
    _ResultArray[7] == 0 ? SafeHideObjectById('BOTTOM_BAR_BUTTON_STATE_ZOMBIE') : SafeShowObjectById('BOTTOM_BAR_BUTTON_STATE_ZOMBIE');
    _ResultArray[8] == 0 ? SafeHideObjectById('BOTTOM_BAR_BUTTON_STATE_VARICELLE') : SafeShowObjectById('BOTTOM_BAR_BUTTON_STATE_VARICELLE');
    _ResultArray[9] == 0 ? SafeHideObjectById('BOTTOM_BAR_BUTTON_STATE_CHAT') : SafeShowObjectById('BOTTOM_BAR_BUTTON_STATE_CHAT');

    //News
    document.getElementById("NEWS").innerHTML = _ResultArray[10];

    //_ResultArray[10] == 0 ? SafeHideObjectById('BOTTOM_BAR_BUTTON_STATE_BOULE_NEIGE') : SafeShowObjectById('BOTTOM_BAR_BUTTON_STATE_BOULE_NEIGE');
    //_ResultArray[11] == 0 ? SafeHideObjectById('BOTTOM_BAR_BUTTON_STATE_DIVERS') : SafeShowObjectById('BOTTOM_BAR_BUTTON_STATE_DIVERS');
    SafeHideObjectById('PLANTE_COMMAND');


}

//////////////////////////////////////////////////////////////////////
//COMMON
//////////////////////////////////////////////////////////////////////
function AddToList(IdList,Value,OptionValue)
{
    var list_option = document.getElementById( IdList );
    list_option.options[list_option.length] = new Option(OptionValue,Value,false,false);
   /* nouvel_element = new Option(OptionValue,Value,false,false);
    document.formulaire.LIST_ECOLE.options[document.formulaire.LIST_ECOLE.length] = nouvel_element;*/
}
//////////////////////////////////////////////////////////////////////
function ShowMenuInfobulle(Text,OffsetX , OffsetY )
{
	if(OffsetX==undefined)OffsetX=0;
	if(OffsetY==undefined)OffsetY=0;

	position_x = g_MouseInformation.m_Position.m_X -20+OffsetX;
	position_y = g_MouseInformation.m_Position.m_Y +10+OffsetY;
	//alert(Text+position_x+" "+position_y);
	document.getElementById("INFO_BULLE").innerHTML = Text;
	document.getElementById("INFO_BULLE").style.display = 'block'
    document.getElementById("INFO_BULLE").style.left = position_x +"px";
    document.getElementById("INFO_BULLE").style.top =  position_y +"px";
}
//////////////////////////////////////////////////////////////////////
function HideMenuInfobulle()
{
	document.getElementById("INFO_BULLE").innerHTML="";
	document.getElementById("INFO_BULLE").style.display="none";
}
//////////////////////////////////////////////////////////////////////////
function testCadre()
{
    alert( 'hello' );
}
//////////////////////////////////////////////////////////////////////////
function ShowLoginForm()
{
    document.getElementById("WELCOME_IMAGE").style.display = "none";
    document.getElementById("WELCOME_LOGIN").style.display = "block";
}
//////////////////////////////////////////////////////////////////////////
function ForgetPassword() 
{
    var Mail = prompt("Entrez votre adresse mail");
    if (CheckMail(Mail)) {
        HttpPostRequest(g_WebSiteUrlFunction + '139', "MAIL=" + Mail, UpdateForgetPassword);
    } else {
        alert('Mail non valide');
    }
}
//////////////////////////////////////////////////////////////////////////
function UpdateForgetPassword(Result) {
    alert(Result);
}
//////////////////////////////////////////////////////////////////////////
function TryLogin(WindowId) 
{
    var Mail = document.getElementById("WELCOME_LOGIN_FORM_MAIL").value;
    var Pass = document.getElementById("WELCOME_LOGIN_FORM_CODE").value;
    if (document.getElementById("WELCOME_LOGIN_FORM_REMEMBER").checked)
    {
        var Remember = 'on';
    } else 
    {
        var Remember = 'off';
    }
    HttpPostRequest(g_WebSiteUrlFunction + '2', "KEY_USER=" + Mail + "&PASSWORD=" + Pass + "&REMEMBER=" + Remember, Login);
    
    
    
    SafeHideObjectById('LOGIN_FORM');
    SafeShowObjectById('LOGIN_FORM_CHARGEMENT');
     
    
     
}
//////////////////////////////////////////////////////////////////////////
function Login( Result )
{
    if( Result == "true" )
    {
        //alert('machin:'+Result);
        window.location.replace(g_WebSiteUrl+"/index.php?PAGE=1");

    }else
    
    
    //if( Result == "false" )
    {
        alert('Erreur:' + Result + '\n envoyez un mail a administration@utopiapolis.net' );
        SafeShowObjectById('LOGIN_FORM');
        SafeHideObjectById('LOGIN_FORM_CHARGEMENT');
    }
}

//////////////////////////////////////////////////////////////////////////
function TestAjax()
{
    /*var HttpRequest = new CHttpRequest();
    HttpRequest.m_URLTarget = g_WebSiteUrl;
    HttpRequest.m_OnComplete = function ()
    {
        alert('loaded');
    }
    HttpRequest.Open();*/
    AddWindowAjax();
}
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
function AddWindowAjax()
{
    WindowURL = g_WebSiteUrl+"/index.php?PAGE=2&RENDER_MODE=WINDOW"; 
    g_WindowArray.push( new CWindow( g_IdWindow ) );
    g_ZIndex ++ ;
    document.getElementById("MAIN_FRAME").innerHTML+='<div ID="MAIN_FRAME_WINDOW_'+g_IdWindow+'" style="top:100px;left:100px;position:absolute;">Loading...</div>';
    
    var HttpRequest = new CHttpRequest();
    HttpRequest.m_URLTarget = WindowURL+'&ID_WINDOW='+g_IdWindow ;
    HttpRequest.Open();
    HttpRequest.m_OnComplete = function ()
    {
        document.getElementById( 'MAIN_FRAME_WINDOW_'+g_IdWindow ).innerHTML = HttpRequest.m_XMLHttpRequest.responseText;
        g_WindowArray[ g_IdWindow ].BringToTop();
    }

    g_IdWindow ++ ;
    
    
}
//////////////////////////////////////////////////////////////////////////
function UpdateInfo()
{
    alert('UpdateInfo');
    /*Request = new CHttpRequest();
    Request.SetMethod( 'GET' );
    Request.SetURLTarget( g_WebSiteUrl+'/index.php?PAGE=1000&RENDER_MODE=DATA');
    Request.m_OnComplete = testblala;//( Request.m_XMLHttpRequest.responseText );
    Request.Open();*/
}

function testblala()
{
    document.getElementById('UPDATE_STRING').innerHTML=Request.m_XMLHttpRequest.responseText;
}
//////////////////////////////////////////////////////////////////////////
var g_ShowMenu = false;
function SwitchMenu()
{
    if(!g_ShowMenu)
    {
        g_ShowMenu = true;
        makeRequest(g_WebSiteUrl+'/index.php?PAGE=5&amp;RENDER_MODE=WINDOW','MENU_CONTENT');
        SafeShowObjectById('MENU');
            
    }else
    {
        g_ShowMenu = false;
        SafeHideObjectById('MENU');
    }
}
//////////////////////////////////////////////////////////////////////////
function HideMenu()
{

    //document.getElementById("MENU").style.display = "none";
}
//////////////////////////////////////////////////////////////////////////
function ShowMenu()
{
    SafeShowObjectById('MENU');
}
//////////////////////////////////////////////////////////////////////////
function ChangeBackgroundImage(Image,element)
{
    element.style.backgroundImage = "url("+Image+")";
}
//////////////////////////////////////////////////////////////////////////
//PROFIL GESTION
//////////////////////////////////////////////////////////////////////////
function HighlightSetButtonProfil( IdPressObject , KeyObject , NumberInSet , SelectColor , UnselectColor)
{
    
    for( index = 0 ; index < NumberInSet ; index ++ )
    {
        document.getElementById( IdPressObject+index ).style.backgroundColor = UnselectColor;
    }
    document.getElementById( IdPressObject + KeyObject ).style.backgroundColor = SelectColor;
}
//////////////////////////////////////////////////////////////////////////
function SaveProfilInfo( Field , Value )
{
    RequestPost = new CHttpRequest();
    RequestPost.SetURLTarget( g_WebSiteUrl+'/index.php?FUNCTION=3');
    RequestPost.SetMethod( 'POST' );
    RequestPost.m_Data="FIELD="+Field+"&VALUE="+Value;
    
    RequestPost.Open();
    RequestPost.m_OnComplete = UpdateProfilPourcent;
    //Recaluler % profil

}
//////////////////////////////////////////////////////////////////////////
function SaveLoginInfo( IdWindow )
{
    RequestPost = new CHttpRequest();
    RequestPost.SetURLTarget( g_WebSiteUrl+'/index.php?FUNCTION=16');
    RequestPost.SetMethod( 'POST' );
    RequestPost.m_Data="NOM="+document.forms["SAVE_LOGIN_INFO_"+IdWindow].elements["NOM"].value
    +"&PRENOM="+document.forms["SAVE_LOGIN_INFO_"+IdWindow].elements["PRENOM"].value
    +"&SURNOM="+document.forms["SAVE_LOGIN_INFO_"+IdWindow].elements["SURNOM"].value;
    alert('Information sauvegardée');
    RequestPost.Open();
    RequestPost.m_OnComplete = UpdateProfilPourcent;
}
//////////////////////////////////////////////////////////////////////////
function UpdateProfilPourcent( Result )
{
    resulttmp = Result / 10;
    resulttmp = Math.floor(resulttmp);
    resulttmp *=10;

    image ='<img style="vertical-align:middle;" src="'+g_WebSiteUrl+'/RESSOURCE/PROGRESSBAR/progressbar_'+resulttmp+'.png"/>';
    if(document.getElementById("PROFIL_POURCENT")!=null)
        document.getElementById("PROFIL_POURCENT").innerHTML=Result+'%'+image;

}
//////////////////////////////////////////////////////////////////////////
/*
    *  é : \351
    * è : \350
    * ê : \352
    * à : \340
    */
    
function makeIm(Image)
{
    NS4=(document.layers);
    IE4=(document.all);
    scaleWidth = true;
    scaleHeight = true;
    imSRC = Image; // MODIFIEZ ICI VOTRE IMAGE
    if (NS4)
    {
        origWidth = innerWidth;
        origHeight = innerHeight
    }

    function reDo()
    {
        if (innerWidth != origWidth || innerHeight != origHeight)
        location.reload();
        
    }

    if (NS4) onresize = reDo;
    if (IE4) onresize = reDoIE;

    function reDoIE()
    {
        imBG.width = document.body.clientWidth;
        imBG.height = document.body.clientHeight;
        alert(document.body.clientHeight);
    }
    
    winWid = (NS4) ? innerWidth : document.body.clientWidth;
    winHgt = (NS4) ? innerHeight : document.body.clientHeight;
    if(winHgt==0)
        winHgt = innerHeight;
    winHgt -=5;
    
    imStr = "<div id=elBGim"
    + " style='position:absolute;left:0;top:0;z-index:-100'>"
    + "<img name='imBG' border='0' src="+imSRC;
    if (scaleWidth) imStr += " width="+winWid;
    if (scaleHeight) imStr += " height="+winHgt;
    imStr += "></div>";
    document.write(imStr)
} 
