function cacheElt(cible){	var elt = document.getElementById(cible);
	elt.setAttribute("classTemp", getValue(cible, 'class'));	elt.setAttribute("class", "cacher");}

function montreElt(cible){	var elt = document.getElementById(cible);
	var classe = getValue(cible, 'classTemp');	elt.setAttribute("class", classe);}

function getValue(cible, cibleValue){	var elt = document.getElementById(cible);	return elt.getAttribute(cibleValue);}
function recherche(cible){	//alert(cible);	
	var etat = getValue(cible, 'class');
	if (etat == 'cacher') montreElt(cible);	else cacheElt(cible);}
/*----------------------------------------------------------------------*/
function popUp(URL){	//alert(URL);
	//var a = window.open();
	//a.document.write(encodeURI(URL));
	day = new Date();	id = day.getTime();	window.open(URL, " + id + ");
	//window.open(URL);}

function remplaceLink(){	//alert("remplaceLink");	var lienPart1 = "http://www.google.fr/custom?domains=www.culture-bio.net&q=";	var lienPart2 = "&sitesearch=&sa.x=278&sa.y=239&sa=Recherche+Google&client=pub-1861333315097281&forid=1&ie=UTF-8&oe=UTF-8&safe=active&flav=0000&sig=d42lMgtnl6Xi5KHz&cof=GALT%3A%23006699%3BGL%3A1%3BDIV%3A%23336699%3BVLC%3A663399%3BAH%3Acenter%3BBGC%3A191919%3BLBGC%3AC3D9FF%3BALC%3AE6E6E6%3BLC%3AE6E6E6%3BT%3A99C9FF%3BGFNT%3A32527A%3BGIMP%3A32527A%3BLH%3A50%3BLW%3A50%3BL%3Ahttp%3A%2F%2Fwww.culture-bio.net%2Fimg%2Fbody_bg_small.jpg%3BS%3Ahttp%3A%2F%2Fwww.culture-bio.net%3BLP%3A1%3BFORID%3A1&hl=fr";	
	//var lienPart2 = "&sitesearch=&sa.x=278&sa.y=239&sa=Recherche+Google&client=pub-1861333315097281&forid=1&ie=UTF-8&oe=UTF-8&safe=active&flav=0000&sig=d42lMgtnl6Xi5KHz&cof=GALT:#006699;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:191919;LBGC:C3D9FF;ALC:E6E6E6;LC:E6E6E6;T:99C9FF;GFNT:32527A;GIMP:32527A;LH:50;LW:50;L:http://www.culture-bio.net/img/body_bg_small.jpg;S:http://www.culture-bio.net;LP:1;FORID:1&hl=fr"	
	var liste = document.getElementsByTagName('div');	//alert(liste.length);		for (h = 0; h<liste.length; h++)	{		var pclass = liste[h].getAttribute('class');				if (pclass == 'post-chapo' || pclass == 'post-content')		{			var liens = liste[h].getElementsByTagName('a');			//alert(liens.length);						for (i=0; i<liens.length; i++)			{				var l = liens[i];				var u = l.getAttribute("href");								for ( j=0; j<l.childNodes.length; j++ ) 				{					if ( l.childNodes[j].nodeType == 3 ) 					{						var donnee = l.childNodes[j].data;						break;					}				}				
				// Preparation à la popup si window.open
				day = new Date();				id = day.getTime();				
				if ( u == "Gchercher" ) 				{					l.href = "javascript:void(window.open('"+lienPart1+donnee+lienPart2+"', "+id+"));";
					//l.href = "javascript:void(popUp('"+lienPart1+donnee+lienPart2+"'));";					//l.href = lienPart1+donnee+lienPart2;					l.title = "Rechercher '"+donnee+"' avec Google";					l.style.color = "#940F04";				}else				{					//alert(u);
					l.href = 'javascript:void(window.open("'+u+'", '+id+'));';
					//l.href = 'javascript:void(popUp("'+u+'"));';
					titre = l.getAttribute("title");
					if ( titre == "undefined" || titre == "" || titre == null ) l.title = u;										}					}		}				}}
/*----------------------------------------------------------------------*/
function lireCookie(name)
{
	var start = document.cookie.indexOf( name + "=" );	var len = start + name.length + 1;	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) return null;	if ( start == -1 ) return null;	var end = document.cookie.indexOf( ";", len );	if ( end == -1 ) end = document.cookie.length;	return unescape( document.cookie.substring( len, end ) );
}
/*++++++Définition de la fonction "ecrireCookie"++++++++++++++++++++++++++++++++++++++
	*
	*	La fonction crée un cookie plus ou moins complet
	*
	*	arguments	:	nom	->	Nom du cookie (String)
	*				valeur	->	Valeur du cookie (String)
	*			Optionnel
	*				expire	->	date d'expiration du cookie (String). En nb de jour.
	*				path	->	
	*				domain	->	
	*				secure	->	
	*
	*	retour		:	Cree un cookie.	
	*/
function ecrireCookie(nom, valeur)
{
	var argv=ecrireCookie.arguments;
	var argc=ecrireCookie.arguments.length;
	if ( argc > 2 )
	{
		var expires = new Date();
		expires.setTime(expires.getTime()+(argv[2]*3600*1000*24));
	}
	else expires = null;
	var path=(argc > 3) ? argv[3] : null;
	var domain=(argc > 4) ? argv[4] : null;
	var secure=(argc > 5) ? argv[5] : false;
	var cook = nom + "=" + escape(valeur) + ((expires==null) ? "" : ("; expires="+expires.toLocaleString())) + ((path==null) ? "" : ("; path="+path)) + ((domain==null) ? "" : ("; domain="+domain)) + ((secure==true) ? "; secure" : "");
	document.cookie = cook;
}

function effaceCookie(nom)
{
	date=new Date;
	date.setFullYear(date.getFullYear()-1);
	EcrireCookie(nom,null,date);
}
/*++++++Définition de la fonction "arrayNextValue"++++++++++++++++++++++++++++++++++++++
	*
	*	La fonction trouve une valeur fournit dans un tableau
	*	et retourne la valeur suivante (ID+1)
	*
	*	arguments	:	tab	->	Tableau concerné
	*				val	->	Valeur à rechercher
	*
	*	retour		:	valeur suivante dans le tableau
	*				sinon false
	*/
function arrayNextValue(tab, val)
{
	//alert('arrayNextValue');
	if ( tab instanceof Array )
	{
		var thisID;
		val0 = val;
		if ( val == null || typeof ++val0 != "number" ) return tab[0];
		for( var valeur in tab )
		{
			if ( tab[valeur] == val )
			{
				thisID = ++valeur;
				break;
			}
		}
		if ( thisID >= tab.length ) return tab[0];
		else return tab[thisID];
	} else return false;	
}

function gestionSupportHooSeek(supports)
{
	var support = lireCookie('support');
	//alert('support = '+support);
	var nextSupport = arrayNextValue(supports, support);
	//alert('nextSupport = '+nextSupport);
	ecrireCookie('support', nextSupport, 30);
	//alert('ecriture cookie');
	return nextSupport;
}