var rnd = Math.random() + "";
var pageid = rnd * 10000000000000000;

function displayTable(){
	for(var i=0; i<=5; i++){
		document.getElementById("table"+i).style.display = "block";
	}
	window.print();
};

// fct toggleOnglet: change l'onglet de la page comparatif_etape2
function toggleOnglet(tableau, btn) {
	for(var i=0; i<=5; i++){
		document.getElementById("table"+i).style.display = "none";
		document.getElementById("btn"+i).className = "btn"+i;		
	}
	document.getElementById(tableau).style.display = "block";
	document.getElementById(btn).className = "btn"+btn.charAt(3)+" btnOpen";
};

// fct toggleOnglet_v2
function toggleOnglet_v2(tableau, btn, nbElements) {
	for(var i=0; i<=nbElements-1; i++){
		document.getElementById("table"+i).style.display = "none";
		document.getElementById("btn"+i).className = "btn"+i;		
	}
	document.getElementById(tableau).style.display = "block";
	document.getElementById(btn).className = "btn"+btn.charAt(3)+" btnOpen";
};



//fct relodIFrame: reload un IFrame de pub selon un KW
function reloadIframe (parameter, value, frameID) {
  	frameID = "bonjour";
 	if ( typeof( window.frames[frameID] ) != "undefined" ) 
  	{
   		var loc = new String(window.frames[frameID].location);
	  	//alert("start : "+ loc);
		test = loc.split(parameter+"=");
		avant = test[0];
		position = test[1].indexOf("&");
		fin = test[1].slice(position,test[1].length)
			
		nouveau_url = avant+parameter+"="+value+fin;		
		//alert("end : "+ nouveau_url);	
		window.frames[frameID].location = nouveau_url;	
		return false;  
   	} 
	else 
	{
   		//si pas defini
   	}
}

// fct setText: replace le texte par défaut dans les champs de saisie
function setText(form, champ, defaultValue, valeur ) {	
	if(document[form][champ].value==defaultValue || document[form][champ].value==""){
		document[form][champ].value = valeur;
	}	
};

// fct toggleImg: Agrandie et diminue l'imgage des pages Articles Standard

var imgSize = 0;
var imgPath = "images/contenu/";
var imgFormat = "jpg";
var commentsOpen = false;
var commentezOpen = false;

function toggleImg(img0, img1) {	
	if(imgSize==0) {
		document.getElementById("divImage").className = "imageAgrandie";
		document.getElementById("divOptions").className = "optionsAgrandie";
		if(document.getElementById("divPas")) document.getElementById("divPas").className = "pasAgrandie";
		if(document.getElementById("infoVisa")) document.getElementById("infoVisa").className = "vousAgrandie";
		if(document.getElementById("divLaisser")) document.getElementById("divLaisser").className = "laisserAgrandie";
		if(document.getElementById("divLaisser2")) document.getElementById("divLaisser2").className = "laisserAgrandie2";
		document.getElementById("image").src = imgPath+img1+"."+imgFormat;
		document.getElementById("btnAgrandir").innerHTML = "Diminuer";
		imgSize=1;
	}else{
		document.getElementById("divImage").className = "image";
		document.getElementById("divOptions").className = "options";
		if(document.getElementById("divPas")) document.getElementById("divPas").className = "pas";
		if(document.getElementById("infoVisa")) document.getElementById("infoVisa").className = "vous";
		if(document.getElementById("divLaisser")) document.getElementById("divLaisser").className = "laisser";
		if(document.getElementById("divLaisser2")) document.getElementById("divLaisser2").className = "laisser";
		document.getElementById("image").src = imgPath+img0+"."+imgFormat;
		document.getElementById("btnAgrandir").innerHTML = "Agrandir";
		imgSize=0;
	}
};

// idem à toggleImg, sauf que le path et l'extension sont inclus dans img0 et img1
function toggleImgPathInc(img0, img1) {	
	if(imgSize==0) {
		document.getElementById("divImage").className = "imageAgrandie";
		document.getElementById("divOptions").className = "optionsAgrandie";
		if(document.getElementById("divPas")) document.getElementById("divPas").className = "pasAgrandie";
		if(document.getElementById("infoVisa")) document.getElementById("infoVisa").className = "vousAgrandie";
		if(document.getElementById("divLaisser")) document.getElementById("divLaisser").className = "laisserAgrandie";
		if(document.getElementById("divLaisser2")) document.getElementById("divLaisser2").className = "laisserAgrandie2";
		document.getElementById("image").src = img1;
		document.getElementById("btnAgrandir").innerHTML = "Diminuer";
		document.getElementById("btnAgrandir2").innerHTML = "<img src='/images/icone_diminuer.gif' alt='Diminuer' />";
		imgSize=1;
	}else{
		document.getElementById("divImage").className = "image";
		document.getElementById("divOptions").className = "options";
		if(document.getElementById("divPas")) document.getElementById("divPas").className = "pas";
		if(document.getElementById("infoVisa")) document.getElementById("infoVisa").className = "vous";
		if(document.getElementById("divLaisser")) document.getElementById("divLaisser").className = "laisser";
		if(document.getElementById("divLaisser2")) document.getElementById("divLaisser2").className = "laisser";
		document.getElementById("image").src = img0;
		document.getElementById("btnAgrandir").innerHTML = "Agrandir";
		document.getElementById("btnAgrandir2").innerHTML = "<img src='/images/agrandir.gif' alt='Agrandir' />";
		imgSize=0;
	}
};

function toggleImgPathIncMulti(img0, img1, imgID) {	
	if(document.getElementById("divImage"+imgID).className == "imageThumb") {
		document.getElementById("divImage"+imgID).className = "imageAgrandie";
		document.getElementById("image"+imgID).src = img1;
		document.getElementById("btnAgrandir"+imgID).innerHTML = "Diminuer";
		document.getElementById("btnAgrandir2"+imgID).innerHTML = "<img src='/images/icone_diminuer.gif' alt='Diminuer' />";
		imgSize=1;
	}else{
		document.getElementById("divImage"+imgID).className = "imageThumb";
		document.getElementById("image"+imgID).src = img0;
		document.getElementById("btnAgrandir"+imgID).innerHTML = "Agrandir";
		document.getElementById("btnAgrandir2"+imgID).innerHTML = "<img src='/images/agrandir.gif' alt='Agrandir' />";
		imgSize=0;
	}
};

function toggleImgPathIncMultiEssai(img0, img1, imgID) {	
	if(imgSize==0) {
		document.getElementById("divImage"+imgID).className = "image";
		document.getElementById("image"+imgID).src = img1;
		document.getElementById("btnAgrandir"+imgID).innerHTML = "Diminuer";
		document.getElementById("btnAgrandir2"+imgID).innerHTML = "<img src='/images/icone_diminuer.gif' alt='Diminuer' />";
		imgSize=1;
	}else{
		document.getElementById("divImage"+imgID).className = "imageThumb";
		document.getElementById("image"+imgID).src = img0;
		document.getElementById("btnAgrandir"+imgID).innerHTML = "Agrandir";
		document.getElementById("btnAgrandir2"+imgID).innerHTML = "<img src='/images/agrandir.gif' alt='Agrandir' />";
		imgSize=0;
	}
};

