Utilisateur:Deep silence/monobook.js

Un article de Wikipédia, l'encyclopédie libre.

Note : Après avoir publié la page, vous devrez forcer son rechargement pour voir les changements : Mozilla / Konqueror / Firefox : Shift-Ctrl-R, Internet Explorer / Opera : Ctrl-F5, Safari : Cmd-R.

// FONCTION DE CHARGEMENT DES CODES 
function addLoadEvent(func){
 if (window.addEventListener) 
     window.addEventListener("load", func, false);
 else if (window.attachEvent) 
     window.attachEvent("onload", func);
}
 
var IE = document.all?true:false;
 
 
       /*
	*
	* Fonctions et variables communes
	*
	*/
	// DATES DU JOUR A DIFFERENTS FORMATS
	m = new Array('janvier','février','mars','avril','mai','juin','juillet','août','septembre','octobre','novembre','décembre'); 
	today = new Date();
	jjmoisaa = today.getDate() + '_' + m[today.getMonth()] + '_' + (today.getYear() + 1900);
	jjmm = today.getDate() + '/' + (today.getMonth()+1);
 
	// VARIABLES EXTERNES
	// pour debugage en dehors de wikipedia
	if (typeof wgPageName == "undefined"){
	  pageName = "unknwon";
	} else {
	   pageName = wgPageName.replace(/_/g, ' '); //.replace(/&/g, '&');
	  // alert(pageName);
	}
	if (typeof wgUserName == "undefined"){
	  userName = "user unknwon";
	} else {
	   userName = wgUserName;
	}
 
        // Retourne le texte sélectionné dans la page, 
        // ou le titre de la page par défaut.
	function getSelectedText() {
            if (window.getSelection){
                return window.getSelection();
            }else if (document.getSelection){
                return document.getSelection();
            }else if (document.selection){
                return document.selection.createRange().text;
            }else return pageName; 
        }
 
 
	// FONCTION DE GESTION DES TOUCHES ENFONCEES
	// retourne "Shift", "Ctrl", "Alt", séparés par "+", 
	// selon les touches enfoncées lors d'un clic de souris.
	// (doit être appelée avec l'evenement du clic souris)
	function getAdditionalKey(e) {
	   var ctrlPressed=0;
	   var altPressed=0;
	   var shiftPressed=0;
 
	   if (parseInt(navigator.appVersion)>3) {
 
	      var evt = navigator.appName=="Netscape" ? e:event;
 
	      if (navigator.appName=="Netscape" && parseInt(navigator.appVersion)==4) {
		 // NETSCAPE 4 CODE
		 var mString =(e.modifiers+32).toString(2).substring(3,6);
		 shiftPressed=(mString.charAt(0)=="1");
		 ctrlPressed =(mString.charAt(1)=="1");
		 altPressed  =(mString.charAt(2)=="1");
		 //self.status="modifiers="+e.modifiers+" ("+mString+")"
 
	      }  else {
		 // NEWER BROWSERS [CROSS-PLATFORM]
		 shiftPressed=evt.shiftKey;
		 altPressed  =evt.altKey;
		 ctrlPressed =evt.ctrlKey;
		 //self.status="shiftKey="+shiftPressed +", altKey="  +altPressed +", ctrlKey=" +ctrlPressed 
	      }
	   }
 
	   var listResult = new Array;
	   if (shiftPressed) {
	      listResult.push("Shift");
	   }
	   if (altPressed) {
	      listResult.push("Alt");
	   }
	   if (ctrlPressed) {
	      listResult.push("Ctrl");
	   }
 
	   var result = "";
	   for (var i=0;i<listResult.length;i++){
	      if (i != 0){
		 result +="+";
	      }
	      result += listResult[i];
	   }
 
	   return result;
	}
 
 
	/*
	 * GESTION DE LA SOURIS
	 */
	document.onmousemove = getMouseXY;
	var mousePositionX = 0
	var mousePositionY = 0
 
	// Main function to retrieve mouse x-y pos.s
	function getMouseXY(e) {
           if (window.event){
	      var evt = window.event;
	      key = window.event.keyCode;
              mousePositionX  = event.x+document.body.scrollLeft;
	      mousePositionY  = event.y+document.body.scrollTop;
	   } else {
	      var evt = e; 
	      key = e.which;    
	      // rattrapage du scroll quand position des divs = 'fixed'
	      mousePositionX  = evt.pageX - window.pageXOffset ;
	      mousePositionY  = evt.pageY - window.pageYOffset ;
	   }
	/*  if (IE) { // grab the x-y pos.s if browser is IE
	    mousePositionX = event.clientX + document.body.scrollLeft
	    mousePositionY = event.clientY + document.body.scrollTop
	  } else {  // grab the x-y pos.s if browser is NS
	    // rattrapage du scroll quand position des divs = 'fixed'
	    mousePositionX = e.pageX - window.pageYOffset;
	    mousePositionY = e.pageY - window.pageXOffset;
	  }  
	  // catch possible negative values in NS4
	  if (mousePositionX < 0){mousePositionX = 0}
	  if (mousePositionY < 0){mousePositionY = 0}  */
 
	  return true
	}
 
 
 
 
	/*
	*
	* Menu popup.
	*
	*/
	colorcadre = "#9D9DA1"; //couleur du cadre
	colorbg = "#e7efff"; //couleur de fond
	colorlien = "#000000"; //couleur du texte
	colorsel = "#FFFFFF"; //couleur selection
	txtStyle = "font-family:Verdana; font-size:10px;" // style du texte du menu (ne pas oublier les ';')
	menuPadding = "7"; // ecart entre les bords d'un menu et son contenu
 
 
 
	// ELEMENT : définit un élément de menu (parent racine)
	function menuElement() {
	}
	menuElement.prototype.initialiserRight = function( ) {
	}
 
	// MENU : contient une liste d options, 
	// qui peuvent être des liens, des fonctions 
	// javascript, ou des sous-menus
	menuPopUp.prototype = new menuElement() ;
	function menuPopUp(){
	   this.parent = menuElement;
	   this.parent();
	   this.contenu = new Array;
	   // nom du menu principal par defaut
	   this.nom = "menu_maincontext";
	   this.mainMenu = true;
	   this.subMenuList = new Array; // liste des sous menus
	}
	menuPopUp.prototype.addElement = function( element ) {
	   // save any sub menu
	   if (element.sousMenu != null){
	      this.subMenuList.push( element.sousMenu );
	      element.sousMenu.menuParent = this;
	   }
 
	   // save the new element and link it back
	   this.contenu.push(element);
	   element.menuParent = this;
	}
	menuPopUp.prototype.initialiser = function( ) {
 
	   document.write('<div id='+this.nom+' name='+this.nom+' class="menu">' );
 
	   // initialise les lignes du menu
	   for(var a=0;a<this.contenu.length;a++){
	      this.contenu[a].initialiser();
	   }
 
      document.write('</div>');
 
	   // crée un lien de la balise vers l'objet menu
	   document.getElementById( this.nom ).menuObject = this;
	}
 
	// LIEN: définit un élément de menu de type lien
	menuLien.prototype = new menuElement() ;
	function menuLien(lib, addr){
	   this.parent = menuElement;
	   this.parent();
	   this.libelle = lib;
	   this.address = addr;
	}
	menuLien.prototype.initialiser = function() {
 
	   document.write('<div class="lien" onMouseOver="menu_sel(1, this);closeSubMenus(null, \''+ this.menuParent.nom + '\');" onMouseOut="menu_sel(0, this)">' );
	   document.write('<A HREF="'+ this.address +'" TARGET="_self" STYLE="text-decoration:none;color:'+colorlien+'">' + this.libelle + '</A>');
	  // document.write( this.libelle );  onClick="javascript:window.location=\''+this.address+'\'" 
	   document.write('</div>');
	}
	// LIGNE TITRE: définit un élément de menu de type titre
	menuTitre.prototype = new menuElement() ;
	function menuTitre(lib){
	   this.parent = menuElement;
	   this.parent();
	   this.libelle = lib;
	}
	menuTitre.prototype.initialiser = function() {
	   document.write('<div class="title"><b>'+this.libelle+'</b></div>');
	}
	// SEPARATEUR: définit un élément de menu de ligne de séparation
	menuSeparateur.prototype = new menuElement() ;
	function menuSeparateur(){
	   this.parent = menuElement;
	   this.parent();
	}
	menuSeparateur.prototype.initialiser = function() {
	   document.write('<hr>');
	}
	// SOUS MENU: définit un élément de menu de type lien vers un sous menu
	sousMenuLien.prototype = new menuLien() ;
	function sousMenuLien(lib, sousMenu){
	   this.parent = menuLien;
	   this.parent( lib , "#" );
	   this.sousMenu = sousMenu;
	   // renomage puisque devient sous-menu
	   this.sousMenu.nom = "menu_" + lib.replace(/ /,"");
	   this.sousMenu.mainMenu = false;
	}
	sousMenuLien.prototype.initialiser = function() {
	   this.sousMenu.initialiser();
	   document.write('<div class="menuLien" align="left" onMouseOver="closeSubMenus(null, \''+ this.menuParent.nom + '\');openSubMenu( \''+this.sousMenu.nom+'\')">');
	   document.write(this.libelle);
      document.write('<div class="menuLienFleche"><B>&nbsp; &raquo;</B></div>' );
	   document.write('</div>');
 
	}
	sousMenuLien.prototype.initialiserRight = function( ) {
	}
 
 
	// fonction appelée pour ouvrir un menu 
	function openMainMenu( e ){
	   if (e != null || window.event!=null){
	      if (window.event){
		 var evt = window.event;
	         key = window.event.keyCode;
		/* var button = window.event.button + 1;
		 var position_x = event.x+document.body.scrollLeft;
		 var position_y = event.y+document.body.scrollTop;*/
	      } else {
		 var evt = e; 
		 key = e.which;     
		/* var button = evt.which;
		 var position_x = evt.pageX;
		 var position_y = evt.pageY;
		 // rattrapage du scroll quand position des divs = 'fixed'
		 position_y -= window.pageYOffset ;
		 position_x -= window.pageXOffset ;*/
	      }
 
	     if ( (key==178 && getAdditionalKey(evt)=="Alt" && document.getElementById) ){
		 var menu = document.getElementById( "menu_maincontext" );
 
		 // vérifie si le menu dépasse de l'écran
		 var okDroite =  (parseInt(mousePositionX) + parseInt(menu.offsetWidth) + 3) < window.innerWidth;
		 var okBas = (parseInt(mousePositionY) + parseInt(menu.offsetHeight) + 3) < window.innerHeight;
 
 
		 if (okBas){
		    menu.style.top = mousePositionY  + 'px';
		 } else {
		    menu.style.top = (parseInt(mousePositionY) - 5 - parseInt(menu.offsetHeight)) + 'px';
		 }
		 if (okDroite){
		    menu.style.left = mousePositionX + 'px';
		 } else {
		    menu.style.left = (parseInt(mousePositionX) - 5 - parseInt(menu.offsetWidth)) + 'px';
		 }
 
 
		  menu.style.visibility = "visible"; 
	      }
	  }
	}
 
 
	// fonction appelée pour ouvrir un sous menu
	// si sous-menu :  l evenement est null , le nom n'est pas null (pour savoir quel sousmenu afficher)
	function openSubMenu( nom ){
	   if ( nom!=null && document.getElementById ){
 
	      var menu = document.getElementById( nom );
	      var menuParent = document.getElementById( menu.menuObject.menuParent.nom );
 
	      // vérifie si le menu dépasse de l'écran
	      var okDroite =  (parseInt( menuParent.offsetLeft ) + parseInt( menuParent.offsetWidth ) + parseInt(menu.offsetWidth) + parseInt(menuPadding) ) < window.innerWidth;
	      var okBas = (parseInt( menuParent.offsetTop) + parseInt( menuParent.offsetHeight ) + parseInt(menu.offsetHeight) ) < window.innerHeight;
	      //+ parseInt(menu.offsetHeight) + 3)
	      /*
	      if (okBas){
		 // nothing to do
	      } else {
		 menu.style.top = (parseInt(position_y) - 5 - parseInt(menu.offsetHeight)) + 'px';
	      }*/
	      if (okDroite){
		 menu.style.left = parseInt( menuParent.offsetLeft ) + parseInt( menuParent.offsetWidth ) + 2 + 'px';
	      } else {
		 menu.style.left = parseInt( menuParent.offsetLeft ) - parseInt( menu.offsetWidth ) - 3 + 'px';
	      }
 
	      menu.style.visibility = "visible"; 
	  }
	}
 
 
 
	// fonction appelée pour fermer un menu ou un sous menu
	// le nom en paramètre est null pour le menu ppal
	function closeMainMenu(e, nom){
	   if (document.getElementById){
	       closeSubMenus(e, nom);
 
	       if (nom == null){
		  nom = "menu_maincontext";
	       }
	       var menu = document.getElementById( nom );
	       menu.style.visibility = "hidden";
              // menu.style.top='-100px';
              // menu.style.left='-100px';
	   }
	}
 
 
	// fonction appelée pour fermer les sous menus d'un menu
	// le nom en paramètre est null pour le menu ppal
	function closeSubMenus(e, nom){
	   if (document.getElementById){
	       if (nom == null){
		  nom = "menu_maincontext";
	       }
	       var menu = document.getElementById( nom );
 
	       // ferme tous les sous menus
	       for (var i=0;i<menu.menuObject.subMenuList.length;i++){
		  closeMainMenu(e, menu.menuObject.subMenuList[i].nom);
	       }
	   }
	}
 
 
	function menu_sel(selec, lienmenu){
	  if(selec == 1){
	    lienmenu.style.background = colorsel;
	  //  lienmenu.style.color = colorbg;
	  }else{
	    lienmenu.style.background =colorbg;
	  //  lienmenu.style.color = colorlien;
	  }
	}
 
	// IE FIX
	if(document.layers){
	  document.captureEvents(Event.MOUSEMOVE);
	  document.captureEvents(Event.ONDBLCLICK);
	  document.captureEvents(Event.MOUSEDOWN);
	}
 
        if (! IE){
	// initialise les évenements
	document.onkeypress = openMainMenu;
	document.onclick = closeMainMenu;
 
 
	// INITIALISATION
	// création du  menu principal
	menuPrincipal = new menuPopUp(); 
	// création du contenu du menu : titre, liens et séparateurs
	menuPrincipal.addElement( new menuTitre( "Page en cours" ) );
	menuPrincipal.addElement( new menuLien( "Historique", "/w/index.php?title=" + pageName + "&action=history" ) );
	menuPrincipal.addElement( new menuLien( "Discussion", "/w/index.php?title=Discussion_" + pageName ) );
 
 
	menuPrincipal.addElement( new menuSeparateur( ) );
	menuPrincipal.addElement( new menuTitre( "Edition" ) );
	menuPrincipal.addElement( new menuLien( "Editer", "/w/index.php?title=" + pageName + "&action=edit#toolbar" ) );
 
	// création du  sous menu des "Editions"
	subMenuEdition = new menuPopUp( ); 
	// création du contenu du menu : titre, liens et séparateurs
	subMenuEdition.addElement( new menuLien( "Zone d'édition", "#toolbar" ) );
	subMenuEdition.addElement( new menuLien( "Edition:[]", "javascript:insertTags('[',']','' );" ) );
	subMenuEdition.addElement( new menuLien( "Edition:[[]]", "javascript:insertTags('[[',']]','' );" ) );
	subMenuEdition.addElement( new menuLien( "Voir homos", "javascript:insertTags('','','{{Voir homonymes|}}' );" ) );
	subMenuEdition.addElement( new menuLien( "Trad. rèf", "javascript:insertTags('','','{{Traduction/Référence|||}}' );" ) );
	subMenuEdition.addElement( new menuLien( "Trad. pdd", "javascript:insertTags('','','{{Traduit de|||}}' );" ) );
	// insertion du sous menu dans le menu principal à l'aide d'un "menuLien"
	menuPrincipal.addElement( new sousMenuLien( "Edition", subMenuEdition ) );
 
 
	// création du  sous menu des "Messages"
	subMenuMessages = new menuPopUp( ); 
	// création du contenu du menu : titre, liens et séparateurs
 
	subMenuMessages.addElement( new menuLien( "Immature", "javascript:insertTags('','','{{Vandalisme cracra}}~~'+'~~');" ) );
	subMenuMessages.addElement( new menuLien( "Test0", "javascript:insertTags('','','{{Test0}}~~'+'~~');" ) );
	subMenuMessages.addElement( new menuLien( "Test1", "javascript:insertTags('','','{{Test1}}~~'+'~~');" ) );
	subMenuMessages.addElement( new menuLien( "Test2", "javascript:insertTags('','','{{Test2}}~~'+'~~');" ) );
	subMenuMessages.addElement( new menuLien( "Test3", "javascript:insertTags('','','{{Test3}}~~'+'~~');" ) );
	subMenuMessages.addElement( new menuLien( "Unique", "javascript:insertTags('','','{{Seul avertissement}}~~'+'~~');" ) );
	subMenuMessages.addElement( new menuLien( "Blocage", "javascript:insertTags('','','{{Blocage||}}~~'+'~~');" ) );
	subMenuMessages.addElement( new menuLien( "Ban", "javascript:insertTags('','','{{Vandale banni}}~~'+'~~');" ) );
	subMenuMessages.addElement( new menuSeparateur( ) );
	subMenuMessages.addElement( new menuLien( "IPPartagée", "javascript:insertTags('','','{{IP partagée|}}');" ) );
	subMenuMessages.addElement( new menuLien( "IPScolaire", "javascript:insertTags('','','{{IP scolaire|}}');" ) );
	subMenuMessages.addElement( new menuLien( "Proxy", "javascript:insertTags('','','{{proxy ouvert}}');" ) );
	subMenuMessages.addElement( new menuSeparateur( ) );
	subMenuMessages.addElement( new menuLien( "Copieur", "javascript:insertTags('','','{{Copieur||}}Merci de ne pas copier de texte depuis un site web ou un livre, s\\'il n\\'est pas libre.~~'+'~~');" ) );
	subMenuMessages.addElement( new menuSeparateur( ) );
	subMenuMessages.addElement( new menuLien( "Fait", "javascript:insertTags('','',':{{Fait}}, ~~'+'~~');" ) );
 
	// insertion du sous menu dans le menu principal à l'aide d'un "menuLien"
	menuPrincipal.addElement( new sousMenuLien( "Messages", subMenuMessages) );
 
 
	menuPrincipal.addElement( new menuSeparateur( ) );
	menuPrincipal.addElement( new menuTitre( "Perso" ) );
	menuPrincipal.addElement( new menuLien( "Page perso", "/wiki/Utilisateur:" + userName.replace(/ /,'_') + "#Aides" ) );
	menuPrincipal.addElement( new menuLien( "Contributions", "/wiki/Special:Contributions/" + userName.replace(/ /,'_')  ) );
	menuPrincipal.addElement( new menuLien( "Suivi", "/wiki/Special:Watchlist" ) );
	menuPrincipal.addElement( new menuLien( "Bac a sable", "/wiki/Utilisateur:" + userName.replace(/ /,'_') + "/BacASable" ) );
	menuPrincipal.addElement( new menuLien( "Commons", "http://commons.wikimedia.org/wiki/Special:Contributions/" + userName.replace(/ /,'_') + "" ) );
 
        // création du  sous menu des "Bots"
	subMenuBots = new menuPopUp( ); 
	// création du contenu du menu : titre, liens et séparateurs
	subMenuBots .addElement( new menuLien( "DeepBot", "/wiki/Utilisateur:DeepBot" ) );
	subMenuBots .addElement( new menuLien( "API wiki","http://www.mediawiki.org/wiki/API" ) );
	subMenuBots .addElement( new menuLien( "Technique", "/wiki/Wikipédia:Technique des bots" ) );
	subMenuBots .addElement( new menuLien( "Requêtes", "/wiki/Wikipédia:Bot/Requêtes" ) );
	// insertion du sous menu dans le menu principal à l'aide d'un "menuLien"
	menuPrincipal.addElement( new sousMenuLien( "Bots", subMenuBots ) );
 
	menuPrincipal.addElement( new menuSeparateur( ) );
	menuPrincipal.addElement( new menuTitre( "Outils" ) );
 
	menuPrincipal.addElement( new menuLien( "Suppressions", "/wiki/Wikipédia:Pages à supprimer" ) );
	/*
	// création du  sous menu des "Requêtes"
	subMenuSuppr = new menuPopUp( ); 
	// création du contenu du menu : titre, liens et séparateurs
 
	// insertion du sous menu dans le menu principal à l'aide d'un "menuLien"
	menuPrincipal.addElement( new sousMenuLien( "Requêtes", subMenuSuppr ) );
	*/
	// création du  sous menu de "surveillance"
	subMenuRC = new menuPopUp( ); 
	// création du contenu du menu : titre, liens et séparateurs
	subMenuRC.addElement( new menuLien( "Surv users", "/wiki/Utilisateur:Deep_silence/Liste" ) );
	subMenuRC.addElement( new menuLien( "Surv IP", "/w/index.php?title=Special:Recentchanges&hidepatrolled=1&hideliu=1" ) );
	subMenuRC.addElement( new menuLien( "Proxy ouverts", "/wiki/Wikipédia:Détection des proxy ouverts" ) );
	// insertion du sous menu dans le menu principal à l'aide d'un "menuLien"
	menuPrincipal.addElement( new sousMenuLien( "Surveillance", subMenuRC ) );	
 
	// création du  sous menu des "Aides"
	subMenuAides = new menuPopUp( ); 
	// création du contenu du menu : titre, liens et séparateurs
	subMenuAides.addElement( new menuLien( "Bandeaux d'articles", "/wiki/Wikipédia:Modèles#Articles" ) );
	subMenuAides.addElement( new menuLien( "Mess. aux IP ", "/wiki/Wikipédia:Modèles/Espace Discussion Utilisateur#Avertissements" ) );	
	subMenuAides.addElement( new menuLien( "Admiss. articles", "/wiki/Wikipédia:Critères d'admissibilité des articles" ) );
	subMenuAides.addElement( new menuLien( "ParserFunctions", "http://meta.wikimedia.org/wiki/Help:ParserFunctions" ) );
 
 
	// insertion du sous menu dans le menu principal à l'aide d'un "menuLien"
	menuPrincipal.addElement( new sousMenuLien( "Aides", subMenuAides ) );
 
	// création du  sous menu des "Recherches"
	subMenuRecherche = new menuPopUp( ); 
	// création du contenu du menu : titre, liens et séparateurs
	subMenuRecherche.addElement( new menuLien( "Recherche fr:", "http://www.google.fr/search?sitesearch=fr.wikipedia.org&fulltext=Rechercher&q=" + pageName) );
	subMenuRecherche.addElement( new menuLien( "Recherche *:", "http://www.google.fr/search?sitesearch=*.wikipedia.org&fulltext=Rechercher&q=" + pageName) );
	subMenuRecherche.addElement( new menuLien( "Recherche en:", "http://www.google.fr/search?sitesearch=en.wikipedia.org&fulltext=Rechercher&q=" + pageName)  );
	subMenuRecherche.addElement( new menuLien( "Liens externes", "/wiki/Special:Linksearch" ) );
	//subMenuRecherche.addElement( new menuLien( "Logs des suppressions", "/wiki/Special:Log/delete" ) );
	// insertion du sous menu dans le menu principal à l'aide d'un "menuLien"
	menuPrincipal.addElement( new sousMenuLien( "Recherches", subMenuRecherche ) );
 
 
	menuPrincipal.addElement( new menuSeparateur( ) );
	menuPrincipal.addElement( new menuTitre( "Admin" ) );
	menuPrincipal.addElement( new menuLien( "Bulletin", "/wiki/Wikipédia:Bulletin des administrateurs" ) );
	// création du  sous menu des "Admin"
	subMenuAdmin = new menuPopUp( ); 
	// création du contenu du menu : titre, liens et séparateurs
	subMenuAdmin .addElement( new menuLien( "Maintenance", "/wiki/Projet:Maintenance" ) );
	subMenuAdmin .addElement( new menuLien( "Requêtes", "/wiki/Wikipédia:Requête aux administrateurs" ) );
	subMenuAdmin .addElement( new menuLien( "Articles courts", "/wiki/Special:Shortpages" ) );
	subMenuAdmin .addElement( new menuLien( "Nvx articles", "/w/index.php?title=Special:Newpages&hidebots=1&hidepatrolled=1&hideliu=1" ) );
 
	// insertion du sous menu dans le menu principal à l'aide d'un "menuLien"
	menuPrincipal.addElement( new sousMenuLien( "En attente", subMenuAdmin ) );
 
	menuPrincipal.addElement( new menuSeparateur( ) );
	menuPrincipal.addElement( new menuTitre( "Wiki" ) );
	menuPrincipal.addElement( new menuLien( "Communauté", "/wiki/Wikipédia:Accueil" ) );
	menuPrincipal.addElement( new menuLien( "Bistro", "/wiki/Wikipédia:Le_Bistro/" + jjmoisaa ) );
 
	// toujours à faire en dernier
	menuPrincipal.initialiser();
        }
 
 
 
 
