	var a = "";
	var b = "";
	var miniscale = {
		running : null ,
		run : function(el, start,end,speed,ratio,div,elem,bloc,func){
			//if(!this.running){
				this.el = el;
				miniscale.elem = document.getElementById(el);
				miniscale.start = start;
				miniscale.k = end;
				miniscale.p = this.k;
				miniscale.div = div;
				miniscale.ratio = ratio;
				miniscale.speed = speed;
				this.func = func;
				if(a) this.setAutoReduce(); else this.gminiscale(el,start,end,speed,ratio,div,elem,bloc);
			//}else{
			//	 return;
			//}
		},
		gminiscale : function(el,start,end,speed,ratio,div,elem,bloc){
			_this = this;
			if(this.elem.style.height != this.k+"px"){
				a = this.el+",";
				this.i = start;
				this.elem.style.visibility = "visible";
				this.elem.style.borderWidth = "2px";
				this.elem.style.borderColor = "#5B331A";
				if(this.func!="") this.elem.getElementsByTagName('div')[0].innerHTML = "";
				this.o = setInterval("_this.expand()",this.speed);
			}else{
				this.i = end;
				this.o = setInterval("_this.reduce(null)",this.speed);
			}
		},
		expand : function(){
			this.elem.style.height = !document.all ? this.i+"px" : this.i ;
			if(this.i>=this.k){ 
				clearInterval(this.o);
				this.elem.style.height = this.k+"px";
				this.running = false;
				if(this.func!="") eval(this.func);
			}
			this.i = Math.ceil(this.ratio*this.p/100);
			this.p = this.p-this.i;
			this.i = Math.ceil(this.k-this.p);
			
		},
		reduce : function(){
			this.elem.style.height = !document.all ? this.i+"px" : this.i ;
			if(this.i<=this.start){ 
				clearInterval(this.o); 
				this.elem.style.height = 0+"px";
				this.elem.style.visibility = "hidden";
				this.elem.style.borderWidth = "0px";
				if(this.func!="") this.elem.innerHTML = "";
				a = "";
				this.running = false;
			}
			this.i = Math.ceil(this.ratio*this.p/100);
			this.p = this.p-this.i;
			this.i = Math.ceil(this.start+this.p); 
		},
		setAutoReduce : function(){
			var j = a.split(",");
			if(j[0]){
				this.el1 = j[0];
				this.elem1 = document.getElementById(j[0]);
				miniscale.i2 = document.getElementById(j[0]).offsetHeight;
				miniscale.start2 = 0;
				miniscale.p2 = this.i2;
				_this = this;
				this.o = setInterval("_this.autoReduce()",this.speed); 
			}
		},
		autoReduce : function(){
			this.elem1.style.height = !document.all ? this.i2+"px" : this.i2 ;
			if(this.i2<=this.start2){ 
				clearInterval(this.o); 
				a = "";
				this.elem1.style.height = this.start+'px';
				this.elem1.style.visibility = "hidden";
				this.elem1.style.borderWidth = "0px";
				if(this.el1 != this.el) this.gminiscale(this.el,this.start,this.end,this.speed,this.ratio,this.div,this.elem,this.bloc)
			}
			this.i2 = Math.ceil(this.ratio*this.p2/100);
			this.p2 = this.p2-this.i2;
			this.i2 = Math.ceil(this.start2+this.p2); 
		}
	};
	function getSiteMap(file,elem,cle){
		var _elem = elem;
		if(window.ActiveXObject) xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		if(window.XMLHttpRequest) xmlHttp = new XMLHttpRequest();
		document.getElementById(_elem).innerHTML = "<div style='text-align:center; margin-top: 50px;font-size: 150%; font-weight: bold;font-family: arial;'><img src=\"__image/wait_black.gif\" /></div>";
		xmlHttp.onreadystatechange = function(){
			if(xmlHttp.readyState == 4){
				var getFileContent = xmlHttp.responseText;
				document.getElementById(_elem).innerHTML = getFileContent;
				//openDiv();
			}
		};
		var iecache = new Date();
		xmlHttp.open("GET",file+"?cle="+cle+"&ienocache="+iecache);
		xmlHttp.send(null);
	};
	
	function showLink(el){
		var posy = getPosition.findPosY(el);
		var posx = getPosition.findPosX(el);
		var d = document.createElement("div");
		d.style.backgroundColor = "#FAD38D";
		d.style.position = "absolute";
		d.style.zIndex = "999";
		d.style.top = posy-20+"px";
		d.style.left = posx+20+"px";
		d.style.border = "solid 1px";
		d.style.padding = "2px";
		d.innerHTML = el.innerHTML;
		_d = d;
		document.body.appendChild(d);
		el.onmouseout = function(){
			document.body.removeChild(_d);	
		};
	};
	
