jQuery(document).ready(function(){
	// Menu du haut

    var foot_chds=document.getElementById('foot').getElementsByTagName('ul');
    for(i=0,chd=foot_chds[i],nb=foot_chds.length;i<nb;i++,chd=foot_chds[i])
	if(chd.className=='menu'){
	    menu=chd.cloneNode(true);
	    break;
	}
    if(menu)
	document.getElementById('head').appendChild(menu);

    // Commentaires
    var limit=document.getElementById("limit");
    if(limit){
	var pub=limit.nextSibling;
	var parent=limit.parentNode;
	var el=document.getElementById('lire_les_commentaires');
	if(el)
	    parent.insertBefore(el, pub);
	var el=el=document.getElementById('comments');
	if(el)
	    parent.insertBefore(el, pub);
	var el=el=document.getElementById('ajouter_un_commentaire');
	if(el)
	    parent.insertBefore(el, pub);
	var el=el=document.getElementById('commentform');
	if(el)
	    parent.insertBefore(el, pub);
	var el=document.createElement('hr');
	el.setAttribute('class', 'mt1em');
	parent.insertBefore(el, pub);
    }
    
    // Categories
    if((cats=document.getElementById('category_subs'))){
	place=document.getElementById('category').lastChild;
	par=document.getElementById('category');
	par.insertBefore(cats, place);
	if((more=document.getElementById('category_more')))
	    par.insertBefore(more, place);
	cats=jQuery('#category_subs');
	cats.slideUp('normal');
	more=document.getElementById('category_more').getElementsByTagName('button').item(0);
	more.className='open';
	jQuery('#category_more').click(function(){
		if(more.className=='open'){
		    cats.slideDown('normal');
		    more.className='close';
		    more.innerHTML='Cliquez ici pour masquer toutes les catégories';
		} else if(more.getAttribute('class')=='close'){
		    cats.slideUp('normal');
		    more.className='open';
		    more.innerHTML='Cliquez ici pour afficher toutes les catégories';
		}
	    });
    }
});