/*
*
*  Répéter les onglets en bas de page
*
*/
function morelinks() {
  // recherche des onglets, et clonage
  var tabs = document.getElementById('p-cactions').cloneNode(true);
  // renommage des clones
  tabs.id = 'mytabs';
  var listitems = tabs.getElementsByTagName('LI');
  for (i=0;i<listitems.length;i++) {
    if(listitems[i].id) listitems[i].id = 'mytabs-' + listitems[i].id;
  }
  // ajout du clone à la page
  document.getElementById('column-content').appendChild(tabs);
 }
// lancement de la fonction au chargement de la page
addLoadEvent(morelinks);
 
 
 
 
 
/*
*
*  Fonctions de gestion des suivis
*
*/
var suiviManagerAllPages = new Array();
 
function SuiviManagerRegexp(regexp)
{
        var match = new RegExp(regexp);
 
        for (var i=0;i<suiviManagerAllPages.length;i++) {
                var pageName = suiviManagerAllPages[i].childNodes[0].getAttribute("value");
                if (match.test(pageName)) {
                        suiviManagerAllPages[i].childNodes[0].checked=true; 
                }
        }
}
 
function SuiviManagerLiensRouges()
{
 
        for (var i=0;i<suiviManagerAllPages.length;i++) {
                var pageClass = suiviManagerAllPages[i].childNodes[2].getAttribute("class");
                if (pageClass && pageClass=="new") {
                        suiviManagerAllPages[i].childNodes[0].checked=true; 
                }
        }
}
 
