function fct_insert(balise,champ){
         document.forms["frm"].elements[champ].value+= balise;
}

function fct_delete(fuse,type,prod){
                             if(confirm('Êtes-vous certain de vouloir supprimer ce produit?')){
    document.location = "index.php?fuseaction=modifs.delete_prod&fuse="+fuse+"&type="+type+"&id_prod="+prod;
}
}
function popUp(URL) {
        day = new Date();
        id = day.getTime();
        eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=1050,height=768,left = 0,top = 0');");
}

function js_fct_confirm_delete(newsid) {

        if (confirm("Etes-vous sÃ»r de vouloir supprimer cette nouvelle dÃ©finitivement ?")) {
                document.location = "index.php?fuseaction=admin.act_delete_news&newsid=" + newsid;
        }

}


function js_fct_confirm_delete(newsid) {

	if (confirm("Etes-vous sûr de vouloir supprimer cette nouvelle définitivement ?")) {
		document.location = "index.php?fuseaction=act_delete_news&newsid=" + newsid;
	}

}



function js_fct_tri(tri){
                         document.location = "index.php?fuseaction=produits.prod&type='.$type.'&try=try";
}

//entretiens
var i = 0;

/*function raz(to){
                  document.getElementById('to').style.display = "none";
                  document.getElementById('trac').style.display = "none";
                  
}*/

