//gestion de la couleur
function changeColor(objet, couleur){
	objet.style.color = couleur;
}

//gestion de la couleur
function changeBgColor(objet, couleur){
	objet.style.backgroundColor = couleur;
}

//gestion de la transparence
function setAlpha(objet, alpha){
	objet.style.opacity = alpha/100;
	objet.style.filter = "alpha(opacity="+alpha+")";
}

//affichage avec transparence progressive
function progress(id, alpha){
	alpha = (!alpha ? 0 : alpha);
	var target = document.getElementById(id);
	setAlpha(target, alpha);
	if(alpha < 80){
		setTimeout(function (){ progress(id, (alpha+5)); }, 50);
	}
}

//affichage avec transparence progressive avec alphamax
function progress2(id, alpha, alpha_max){
	alpha = (!alpha ? 0 : alpha);
	var target = document.getElementById(id);
	setAlpha(target, alpha);
	if(alpha < alpha_max){
		setTimeout(function (){ progress2(id, (alpha+5), alpha_max); }, 50);
	}
}

//déroulement progressif de la hauteur
function progressHeight(id, h, hmax, pas){
	h = (!h ? 0 : h);
	var target = document.getElementById(id);
	target.style.height = h+'px';
	if(h < hmax){
		setTimeout(function (){ progressHeight(id, (h+pas), hmax, pas); }, 40);
	}
}

//permet d'afficher les balises HTML telles quelles
function HTMLentities(texte) {
	texte = texte.replace(/</g,'&lt;'); // 60 3C
	texte = texte.replace(/>/g,'&gt;'); // 62 3E
	return texte;
}

//recherche de l'offset
function getOffsetleft(objet){
	if (objet.offsetParent){
		return (objet.offsetLeft + getOffsetleft(objet.offsetParent));
	}else{
		return (objet.offsetLeft);
	}
}

//recherche de l'élément précédant
function getPrevious (obj) {
	if (obj.previousSibling == null){
		return obj;
	}
	var prev = obj.previousSibling;
	while(prev.nodeType != 1 && prev.previousSibling != null){
		prev = prev.previousSibling;
	}
	return prev;
}
