var nombre_clignotement = 3;
var decompte_champ;
var nb_seconde;

function show(what) {
	if(document.getElementById(what).style.display == 'none')
		document.getElementById(what).style.display = 'block';
	else
		document.getElementById(what).style.display = 'none';
}
function cligOn(what, bgcolor) {
	what.style.backgroundColor = "lightblue";
	compte++;
	timing = window.setTimeout(function() {cligOff(what, bgcolor);}, 200);
}
function cligOff(what, bgcolor) {
	what.style.backgroundColor = bgcolor;
	if (compte < nombre_clignotement)
		timing = window.setTimeout(function() {cligOn(what, bgcolor);}, 200);
	else window.clearTimeout(timing)
}
function clig(what) {
	objet = document.getElementById(what);
	bgk = document.getElementById(what).style.backgroundColor;
	compte = 0;
	timing = window.setTimeout(function() {cligOn(objet, bgk);}, 200);
}
function addTag(what, to) {
	if(document.getElementById(to).value == '')
		document.getElementById(to).value=what.innerHTML;
	else
		document.getElementById(to).value+=' '+what.innerHTML;
}
function montre(id) {
	var d = document.getElementById(id);
	for (var i = 1; i<=6; i++) {
		if (document.getElementById('menu'+i)) {document.getElementById('menu'+i).style.display='none';}
	}
	if (d) {d.style.display='block';}
}
function decompte() {
	var champ = document.getElementById(decompte_champ);
	if(!(nb_seconde))
		nb_seconde = champ.innerHTML;
	if(champ.innerHTML > 1) {
		champ.innerHTML = nb_seconde;
		nb_seconde--;
		stout = setTimeout("decompte()", 1000);
	} else {
		champ.innerHTML = "maintenant";
		clearTimeout(stout);
	}
}
function buildLink(select, link, input) {
	champ = document.getElementById(input);
	if(select == "forum")
		champ.value = "[url="+link+"][img]"+link+"[/img][/url]";
	else if(select == "site")
		champ.value = "<a href='"+link+"' target='_blank'><img src='"+link+"' border='0' alt='Hebergement gratuit d\'image et photo' /></a>";
	else
		champ.value = link;
}
