function cache_element(nom, id, nombre)
	{
	if(document.getElementById(nom+id+'1').style.visibility == 'hidden')
		{
		for(var i=1; i<=nombre; i++)
			{
			document.getElementById(nom+id+i).style.visibility = 'visible';
			document.getElementById(nom+id+i).style.display = 'block';
			var max = document.getElementById(nom+id+i).innerHTML.lastIndexOf('-->');
			document.getElementById(nom+id+i).innerHTML = document.getElementById(nom+id+i).innerHTML.substr(4,max-4);
			}
		}
	else
		{
		for(var i=1; i<=nombre; i++)
			{
			document.getElementById(nom+id+i).style.visibility = 'hidden';
			document.getElementById(nom+id+i).style.display = 'none';
			document.getElementById(nom+id+i).innerHTML = '<!--'+document.getElementById(nom+id+i).innerHTML+'-->';
			}
		}
	}
function cache(id)
	{
	if(document.getElementById(id).style.visibility == 'visible')
		{
		document.getElementById(id).style.visibility = 'hidden';
		document.getElementById(id).style.display = 'none';
		}
	else
		{
		document.getElementById(id).style.visibility = 'visible';
		document.getElementById(id).style.display = 'block';
		}
	}
function montre(id)
	{
	if(document.getElementById(id).style.visibility == 'hidden')
		{
		document.getElementById(id).style.visibility = 'visible';
		document.getElementById(id).style.display = 'block';
		}
	else
		{
		document.getElementById(id).style.visibility = 'hidden';
		document.getElementById(id).style.display = 'none';
		}
	}
function cache_forum(id,lien_img)
	{
	fullrom_cache = GetCookie("fullrom_cache");
	if(fullrom_cache == null)
		fullrom_cache = '';
	if(document.getElementById("forum"+id).style.visibility == 'hidden')
		{
		document.getElementById("forum"+id).style.visibility = "visible";
		document.getElementById("forum"+id).style.display = "table-cell";
		document.getElementById("btn_forum"+id).src = lien_img+"fleche_haut.gif";
		if(eregi(fullrom_cache, " "+id+","))
			{
			date=new Date;
			date.setMonth(date.getMonth()+6);
			new_cache = str_replace(" "+id+",", "", fullrom_cache);
			ecrire_cookie("fullrom_cache", new_cache, date);
			}
		}
	else
		{
		document.getElementById("forum"+id).style.visibility = "hidden";
		document.getElementById("forum"+id).style.display = "none";
		document.getElementById("btn_forum"+id).src = lien_img+"fleche_bas.gif";
		if(!eregi(fullrom_cache, " "+id+","))
			{
			date=new Date;
			date.setMonth(date.getYear()+1);
			new_cache = fullrom_cache+" "+id+",";
			ecrire_cookie("fullrom_cache", new_cache, date);
			}
		}
	}
function contact(name, type)
	{
	if(type == 1)
		{
		if(document.getElementById("envoi_mp").destinataire.value == '')
			document.getElementById("envoi_mp").destinataire.value = name;
		else
			document.getElementById("envoi_mp").destinataire.value = document.getElementById("envoi_mp").destinataire.value+', '+name;
		}
	else
		document.getElementById("envoi_mp").destinataire.value = name;
	document.getElementById("liste_contact").style.visibility = "hidden";
	}
function lien_form(form){
	if (form.changer_forum.selectedIndex != 0){
		window.top.location.href = form.changer_forum.options[form.changer_forum.selectedIndex].value;
	}else{
		alert('Veuillez choisir un forum !');
	}
}

function smiley(nom_form,text,texte_defaut) {
    var txtarea = document.getElementById(nom_form).message; text = ' ' + text + ' ';
	if(txtarea.value == texte_defaut) {
		txtarea.value = text;
    } else {
        txtarea.value += text; txtarea.focus(); 
    } 
} 

function str_replace(cherche,remplace,texte){

	while(texte.indexOf(cherche) > -1){

		texte = texte.replace(cherche,remplace);

	}

	return texte;

}
function eregi( chaine, find )
 {

  var norm = new RegExp( find );
  return norm.exec( chaine )!=null;

 }