// fct toggleComments: Affiche et cache les commentaires des pages Articles
function toggleComments(div, ahref) {	
	if(commentsOpen==false) {
		document.getElementById(div).style.display = "block";
		document.getElementById("divLisez_tous").style.display = "none";
		if(ahref) document.location.href = "#commentaires";
		//if(document.getElementById("btnCommentaires")) document.getElementById("btnCommentaires").innerHTML = "Fermer les commentaires";
		commentsOpen=true;
	}else{
		document.getElementById(div).style.display = "none";
		document.getElementById("divLisez_tous").style.display = "block";
		//if(document.getElementById("btnCommentaires")) document.getElementById("btnCommentaires").innerHTML = "Lisez les commentaires";
		commentsOpen=false;
	}	
};

// fct popUp pour le bloc ComparaisonsSuggerees
var newWin = null;

function closeWin(){
	if (newWin != null){
		if(!newWin.closed) newWin.close();
	}
};

function popUp(strURL,strType,strHeight,strWidth) {
	closeWin();
	var strOptions="";
	if (strType=="console") strOptions="resizable,height="+strHeight+",width="+strWidth;
	if (strType=="fixed") strOptions="status,height="+strHeight+",width="+strWidth;
	if (strType=="elastic") strOptions="toolbar,menubar,scrollbars,resizable,location,height="+strHeight+",width="+strWidth;
	newWin = window.open(strURL, 'newWin', strOptions);
	newWin.focus();
};

// fct getVehicule: switch entre les 2 TD ressources et le TD comparaisons
function getVehicule(formulaire, div) {
	toggleComparaison(div, 0)
	if (navigator.appName=="Microsoft Internet Explorer"){
		var display = "block";
	} else {
		var display = "table-cell";
	}	
	// si on vient de choisir le v�hicule 2:
	if(div=="vehicule2"){
		document.getElementById("comparaisons").style.display = "none";
		document.getElementById("ressources_vehicule2").style.display = display;
		document.getElementById("comparaisons_2").style.display = display;
		initList("annee", "list1", "form_comparaison3");	// init la liste du v�hicule 3
	}
	// si on vient de choisir le v�hicule 3:
	else if(div=="vehicule3"){
		document.getElementById("comparaisons_2").style.display = "none";
		document.getElementById("ressources_vehicule3").style.display = display;
	}	
};

// Date et ann�e
function laDate(){
	lesMois = new Array("janvier", "f�vrier", "mars", "avril", "mai", "juin", "juillet", "ao�t", "septembre", "octobre", "novembre", "d�cembre" );
	Today = new Date;
	Jour = Today.getDate();
	Mois = lesMois[Today.getMonth()];
	Annee = Today.getFullYear();
	Message = Jour +' '+ Mois +' '+ Annee;
	
	return Message;
};
function annee(){
	Today = new Date;
	Annee = Today.getFullYear();
	
	return Annee;
};

function changeFontSize(ID, Size) {
	var exp = new Date("December,31,2099");
	var setup;
	if (Size == '2') {
		setup = Array('120%', 'sz2', 'isz2b');
	} else if (Size == '3') {
		setup = Array('140%', 'sz3', 'isz3b');
	} else {
		setup = Array('100%', 'sz1', 'isz1b');
	}
	document.getElementById(ID).style.fontSize = setup[0];
	document.cookie = "ftSz=" + Size + ";expires=" + exp.toGMTString() + ";path=/;";
//	ResetImgTxt();
//	ChangeImg(setup[1],setup[2]);
}

function changeFontSize2(ID) {
	size = document.getElementById(ID).style.fontSize;
	if(size=='120%'){
		nextSize='3';
	}else if(size=='140%'){
		nextSize='1';
	}else{
		nextSize='2';
	}
	changeFontSize(ID, nextSize)
}


function displayPlus(s)
{
	if(s==null)
	{
		root.obj.setProperty('plusInfos_assurance','display','none');
		root.obj.setProperty('plusInfos_entretien','display','none');
		showOpaque();
	}
	if(s!=null) 
	{
		var div = 'plusInfos_'+s;
		root.obj.setProperty(div,'display','block');
		//setPosition(div);
		showOpaque(div);
	}
}

function setPosition(div){
	// position de la boite
	var w = document.body.scrollWidth; //screen.width;
	var h = document.body.scrollheight; //screen.height;
	var x = (w-360)/2;
	document.getElementById(div).style.backgroundColor = "#fff";
	document.getElementById(div).style.border = "5px solid #d4d4c8";
	document.getElementById(div).style.position = "absolute";
	document.getElementById(div).style.left = x+"px";
	document.getElementById(div).style.top = "350px";
};

var opaque = false;
function showOpaque(div){
	if(!opaque){
		document.getElementById("bgOpaque").style.display = "block";
		document.getElementById("bgOpaque").style.width = document.body.scrollWidth;
		document.getElementById("bgOpaque").style.height = document.body.scrollHeight;
		if(document.getElementById("miseValeurGallerie"))
			document.getElementById("miseValeurGallerie").style.display = "none";
		setOpacity(document.getElementById("bgOpaque"), 50, false);
		opaque = true;
		setPosition(div);
	}else{
		document.getElementById("bgOpaque").style.display = "none";
		if(document.getElementById("miseValeurGallerie"))
			document.getElementById("miseValeurGallerie").style.display = "block";
		opaque = false;
	}
};

var currentFix = null;

function displaySend(s)
{
	showOpaque("sendFriendBox");
			
	var o1 = root.obj;
	var s0 = 'sendFriendBox';
	var s1 = o1.getProperty(s0,'display');
	var s2 = (s1==null || s1=='none')? 'block' : 'none';
	if(s2=='none' && currentFix!=s) s2 = 'block';
	if(s==null)
	{
		s2 = 'none';
		root.obj.setProperty('sendFriendMessage','display','none');
		root.obj.setProperty('sendFriendAnimation','display','none');
		root.obj.setProperty('sendFriendForm','display','block');
	}
	var b = o1.setProperty(s0,'display',s2);
	if(currentFix!=s && s!=null) 
	{
		var n1 	= o1.getProperty(s,'offsetHeight');
		var n2 	= (s=='articleToolsBottom')? -(n1+o1.getProperty(s0,'offsetHeight')): 0 ;
		var b 	= o1.setProperty(s0,'left',(o1.getProperty(s,'offsetLeft')+o1.getProperty(s,'offsetWidth')-o1.getProperty(s0,'offsetWidth'))+'px');
		var b 	= o1.setProperty(s0,'top',(o1.getProperty(s,'offsetTop')+n1+n2)+'px');
		currentFix=s;
	}
};

