function afficheCatalogue(){
	document.getElementById('catalogue_encart').style.display="block";
}
function masqueCatalogue(){
	document.getElementById('catalogue_encart').style.display="none";
}
function Compter(Target, max, nomchamp)
			{
			   StrLen = Target.value.length
			   if (StrLen > max )
			   {
			      Target.value = Target.value.substring(0,max);
			      CharsLeft = max;                                
			   }
			   else
			   {
			      CharsLeft = StrLen;
			   }    
			   nomchamp.value = max - CharsLeft;
			}



function toggleLayer (layer_name)
	
	{
		var layer_to_be_toggled = document.getElementById (layer_name);
		var all_layers = document.getElementsByTagName ("div");
		
		for (i = 0; i < all_layers.length; ++i)
			if (all_layers[i].id != layer_name && all_layers[i].className == "togglable")
				all_layers[i].style.display = "none";
		
		if (layer_to_be_toggled.style.display == "block")
			layer_to_be_toggled.style.display = "none";
		else
			layer_to_be_toggled.style.display = "block";
	}



//Nombre de boites de l'accordeon
var nItems = 7;

function EffetAccordeon(){

  for (var i = 1; i<nItems; i++) {

		var leLien = $('link0'+i);
		if(!leLien )
		return;

		//Attribution des statuts de depart
		if(i != 1){
			$('accordbox0'+i).style.display = 'none';
			$('link0'+i).statut = 'Refermer';
		}

		$('link01').statut = 'Afficher';

		leLien.i = i;

		//Attribution de la methode onclick aux onglets
		leLien.onclick = function (){

			for (var a = 1; a<nItems; a++){
				var currentStatut = $('link0'+a	).statut;
				if(a != this.i){if(currentStatut == 'Afficher'){var kill = 'ok';}}
			}

			testStatut(kill, this.i, this);

			return false;
		}

	}

}

//Fonction pour tester le statuts des boites "accordbox0"+x
function testStatut(kill, indice, objetCourant){

	for (var a = 1; a<nItems; a++) {

		var currentStatut = $('link0'+a	).statut;

		if(a != indice){
			if(currentStatut == 'Afficher'){Replier(a, indice, currentStatut);}
		}else{
			if(objetCourant.statut != 'Refermer'){Replier(a, null, this.statut);}
			else{if(kill != 'ok'){Deplier(a, null, objetCourant.statut);}}
		}
	}

}

//Fonction pour d?plier les boites
function Deplier(element, sonStatut){

	var oLeLien = $('link0'+element);
	oLeLien.parentNode.parentNode.className = 'cdbbox btnactif';

	var oElement = $('accordbox0'+element);

	new Effect.BlindDown(oElement, {duration:0.3});

	oLeLien.statut = 'Afficher';

}

//Fonction pour replier les boites
function Replier(element, indice, statut){

	var oLeLien = $('link0'+element);
	oLeLien.parentNode.parentNode.className = 'cdbbox btninactif';

	var oElement = $('accordbox0'+element);

	new Effect.BlindUp(oElement, {
		duration:0.2,
		afterFinish: function(Effect){if(indice!==null){Deplier(indice, statut);}}
		}
	)

	oLeLien.statut = 'Refermer';

}

Event.observe(window, 'load', EffetAccordeon, false);

function bookmarksite(title,url){
    if (window.sidebar) // firefox
        window.sidebar.addPanel(title, url, "");
    else if(window.opera && window.print){ // opera
        var elem = document.createElement('a');
        elem.setAttribute('href',url);
        elem.setAttribute('title',title);
        elem.setAttribute('rel','sidebar');
        elem.click();
    }
    else if(document.all)// ie
        window.external.AddFavorite(url, title);
}

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" : "");
}

function EffaceCookie(nom){
    date=new Date;
    date.setFullYear(date.getFullYear()-1);
    EcrireCookie(nom,null,date, '/');
}

function LireCookie(cookieName) {
 var theCookie=""+document.cookie;
 var ind=theCookie.indexOf(cookieName);
 if (ind==-1 || cookieName=="") return "";
 var ind1=theCookie.indexOf(';',ind);
 if (ind1==-1) ind1=theCookie.length;
 return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
}

function Display_Flash(){
	if (LireCookie('flash_status') == 'stop_for_now') {
		document.write(
			'<div style="width:446px; padding-top:7px;">'
			+'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="445" height="250" id="accueil" align="middle">'
			+'<param name="allowScriptAccess" value="sameDomain" />'
			+'<param name="movie" value="/common/flash/accueil-video-out.swf" />'
			+'<param name="quality" value="high"/>'
			+'<param name="wmode" value="transparent" />'
			+'<param name="bgcolor" value="#ffffff" />'
			+'<embed src="/common/flash/accueil-video-out.swf" quality="high" wmode="transparent" bgcolor="#ffffff" width="445" height="250" name="accueil" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'
			+'</object>'
			+'</div>'
		);
		EcrireCookie('flash_status', 1)
	}
}