function SuiviManagerDeselect()
{
        for (var i=0;i<suiviManagerAllPages.length;i++) {
                suiviManagerAllPages[i].childNodes[0].checked=false; 
        }
}
 
 
function SuiviManager() {
        if (document.URL.indexOf("http://fr.wikipedia.org/wiki/Special:Watchlist/edit")!=0) return; 
 
        var a=-1;
        var interfaceMsg = new Array(); 
        var regexpList = new Array(); 
 
        //////////////////////////////////////////////////
        // Expressions régulières et liens de l'interface
        //
        // besoin d'aide pour les regexp ? 
        // http://www.commentcamarche.net/javascript/jsregexp.php3
        //////////////////////////////////////////////////
 
        interfaceMsg[++a]       = "<b>Tout cocher</b>";
        regexpList[a]           = "^.*"; 
 
        interfaceMsg[++a]       = "Utilisateurs";
        regexpList[a]           = "^Utilisateur:";
 
        interfaceMsg[++a]       = "Wikipédia:*"; 
        regexpList[a]           = "^Wikipédia:";
 
        interfaceMsg[++a]       = "Sous-pages de PàS"; 
        regexpList[a]           = "^Wikipédia:Pages à supprimer\/";
 
        interfaceMsg[++a]       = "Sous-pages de PàV"; 
        regexpList[a]           = "^Wikipédia:Pages à vérifier\/";
 
        interfaceMsg[++a]       = "Pages du bistro"; 
        regexpList[a]           = "^Wikipédia:Le Bistro\/";
 
        interfaceMsg[++a]       = "Images"; 
        regexpList[a]           = "^Image:";
 
        interfaceMsg[++a]       = "Modèles"; 
        regexpList[a]           = "^Modèle:"; 
 
        interfaceMsg[++a]       = "Aide"; 
        regexpList[a]           = "^Aide:"; 
 
        interfaceMsg[++a]       = "Catégories"; 
        regexpList[a]           = "^Catégorie:";      
 
        interfaceMsg[++a]       = "Portails"; 
        regexpList[a]           = "^Portail:";        
 
        //////////////////////////////////////////////////
        var topTag = document.getElementById("contentSub")
 
        // récupère toutes les pages
        var watchlist = document.getElementsByTagName("ul");
 
        for (u=0;u<watchlist.length;u++) {
                        var entries = watchlist[u].getElementsByTagName("li"); 
                        for (i=0;i<entries.length;i++) {
                                suiviManagerAllPages.push(entries[i]);
                        }
        }
 
        // prépare la mini-interface
        var str = "<div style=\"background-color:#8ecfe4;font-size:1px;height:8px;border:1px solid #AAAAAA;-moz-border-radius-topright:0.5em;-moz-border-radius-topleft:0.5em;\"></div>"
        + "<div style=\"border:1px solid #6ac1de;border-top:0px solid white;padding:5px 5px 0 5px;margin-bottom:3ex;\"><p>"
        + "<div style=\"float: left; text-align: left; white-space: nowrap;\"></div>"
 
        for (var cpt = 0; cpt < interfaceMsg.length; cpt ++) {
                str += "<a href=\"javascript:SuiviManagerRegexp('" + regexpList[cpt] + "')\">"
                                                + interfaceMsg[cpt]
                                                + " ·</a> "
                }
 
                str += "<a href=\"javascript:SuiviManagerLiensRouges()\">"
                        + "Retirer les liens rouges"
                        + " ·</a> "
 
                str += "<a href=\"javascript:SuiviManagerDeselect()\">"
                        + "<b>Enlever toutes les coches</b>"
                        + " ·</a> "
 
        topTag.innerHTML =       topTag.innerHTML + "<br clear=all />" + str + "<p></div>"
 
}
// lancement de la fonction au chargement de la page
addLoadEvent(SuiviManager);
 
 
 
 
/*
 * Liens rouges
 *
 */