function sendFriendForm(o)
{
	if(root.server.enable)
	{
		var c		= new root.server.connection();
		c.url		= '/php/ajx_sendMail.php?xxxxx='+root.flash.generateUniqueId();
		c.onLoad 	= function(data)
		{
			root.obj.setProperty('sendFriendAnimation','display','none');
			if(data=='error_checking=none')
			{
				root.obj.setProperty('sendFriendMessage','display','block');
				root.obj.setProperty('sendFriendForm','display','none');
			}else{
				root.obj.setProperty('sendFriendForm','display','block');
				var e = root.server.decode(data);
				for(var i in e)
				{
					root.obj.setProperty(i,'innerHTML','* '+e[i]);
					var p = root.obj.getProperty(i,'display');
					if(p==null || p=='none') root.obj.setProperty(i,'display','block');
				}
			}
		};
		c.onError 	= function(errorMessage)
		{
			alert('errorMessage = '+ errorMessage);
		};
		for(var i in o) root.obj.setProperty('error_'+i,'display','none');
		root.obj.setProperty('sendFriendAnimation','display','block');
		root.obj.setProperty('sendFriendForm','display','none');
		var b = root.server.send(c,o);
		return false;
	}else{
		return true;
	}
};

// .o0){ JML : Javascript Micro Library | Version : 5.487 | Last modified : 16.02.2007 | Author: HK510.com }(0o.
function UI1B0(o,s)
{
	this.parent = o;
	this.getObj = function(n,d)
	{
		if(typeof(n)=='object') return n;
		if(typeof(n)=='undefined') return null;
		if(typeof(d)=='string' && this.getObj(d)==null) return null;
		var p,i,x;
		if(!d) d = document;
		if((p=n.indexOf("@"))>0 && parent.frames.length)
		{
			d=parent.frames[n.substring(p+1)].document;
			n=n.substring(0,p);
		}
		if(!(x=d[n]) && d.all) x=d.all[n];
		for (i=0;!x && i<d.forms.length;i++) x=d.forms[i][n];
		for(i=0;!x && d.layers&&i<d.layers.length;i++) x = this.getObj(n,d.layers[i].document);
		if(!x && d.getElementById) x=d.getElementById(n);
		return x;
	};
	this.createNew = function(n)
	{
		return this[n] = new UI1B0(this,'{Object:'+n+'}');
	};
	this.addClass = function(n,c,s,o)
	{
		this[n] 	= new c(this,s);
		if(typeof(o)!='undefined' && typeof(o.extendClass)!='undefined')
		{
			this[n].extend 	= o.extendClass;
			this[n].extend(this,s);		
		}else{
			this[n].extend 	= UI1B0;
			this[n].extend(this,s);
		}
		this[n].constructor();
	};
	isset = function(g){return typeof(g)!='undefined';};
	this.toString = function(){return s;};
};
function UI9B5(o)
{
	this.constructor = function()
	{
		this.type		= this.getType();
		this.platform		= this.getPlatform();
	};
	this.getType = function()
	{
		var v = 'others';
		if(document.all && document.getElementById) v = 'ie';
		if(document.all && navigator.userAgent.toLowerCase( ).indexOf("opera") != -1) v = 'opera'; 
		if(!document.all && document.addEventListener) v = 'moz';
		if(navigator.userAgent.toLowerCase().indexOf('firefox')!=-1) v = 'ff';
		if(document.layers) v = 'ns4';
		return v;
	};
	this.getPlatform = function()
	{
		var v = 'others';
		if(navigator.appVersion.indexOf('Mac')!=-1) v = 'mac';
		if(navigator.appVersion.indexOf('Win')!=-1) v = 'win';
		return v;
	};
	this.popup = function(p,w,h,n,l,t,f)
	{
		var n1 	= (l!=null)? l : this.getHCenter(w);
		var n2 	= (t!=null)? t : this.getVCenter(h);
		var f 	= (f==null)? 'scrollbars=yes,toolbar=no,location=no,status=no,menubar=no,resizable=no,dependent=no': f;
		var r 	= null;
		r = window.open(p,n,'width='+w+',height='+h+',top='+n2+',left='+n1+','+f);
		if(r!=null && window.focus) r.window.focus();
		return (r!=null)? r : null;
	};
	this.getHCenter = function(w)
	{
		return (this.getScreenWidth()-w)/2;
	};
	this.getVCenter = function(h)
	{
		return (this.getScreenHeight()-h)/2;
	};
	this.getWidth = function()
	{
		return (this.type=='ie')? document.body.clientWidth : (this.type=='ff')? document.documentElement.clientWidth : window.innerWidth;
	};
	this.getHeight = function()
	{
		return (this.type=='ie')? document.body.clientHeight : (this.type=='ff')?document.documentElement.clientHeight : window.innerHeight;
	};
	this.getScreenWidth = function()
	{
		return screen.width;
	};
	this.getScreenHeight = function()
	{
		return screen.height;
	};
	this.writeJs = function(s)
	{
		var e 	= document.createElement('script');
		e.type	='text/javascript';
		e.text 	= s;
		document.body.appendChild(e);			
	};
	this.writeCss = function(s)
	{
		var e 	= document.createElement('style');
		var t 	= root.browser.type;
		e.type	= 'text/css';
		if(t=='ie'){e.styleSheet.cssText=s;
		}else if(t=='moz'){e.appendChild(document.createTextNode(s));
		}else{e.innerHTML = s;}
		document.getElementsByTagName('head')[0].appendChild(e);		
	};
};
function SK1x4()
{
	this.constructor 	= function()
	{
		this.enable = this.isEnable();
	};
	this.load 		= function(o){this.engine(o,null,'GET');};
	this.send 		= function(o,d){this.engine(o,d,'POST');};
	this.cancel		= function(o){if(typeof(o.connector)!='undefined' && typeof(o.connector.abort)!='undefined') o.connector.abort();}
	this.isEnable		= function()
	{
		return typeof(this.getConnector())!='undefined';
	};
	this.getConnector	= function()
	{
		var o;
		if(window.XMLHttpRequest)
		{
			o = new XMLHttpRequest();
		}else if(window.ActiveXObject){
			try{o = new ActiveXObject("Msxml2.XMLHTTP");}
			catch(e)
			{
				try{o = new ActiveXObject("Microsoft.XMLHTTP");}
				catch(e){}
			}
		}
		return o;
	};
	this.connection 	= function()
	{
		var url;
		var type;
		var onLoad;
		var onError;
		var connector;
		var timeout;
		var validate;

		this.execute = function(h)
		{
			var c = this.connector;
			if(c.readyState==4 && c.status==200)
			{
				clearTimeout(this.timeout);
				this.type 		= h.getType(c.getAllResponseHeaders());
				var t = null;
				if(this.type=='text')	t = c.responseText;
				if(this.type=='xml') 	t = (typeof(c.responseXML.xml)!='undefined')? c.responseXML.xml : c.responseXML;
				if(this.type=='js') 	t = c.responseText;
				if(this.type=='css')	t = c.responseText;
				var r 	= (typeof(this.onLoad)=='function')? this.onLoad(t) :  null;
			}		
		};
	};
	this.engine 		= function(o,d,m)
	{
		var h 		= this;
		o.connector 	= this.getConnector();
		if(typeof(o.connector)=='undefined')
		{
			if(typeof(o.onError)=='function') o.onError('Error -> "+this+"\nXMLHttpRequest/ActiveXObject not supported !');
			return;
		}
		if(typeof(o.url)=='undefined' || typeof(o.url)!='string')
		{
			if(typeof(o.onError)=='function') o.onError('Error -> "+this+"\nUrl is undefined !');
			return;
		}
		if(typeof(o.type)=='undefined') o.type='text';
		if(typeof(o.timeout)!='undefined') clearTimeout(o.timeout);
		o.validate 	= function()
		{
			clearTimeout(o.timeout);			
			if(typeof(o.connector.abort)!='undefined') o.connector.abort();
			if(typeof(o.onError)=='function') o.onError('Error -> "+this+"\nTimeout !\nServer is not responding !');
		};
		o.timeout 	= setTimeout(o.validate,20000,this);
		o.connector.onreadystatechange = function()
		{
			try{o.execute(h);}
			catch(e)
			{
				clearTimeout(o.timeout);
				if(typeof(o.onError)=='function') o.onError('Error -> "+this+"\nTimeout !\nNetwork error !');
			}
		}
		var p = (m=='GET')? null : this.encode(d);
		var t = (m=='GET')? 'text/xml' : 'application/x-www-form-urlencoded';
		o.connector.open(m,o.url,true);
		o.connector.setRequestHeader("Content-Type",t);
		o.connector.send(p);
	};
	this.encode 		= function(o)
	{
		var s = '';
		for(var i in o) s+=i+'='+o[i]+'&';
		return s.substring(0,s.length-1);
	};
	this.decode 		= function(s)
	{
		var a = s.split('&');
		if(typeof(a.length)!='number') return;
		var o = new Object();
		for(var i=0;i<=a.length-1;i++)
		{
			var b 	= a[i].split('=');
			o[b[0]] = b[1];
		}
		return o;
	};	
	this.getType 		= function(s)
	{
		var r = null;
		var s = s.split('Content-Type')[1];
		if(s.indexOf('xml')!=-1) 	r = 'xml';
		if(s.indexOf('text')!=-1) 	r = 'text';
		if(s.indexOf('javascript')!=-1) r = 'js';
		if(s.indexOf('css')!=-1) 	r = 'css';
		return r;
	};	
}
function UI6B6(o)
{
	this.constructor = function()
	{
	};
	this.setProperty = function(t,p,v)
	{
		var o = this.getObj(t);
		if(o==null) return;
		if(typeof(v)=='function')
		{
			var s;
			if(p.indexOf('resize')!=-1){s = (o.addEventListener)?'resize':'onresize';}
			if(p.indexOf('load')!=-1){s = (o.addEventListener)?'load':'onload';}
			if(o.addEventListener) return o.addEventListener(s,v,false);
			if(o.attachEvent && root.browser.type!='opera') return o.attachEvent(s,v);
		}
		return (typeof(o.style[p])!='undefined')? o.style[p] = v : (typeof(o[p])!='undefined')? o[p] = v : null;
	};
	this.getProperty = function(t,p)
	{
		var r = null;
		var o = this.getObj(t);
		if(o==null) return;
		if(p == "offsetLeft" || p == "offsetTop")
		{
			r = this.getOffset(o,p);
		}else if(p == "offsetWidth" || p == "offsetHeight"){
			r = o[p];
		}else{
			r = (typeof(o[p])!='undefined')? o[p] : this.getStyle(o,p);
		}
		return r;
	};
	this.trace  	= function(o,b)
	{
		var s='';
		var r = (typeof(b)!='undefined')?(b)?'<br />':'\n':'\n';
		for(var i in o) s+=i+'='+o[i]+', type = '+ typeof(o[i])+r;
		(r=='<br />')? document.write(s) : alert(s);
	};
	this.getStyle = function(o,p)
	{
		return o.style[p].match('[^px]+');		
	};
	this.getOffset = function(o,p)
	{
		var a = o[p];
		o = o.offsetParent;
		while(o!=null){a+=o[p];o=o.offsetParent;}			
		return a;
	};
	
	this.addItem = function(s0,s1,s2,s3,s4,o1)
	{
		var o2 = document.createElement(s0);
		if(!isset(o2) || o2==null) return null;
		if(s1!=null) this.setProperty(o2,'id',s1);
		if(s2!=null) this.setProperty(o2,'className',s2);
		if(s3!=null) this.setProperty(o2,'innerHTML',s3);
		var o3 = this.getObj(s4);
		if(isset(o1) && o1!=null)
		{
			var o4 = this.getObj(o1.sub);
			var b1 = o1.before;
			var o5 = (b1)? o4 : o4.nextSibling;
			o3.insertBefore(o2,o5);
		}else{
			o3.appendChild(o2);
		}
		return o2;
	};
	this.removeItem = function(s)
	{
		var o1 = this.getObj(s);
		var o2 = o1.parentNode;
		if(o1==null || o2==null) return;
		(o2.removeNode)? o1.removeNode(true) : o2.removeChild(o1);
	};
};
function UI9C8(o)
{
	this.constructor = function()
	{
		this.pageId		= this.generatePageId();
		this.version		= this.getVersion();
	};
	this.generatePageId = function()
	{
		return this.generateUniqueId();
	};
	this.generateUniqueId = function(n)
	{
		var e = (typeof(n)!='undefined' && typeof(n)=='number')?n:3001;
		return new Date(e, 00, 01, 00, 00, 00)-new Date();
	};
	this.create = function(o,b)
	{
		var f 	= o.flash;
		var c	= o.custom;
		var u 	= (f.unique)?'?UID='+this.generateUniqueId():'';
		var e 	= '';
		var r 	= '';
		var s	= '<param name=';
		var a  	= (isset(f.transparent) && f.transparent)? true : false;
		for(var i in c) e+= i+'='+c[i]+'&';
		e	+='pageId='+this.pageId;
		r 	= "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'"+
			"codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="+f.version+"' "+
			"width='"+f.width+"' height='"+f.height+"' id='"+f.id+"' align='"+f.align+"' >"+
			s+"'allowScriptAccess' value='sameDomain' /> "+
			s+"'movie' value='"+f.src+u+"' /> "+
			s+"'quality' value='"+f.quality+"' /> "+
			s+"'menu' value='false' /> "+
			s+"'bgcolor' value='"+f.color+"' /> "+
			s+"'FlashVars' value='"+e+"'>";
			r+=(a)? s+"'wmode' value='transparent' />" : "";
			r+="<embed src='"+f.src+u+"' quality='"+f.quality+"' "+
			"FlashVars='"+e+"' bgcolor='"+f.color+"' width='"+f.width+"' height='"+f.height+"' name='"+f.id+"' ";
			r+= (a)? "wmode='transparent'" : "";
			r+="align='"+f.align+"' allowScriptAccess='sameDomain' menu='false' type='application/x-shockwave-flash' "+
			"pluginspage='http://www.macromedia.com/go/getflashplayer' /></object> ";
		if(isset(b) && b)
		{
			return r;
		}else{
			root.obj.setProperty(f.container,'innerHTML',r);			
		}
	};
	this.getVersion = function()
	{
		var e,r,q;
		var n = navigator.plugins;
		var p = 'ShockwaveFlash.ShockwaveFlash';
		if(root.browser.type=='ie' && root.browser.platform=='win')
		{
			try{q=new ActiveXObject(p+".7");r=q.GetVariable("$version").match('\\d');}
			catch(e){try{q=new ActiveXObject(p+".6");r=6;}
			catch(e){try{q=new ActiveXObject(p+".3");r=q.GetVariable("$version").match('\\d');}
			catch(e){}}}
		}
		if(n)
		{
			var s1 	= 'Shockwave Flash';
			var s2 	= ' 2.0';
			var b	= n[s1+s2];
			if(b || n[s1]) r = Number(n[s1+((b)? s2 : '')].description.match('\\d'));
		}
		return r;
	};
};
function UI7G4(o)
{
	this.constructor = function()
	{
	};
	this.create = function(o,f)
	{
		var a1 = arguments;
		var a2 = new Array();
		for(var i=2;i<=a1.length-1;i++) a2[i-2] = a1[i];
        	var r = function()
        	{
        	    return (typeof(f)=='function')? f.apply(o,a2) : (o==null || typeof(o)=='undefined')? window[f].apply(null,a2) : o[f].apply(o,a2);
        	}
	        return r;
	};
};
function UI7J0(o)
{
	this.constructor = function()
	{
		this.r1 	= "\\.[\\D]{3,4}$";
		this.count	= 0;
		this.member 	= new Object();
		this.dump	= new Object();
	};
	this.preload = function()
	{
		this.core(arguments,false);
	};
	this.swap = function()
	{
		this.core(arguments,true);
	};
	this.core = function(a,b)
	{
		for(var i = 0;i<=a.length-1;i++)
		{
			var o = null;
			var e = a[i];
			var s = null;
			var u = null;
			if(typeof(e)=='object')
			{
				o = e;
				s = e.src;
				if(!b) this.push(this.set(e.src,'_o'));
			}
			if(typeof(e)=='string')
			{
				var d = this.extension(e);
				if(d!=null && e.indexOf('|')==-1 && !b) this.push(e);					
				if(d==null || e.indexOf('|')!=-1)
				{
					var g = e.split('|');
					var h = this.getObj(g[0]);
					if(g.length==1 && h!=null)
					{
						o = e;
						s = e.src;
						if(!b) this.push(this.set(e.src,'_o'));						
					}
					if(g.length==2 && h!=null)
					{
						o = h;
						s = h.src;
						u = (this.extension(g[1])!=null)? g[1] : this.set(s,g[1])
						if(!b) this.push(u); 
					}
				}
			}
			if(b)
			{
				var c = this.state(s);
				if(c=='over') u = (u!=null)? u : this.set(s,'');
				if(c=='normal') u = (u!=null)? u : this.set(s,'_o');
				if(u!=null && o!=null) o.src=u;
			}
		}
		
	};
	this.push = function(s)
	{
		if(!this.search(s))
		{
			this.dump[this.count] = s;
			this.count++;
		}
	};
	this.execute = function()
	{
		for(var i in this.dump)
		{
			this.member[i] 		= new Image;
			this.member[i].src 	= this.dump[i];
		}
	};
	this.search = function(u)
	{
		var r = false;
		var o = this.member;
		for(var i in o){if(o[i].src==u){r=true;break;}}
		return r;
	};
	this.set = function(u,s)
	{
		var r = null;
		var t = this.extension(u);
		if(s=='normal') s = '';
		if(s=='over') s = '_o';
		if(s=='active') s = '_a';
		if(u.match('_o.')!=null && r==null) r = '_o'+t;
		if(u.match('_a.')!=null && r==null) r = '_a'+t;
		if(r == null) r = t;
		return u.replace(r,s+t);
	};
	this.state = function(s)
	{
		var r = null;
		var a = new Array(['_o','over'],['_a','active'],['','normal']);
		for(var i= 0;i<=a.length-1;i++){if(s.match(a[i][0]+'.')!=null){r = a[i][1];break;}}
		return r;
	};
	this.extension = function(s)
	{
		return s.match(this.r1);
	};
};
if(!Function.prototype.apply)
{
	Function.prototype.apply = function(o,a)
	{
		var r, e;
		if(!o) var o 	= window;
		if(!a) var a 	= new Array();
		var b 		= new Array();
		for(var i=0;i<a.length;i++) b[i] = 'a['+i+']';
		e = 'o.f(' + b.join(',') + ');';
		o.f = this;
		r = eval(e);
		delete o.f;
		return r;
	}
}
if(!Array.prototype.push)
{
	Array.prototype.push = function()
	{
		var a = arguments;
		var n = this.length;
		for(var i=0;i<=a.length-1;i++) this[n+i] = a[i];
		return this.length;
	};
}
//pour affichage partager dans article
function partager(quel){
			var affichage = document.getElementById('partage1');
			var affichage2 = document.getElementById('partage2');
			var affichage3 = document.getElementById('partage3');
			var affichage4 = document.getElementById('partage4');
		if(quel==1){
			affichage.href="javascript:partager(2);";
			affichage2.style.visibility="hidden";
			affichage2.style.display="none";
			affichage2.style.height="0px";
		}
		if(quel==2){
			affichage.href="javascript:partager(1);";
			affichage2.style.visibility="visible";
			affichage2.style.display="block";
			affichage2.style.height="auto";
		}
			if(quel==3){
			affichage3.innerHTML="Qu'est-ce?&nbsp;<img alt='Agrandir' title='Agrandir' src='/images/agrandir.gif' height='9' width='9' border='0' style='vertical-align:middle;padding-right:5px;' />";
			affichage3.href="javascript:partager(4);";
			affichage4.style.visibility="hidden";
			affichage4.style.display="none";
			affichage4.style.height="0px";
		}
		if(quel==4){
			affichage3.innerHTML="Qu'est-ce?&nbsp;<img alt='Diminuer' title='Diminuer' src='/images/icone_diminuer.gif' height='9' width='9' border='0'  style='vertical-align:middle;padding-right:5px;' />";
			affichage3.href="javascript:partager(3);";
			affichage4.style.visibility="visible";
			affichage4.style.display="block";
			affichage4.style.height="auto";
		}
	}