//-----------------//
	var scrollElement = {
		goTo : function(_this,elem){
			this.elem = document.getElementById(elem);
			this.from = document.documentElement.scrollTop;
			this.to = getPosition.findPosY(document.getElementById(elem))-30;
 			if(this.from<this.to) this.size = this.to-this.from;
 			if(this.from>this.to) this.size = this.from-this.to;
   			if(this.to>document.body.scrollHeight - document.documentElement.clientHeight)
   				this.to = document.body.scrollHeight - document.documentElement.clientHeight;
 			this.taux = 20;
 			this.pourcent = Math.ceil(this.taux*this.size/100);
 			this.initMove();
		},
		initMove : function(){
			if(this.from < this.to) this.go = setInterval("scrollElement.moveDown()",2);
			if(this.from > this.to) this.go = setInterval("scrollElement.moveUp()",2);
		},
		moveDown : function(){
			document.documentElement.scrollTop = this.from;
			if(this.from==this.to){
				clearInterval(this.go);
				this.elem.style.cursor = "pointer";
				//this.elem.style.backgroundImage = "url(__image/up.gif)";
				this.elem.style.backgroundRepeat = "no-repeat";
				this.elem.style.backgroundPosition = "right center";
				this.elem.onclick = function(){
					id = "src_"+this.id;
					this.style.cursor = "";
		 			this.style.backgroundImage = "";
		 			this.style.backgroundRepeat = "";
		 			this.style.backgroundPosition = "";
					scrollElement.goTo(this,id,'articleContenu');
				}
			}
			this.calcul('b');
		},
		moveUp : function(){
			document.documentElement.scrollTop = this.from;
			if(this.from==this.to) clearInterval(this.go); 
			this.calcul('h');
		},
		calcul : function(direction){
			if(direction=="b"){
				this.from = Math.ceil(this.taux*this.size/100);
				this.size = this.size-this.from;
				this.from = Math.ceil(this.to-this.size);
			}else{
				this.from = Math.ceil(this.taux*this.size/100);
				this.size = this.size-this.from;
				this.from = Math.ceil(this.to+this.size);
			}
		}
	}
//-----------------//	
	function pop(chemin,nom,param,el,type){ 
		var image = document.getElementById(el);
		var mediaId = image.id.replace("miniature_","");
		var path = image.src;
		var legend = image.alt;
		
		if(image.offsetHeight>130 || image.offsetWidth>300){ 
                  popImage(path.replace("mini_",""),'',param); 
                  return false; 
            }
		
		if(!document.all) var flt = image.style.cssFloat;
		if(document.all) var flt = image.style.styleFloat;
		var x = getPosition.findPosX(image);
	 	var y = getPosition.findPosY(image);
	 	var w = image.offsetWidth;
		var h = image.offsetHeight;
		var newBloc = document.createElement('div');
		newBloc.onclick = function(){ this.parentNode.removeChild(this);};
		if(!type) var pos = "top:"+y+"px;left:"+x+"px;";
		if(window.XMLHttpRequest) newBloc.setAttribute("style","position:absolute;"+pos+"z-index:999;width:"+w+"px;height:"+h+"px; border: solid 1px; cursor: pointer;");
		if(window.ActiveXObject) newBloc.style.setAttribute("cssText","position:absolute;"+pos+"z-index:999;width:"+w+"px;height:"+h+"px; border: solid 1px; cursor: pointer;");
		newBloc.title = "Cliquer pour fermer l'image";
		if(!type){ document.body.appendChild(newBloc); }else{ image.parentNode.insertBefore(newBloc,image); }
		
		var scaleElem = new scaleImg(newBloc,path,image,flt);
		//if()
		scaleElem.setMove();
		scaleElem.path = path;
		scaleElem.param = param;
		scaleElem.text = legend;
		scaleElem.elSource.style.visibility = "hidden";
		scaleElem.mediaId = mediaId;
		scaleElem.afterDone = function(){

			var inside = new insert();
			
			inside.path = this.path;
			inside.param = this.param;
			inside.bloc = this.bloc;
			inside.pos = this.endw;
			inside.file();
			
			this.elSource.style.visibility = "visible";
			this.bloc.style.backgroundColor = "#fff";	
				
 			var leg = new viewLegend();
 			leg.bloc = this.bloc;
 			leg.text = this.text;
 			leg.posbloc = this.posbloc;
 			leg.mediaId = this.mediaId;
			leg.display();
		};
		
	};