////////////////////// ZONE PERSONNALISABLE //////////////////////
 
// Le script est automatiquement lancé si l'espace de nom et l'action sont dans les variables suivantes
var liensRougesNSOuvrir = [0,2,3,4,10,11,14];
var liensRougesActionOuvrir = [];
 
// Les liens pointant vers les espaces de nom suivants ne sont jamais traités
var liensRougesNSExclus = new String('Discuter|Discussion .*|Utilisateur:');
 
///////////////// FIN DE LA ZONE PERSONNALISABLE /////////////////
if(!Array.indexOf) Array.prototype.indexOf = function(w) { for(var i=0; i<this.length; i++) if(this[i] == w) return i; return -1; }
function liensRouges(w)
{
 if(!w)
 {
  if(liensRougesNSOuvrir.indexOf(wgNamespaceNumber) == -1 || (!liensRougesActionOuvrir.lenght==0 && liensRougesActionOuvrir.indexOf(wgAction) == -1)) return;
 }
 var allLinks = document.getElementById('bodyContent').getElementsByTagName('a');
 var reg1 = new RegExp(' ','g');
 var reg2 = new RegExp('^('+liensRougesNSExclus+'):','i');
 for(i=0; i<allLinks.length; i++)
 {
  if(allLinks[i].getAttribute('class') == 'new')
  {
   titre = allLinks[i].getAttribute('title');
   if(reg2.test(titre)) continue;
   titre = titre.replace(' (page inexistante)', '');
   var newElement1 = document.createElement('sup');
   newElement1.className = 'exposant';
   newElement1.innerHTML = 
     '<a href="/wiki/Special:Whatlinkshere/'+titre.replace(reg1,'_')+'" title="Pages liées">←</a>';
   var newElement2 = document.createElement('sup');
   newElement2.className = 'exposant';
   newElement2.innerHTML =
     '<a href="http://www.google.fr/search?sitesearch=fr.wikipedia.org&fulltext=Rechercher&q='+titre+'" title="Google">?</a>';
   allLinks[i].parentNode.insertBefore(newElement2, allLinks[i].nextSibling);
   allLinks[i].parentNode.insertBefore(newElement1, allLinks[i].nextSibling);
  }
 }
}
if(wgNamespaceNumber != -1) addOnloadHook(liensRouges);
 
 
 
 
 