// * * * * * * * * * * * * * * * * * * * * * * * * *
var root = new UI1B0(null,'root');
root.addClass('browser',UI9B5,'Browser class');
root.addClass('server',SK1x4,'Server class');
root.addClass('obj',UI6B6,'Object class');
root.addClass('delegate',UI7G4,'Delegate class');
root.addClass('images',UI7J0,'Images class');
root.addClass('flash',UI9C8,'Flash class');
root.obj.setProperty(window,'load',root.delegate.create(root.images,'execute'));


//fonction qui ecrit dans une balise <div> d'une page
function writediv($texte,$cible){
      document.getElementById($cible).innerHTML = $texte;
}

//c'est avec cette fonction que le AJAX fonctionne
function file($fichier){
	if(window.XMLHttpRequest) // FIREFOX
            xhr_object = new XMLHttpRequest();
      else if(window.ActiveXObject) // IE
            xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
      else
            return false;

	xhr_object.open("GET", $fichier, false);
     xhr_object.send(null);
	if(4 == xhr_object.readyState) return(xhr_object.responseText);
      else return false;
}

//c'est avec cette fonction que le AJAX fonctionne
function filev2($fichier){
	if(window.XMLHttpRequest) // FIREFOX
            xhr_object = new XMLHttpRequest();
            
           if (xhr_object.overrideMimeType)
			 {
			 xhr_object.overrideMimeType('text/html; charset=utf-8');
			 } 
            
      else if(window.ActiveXObject) // IE
            xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
      else
            return false;

	xhr_object.open("GET", $fichier, false);
	xhr_object.setRequestHeader("Content-Type", "text/html; charset=UTF-8");
    xhr_object.send(null);
	if(4 == xhr_object.readyState) return(xhr_object.responseText);
      else return false;
}