function montre(cell){
                        var tond = cell;
                        if(i==1){
                        document.getElementById(tond).style.display = "none";
                        i = 0;
                        }else{
                        document.getElementById(tond).style.display = "block";
                        i = 1;
                        }
                }

  



                var t_menu = new Array();
                var liste_menu = new Array();
                var extention = ".bmp";
                
                function dessus(cell){
                        //cell.bgColor = "#0000FF";
                }
                function partir(cell){
                        //cell.bgColor = cell.parentNode.parentNode.parentNode.bgColor;
                }
                
                function reduire(cell){
                //réduit le menu déroulant si on quitte sur le menu
                        var id_menu = cell.id;
                        t_menu[id_menu].ouvrir = -1;
                        document.getElementById("sujet").style.visibility = "visible";
                }
                
                function developper(cell){
                //dévellope le menu déroulant si on passe sur le menu
                        var id_menu = cell.id;
                        t_menu[id_menu].ouvrir = 1;
                        if  ((t_menu[id_menu].type_menu == 1) || (t_menu[id_menu].type_menu == 2))
                                document.getElementById("basongelet_" + id_menu).style.display = "block";
                                document.getElementById("sujet").style.visibility = "hidden";
                }
                
                function reduire2(cell){
                //réduit le menu déroulant si on quitte sur le menu déroulant
                        var id_menu = cell.id.substring(6, cell.id.length);
                        t_menu[id_menu].ouvrir = -1;
                        document.getElementById("sujet").style.visibility = "visible";
                }
                
                function developper2(cell){
                //devellope le menu déroulant si on passe sur le menu déroulant
                        var id_menu = cell.id.substring(6, cell.id.length);
                        t_menu[id_menu].ouvrir = 1;
 //     document.write("<TABLE WIDTH='100%' HEiGHT='100%'><TR><TD>" + t_menu[id_menu].ouvrir + "</TD></TR></TABLE>");
                        if  ((t_menu[id_menu].type_menu == 1) || (t_menu[id_menu].type_menu == 2))
                                document.getElementById("basongelet_" + id_menu).style.display = "block";
                                document.getElementById("sujet").style.visibility = "hidden";
                }
                
                function reduire3(cell){
                //réduit le menu déroulant si on quitte sur l'ombre sous le menu
                        var id_menu = cell.id.substring(11, cell.id.length);
                        t_menu[id_menu].ouvrir = -1;
                        document.getElementById("sujet").style.visibility = "visible";
                }
                
                function developper3(cell){
                //devellope le menu déroulant si on passe sur l'ombre sous le menu
                        var id_menu = cell.id.substring(11, cell.id.length);
                        t_menu[id_menu].ouvrir = 1;
                        if  ((t_menu[id_menu].type_menu == 1) || (t_menu[id_menu].type_menu == 2))
                                document.getElementById("basongelet_" + id_menu).style.display = "block";
                                document.getElementById("sujet").style.visibility = "hidden";
                }
                
                function affmenu(){
                
                for (a=0 ; a<liste_menu.length ; a++)
                {
                        var idmenu = liste_menu[a];
                        //si on ouvre le menu et qu'il n'est pas complètement déroulé
                        //ou si on l'enroule et qu'il n'est pas complètement enroulé alors on fait bouger le menu déroulant
                        if ((t_menu[idmenu].ouvrir == 1)&&(t_menu[idmenu].nbrvar < t_menu[idmenu].nbrvarmax))
                        {
                                t_menu[idmenu].ypos_menu += t_menu[idmenu].vary;
                                t_menu[idmenu].xpos_menu += t_menu[idmenu].varx;
                                document.getElementById(idmenu).style.left = t_menu[idmenu].xpos_menu + "px";
                                document.getElementById(idmenu).style.top =  t_menu[idmenu].ypos_menu + "px";
                                t_menu[idmenu].nbrvar += 1;
                        }
                        if ((t_menu[idmenu].ouvrir == -1)&&(t_menu[idmenu].nbrvar > 0))
                        {
                                t_menu[idmenu].ypos_menu -= t_menu[idmenu].vary;
                                t_menu[idmenu].xpos_menu -= t_menu[idmenu].varx;
                                document.getElementById(idmenu).style.top = t_menu[idmenu].ypos_menu + "px";
                                document.getElementById(idmenu).style.left = t_menu[idmenu].xpos_menu + "px";
                                t_menu[idmenu].nbrvar -= 1;
                        }
                        if ((t_menu[idmenu].nbrvar >= t_menu[idmenu].nbrvarmax)&&(t_menu[idmenu].ouvrir == 1))
                        {//completement développé
                                t_menu[idmenu].ouvrir = 0;
                                t_menu[idmenu].nbrvar = t_menu[idmenu].nbrvarmax;
                        }
                        if ((t_menu[idmenu].nbrvar <= 0)&&(t_menu[idmenu].ouvrir == -1))
                        {//complètement réduit
                                t_menu[idmenu].ouvrir = 0;
                                t_menu[idmenu].nbrvar = 0;
                                document.getElementById("basongelet_" + idmenu).style.display = "none";
                        }
                }
                }
                
                
                
                
                
                function menu(nom, larg, haut, x, y, type_menu, larg_m, haut_m, x_m, y_m, varx, vary, nbrvmax, url){
                        var strtemp;
                                            
                    if ((type_menu == 1)||(type_menu == 3))
                        {// si le menu à créer se déroule vers le bas
                              //crée le menu
                              strtemp = '<DIV id="princ_' + nom + '" STYLE="position: absolute; left:' + x + '; top:' + y + '; width:' + larg + '; height:' + haut + '; z-index:4" onmouseover="developper2(this);" onmouseout="reduire2(this);">';;
                                strtemp += '<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" id="tab_princ' + nom + '" width="100%">';
                                strtemp += '<tr>';
                        strtemp += '<td class="m_prod">';
                        if (url == "")
                                strtemp += nom;
                        else
                                strtemp += '<a href="' + url + '" target="main_win" style="text-decoration: none">' + nom + '</a>';
                        strtemp += '</td>';
                        strtemp += '</tr></table>';
                            strtemp += '</DIV>'
                            document.write(strtemp);
                            
                                //crée le menu déroulant
                                strtemp = '<DIV id="' + nom + '" class="ss_prod" STYLE=" position: absolute; left:' + x_m + 'px; top:' + y_m + 'px; width:' + larg_m + '; height:' + haut_m + '; z-index:3" onmouseover="developper(this);" onmouseout="reduire(this);">';
                                strtemp += '<table border="0" cellpadding="0" cellspacing="0" width="100%" id="tab_' + nom + '">';
                                for (a=1 ; a<=menu.arguments.length-14 ; a=a+2)
                                {
                                        strtemp += '<tr>';
                                        strtemp += '<td class="sm_prod">'
                                        strtemp += '<a href="' + menu.arguments[13 + a + 1] + '">' + menu.arguments[13 + a] + '</a>';
                                        strtemp += '</td></tr>';
                                }
                                strtemp += '</table>';
                              strtemp += '</DIV>'
                              document.write(strtemp);
                            
                            //crée l'ombre sous le menu
                        strtemp = '<DIV id="basongelet_' + nom + '" style="position: absolute; left: ' + (x_m+1) + 'px; top: ' + (y+haut-7)+ '; width:' + (larg_m-3) + 'px; height:7px;z-index: 5;display: none;" onmouseover="developper3(this);" onmouseout="reduire3(this);">';
strtemp += '<TABLE  border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%">';

            //                strtemp = '<TABLE border="0" cellpadding="0" cellspacing="0" style="position: absolute; left: ' + (x_m+1) + 'px; top: ' + (y+haut-7)+ '; border-collapse: collapse; z-index: 5;display: none" width="' + (larg_m-3) + 'px" id="basongelet_' + nom + '" height="7px" onmouseover="developper3(this);" onmouseout="reduire3(this);">';
                                strtemp += '<tr><td width="12" background="ombre_onguelet_haut_1'+extention+'">';
                                strtemp += '<span style="font-size: 2pt">&nbsp;</span></td>';
                                strtemp += '<td background="ombre_onguelet_haut_2'+extention+'"><span style="font-size: 2pt">&nbsp;</span></td>';
                                strtemp += '<td width="9" background="ombre_onguelet_haut_3'+extention+'">';
                                strtemp += '<span style="font-size: 2pt">&nbsp;</span></td></tr></TABLE></DIV>';
                            document.write(strtemp);

                        }
                        else
                        if ((type_menu == 2)||(type_menu == 4))
                        {//si le menu à créer se déroule vers la gauche
                      //crée le menu
                              strtemp = '<DIV id="princ_' + nom + '" STYLE="position: absolute; left:' + x + '; top:' + y + '; width:' + larg + '; height:' + haut + '; z-index:4" onmouseover="developper2(this);" onmouseout="reduire2(this);">';
                                strtemp += '<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" id="tab_princ' + nom + '" width="100%" height="100%">';
                                strtemp += '<tr><td background="bord_gauche_1'+extention+'"><span style="font-size: 1">&nbsp;</span></td>';
                                strtemp += '<td width="13" height="4" background="bord_gauche_2'+extention+'"><span style="font-size: 1">&nbsp;</span></td></tr>';
                        strtemp += '<tr><td bgcolor="#8BBF2A" align="center" height="100%"><b>';
                        strtemp += '<font face="Arial" size="2" color="#961C29">';
                        if (url == "")
                                strtemp += nom;
                        else
                                strtemp += '<a href="' + url + '" target="main_win" style="text-decoration: none">' + nom + '</a>';
                        strtemp += '</font></b></td>';
                        strtemp += '<td width="13" background="bord_gauche_3'+extention+'">&nbsp;</td></tr>';
                        strtemp += '<tr><td background="bord_gauche_5'+extention+'"><span style="font-size: 1">&nbsp;</span></td>';
                        strtemp += '<td background="bord_gauche_4'+extention+'" width="13" height="4"><span style="font-size: 1">&nbsp;</span></td></tr></table>';
                            strtemp += '<TR><TD></TD></TR></TABLE></DIV>'
                            document.write(strtemp);
                            
                                //crée le menu déroulant
                                strtemp = '<DIV id="' + nom + '" STYLE="position: absolute; left: ' + x_m + 'px; top: ' + y_m + 'px; width:' + larg_m + '; height:' + (haut_m+5) + '; z-index:3" onmouseover="developper(this);" onmouseout="reduire(this);">';
                                strtemp += '<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" id="tab_' + nom + '" width="100%" height="100%">';
                                strtemp += '<tr><td background="onguelet_gauche_1'+extention+'"></td>';
                                strtemp += '<td background="onguelet_gauche_2'+extention+'" height="14" width="20"></td></tr>';
                                for (a=1 ; a<=menu.arguments.length-14 ; a=a+2)
                                {
                                        strtemp += '<td bgcolor="#8BBF2A" align="right"><b><font face="Arial" size="2" color="#961C29">'
                                        strtemp += '<a href="' + menu.arguments[13 + a + 1] + '" target="main_win" style="text-decoration: none">' + menu.arguments[13 + a] + '</a>';
                                        strtemp += '</font></b></td><td background="onguelet_gauche_3'+extention+'"></td></tr>';
                                }
                                strtemp += '<td background="onguelet_gauche_5'+extention+'"><font size="1">&nbsp;</font></td>';
                                strtemp += '<td background="onguelet_gauche_4'+extention+'" height="13"><font size="1">&nbsp;</font></td></tr></table>';
                              strtemp += '<TR><TD></TD></TR></TABLE></DIV>'
                              document.write(strtemp);
                            
                            //crée l'ombre sous le menu
                        strtemp = '<DIV id="basongelet_' + nom + '" style="position: absolute; left: ' +  (x+larg-7) + 'px; top: ' + (y_m+1)+ '; width:7px; height:' + (haut_m+4) + 'px;z-index: 5;display: none;" onmouseover="developper3(this);" onmouseout="reduire3(this);">';
strtemp += '<TABLE  border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" height="100%">';

                    //        strtemp = '<TABLE border="0" cellpadding="0" cellspacing="0" style="position: absolute; left: ' + (x+larg-7) + 'px; top: ' + (y_m+1)+ '; border-collapse: collapse; z-index: 5;display: none" width="7" id="basongelet_' + nom + '" height="' + (haut_m+4) + '" onmouseover="developper3(this);" onmouseout="reduire3(this);">';
                                strtemp += '<tr><td height="11" background="ombre_onguelet_gauche_1'+extention+'">';
                                strtemp += '<span style="font-size: 2pt">&nbsp;</span></td></tr>';
                                strtemp += '<tr><td background="ombre_onguelet_gauche_2'+extention+'"><span style="font-size: 2pt">&nbsp;</span></td></tr>';
                                strtemp += '<tr><td height="11" background="ombre_onguelet_gauche_3'+extention+'">';
                                strtemp += '<span style="font-size: 2pt">&nbsp;</span></td></tr></TABLE></DIV>';
                            document.write(strtemp);
                        }
                        
                        this.nom = nom;
                        this.largeur = larg;
                        this.hauteur = haut;
                        this.xpos = x;
                        this.ypos = y;
                        this.type_menu = type_menu;
                        this.largeur_menu = larg_m;
                        this.hauteur_menu = haut_m;
                        this.xpos_menu = x_m;
                        this.ypos_menu = y_m;
                        this.varx = varx;
                        this.vary = vary;
                        this.nbrvar = 0;
                        this.nbrvarmax = nbrvmax;
                        this.ouvrir = 0;
                        
                        liste_menu.push(nom);

                }
function show_props(obj,obj_name){
  var result="";
  for(var i in obj)
    result+= obj_name+"."+i+" = "+
             obj[i]+"\n";
  return result;
}