function getCookieVal(offset) {
var endstr=document.cookie.indexOf (";", offset);
if (endstr==-1)
endstr=document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {
var arg=name+"=";
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;
} 
function ecrire_cookie(nom, valeur, expires) {
  document.cookie=nom+"="+escape(valeur)+
  ((expires==null) ? "" : ("; expires="+expires.toGMTString()+"; path=/"));
}

function top_vente(id)
	{
	var total = 5;
	if(typeof(id_courant) !='number')
		window['id_courant'] = 1;
	if(id == 1)
		{
		if(id_courant > 1)
			{
			id_courant--;
			for(i = 1; i <= total; i++)
				{
				if(i >= id_courant && i <= id_courant+2)
					document.getElementById("top_"+i).className = "icn_top_vente_visible";
				else
					document.getElementById("top_"+i).className = "icn_top_vente_hidden";
				}
			}
		}
	else if(id == 2)
		{
		if(id_courant < total-2)
			{
			id_courant++;
			for(i = 1; i <= total; i++)
				{
				if(i >= id_courant && i <= id_courant+2)
					document.getElementById("top_"+i).className = "icn_top_vente_visible";
				else
					document.getElementById("top_"+i).className = "icn_top_vente_hidden";
				}
			}
		}
	}
function ouvre_menu(id,max)
	{
	for(i = 1; i <= max; i++)
		{
		document.getElementById("menu_"+i).className = "cache";
		document.getElementById("fleche_"+i).className = "fleche";
		}
	document.getElementById("menu_"+id).className = "milieu";
	document.getElementById("fleche_"+id).className = "cache";
	}
function ouvre_club(id)
	{
	if(id == 1)
		{
		document.getElementById("club_fleche").style.visibility = "hidden";
		document.getElementById("club_fleche").style.display = "none";
		document.getElementById("club_info").style.visibility = "visible";
		document.getElementById("club_info").style.display = "block";
		}
	else
		{
		document.getElementById("club_info").style.visibility = "hidden";
		document.getElementById("club_info").style.display = "none";
		document.getElementById("club_fleche").style.visibility = "visible";
		document.getElementById("club_fleche").style.display = "block";
		}
	}
function popup()
	{
	var page_actuel = taille_page();
	var largeur = 468;
	var hauteur = 400;
	var pos_left = (screen.width-largeur)/2;
	var pos_top = (((screen.height-hauteur)/2)+window.scrollY)-100;
	document.getElementById('popup_bg').style.width = page_actuel[0]+'px';
	document.getElementById('popup_bg').style.height = page_actuel[1]+'px';
	document.getElementById('popup').style.marginLeft = pos_left+'px';
	document.getElementById('popup').style.marginTop = pos_top+'px';
	document.getElementById('popup').style.width = largeur+'px';
	document.getElementById('popup').style.height = hauteur+'px';
	document.getElementById('popup_bg').style.visibility = 'visible';
	document.getElementById('popup_bg').style.display = 'block';
	}
function popup_close()
	{
	document.getElementById('popup_bg').style.visibility = 'hidden';
	document.getElementById('popup_bg').style.display = 'none';
	}
function taille_page() {
	        
	     var xScroll, yScroll;
		
		if (window.innerHeight && window.scrollMaxY) {	
			xScroll = window.innerWidth + window.scrollMaxX;
			yScroll = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
			xScroll = document.body.scrollWidth;
			yScroll = document.body.scrollHeight;
		} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
			xScroll = document.body.offsetWidth;
			yScroll = document.body.offsetHeight;
		}
		
		var windowWidth, windowHeight;
		
		if (self.innerHeight) {	// all except Explorer
			if(document.documentElement.clientWidth){
				windowWidth = document.documentElement.clientWidth; 
			} else {
				windowWidth = self.innerWidth;
			}
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else if (document.body) { // other Explorers
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}	
		
		// for small pages with total height less then height of the viewport
		if(yScroll < windowHeight){
			pageHeight = windowHeight;
		} else { 
			pageHeight = yScroll;
		}
	
		// for small pages with total width less then width of the viewport
		if(xScroll < windowWidth){	
			pageWidth = xScroll;		
		} else {
			pageWidth = windowWidth;
		}

		return [pageWidth,pageHeight];
	}
function vider_case(nom_case,texte_case) 
{
		if(nom_case.value == texte_case){
			nom_case.value = '';
		}
}

function remplir_case(nom_case,texte_case) 
{
		if(nom_case.value == ''){
			nom_case.value = texte_case;
		}
}
function commenter_case(nom_case, action) 
	{
		if(action == 1)
			{
			document.getElementById('commentaire_off').className = "hidden";
			document.getElementById('commentaire_on').className = "visible";
			document.getElementById('form_comment').commentaire.focus();
			}
		else
			{
			if(document.getElementById('form_comment').commentaire.value == '')
				{
				document.getElementById('commentaire_off').className = "visible";
				document.getElementById('commentaire_on').className = "hidden";
				}
			}
	}
function repondre_case(nom_case, action) 
	{
		if(action == 1)
			{
			document.getElementById('repondre_off').className = "hidden";
			document.getElementById('repondre_on').className = "visible";
			document.getElementById('form_repondre').message.focus();
			}
		else
			{
			if(document.getElementById('form_repondre').message.value == '')
				{
				document.getElementById('repondre_off').className = "visible";
				document.getElementById('repondre_on').className = "hidden";
				}
			}
	}
