function verif(){
    if (document.form.titre.value == '') {
        alert("Veuillez renseigner le titre du billet");
        return false;
    }
    if (document.form.auteur.value == '') {
        alert('Veuillez renseigner l\'auteur du billet');
        return false;
    }
}

function verifCom(){
    if (document.fCom.code.value == '') {
        alert('Veuillez recopier le code');
        return false;
    }
    if (document.fCom.nom.value == '') {
        alert("Veuillez renseigner votre nom");
        return false;
    }
    if (document.fCom.email.value == '') {
        alert("Veuillez renseigner votre email");
        return false;
    }
    if (document.fCom.com.value == '') {
        alert("Veuillez renseigner le contenu du message");
        return false;
    }
}

function initializeCollapsible(aff){
    var i, icon, headings = xGetElementsByClassName('collapsible');
    var idFck;
    var classFck;
    for (i = 0; i < headings.length; i++) {
        icon = document.createElement('div');
        //nextsib : ul
        icon.collapsibleSection = xNextSib(headings[i]);
        icon.onclick = iconOnClick;
        // premier li pour l'admin
        
        icon.className = 'expandIcon';
        icon.title = 'Cliquer pour étendre';
        icon.onmouseover = iconOnMouseover;
        icon.onmouseout = iconOnMouseout;
        headings[i].appendChild(icon);
		if(aff == 1 || openCollapse == 1) {
			icon.onclick();
		}
    }
	openCollapse = 0;
}

function iconOnClick(){
    // section : ul
    var section = this.collapsibleSection;
    if (section.style.display != 'block') {
        section.style.display = 'block';
        this.className = 'collapseIcon';
        this.title = 'Cliquer pour cacher';
    }
    else {
        section.style.display = 'none';
        this.className = 'expandIcon';
        this.title = 'Cliquer pour étendre';
    }
}

function iconOnMouseover(){
    this.collapsibleSection.style.backgroundColor = '#cccccc';
}

function iconOnMouseout(){
    this.collapsibleSection.style.backgroundColor = 'transparent';
}


function affTous(ch){
    var icon = xGetElementsByClassName('expandIcon');
	var icon2 = xGetElementsByClassName('collapseIcon');
	var parent;
    for (i = 0; i < icon.length; i++) {
		parent=xParent(icon[i], true);
		parent.removeChild(icon[i]);
	}
    for (i = 0; i < icon2.length; i++) {
		parent=xParent(icon2[i], true);
		parent.removeChild(icon2[i]);
	}
    if (ch == true) {
		initializeCollapsible(1);
	}
	else {
		var div = xGetElementsByClassName('collapsible');
		for (i = 0; i < div.length; i++) {
			xNextSib(div[i]).style.display = 'none';
		}
		initializeCollapsible(0);
	}
}