/*
 * Résumé Deluxe
 *
 * Ajoute des commentaires de modification prédéfinis
 *
 * Auteur : Dake
 * Contributions : Pabix, Tieno
 * Date de dernière révision : 12 novembre 2006
 */
 
//////////////////////ZONE PERSONNALISABLE//////////////////////
var resumedeluxeTitles = new Array();
with (resumedeluxeTitles) {
        push("ortho");
        push("- typo");
        push("- cat");
        push("- cat + précise");
        push("- cats imbriquées");
        push("- interwiki");
        push("- wikification");
        push("- redirection");
        push("- style");
        push("- revert");
        push("- refonte");
        push("- neutralisation");
        push("- liens rouges hc");
        push("- wikilink");
        push("- homo");
 
}
var resumedeluxeInputs= new Array();
with (resumedeluxeInputs) {
        push("orthographe");
        push("typographie");
        push("+ cats");
        push("cat plus précise");
        push("- cats imbriquées");
        push("interwikis");
        push("wikification");
        push("redirection");
        push("style");
        push("revert");
        push("refonte");
        push("neutralisation");
        push("- liens rouges hc");
        push("+ wikilink");
        push("homonymie");
}
/////////////////FIN DE LA ZONE PERSONNALISABLE/////////////////
function addToSummary(str)
{
        var resum = document.editform.wpSummary.value;
        if(resum != 0 && resum.indexOf("*/") < resum.length - 2) {
                document.editform.wpSummary.value += ", ";
        }
        document.editform.wpSummary.value += str;
}
 