//-----------------//	
	function anim(ratio,w,endr,endw){
		this.ratio = ratio;
		this.w = w;
		this.endr = endr;
		this.endw = endw;
		this.sweep = function(){
			this.w = Math.ceil(this.ratio*this.endr/100); 
			this.endr = this.endr-this.w;
			this.w = Math.ceil(this.endw-this.endr);
		};
		this.sweep();
	};
//-----------------//	
	function scaleImg(bloc,path,elSource,flt){
		_this = this;
		this.elSource = elSource;
		this.bloc = bloc;
		this.path = path;
		this.flt = flt;
		this.w = bloc.offsetWidth;
		this.h = bloc.offsetHeight;
		this.ratio = 30;
		this.getPosition();
		this.setPosition();
	//-----------------//
		this.endw = Math.ceil(this.w*2.2);
		this.endw2 = this.endw-this.w;
		this.endr = this.endw2;
	//-----------------//	
		this.endh = Math.ceil(this.h*2.2);
		this.endh2 = this.endh-this.h;
		this.endr2 = this.endh2;
	//-----------------//
		if(this.posbloc==3){
			this.p = 0;
			this.endp = Math.ceil(this.w*2.2)-this.w;
			this.endp2 = this.endp;
		}
	};
	scaleImg.prototype.setMove = function(){
		this.go = setInterval("_this.move()",5);
	};
	scaleImg.prototype.move = function(){
		this.bloc.style.width = this.w+"px";
		this.bloc.style.height = this.h+"px";
		if(this.posbloc==3) this.bloc.style.marginLeft = "-"+this.p+"px";
		if(this.w >= this.endw){ clearInterval(this.go); this.afterDone(); }
	//-----------------//
		var scaleW = new anim(this.ratio,this.w,this.endr,this.endw);
		this.w = scaleW.w;
		this.endr = scaleW.endr;
	//-----------------//
		var scaleH = new anim(this.ratio,this.h,this.endr2,this.endh);
		this.h = scaleH.w;
		this.endr2 = scaleH.endr;
	//-----------------//
		if(this.posbloc==3){
			var scaleP = new anim(this.ratio,this.p,this.endp2,this.endp);
			this.p = scaleP.w;
			this.endp2 = scaleP.endr;	
		}
	};
	scaleImg.prototype.afterDone = function(){};

	scaleImg.prototype.getPosition = function(){
		var quart = document.getElementById('articleContenu').offsetWidth/4;
		this.q1 = new Array(0,quart);
		this.q2 = new Array(quart,quart*2);
		this.q3 = new Array(quart*2,quart*3);
		this.q4 = new Array(quart*3,quart*4);
	};
	scaleImg.prototype.setPosition = function(){
		var relPos = getPosition.findPosX(this.bloc)-getPosition.findPosX(document.getElementById('articleContenu'));
		if(relPos<this.q1[1]){
			this.posbloc = 1;
		}else if(relPos>this.q2[0] && relPos<this.q2[1]){
			this.posbloc = 2;
		}else{
			this.posbloc = 3;
		}
	};