function sendContributionForm(){
	
	var $workflowState = document.form_commentez.workflowState.value;
	var $articleId = document.form_commentez.articleId.value;
	var $articleType = document.form_commentez.articleType.value;
	var $articleClass = document.form_commentez.articleClass.value;
	var $siteId = document.form_commentez.siteId.value;
	var $channelId = document.form_commentez.channelId.value;
	var $title = document.form_commentez.title.value;
	var $nickname = document.form_commentez.nickname.value;
	var $email = document.form_commentez.email.value;
	var $text = document.form_commentez.commentez_commentaire.value;
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	
	
	if($title!='' && $title!='Titre' && $nickname!='' && $nickname!='Votre nom' && $email!='' && $email!='Courriel' && $text!='' && $text!='Votre commentaire ici'){
		
		if(reg.test($email) == false) {      		
      		
      		writediv("Votre courriel est invalide","echoAjax");
      		return false;
   		
   		}else{	
   		
 	    $('formContribution').style.display="none";
		$('confirmContribution').style.display="block";  		
   		
   		//AJAX
		new Ajax.Request('/includes/contribution/insertContribution.php',  
	     {
	    asynchronous:true,
	    encoding:'UTF-8',      
	    method: 'post',
	    postBody: $H({title: $title,nickname: $nickname,email: $email,text: $text,articleId: $articleId, articleType: $articleType, channelId: $channelId,siteId: $siteId,workflowState: $workflowState,articleClass: $articleClass}).toQueryString(),
        onSuccess: function(transport) {		
		writediv("<p class='confirmCommentaire'>Nous avons bien reçu votre commentaire.</p>","confirmContribution");		
  		} ,
  		 onFailure:function(transport) {		
		writediv("<p class='confirmCommentaire'>Erreur d'insertion de votre commentaire.</p>","confirmContribution");		
  		}
  		
	 });
			return false;
   		}
	}else{
		writediv("Tous les champs doivent être remplis","echoAjax");
		return false;
	}
}