function DeluxeSummary()
{
        var sumLbl = document.getElementById("wpSummaryLabel");
        if(sumLbl) {
                var sumInput = document.getElementById("wpSummary");
                sumInput.style.width = "95%";
                var str = "Messages prédéfinis : ";
                for(var cpt = 0; cpt < resumedeluxeTitles.length; cpt ++) {
                        var tmp = resumedeluxeInputs[cpt];
                        str += "<a href=\"javascript:addToSummary('" + tmp.replace( /[']/g , "\\'") + "')\""
                                + " class=\"sumLink\" title=\"Ajouter dans la boîte de résumé\">"
                                + resumedeluxeTitles[cpt]
                                + "</a> ";
                }
                sumLbl.innerHTML = str + "<br />" + sumLbl.innerHTML;
        }
}
addOnloadHook(DeluxeSummary);
 
 
 
 
 
 
 
 
 
 
/**
 * Ajoute des liens après les catégories pour rapidement
 * supprimer / modifier / ajouter une catégorie sur un article.
 * Utilise Ajax et l'api MediaWiki pour rechercher une catégorie.
 * Version adaptée pour WP:fr de [[:commons:MediaWiki:HotCat.js]]
 * 
 * Auteur original : Magnus Manske
 * Adaptation pour WP:fr : Zelda
 * [[Catégorie:MediaWiki:Fonction Monobook en JavaScript]]
 */
 
// VARIABLES PERSONNALISABLES
 
// Suggestion delay in ms
var hotcat_suggestion_delay = 300;
 
// Taille de la liste déroulante (en items)
var hotcat_list_size = 10;
 
// Nombre de categories suggérées lors de la recherche
var hotcat_list_items = 70;
 
// Permet d'enregistrer automatiquement la modif sans repasser par la fenêtre d'édition
// var hotcat_autocommit = false;
 
// Permet d'afficher la liste de suggestion vers le bas
// var hotcat_list_down = true;
 
// FIN DE LA PERSONNALISATION DES VARIABLES
 
var hotcat_running = 0 ;
var hotcat_last_v = "" ;
var hotcat_exists_yes = "http://upload.wikimedia.org/wikipedia/commons/thumb/b/be/P_yes.svg/20px-P_yes.svg.png" ;
var hotcat_exists_no = "http://upload.wikimedia.org/wikipedia/commons/thumb/4/42/P_no.svg/20px-P_no.svg.png" ;
 
addOnloadHook ( hotcat ) ;
 
function hotcat () {
  if ( hotcat_check_action() ) return ; // Edited page, reloading anyway
 
  var catlinks = document.getElementById("catlinks");
 
  if (! catlinks && wgNamespaceNumber %2 == 0) { // all except discussion
   // let's create a fake one
   var bodyC = document.getElementById("bodyContent");
   catlinks = document.createElement("div");
   catlinks.id = "catlinks";
   catlinks.appendChild(document.createElement("div"));
   catlinks.firstChild.className = "catlinks";
   catlinks.firstChild.appendChild(document.createElement("div"));
   catlinks.firstChild.firstChild.id = "mw-normal-catlinks";
   bodyC.appendChild(catlinks);
  }
 
  var catline = document.getElementById ('mw-normal-catlinks'); // Since MW 1.13alpha
  if (catline == null)
     catline = getElementsByClassName ( document , "p" , "catlinks" ) [0] ; // Earlier versions
 
  if ( catline == null || typeof catline == 'undefined' ) return ;
 
  hotcat_modify_existing ( catline ) ;
  hotcat_append_add_span ( catline ) ;
}
 
function hotcat_append_add_span ( catline ) {
  var span_add = document.createElement ( "span" ) ;
  var span_sep = document.createTextNode ( " | " ) ;
  if ( catline.firstChild ) catline.appendChild ( span_sep ) ;
  catline.appendChild ( span_add ) ;
  hotcat_create_span ( span_add ) ;
}
 
String.prototype.ucFirst = function () {
   return this.substr(0,1).toUpperCase() + this.substr(1,this.length);
}
 
function hotcat_modify_span ( span , i ) {
  var cat_title = span.firstChild.getAttribute ( "title" ) ;
  // Removing leading Category:
  cat_title = cat_title.substr(cat_title.indexOf(":") + 1);
  var sep1 = document.createTextNode ( " " ) ;
  var a1 = document.createTextNode ( "(-)" ) ;
  var remove_link = document.createElement ( "a" ) ;
  remove_link.href = "javascript:hotcat_remove(\"" + cat_title + "\");" ;
  remove_link.appendChild ( a1 ) ;
  span.appendChild ( sep1 ) ;
  span.appendChild ( remove_link ) ;
 
  var mod_id = "hotcat_modify_" + i ;
  var sep2 = document.createTextNode ( " " ) ;
  var a2 = document.createTextNode ( "(±)" ) ;
  var modify_link = document.createElement ( "a" ) ;
  modify_link.id = mod_id ;
  modify_link.href = "javascript:hotcat_modify(\"" + mod_id + "\");" ;
  modify_link.appendChild ( a2 ) ;
  span.appendChild ( sep2 ) ;
  span.appendChild ( modify_link ) ;
}
 
function hotcat_modify_existing ( catline ) {
  var spans = catline.getElementsByTagName ( "span" ) ;
  for ( var i = 0 ; i < spans.length ; i++ ) {
    hotcat_modify_span ( spans[i] , i ) ;
  }
}
 
function hotcat_remove ( cat_title ) {
  var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;
  if (window.confirm("Voulez-vous vraiment supprimer la catégorie '" + cat_title + "' ?")) {
    document.location = editlk + '&hotcat_removecat=' + encodeURIComponent(cat_title) ;
  }
}
 
function hotcatGetParamValue(paramName, h) {
        if (typeof h == 'undefined' ) { h = document.location.href; }
        var cmdRe=RegExp('[&?]'+paramName+'=([^&]*)');
        var m=cmdRe.exec(h);
        if (m) {
                try {
                        return decodeURIComponent(m[1]);
                } catch (someError) {}
        }
        return null;
}
 
function hotcat_check_action () {
  var ret = 0 ;
  if ( wgAction != "edit" ) return ret ; // Not an edit page, so no business...
  var summary = new Array () ;
  var t = document.editform.wpTextbox1.value ;
  var prevent_autocommit = 1 ;
  if ( typeof hotcat_autocommit != 'undefined' && hotcat_autocommit ) prevent_autocommit = 0 ;
 
  // Remove existing category?
  var hrc = hotcatGetParamValue('hotcat_removecat') ;
  // Add new category?
  var hnc = hotcatGetParamValue('hotcat_newcat') ;
 
  if ( typeof hrc != "undefined" && hrc != null && hrc != "" ) {
    var hcre = new RegExp("(\\s*)\\[\\[ *(?:Catégorie|Category) *: *" + hrc.replace(/([\\\^\$\*\+\?\.\|\{\}\[\]\(\)])/g, "\\$1") + " *(\\|[^\\]]*)?\\]\\]", "gi");
    var matches = t.match(hcre);
    if (matches != null && matches.length == 1) { // Found one occurrence of the category - good!
      if ( typeof hnc != "undefined" && hnc != null && hnc != "" ) {
        t = t.replace(hcre, "$1["+"[Catégorie:" + hnc + "$2]]");
        summary.push ( "Modification de la catégorie ["+"[Catégorie:" + hrc + "]] → ["+"[Catégorie:" + hnc + "]]" ) ;
      } else {
        t = t.replace(hcre, "");
        summary.push ( "Retrait de la catégorie ["+"[Catégorie:" + hrc + "]]" ) ;
      }
      ret = 1 ;
    } else {
     // alert ( "Impossible de trouver une occurrence unique de \"" + hrc + "\" - elle est peut-être incluse via un modèle" ) ;
      prevent_autocommit = 1 ;
    }
  } else {
    // Only adding?
    if ( typeof hnc != "undefined" && hnc != null && hnc != "" ) {
      // Looking for last cat
      var re = /\[\[(?:Catégorie|Category):[^\]]+\]\]/ig
      var index = -1;
      while (re.exec(t) != null) index = re.lastIndex;
      var txt = "["+"[Catégorie:" + hnc + "]]" ;
      if (index < 0) {
        t = t + '\n' + txt ;
      } else {
        t = t.substring(0, index) + '\n' + txt + t.substring(index);
      }
      summary.push ( "Ajout rapide de la catégorie ["+"[Catégorie:" + hnc + "]]" ) ;
      ret = 1 ;
    }
  }
 
  if ( ret ) {
    document.editform.wpTextbox1.value = t ;
    if ( !prevent_autocommit ) {
      document.getElementById("bodyContent").style.display = "none" ; // Hiding the entire edit section so as not to tempt the user into editing...
      document.editform.wpSave.click();
    }
  }
 
  // This is the end, my friend, the end...
  return ret ;
}
 
function hotcat_clear_span ( span_add ) {
  while ( span_add.firstChild ) span_add.removeChild ( span_add.firstChild ) ;
}
 
function hotcat_create_span ( span_add ) {
  hotcat_clear_span ( span_add ) ;
  var a_add = document.createElement ( "a" ) ;
  var a_text = document.createTextNode ( "(+)" ) ;
  span_add.id = "hotcat_add" ;
  a_add.href = "javascript:hotcat_add_new()" ;
  a_add.appendChild ( a_text ) ;
  span_add.appendChild ( a_add ) ;
}
 
function hotcat_modify ( link_id ) {
  var link = document.getElementById ( link_id ) ;
  var span = link.parentNode ;
  var catname = span.firstChild.firstChild.data ;
 
  while ( span.firstChild.nextSibling ) span.removeChild ( span.firstChild.nextSibling ) ;
  span.firstChild.style.display = "none" ;
  hotcat_create_new_span ( span , catname ) ;
  hotcat_last_v = "" ;
  hotcat_text_changed () ; // Update icon
}
 
function hotcat_add_new () {
  var span_add = document.getElementById ( "hotcat_add" ) ;
  hotcat_clear_span ( span_add ) ;
  hotcat_last_v = "" ;
  hotcat_create_new_span ( span_add , "" ) ;
}
 
function hotcat_create_new_span ( thespan , init_text ) {
  var form = document.createElement ( "form" ) ;
  form.method = "post" ;
  form.onsubmit = function () { hotcat_ok(); return false; } ;
  form.id = "hotcat_form" ;
  form.style.display = "inline" ;
 
  var list = document.createElement ( "select" ) ;
  list.id = "hotcat_list" ;
  list.onclick = function () { document.getElementById("hotcat_text").value = document.getElementById("hotcat_list").value ; hotcat_text_changed() ; } ;
  list.ondblclick = function () { document.getElementById("hotcat_text").value = document.getElementById("hotcat_list").value ; hotcat_text_changed() ; hotcat_ok(); } ;
  list.style.display = "none" ;
 
  var text = document.createElement ( "input" ) ;
  text.size = 40 ;
  text.id = "hotcat_text" ;
  text.type = "text" ;
  text.value = init_text ;
  text.onkeyup = function () { window.setTimeout("hotcat_text_changed();", hotcat_suggestion_delay ); } ;
 
  var exists = document.createElement ( "img" ) ;
  exists.id = "hotcat_exists" ;
  exists.src = hotcat_exists_no ;
 
  var explore = document.createElement ( "input" ) ;
  explore.type = "button" ;
  explore.value = "Explorer" ;
  explore.onclick = hotcat_explore ;
 
  var OK = document.createElement ( "input" ) ;
  OK.type = "button" ;
  OK.value = "OK" ;
  OK.onclick = hotcat_ok ;
 
  var cancel = document.createElement ( "input" ) ;
  cancel.type = "button" ;
  cancel.value = "Annuler" ;
  cancel.onclick = hotcat_cancel ;
 
  form.appendChild ( list ) ;
  form.appendChild ( text ) ;
  form.appendChild ( exists ) ;
  form.appendChild ( explore ) ;
  form.appendChild ( OK ) ;
  form.appendChild ( cancel ) ;
  thespan.appendChild ( form ) ;
  text.focus () ;
}
 
function hotcat_explore () {
  var text = document.getElementById ( "hotcat_text" ) ;
  var v = text.value ;
 
  // Empty category ?
  if ( v == "" ) {
    hotcat_cancel() ;
    return ;
  }
 
  var url = 'http://' + location.hostname + "/wiki/Catégorie:" + encodeURIComponent( v ) ;
 
  window.open(url, '_blank', 'dependent=yes,location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,toolbar=yes');
}
 
 
 
function hotcat_ok () {
  var text = document.getElementById ( "hotcat_text" ) ;
  var v = text.value ;
 
  // Empty category ?
  if ( v == "" ) {
    hotcat_cancel() ;
    return ;
  }
 
  var editlk = document.getElementById('ca-edit').getElementsByTagName('a')[0].href;
  var url = editlk + '&hotcat_newcat=' + encodeURIComponent( v ) ;
 
  // Editing existing?
  var span = text.parentNode.parentNode ; // span.form.text
  if ( span.id != "hotcat_add" ) { // Not plain "addition"
    var cat_title = span.firstChild.getAttribute ( "title" ) ;
    // Removing leading Category:
    cat_title = cat_title.substr(cat_title.indexOf(":") + 1);
    url += '&hotcat_removecat=' + encodeURIComponent( cat_title ) ;
  }
 
  document.location = url ;
}
 
function hotcat_cancel () {
  var span = document.getElementById("hotcat_form").parentNode ;
  if ( span.id == "hotcat_add" ) {
    hotcat_create_span ( span ) ;
  } else {
    while ( span.firstChild.nextSibling ) span.removeChild ( span.firstChild.nextSibling ) ;
    span.firstChild.style.display = "" ;
    for ( var i = 0 ; i < span.parentNode.childNodes.length ; i++ ) {
      if ( span.parentNode.childNodes[i] != span ) continue ;
      hotcat_modify_span ( span , i ) ;
      break ;
    }
  }
}
 
function hotcat_text_changed () {
  if ( hotcat_running ) return ;
  var text = document.getElementById ( "hotcat_text" ) ;
  var v = text.value.ucFirst() ;
  if ( hotcat_last_v == v ) return ; // Nothing's changed...
 
  hotcat_running = 1 ;
  hotcat_last_v = v ;
 
  if ( v != "" ) {
    var url = wgServer + "/" + wgScriptPath + "/api.php?format=xml&action=query&list=allpages&apnamespace=14&apfrom=" + encodeURIComponent( v ) + "&aplimit=" + encodeURIComponent( hotcat_list_items );
    if ( typeof ( hotcat_xmlhttp ) != "undefined" ) hotcat_xmlhttp.abort() ; // Just to make sure...
    hotcat_xmlhttp = new sajax_init_object() ;
    hotcat_xmlhttp.open('GET', url, true);
    hotcat_xmlhttp.onreadystatechange = function () {
          if ( typeof hotcat_xmlhttp == "undefined" ) return ;
          if (hotcat_xmlhttp.readyState == 4) {
              var xml = hotcat_xmlhttp.responseXML ;
              if ( xml == null ) return ;
              var pages = xml.getElementsByTagName( "p" ) ;
              var titles = new Array () ;
              for ( var i = 0 ; i < pages.length ; i++ ) {
                var s = pages[i].getAttribute("title");
                // Removing leading "Category:"
                s = s.substr(s.indexOf(":") + 1);
                if ( s.substr ( 0 , hotcat_last_v.length ) != hotcat_last_v ) break ;
                titles.push ( s ) ;
              }
              hotcat_show_suggestions ( titles ) ;
          }
      };
    hotcat_xmlhttp.send(null);
  } else {
    var titles = new Array () ;
    hotcat_show_suggestions ( titles ) ;
  }
  hotcat_running = 0 ;
}
 
function hotcat_show_suggestions ( titles ) {
  var text = document.getElementById ( "hotcat_text" ) ;
  var list = document.getElementById ( "hotcat_list" ) ;
  var icon = document.getElementById ( "hotcat_exists" ) ;
  if ( titles.length == 0 ) {
    list.style.display = "none" ;
    icon.src = hotcat_exists_no ;
    return ;
  }
 
  var listh = hotcat_list_size * 20 ;
  if (titles.length < hotcat_list_size) {
    listh = titles.length * 20 ;
  }
  var nl = parseInt ( text.parentNode.offsetLeft ) - 1 ;
  var nt = parseInt(text.offsetTop) - listh ;
  // Parameter to show suggestion list beneath categories instead of above
  if (typeof hotcat_list_down != "undefined" && hotcat_list_down) {
     nt = text.offsetTop + text.offsetHeight;
  }
  list.size = 5 ;
  list.style.align = "left" ;
  list.style.zIndex = 5 ;
  list.style.position = "absolute" ;
  list.style.top = nt + "px" ;
  list.style.width = text.offsetWidth + "px" ;
  list.style.height = listh + "px" ;
  list.style.left = nl + "px" ;
  while ( list.firstChild ) list.removeChild ( list.firstChild ) ;
  for ( var i = 0 ; i < titles.length ; i++ ) {
    var opt = document.createElement ( "option" ) ;
    var ot = document.createTextNode ( titles[i] ) ;
    opt.appendChild ( ot ) ;
    opt.setAttribute( "value", titles[i] );
    list.appendChild ( opt ) ;
  }
 
  list.style.display = "block" ;
 
  icon.src = hotcat_exists_yes ;
 
  var first_title = titles.shift () ;
  if ( first_title == hotcat_last_v ) return ;
 
  var suggestion = first_title;
 
  text.value = suggestion  ;
  if (text.createTextRange) {
    // IE
    var ra = text.createTextRange();
    ra.moveStart("character", hotcat_last_v.length);
    ra.moveEnd("character", suggestion.length);
    ra.select();
  } else if( is_khtml ) {
    text.setSelectionRange( hotcat_last_v.length, suggestion.length );
  } else {
    text.selectionStart = hotcat_last_v.length ;
    text.selectionEnd = suggestion.length ;
  }
}