/* ******************************************************************************
*
*		    [ javascript.js (français) ]
*
*	--------------------------------------------------------------------------
*
*	Copyright : 		Groupe Dagonfield Génésis
*	Site Web : 		http://www.dagonfield.com
*	E-mail : 		Nerevare - dagonfield@gmail.com
*				Met@lnono - nono1135@hotmail.com
*				yoursef - yoursef@gmail.com

*	--------------------------------------------------------------------------
*
*	Dernière modification le 06 Septembre 2006 par Met@lnono
*
****************************************************************************** */

/* Fonction permettant de cacher les liens dans la barre de statut */
function hidestatus() {
	window.status = '';
	return true;
}

/* Fonction permettant d'afficher des éléments */
function afficher(id) {
	var affiche = document.getElementById(id);
	affiche.style.display = "";
}

/* Fonction permettant de cacher/afficher des éléments */
function afficher_cacher(id) {
	var div = document.getElementById(id);
    if (div.style.display == "none") {
		div.style.display = "";
		EcrireCookie(id, "");
    }
    else {
		div.style.display = "none";
		EcrireCookie(id, "none");
    }
}

/* Fonction permettant de créer un cookie */
function EcrireCookie(nom, valeur) {
	var argv = EcrireCookie.arguments;
	var argc = EcrireCookie.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	document.cookie = nom+"="+escape(valeur)+
		((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
		((path==null) ? "" : ("; path="+path))+
		((domain==null) ? "" : ("; domain="+domain))+
		((secure==true) ? "; secure" : "");
}

/* Fonctions permettant de lire un cookie */
function getCookieVal(offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1) endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}
function LireCookie(nom) {
	var arg = nom+"=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen)
	{
		var j = i+alen;
		if (document.cookie.substring(i, j) == arg) return getCookieVal(j);
		i = document.cookie.indexOf(" ",i)+1;
		if (i == 0) break;
	}
	return null;
}

/* Fonction de redimensionnement automatique d'une iframe */
function autoResize(iframe) {
	try {
		var innerDoc = (iframe.contentDocument) ? iframe.contentDocument : iframe.contentWindow.document;
		if (innerDoc.body.offsetHeight) //ns6 syntax
		{
			iframe.height = innerDoc.body.offsetHeight + 60; //Extra height FireFox
		}
		else if (iframe.Document && iframe.Document.body.scrollHeight) //ie5+ syntax
		{
			iframe.height = iframe.Document.body.scrollHeight;
		}
	}
	catch(err) {
		alert(err.message);
	}
}

/* Fonction de highlight sur les images */
function smfFooterHighlight(element, value, racine) {
	element.src = racine + "img/sys/" + (value ? "h_" : "") + element.id + ".png";
}