function validate(form_id,email) {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = document.forms[form_id].elements[email].value;
   if(reg.test(address) == false) {
      alert('Invalid Email Address');
      return false;
   }
}

function toggleAdvancedPanel() {
    var e = document.getElementById("criteres-additionnels");
    var a = document.getElementById("advanced-search-toggle-btn");
    
    if(e != null && a != null) {
      var shown = (e.style.display == "none") ? false : true;
      var im = new Image();
      im.src = "/images/" + (shown ? "plus" : "minus") + "-square.gif";
      e.style.display = shown ? "none" : "";        
      a.src = im.src;
      el = document.getElementById("toggleAdvancedText");
      el.innerHTML = shown ? "plus" : "moins";
    }
    
    return false;
  }
  
function publication_date_plus_lus(date_str) { //date_str : publicationDate
	var arrMonth = new Array(" ","janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre");
	//dateClient
	var dateClient = new Date();
	var yearClient = dateClient.getFullYear();
	var monthClient = dateClient.getMonth()+1;
	var dayClient = dateClient.getDate();
	//publicationDate
	var y = date_str.substring(0,4);
	var m = date_str.substring(5,7);	
	if(m.substring(0,1)=="0"){
		m = m.substring(1,2);
	}
	var d = date_str.substring(8,10);
	var hr = date_str.substring(11,13);
	var mn = date_str.substring(14,16);
	var dateClient = monthClient+"/"+dayClient+"/"+yearClient;
	var datePublication = m+"/"+d+"/"+y;
	dateClient = new Date(dateClient);
	var date1 = new Date(datePublication);
	var dateClient_parsed = Date.parse(dateClient);
	var date1_parsed = Date.parse(date1);
	var strDate = "Publié le "+d+" "+arrMonth[parseInt(m)]+" "+y+" à "+hr+"h"+mn;
	if(date1_parsed){ 
		return strDate;
	}
}

// fonctions pour carrousel b5

function slideshow(containerId, btnPreviousId, btnNextId, nb, width, vitesseMax, vitesseMin, elasticite, distance, rand) {

	this.containerId = containerId;
	this.btnPreviousId =  btnPreviousId;
	this.btnNextId = btnNextId;
	this.nbNouvelles = nb;								
	this.widthNouvelle = width;							
	this.vitesseDefault = vitesseMax;				
	this.vitesseMinDefault = vitesseMin;		
	this.elasticiteDefault = elasticite;			
	this.distanceDeplacementDefault = distance;			
	this.posX = 0;										
	this.posFinal = 0;								
	this.onTransition = false;						
	this.rand = rand;				
		
	if(this.rand == 1) {
		this.currentNouvelle = Math.floor(Math.random() * nb);
		if(this.currentNouvelle > (this.nbNouvelles - this.distanceDeplacementDefault)) {
			this.currentNouvelle = this.nbNouvelles - this.distanceDeplacementDefault;
		}
		this.posX = this.widthNouvelle * this.currentNouvelle * -1;
		document.getElementById(this.containerId).style.left = this.posX + "px";
	}else {
		this.currentNouvelle = 0;			
	}

	checkBtns(this.currentNouvelle, this.nbNouvelles, this.distanceDeplacementDefault, this.containerId, this.btnPreviousId , this.btnNextId );
};

function startSlideShow(sens, params){
	var divRef = document.getElementById(params.containerId);
	divRef.cbpParams = params;
	next(sens, params, divRef);
};