//-----------------//	
	function insert(){
		_this = this;
		this.bloc = null;
		this.path = null;
		this.param = null;
		this.pos = null;
		this.file
		this.file = function(){
			var wait = document.createElement('img');
			_wait = wait;
			if(window.XMLHttpRequest) wait.setAttribute("style","position: absolute;left: 50%;margin-left:-10px;top:50%;margin-top:-20px;");
			if(window.ActiveXObject) wait.style.setAttribute("cssText","position: absolute;left: 50%;margin-left:-10px;top:50%;margin-top:-20px;");
			wait.src = '__image/wait.gif';
			
			var img = document.createElement('img');
			img.src = this.path.replace("mini_","");
			img.id = this.path.replace("mini_","");
			
			_file = img.src;
			_nom = "";
			_param = this.param;
			
			this.plus = document.createElement('div');
			if(window.ActiveXObject) this.plus.style.setAttribute("cssText","color:#fff;cursor:pointer;position: absolute; top:-1px ; left:"+(this.pos)+"px;");
			if(window.XMLHttpRequest) this.plus.setAttribute("style","color:#fff; cursor:pointer; position: absolute; top:-1px ; left:"+(this.pos)+"px;");
			this.plus.innerHTML = "<img src='__image/zoom.png' title='Afficher en taille réelle' />";
			this.plus.onclick = function(e){ 
				if (!e) var e = window.event;
				e.cancelBubble = true;
				if (e.stopPropagation) 
				e.stopPropagation();
				popImage(_file,_nom,_param);
			}
			
			this.bloc.appendChild(wait);
			this.bloc.appendChild(this.plus);

			if(window.XMLHttpRequest) img.setAttribute("style","width:"+this.bloc.style.width+"; height:"+this.bloc.style.height+";");
			if(window.ActiveXObject) img.style.setAttribute("cssText","width:"+this.bloc.style.width+"; height:"+this.bloc.style.height+";position: absolute; z-index: 200;");
			if(window.ActiveXObject){
				this.bloc.appendChild(img);
			}
			if(window.XMLHttpRequest){
				img.onload = function(){
					_this.bloc.removeChild(_wait);
					_this.bloc.appendChild(this);
				};
			}
		};
	};
//-----------------//	
	function viewLegend(){
		_this = this;
		this.bloc = null;
		this.text = null;
		this.posbloc = null;
		this.mediaId = null,
		this.go = function(){
			if(this.posbloc==1)
				 var pos = "margin-left:"+(this.bloc.offsetWidth+20)+"px;";
			else
				 var pos = "margin-left:-220px;";
				 
			this.blocLeg = document.createElement('div');
			

			this.blocLeg.className = "popLegend";
			this.blocLeg.onclick = function(e){
				if (!e) var e = window.event;
				e.cancelBubble = true;
				if (e.stopPropagation) 
				e.stopPropagation();}
 			if(window.XMLHttpRequest) 
 				this.blocLeg.setAttribute("style","position:absolute;top:-2px;background-color:#000;"+pos
 					+"width:200px;color:#ccc;opacity:.0;font-size:90%;font-style:italic;font-family:arial; border: solid 2px #fff;");
 			if(window.ActiveXObject) 
 				this.blocLeg.style.setAttribute("cssText","position:absolute;top:-2px;background-color:#000;"+pos
 					+"width:200px;color:#ccc;filter:alpha(opacity=0);font-size:90%;font-style:normal;font-family:arial; border: solid 2px #000;");
 			
 				
 					
			this.blocLeg.innerHTML = "<div style='padding:10px;'>"+this.text+"</div>";
			this.bloc.appendChild(this.blocLeg);
			//this.bloc.appendChild(this.plus);
			this.w = 0;
			this.endw = 90;
			this.endr = this.endw;
			this.go = setInterval("_this.move()",5);
		};
		this.display = function(){
			_this = this;
			if(window.ActiveXObject) var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			if(window.XMLHttpRequest) var xmlHttp = new XMLHttpRequest();
			xmlHttp.onreadystatechange = function(){
				if(xmlHttp.readyState == 4){
					var getContent = xmlHttp.responseText;
					if(getContent!=""){ _this.text = getContent; _this.go();}
				}
			}
			var iecache = new Date();
			xmlHttp.open("GET","../xhr.legend.php?cle="+this.mediaId);
			xmlHttp.send(null);	
		};
		this.move = function(){
			if(window.XMLHttpRequest) this.blocLeg.style.opacity = "."+this.w;
			if(window.ActiveXObject) this.blocLeg.style.filter = "alpha(opacity="+this.w+")";
			if(this.w >= this.endw){ 
				clearInterval(this.go);
				if(window.XMLHttpRequest) this.blocLeg.style.opacity = ""; 
				if(window.ActiveXObject) this.blocLeg.style.filter = "";
				this.afterDone(); 
			}
			var scaleLeg = new anim(20,this.w,this.endr,this.endw);
			this.w = scaleLeg.w;
			this.endr = scaleLeg.endr;	
		};
		this.afterDone = function(){
			
		};
	};
//-----------------//

	function setSiteMapWidth(el){		

	};