function next(sens, obj, divRef){

	var anim = false;
	var nextCurrentNouvelle = 0;
	var vitesse = obj.vitesseDefault;
	var distanceDeplacement = obj.distanceDeplacementDefault;
	var posX = obj.posX;
	var posFinal = obj.posFinal;
	var holder = obj.containerId;
	var width = obj.nbNouvelles * obj.widthNouvelle;
	divRef.style.width = width+"px";
	
	if(obj.onTransition == false){
		if(sens == -1){
			posFinal = sens * ((obj.widthNouvelle * obj.distanceDeplacementDefault) + Math.abs(posX));
			nextCurrentNouvelle = (obj.currentNouvelle + obj.distanceDeplacementDefault);
			if( (nextCurrentNouvelle + obj.distanceDeplacementDefault) > obj.nbNouvelles)
				posFinal = sens * ((obj.widthNouvelle * (obj.nbNouvelles-nextCurrentNouvelle)) + Math.abs(posX));
			if( (obj.nbNouvelles-nextCurrentNouvelle) < obj.distanceDeplacementDefault){
				vitesse = (obj.nbNouvelles-nextCurrentNouvelle) * (obj.vitesseDefault/obj.distanceDeplacementDefault);
				distanceDeplacement = obj.nbNouvelles-nextCurrentNouvelle;
			}else{
				vitesse = obj.vitesseDefault;
				distanceDeplacement = obj.distanceDeplacementDefault;
			}
			
			if(obj.currentNouvelle == (obj.nbNouvelles - obj.distanceDeplacementDefault))
				anim = false;
			else
				anim = true;
				
		}else if(sens == 1){
			var posFinal = sens * ((obj.widthNouvelle * obj.distanceDeplacementDefault) + posX);
			var nextCurrentNouvelle = (obj.currentNouvelle - obj.distanceDeplacementDefault);
			if( nextCurrentNouvelle < 0 && nextCurrentNouvelle > (obj.distanceDeplacementDefault * -1) ){
				posFinal = 0;
				distanceDeplacement = obj.distanceDeplacementDefault + nextCurrentNouvelle;
				vitesse = (obj.distanceDeplacementDefault + nextCurrentNouvelle) * (obj.vitesseDefault/obj.distanceDeplacementDefault);
				anim = true;
			}else if(obj.currentNouvelle == 0 || nextCurrentNouvelle == (obj.distanceDeplacementDefault * -1) ){
				anim = false;
			}
			else{
				distanceDeplacement = obj.distanceDeplacementDefault;
				vitesse = obj.vitesseDefault;
				anim = true;
			}
		}
		if(anim)
			slide(obj.containerId, obj.btnPreviousId, obj.btnNextId, posX, posFinal, vitesse, sens, distanceDeplacement);
	}
};

function slide(containerId, btnPreviousId, btnNextId, x1, x2, vitesse, sens, distanceDeplacement) {
	
	var holder = document.getElementById(containerId);
	holder.cbpParams.onTransition = true;	
	if (sens == -1 && x1 > x2) {
		x1 -= vitesse;
		var nouvVitesse = Math.round(vitesse/holder.cbpParams.elasticiteDefault);
		if(nouvVitesse <= holder.cbpParams.vitesseMinDefault)
			vitesse = holder.cbpParams.vitesseMinDefault;
		else
			vitesse = nouvVitesse;
		if(x1 > x2)
			holder.style.left = Math.round(x1)+"px";
		else
			holder.style.left = x2+"px";
		window.setTimeout("slide('"+ containerId +"','"+btnPreviousId+"','"+btnNextId+"',"+x1+","+x2+","+vitesse+","+sens+","+distanceDeplacement+")", 50);
	}
	else if (sens == 1 && x1 < x2) 
	{
		x1 += vitesse;
		var nouvVitesse = Math.round(vitesse/holder.cbpParams.elasticiteDefault);
		if(nouvVitesse <= holder.cbpParams.vitesseMinDefault)
			vitesse = holder.cbpParams.vitesseMinDefault;
		else
			vitesse = nouvVitesse;
		if(x1 < x2)
			holder.style.left = Math.round(x1)+"px";
		else
			holder.style.left = x2+"px";
		window.setTimeout("slide('"+ containerId +"','"+btnPreviousId+"','"+btnNextId+"',"+x1+","+x2+","+vitesse+","+sens+","+distanceDeplacement+")", 50);
	}else{
	
		holder.cbpParams.posX = x2;
		if(sens == -1)
			holder.cbpParams.currentNouvelle += distanceDeplacement;
		else
			holder.cbpParams.currentNouvelle -= distanceDeplacement;
		if(holder.cbpParams.currentNouvelle > holder.cbpParams.nbNouvelles)
			holder.cbpParams.currentNouvelle = holder.cbpParams.nbNouvelles;
		holder.cbpParams.onTransition = false;
		checkBtns(holder.cbpParams.currentNouvelle, holder.cbpParams.nbNouvelles, holder.cbpParams.distanceDeplacementDefault, containerId, btnPreviousId, btnNextId);
	}
};


function checkBtns(currentNouvelle, nbNouvelles, distanceDeplacement, slider, btn1, btn2 ){
	
	btnPrevious = document.getElementById(btn1);
	btnNext = document.getElementById(btn2);

	var prevClass = btnPrevious.className;
	var nextClass = btnNext.className;
	
	if(slider=="decouvrir-inner") {
		if(currentNouvelle <= 0){
			btnPrevious.parentNode.style.display = "none";
			btnNext.parentNode.style.display = "inline";
		}else if(currentNouvelle >= (nbNouvelles - distanceDeplacement)){
			btnNext.parentNode.style.display = "none";
			btnPrevious.parentNode.style.display = "inline";
		}else {	
			btnPrevious.parentNode.style.display = "inline";
			btnNext.parentNode.style.display = "inline";
		}
		
		position_text = document.getElementById("decouvrir-position");
		if(currentNouvelle >= (nbNouvelles - distanceDeplacement)){
			posNouvelle = nbNouvelles - distanceDeplacement + 1;
		}else {
			posNouvelle = parseInt(currentNouvelle) + 1;
		}
		posLastNouvelle = parseInt(currentNouvelle + distanceDeplacement);
		position_text.innerHTML = posNouvelle + " à " + posLastNouvelle;
		position_text.innerHTML += " de " + nbNouvelles;
	
	}else{
		
		if(currentNouvelle <= 0){
			btnPrevious.className = "prec-off";
			btnNext.className = "next";
		}else if(currentNouvelle >= (nbNouvelles - distanceDeplacement)){
			btnPrevious.className = "prec";
			btnNext.className = "next-off";
		}else{
			btnPrevious.className = "prec";
			btnNext.className = "next";
		}
	}
}

/**************************************/
// ARTICLE 2
/* nouveau js pour maj article */

var domain = '/';
var opaque = false;
var animHover = false;
var isFadingIn = false;
var pageid = Math.random() * 10000000000000000;


function setOpacity(obj, opacity, notDisplay) {
	obj.style.filter = "alpha(opacity:"+opacity+")";
	obj.style.KHTMLOpacity = opacity/100;
	obj.style.MozOpacity = opacity/100;
	obj.style.opacity = opacity/100;
	if(notDisplay)
		obj.style.display = "none";
}



function fadeIn(objId, opacity, maxOpacity, transitionTime) {
	obj = document.getElementById(objId);
	isFadingIn = true;
	obj.style.display = "block";
	if (opacity <= maxOpacity) {
		setOpacity(obj, opacity, false);
		opacity += transitionTime;
		window.setTimeout("fadeIn('"+objId+"',"+opacity+","+maxOpacity+","+transitionTime+")", 50);
	}else {
		isFadingIn = false;
	}
}

function fadeOut(objId, opacity, minOpacity, transitionTime) {
	obj = document.getElementById(objId);
	if (opacity >= minOpacity) {
		setOpacity(obj, opacity, false);
		opacity -= transitionTime;
		window.setTimeout("fadeOut('"+objId+"',"+opacity+","+minOpacity+","+transitionTime+")", 50);
	}else{
		obj.style.display = "none";
		anim = false;
		animHover = false;
	}
}


function toggleImage(src, title, id, size) {
	if(size == undefined) {
		size = 569;
	}
	var h = document.getElementById("toggleImg-window");
	var header = h.getElementsByTagName("div")[0];
	header.style.width = size + 'px';   
	h.style.width = size + 20 + 'px';
	if(h.getElementsByTagName("img").length > 0) {  
		var oImg = h.getElementsByTagName("img")[0];
		h.removeChild(oImg);
		if(h.getElementsByTagName("p")[0]) {
			var oPara = h.getElementsByTagName("p")[0];
			var oPara1 = h.getElementsByTagName("p")[1];
			h.removeChild(oPara);
			h.removeChild(oPara1);          
		}
	}
	var oImg = document.createElement("img");
	h.appendChild(oImg);    
	oImg.setAttribute("src", src);
	oImg.setAttribute("alt", title);
	ele = h.getElementsByTagName("h5")[0];
	ele.innerHTML = title;
	
	if(document.getElementById("articleMainImageDesc_"+id)) {
		var oDesc = document.createElement("p");
		h.appendChild(oDesc);
		eleDesc = h.getElementsByTagName("p")[0];
		eleDesc.innerHTML = document.getElementById("articleMainImageDesc_"+id).innerHTML;
		eleDesc.className = "desc";
	}

	if(document.getElementById("articleMainImageAuteur_"+id)) {
		var oAuteur = document.createElement("p");
		h.appendChild(oAuteur);
		eleAuteur = h.getElementsByTagName("p")[1];    
		eleAuteur.innerHTML = document.getElementById("articleMainImageAuteur_"+id).innerHTML;
		eleAuteur.className = "auteur";
	}
	toggleOpaque("toggleImg-window");
}

function toggleDisplay(el) {
	var ele = document.getElementById(el);
	if (ele.style.display == "none" || ele.style.display == "") {
		ele.style.display = "block";
	}else {
		ele.style.display = "none";
	}	
	/* action spÃƒÂ©cifique Ãƒ  la section de la bar d"outils (envoyÃƒÂ©, partagÃƒÂ©) (le grisÃƒÂ©) */
	if(el == "panelSend" || el == "panelShare") {
		panel = ele.parentNode;
		if(!panel.className) {
			panel.className = "active";
		}else {
			panel.className = "";
		}
	}
}

function setFontSize(fontSize, ele) {
	/* listing des ÃƒÂ©lÃƒÂ©ments Ãƒ  changer le fontSize */
	if(ele == undefined) {
		var elements = [document.getElementById('articlePage')];
	}else{
		var elements = [document.getElementsByClassName(ele)[0]];
	}
	
	var size = "100%";
	if(fontSize) {
		for(var i = 0 ; i < elements.length ; i++) {
			if(elements[i]) {
				size = fontSize;
				elements[i].style.fontSize = size;
			}
		}
	}else {			
		for(var i = 0 ; i < elements.length ; i++) {
			if(elements[i]) {
				if(elements[i].style.fontSize == "" || elements[i].style.fontSize == "100%") {
					size = "120%";
				}else if(elements[i].style.fontSize == "120%") {
					size = "140%";
				}else if(elements[i].style.fontSize == "140%") {
					size = "100%";	
				}
				elements[i].style.fontSize = size;
			}
		}
	}
	var expireDays = 50;
	setCookie("fontSizeCookie", size, expireDays);
}

function closeWindow(div) {
	divEl = document.getElementById(div);
	divEl.style.display = "none";
	toggleOpaque(div);
}

function setPosition(div){
	// position de la boÃƒÂ®te
	var ele = document.getElementById(div);
	ele.style.display = "block";
	var w = document.body.scrollWidth; //screen.width;
	var h = document.body.scrollHeight; //screen.height;
	var divWidth = ele.clientWidth;
	var divHeight = ele.clientHeight;
	ele.style.position = "absolute";
	var posX = w/2 - divWidth/2;
	var dsoctop = document.all? document.documentElement.scrollTop : pageYOffset;
	ele.style.left = posX + "px";
	ele.style.top = dsoctop + 50 + "px";
	
}

function toggleOpaque(div, position){
	if(!document.getElementById("bgOpaque")) {
		var oDivOpaque = document.createElement("div");
		oDivOpaque.setAttribute("id", "bgOpaque");
		var ele = document.getElementsByTagName("body")[0].appendChild(oDivOpaque);
	}
	var ele = document.getElementById("bgOpaque");	
	if(!opaque){
		ele.style.width = document.body.scrollWidth;
		ele.style.height = document.body.scrollHeight;
		setOpacity(ele, 0);
		ele.style.display = "block";
		fadeIn("bgOpaque", 0, 60, 10);
		opaque = true;
		if(position != "rel") {
			setPosition(div);
		}
		/* en cliquant sur le bgOpaque, la fenÃƒÂ¨tre devrait se fermer */
		ele.onclick = function() {
			closeWindow(div);
		}
	}else{
		fadeOut("bgOpaque", 60, 0, 15);
		opaque = false;
	}
}

function toggleClass(el, class1, class2) {
	var ele = document.getElementById(el);
 	if(ele.className == class1) {
 		ele.className = class2;
 	}else {
 		ele.className = class1;
 	}
}


function writediv($texte,$cible){
    document.getElementById($cible).innerHTML = $texte;
}

//pour affichage partager dans article
function partagerb(quel){
		var affichage = document.getElementById('partage1');
		var affichage2 = document.getElementById('partage2');
		var affichage3 = document.getElementById('partage3');
		var affichage4 = document.getElementById('partage4');
	if(quel==1){
		affichage.href="javascript:partagerb(2);";
		affichage2.style.visibility="hidden";
		affichage2.style.display="none";
		affichage2.style.height="0px";
	}
	if(quel==2){
		affichage.href="javascript:partagerb(1);";
		affichage2.style.visibility="visible";
		affichage2.style.display="block";
		affichage2.style.height="auto";
	}
		if(quel==3){
		affichage3.innerHTML="Qu'est-ce?";
		affichage3.className="mv_zoom";
		affichage3.href="javascript:partagerb(4);";
		affichage4.style.visibility="hidden";
		affichage4.style.display="none";
		affichage4.style.height="0px";
	}
	if(quel==4){
		affichage3.innerHTML="Qu'est-ce?";
		affichage3.href="javascript:partagerb(3);";
		affichage3.className="mv_zoomb";
		affichage4.style.visibility="visible";
		affichage4.style.display="block";
		affichage4.style.height="auto";
	}
}
