function t2U(t){t=String(t);var e=encodeURIComponent||escape;return e(t).replace(/\+/g,"%2B");}
txt2URI=t2U;
function t2U_(t){t=String(t);return txt2URI(t.replace(/ /g,"_"));}
txt2URI_=t2U_;
function t2H(t){t=String(t);return t.replace(/&/g,"&amp;").replace(/\"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}txt2HTML=t2H;
function H2t(t){t=String(t);return t.replace(/&amp;/g,"&").replace(/&quot;/g,"\"").replace(/&#039;/g,"'").replace(/&lt;/g,"<").replace(/&gt;/g,">")}
HTML2txt=H2t;
function nl2br(t){return t.replace(/\n/g,"<br />");}
function getId(i){return document.getElementById(i);}
function show (t){t.style.display="inline";}
function show_(t){t.style.display="";}
function hide (t){t.style.display="none";}
function pop(url,larg,haut,posx,posy,opt){var loc=(opt && opt.loc==1)?'1':'0';window.open(url,"_blank","height="+haut+",width="+larg+",left="+posx+",top="+posy+",location="+loc+",menubar=0,resizable=1,screenX="+posx+",screenY="+posy+",scrollbars=1,status=0,toolbar=0");}
function pourBDD(t){t=String(t);return t.replace(/\\/g,"\\\\").replace(/'/g,"\\'");}
function loc(d){top.location.href=d;}
function gT(){return (new Date).getTime();}
var lastc=0;function tlc(){lastc=gT();}function locnc(t){if (gT()-lastc>300){loc(t);}}
function lc(el,id,p1,p2,p3){try{el.href='/lien.php?id='+id+'&p1='+p1+'&p2='+p2+'&p3='+p3+'&url='+txt2URI(el.href);el.onmousedown='';}catch(e){}return true;}
function array_search(t,a){var i;for (i=0;i<a.length;i++){if (a[i]==t){return i;}}return -1;}
function in_array(t,a){return (array_search(t,a)!=-1);}
function multisort0(a,b){return a[0]>b[0];}
function arrayassoc(t){var r=new Array();for (i=0;i<t.length-1;i=i+2){r[t[i]]=t[i+1];}return r;}
var BASEURL='http://www.autotitre.com';
var logerreur="";
/* menu */
var menuover="";

function print_r(t){var ret=''+t+"\n";var j=0;w=window.open();for (i in t){j++;ret=ret+i+":"+t[i]+"\n";}w.document.write(ret);}

function CO(){this.c=function(n,v,s){
if (s){var d=new Date();d.setTime(gT()+s);var e="; expires="+d.toGMTString();}
else{var e="";}document.cookie=n+"="+v+e+"; path=/;domain=.autotitre.com";}
this.r=function(n){n=n+"=";var a=document.cookie.split(';');for(var i=0;i<a.length;i++) {
var c=a[i];while(c.charAt(0)==' ') c=c.substring(1,c.length);
if (c.indexOf(n)== 0) return c.substring(n.length,c.length);}return null;}
this.d=function(n){this.d(n,"",-1);}}

var cook=new CO();

var ismob=0;
var navi=navigator.userAgent.toLowerCase();
function mob(t){
if (/opera/.test(navi)){ return;}
var lh=location.href;
var hm='m.autotitre.com';
var hw='www.autotitre.com';
var vuri=lh.substring(lh.indexOf('www.')+17);
if (window.location.hostname==hm){ismob=1;var vuri=lh.substring(lh.indexOf('m.')+15);}
var vm='http://'+hm+vuri;
var vw='http://'+hw+vuri;
if (t==1){loc(vm);}
if (t==2){cook.c('mob',2,3600*24*7);loc(vw);}
if (screen.width<700){
var _mc=cook.r('mob');if (window.location.hostname==hw){if (_mc==1){loc(vm);ismob=1;}else{if (_mc!=2){if (confirm('Redirection vers la version mobile...')){
cook.c('mob',1,3600*24*7);loc(vm);}else{cook.c('mob',2,3600*24*7);ismob=2;}}else{ismob=2;}}}else{ismob=1;}
}
}
mob(0);
function wmob(){if (ismob>0){document.write('<button onclick="mob('+((ismob==1)?2:1)+');">Afficher la version '+((ismob==1)?'classique':'mobile')+'</button>');}}
var bloquemenu=false;
function men(i,f){
if (window['Atouslesmm']){Atouslesmm.loadsm();}
if(bloquemenu){if (i!=menuover){bloquemenu=false;window.focus();men(menuover,0);}else{return;}}
var cn="tdmenuout";
if (f){cn="tdmenuon";getId('men'+menPOSITION).className="tdmenuout";menuover=i;setTimeout("men2('"+i+"',1)",250);}
else{getId('men'+menPOSITION).className="tdmenuon";menuover="";setTimeout("men2('"+i+"',0)",250);}
getId('men'+i).className=cn;
}

function men2(i,f){
if (f) {if (i==menuover) show(getId('sm'+i));}
else{if (menuover!=i){hide(getId('sm'+i));}}
}

function changeMenuRech(m){
	/* Affichage des bons input et boutons */
	var sel=getId('selrech');
	for (var i=0;i<sel.options.length;i++){
		if (parseInt(sel.options[i].value)==m){
			sel.options[i].selected=true;
			i=99;
		}
	}
}
function trechajax(){
var v=getId('trech').value;var i=parseInt(getId('selrech').value);var r=new RegExp(".+:","");var res=v.match(r);
if (!res){do{
if (i==6){ajax("/ajax-ft.php","GET","output=json&q="+txt2URI(v),false,trech);break;}
if (i==2){ajax("/ajax-forum.php","GET","output=json&q="+txt2URI(v),false,trech);break;}
if (i==3){ajax("/ajax-annonce.php","GET","output=json&q="+txt2URI(v),false,trech);break;}
ajax("/ajax-actu.php","GET","output=json&q="+txt2URI(v),false,trech);
}while(false);}
}

function getUrlRech(){
var v=getId('trech').value;
var r='/';
var i=parseInt(getId('selrech').value);
do{
if (i==6){r='/redir-ft.php?q='+txt2URI(v);break;}
if (i==2){r="/redir-forum.php?q="+txt2URI(v);break;}
if (i==3){r="/redir-annonce.php?q="+txt2URI(v);break;}
if (i==8){r="http://shop.autotitre.com/ctl/do/search?siteSearchQuery="+txt2URI(v);break;}
r="/?q="+txt2URI(v);
}while(false);
return r;
}
function goRech(){loc(getUrlRech());}
function selrechchange(t){t.style.backgroundPosition="0px -60px";}
function menuFixeChange(mf){
getId('menuF').style.position=(mf?'absolute':'fixed');
getId('menuF'+(mf?'open':'close')).style.display='';
getId('menuF'+(!mf?'open':'close')).style.display='none';
if (!isConnecte) alert('Veuillez vous connecter ou vous inscrire pour conserver cette préférence');
else ajax('/ajaxion.php?action=menuFixe&actif='+(mf?'0':'1'),'GET','null',false);
}
  
function getMenuRech(txt){
return ''+
'<table cellspacing="0"><tr><td><form id="frech" onsubmit="goRech();return false;"><table cellspacing="0" width="500" style="background:#000 url(http://up.autotitre.com/img/11/fondf.gif);border-radius:7px;">'+
''+
'<tr height="25" valign="top">'+
'<td style="width:40px;" align="center" ><a href="/" onclick="scrollTo(0,0);return false;" title="retour en haut de page"><img src="/b" class="s top_png" border="0" width="28" height="21" /></a></td>'+
'<td width="380" id="menutdform" >'+
'<select name="type" style="width:90px;" onchange="selrechchange(this)" id="selrech"><option value="1" id="optrechactu">Actualité</option><option id="optrechforum" value="2">Forum</option><option value="3" id="optrechannonce">Annonces</option><option value="6" id="optrechfiche">Fiche tech.</option><option value="8" id="optrechshop">Shopping</option></select><img src="/b" width="5" height="21" /><img src="/b" width="26" height="21" id="imgrech" class="s loupe_png" /><input type="text" value="'+(txt?txt2HTML(txt):'')+'" style="width:195px;" id="trech" autocomplete="off" /><span id="spanorech"></span><br /><div id="trechbox" class="sugg"></div>'+
'</td><td id="menutdsubmit" style="width:100px;"><a href="#" id="arech" onmouseover="this.onfocus();" onfocus="this.href=getUrlRech();">Recherche</a></td>'+
'<td style="width:40px;" align="center"><a href="/" onclick="scrollTo(0,0);return false;" title="retour en haut de page"><img src="/b" class="s top_png" border="0" width="28" height="21" /></a></td>'+
'</td></tr></table></form></td><td style="width:10px;'+(!menuFixe?'display:none':'')+'" align="right" id="menuFclose" valign="top"><a href="#" onclick="menuFixeChange(true);return false;"><img src="/b" border="0" width="7" height="7" class="s clo_png"/></a></td>'+
'<td style="width:10px;'+(menuFixe?'display:none':'')+'" align="right" id="menuFopen" valign="top"><a href="#" onclick="menuFixeChange(false);return false;"><img src="/b" border="0" width="7" height="7" class="s ope_png"/></a></td>'+
'</tr>'+
'</table>';
}

var req=null;
function ajax(page,method,data,sync,obj){
 /* if (req!=null && req.readyState>0) req.abort(); **stop activite?** */
 if(sync){sync=true;}else{sync=false;}if(obj){}else{obj=null;}
 if (data==undefined) data="null";
 if(window.XMLHttpRequest){try{req=new XMLHttpRequest();}catch(e){logerreur+='///'+e;req=false;}}else if(window.ActiveXObject){try{req=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{req=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){logerreur+='///'+e;req = null;}}}

 if(req!=null){
  req.onreadystatechange=function(){
   var r=(this && this.readyState)?this:req;
   if (r.readyState==4){
     if (r.status==200){
      var res=r.responseText;if(res.length>9 && res.substring(0,9)=="while(1);"){res=res.substring(9);}
      try{if(obj!=null){obj.ajaxok(res);}else{eval(res);}}catch(e){document.title='Erreur ajax '+e+res;logerreur+='///'+e+res;}
     }
     else{
      if (obj!=null && obj.ajaxko){
        try{ obj.ajaxko(r.status);}catch(e){}
      }
      else{
       /* document.title+='NO network ? (status:'+r.status+')'; */
      }
     }
    }
  }
  
  if(!method) method='GET';
  if(method == "GET"){
   if(data == "null"){req.open("GET", page,!sync);}else{req.open("GET", page+"?"+data,!sync);}
  }
  else if(method == "POST"){req.open("POST", page,!sync);}
  if(method == "GET"){req.send(null);}
  else if(method == "POST"){req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');req.setRequestHeader("Content-Length",data.length);req.send(data);}
  if (sync) {try{eval(req.responseText);}catch(e){alert('Erreur'+e+' /// '+req.responseText);logerreur+='///'+e;}}
  return true;
 }
 else{return false;}
}
var oldtitle=document.title;
function titlemp(nb){
document.title="(MP) "+oldtitle;
}

var ifpage=0;
var pagevar=[''];
var pagevarnow='';
var pagevarp=[1];
var pagevarpnow=[1];
var nextverifmp=45;

function newPage(n){
 if (ifpage==n){
   pagevar[n]=pagevarnow; 
   pagevarp[n]=pagevarpnow;
 }
 else{
   // préc
   if (pagevar[n]!=undefined){ justeloadTags(pagevar[n],pagevarp[n]);}
   ifpage=n;
 }
}

function minusc(t){var a="àáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ";var b="aaaaaaæceeeeiiiiðnooooo÷øuuuuyþy";t=t.toLowerCase();try{
for(k=0;k<t.length;k++){if (t.charCodeAt(k)>200){for (j=0;j<a.length;j++){t=t.replace(a.charAt(j),b.charAt(j));}}}}catch(e){logerreur+='///'+e;}return t;}

var ongover='';
var ongpage='';
var ongattente='';

var ongto=null;
function chOngOver2(t){
   try{
	getId('lien'+ongover).style.display="none";
	getId('lien'+t).style.display="inline";
    getId('sectionbas').innerHTML=getId('lien'+t).innerHTML;
	getId('Ong'+ongover).className=(ongover==ongpage)?"actif":"";
   }
   catch(e){
      logerreur+='///'+e;
   }
   ongover=t;
}
function chOngOver(t){
   if (ongover!=t){
	 ongto=window.setTimeout('try{chOngOver2(\''+t+'\');}catch(e){}',300);
	 ongattente=t;
   }
   
   try{
	getId('Ong'+t).className=(t==ongpage)?"actif":"over"; //over en 2	
	getId('Ong'+t+'b').className=(t==ongpage)?"actif":"over"; //over en 2	
   }
   catch(e){
	logerreur+='///'+e;
   }
}
function chOngOut(t){
   try{
	getId('Ong'+t).className=(t==ongpage)?"actif":((t==ongover)?"lastover":"");
	getId('Ong'+t+'b').className=(t==ongpage)?"actif":((t==ongover)?"lastover":"");
   }
   catch(e){   logerreur+='///'+e;}
   window.clearTimeout(ongto);
   ongattente='';
}
var lmbs=new Array();function triAl(a,b){return ((a.toLowerCase()<b.toLowerCase())?-1:1);}var lstmodo=new Array("lionel","yam","eric","moderateur","vassim","autoweb","kanter","kaz99","mixomatos","da_master","nethil","bigjim","le.gaumais");
function profil(pseudo){
m=false;
for (i=0;i<lstmodo.length;i++){if (minusc(pseudo)==lstmodo[i]){m=true;break;}}

document.write('<a href="/forum/profil.php?qui='+txt2HTML(pseudo)+'" onclick="javascript:voirprofil(\''+txt2HTML(pourBDD(pseudo))+'\');return false" class="lienForumAutre" '+((m)?'style="color:#ff0000"':'style="color:#000"')+'>'+txt2HTML(pseudo)+'</a> ');
		
var profilpseudo=minusc(pseudo);
for (i=0;i<lmbs.length;i++){
	if (lmbs[i]==profilpseudo) { var objtmp=document.getElementById("lmbsimg"+i);objtmp.src="http://up.autotitre.com/forum/img/el.gif";objtmp.title="en ligne";}
}

}function cacherPourRecherche(){return true;}var nbprofopen=0; function voirprofil(pseudo){window.open("/forum/profil.php?qui="+txt2URI(pseudo),"_blank","height=400,width=600,left="+(10+nbprofopen*20)+",top="+(20+nbprofopen*30)+",location=0,menubar=0,resizable=1,screenX="+(10+nbprofopen*20)+",screenY="+(20+nbprofopen*30)+",scrollbars=0,status=0,toolbar=0");nbprofopen++;if(nbprofopen>15) nbprofopen=0;}
function demandeprofil(){window.open("/forum/voirprofil.php","_blank","height=420,width=600,left=50,top=50,location=1,menubar=0,resizable=1,screenX=80,screenY=80,scrollbars=0,status=0,toolbar=0");}

function posx(o){if(o.offsetParent) return o.offsetLeft+posx(o.offsetParent);return o.offsetLeft;}
function posy(o){if (o.offsetParent) return o.offsetTop+posy(o.offsetParent);return o.offsetTop;}

function AC_AddExtension(src, ext){if (src.indexOf('?') != -1)return src.replace(/\?/, ext+'?');else  return src + ext;}

function AC_Generateobj(objAttrs, params, embedAttrs){
var str = '<object ';for (var i in objAttrs) str += i + '="' + objAttrs[i] + '" ';str += '>';
for (var i in params) str += '<param name="' + i + '" value="' + params[i] + '" /> ';str += '<embed ';
for (var i in embedAttrs) str += i + '="' + embedAttrs[i] + '" ';str += ' ></embed></object>';document.write(str);}

function AC_FL_RunContent(){
var ret=AC_GetArgs(arguments,".swf","movie","clsid:d27cdb6e-ae6d-11cf-96b8-444553540000","application/x-shockwave-flash");
AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);}

function AC_SW_RunContent(){var r=AC_GetArgs(arguments,".dcr","src","clsid:166B1BCA-3F9C-11CF-8075-444553540000",null);
AC_Generateobj(r.objAttrs, r.params, r.embedAttrs);}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){var ret = new Object();ret.embedAttrs = new Object();
ret.params = new Object();ret.objAttrs = new Object();
for (var i=0; i < args.length; i=i+2){var currArg = args[i].toLowerCase();    
switch (currArg){case "classid":break;case "pluginspage":ret.embedAttrs[args[i]] = args[i+1];break;
case "src":case "movie":args[i+1] = AC_AddExtension(args[i+1], ext);ret.embedAttrs["src"]=args[i+1];ret.params[srcParamName] = args[i+1];break;
case "onblur":case "oncellchange":case "onclick":case "ondblClick":
case "ondrag":case "ondragend":case "ondragenter":case "ondragleave":case "ondragover":case "ondrop":
case "onfinish":case "onfocus":case "onhelp":case "onmousedown":case "onmouseup":case "onmouseover":case "onmousemove":
case "onmouseout":case "onkeypress":case "onkeydown":case "onkeyup":case "onload":case "onlosecapture":case "onpropertychange":
case "onreadystatechange":case "onrowsdelete":case "onrowenter":case "onrowexit":case "onrowsinserted":case "onstart":
case "onscroll":case "onbeforeeditfocus":case "onactivate":case "onbeforedeactivate":case "ondeactivate":case "type":case "codebase":
ret.objAttrs[args[i]] = args[i+1];break;
case "width":case "height":case "align":case "vspace": case "hspace":case "class":case "title":case "accesskey":case "name":
case "id":case "tabindex":ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];break;
default:ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];}}
ret.objAttrs["classid"] = classid;
if (mimeType) ret.embedAttrs["type"] = mimeType;
return ret;}

//suggest
function SB(nom,link){
	this.nom=nom;
	this.box=getId(this.nom+"box");
	this.sf=getId(this.nom);
	this.oldvalue=this.sf.value;
	if (link) this.link=link; else this.link=null;
	
	this.suggests=new Array();
	this.searchValue=null;
	this.hoveredsuggest=-1;
	
	getId(nom).setAttribute("autocomplete","off");
getId(nom).onkeydown=function(F){try{window[this.id].searchKeyDown(event.keyCode);}catch(G){window[this.id].searchKeyDown(F.keyCode);}};
getId(nom).onkeyup=function(F){try{window[this.id].searchKeyUp(event.keyCode);}catch(G){window[this.id].searchKeyUp(F.keyCode);}};
getId(nom).onblur=function(){window[this.id].hideSugbox();}

this.hoversuggest=function(A){for(var B=0;B<this.suggests[1].length;B++){this.box.getElementsByTagName("a")[B].className="";}if(A!=-1){this.box.getElementsByTagName("a")[A].className="hovered";this.hoveredsuggest=A;}}

  this.V=function(V){
    getId(this.nom).value=V.replace(/ *\([^\)]*\)/, "");
  }
	this.searchKeyDown=function(A){
		if(this.box.style.display=="block"){
			if(A!=38 && A!=40){
				this.hoveredsuggest=-1
			}
			if(A==38 && this.hoveredsuggest!=-1){
				this.hoveredsuggest--;
				this.hoversuggest(this.hoveredsuggest);
				this.V(this.suggests[1][this.hoveredsuggest]);
			}
			if(A==40 && this.hoveredsuggest<this.suggests[1].length-1){
				this.hoveredsuggest++;
				this.hoversuggest(this.hoveredsuggest);
				this.V(this.suggests[1][this.hoveredsuggest]);
			}
			if(A==38 && this.hoveredsuggest==-1){
				this.V(this.searchValue);
			}
		}
	}
	this.searchKeyUp=function(A){
		if(A!=38&&A!=40){
			this.searchValue=getId(this.nom).value;
		}
		if(getId(this.nom).value!="" && A!=13 && A!=27 && A!=38 && A!=40){
			this.givesuggests();
		}
		if((getId(this.nom).value==""||A==27) && this.box.style.display=="block"){
			this.hideSugbox();
		}
	}
	
	this.givesuggests=function(){
		this.suggests=[[],[]];
		window[this.nom+"ajax"]();
	}
	this.ajaxok=function(txt){
		var tlink='';
		this.suggests=eval(txt);
		if(this.suggests[1].length==0){
			this.hideSugbox()
		}
		else{
			this.showSugbox()
		}
		this.box.innerHTML="";
		
		for(var A=0;A<this.suggests[1].length;A++){
			if (this.suggests[3] && this.suggests[3][A]){
				tlink=this.suggests[3][A];
			}
			else{
				if (this.link==null){
					tlink="#";
				}
				else{
					tlink=this.link+txt2URI(this.suggests[1][A]);
				}
			}
			this.box.innerHTML+='<a href="'+tlink+'" style="width:'+(this.sf.offsetWidth-6)+'px;text-align:left" onmouseover="window[\''+this.nom+'\'].hoversuggest('+A+');" '+((tlink=="#")?'onclick="window[\''+this.nom+'\'].V(window[\''+this.nom+'\'].suggests[1][window[\''+this.nom+'\'].hoveredsuggest]);getId(\''+this.nom+'\').focus();return false;"':'')+
						  ' title="'+txt2HTML(this.suggests[1][A])+'">'+txt2HTML(this.suggests[1][A])+'</a>';
		}
	}
	this.showSugbox=function(){

		this.box.style.top=(posy(this.sf)+this.sf.offsetHeight-1)+"px";
		if (this.nom=='trech'){
    this.box.style.left=(posx(this.sf)-300)+"px";
    }
    else{
		this.box.style.left=(posx(this.sf))+"px";
		}
		this.box.style.width=(this.sf.offsetWidth-2)+"px";
		this.box.style.display="block"
	}
	this.hideSugbox=function(){
		setTimeout('getId("'+this.nom+'box").style.display="none"',250);
	}
}

function dcE(t){return document.createElement(t);}
function dcTN(t){return document.createTextNode(t);}
function oaEL(o,n,f,c){if (c==undefined){c=false;}if (window.addEventListener){o.addEventListener(n,f,c);}else if(window.attachEvent){o.attachEvent("on"+n,f);}}
Object.prototype.aEL=function(n,f,c){oaEL(this,n,f,c);}
function eaC(e,c){e.appendChild(c);}
function erC(e,c){while(e.firstChild) e.removeChild(e.firstChild);}
function erCaJS(e,js){erC(e);eaJS(e,js);}
function eaJS(e,js){var c;do{if(typeof(js)=="string"){eaC(e,dcTN(js));break;}if(typeof(js)=="object"){if(js.length==1){eaC(e,dcTN(js[0]));break;}if(js[0]&&typeof(js[0])=="object"&&js[0]instanceof Array){for(i in js){if(typeof(js[i])=="string"){eaC(e,dcTN(js[i]));}
else{eaJS(e,js[i]);}}break;}c=dcE(js[0]);if(js[1]){for(i in js[1]){if(i=='style'){for(j in js[1]['style']){c[i][j]=js[1]['style'][j];}}else{c[i]=js[1][i];}}}if(js[2]){eaJS(c,js[2]);}
eaC(e,c);}}while(false);}

var pxpos=[];
var pypos=[];

function deppubs(s,d){try{var obp=getId(d);var obpb=getId(s);var x=posx(obp);var y=posy(obp);}catch(e){}if (pxpos[s]!=posx(obp) && pypos[s]!=posy(obp)){deppubv(s,d);}
setTimeout("deppubs('"+s+"','"+d+"');",1000);
}
function deppubv(s,d){try{var obp=getId(d);var obpb=getId(s);obpb.style.left=posx(obp)+"px";obpb.style.top=posy(obp)+"px";}catch(e){};}

function deppub(s,d){deppubs(s,d);try{var obpb=getId(s);obpb.style.display="block";}catch(e){};}
function imgred(dw,dh,ow,oh){var r;if (dw>=ow && dh>=oh) r=1;else if (dw/dh<ow/oh) r=dw/ow;else r=dh/oh;return [Math.round(ow*r),Math.round(oh*r)];}
function eq(a,b){return a.replace(/(\r\n|\r|\n)/g,'\n')==b.replace(/(\r\n|\r|\n)/g,'\n');}
function imm(t,o){t.firstChild.style.display=o?'inline':'none';}

function Arbre(n,nb,nbf,p,v){
this.go=function(hid){return ajax("/ajax-arbre.php","GET",Math.random()+"&type="+txt2URI(this.t)+"&rep="+txt2URI(this.rep())+"&id="+hid,false,this);}
this.ajaxok=function(r){var j=eval('('+r+')');this.f=[];this.fn=[];this.ftop=[];this.ajaxO(j);}
this.ajaxko=function(s){}
this.setJSVar=function(v){this.jsvar=v;}

this.f=[];
this.fn=[];
this.ftop2=[];
this.ftop=[];
this.p=p;
this.v={};
this.l=-1;
this.mypos="";
this.isO=[];
this.isL=false;
this.isLH=[];

this.cons=function(n,nb,nbf,p,v){
this.n=n;
this.nb=nb;
this.nbf=nbf;
if (this.p){
this.setJSVar(this.p.jsvar);
this.l=this.p.l+1;
this.t=this.p.t;
}
else{
if (n!=""){this.t=this.n;this.n="";}
}
if (typeof(v)=='object'){this.v=v;}
}
this.cons(n,nb,nbf,p,v);

this.myPos=function(){if (this.l==-1) return "";this.mypos=this.p.pos(this.n);return this.mypos;}
this.charge=function(hid){if (this.nbf!=this.f.length){this.go(hid);}this.isL=true;}
this.get=function(n){
var ret;
if (n==""){return this;}
a=n.split("/");
i=array_search(a[0],this.fn);
if (i>=0){a.shift();n=a.join("/");return this.f[i].get(n);}
return null;
}
this.getById=function(eid){
var f;var t;
t=eid.split("_");
if (t.length>1) t=t[1]; else t=t[0];
if (t=="") return this;
t=t.split(".");
if ((t.length-2)==this.l){t=t[this.l+1].split("-");return this.f[t[0]];}
else{t=t[this.l+1].split("-");return this.f[t[0]].getById(eid);}
}
this.pos=function(n){return array_search(n,this.fn);}
this.open=function(hid){
hid=hid.split("_").pop();
i=array_search(hid,this.isO);
o=(i>=0);
if (this.isL){ih=array_search(hid,this.isLH);if (ih<0){this.openH(hid);}}
else{this.charge(hid);}
getId(this.jsvar+"ul_"+hid).style.display=(o?"none":"list-item");
getId(this.jsvar+"i_"+hid).className=(o?"s ac":"s ao");

if (!o){this.isO.push(hid);}
else{this.isO.splice(i,1);}
}
this.ajaxO=function(r){var hid=r.id;var f=r.f;for (i=0;i<f.length;i++){this.root().add(f[i][0],f[i][1],f[i][2],f[i][3]);}this.openH(hid);}
this.openH=function(hid){erCaJS(getId(this.jsvar+"ul_"+hid),this.toJSONNode(1,hid));getId(this.jsvar+"i_"+hid).className="s ao";this.isLH.push(hid);}
this.root=function(){if (this.p) return this.p.root();return this;}
this.openById=function(eid){this.getById(eid).open(eid);}
this.add=function(n,nb,nbf,v){
var i,a;
if (n=="" && this.l==-1){
this.cons(n,nb,nbf,null,v);
}
else{
a=n.split("/");
if (a.length==1){
if (v && v.top==1){this.ftop.push(this.f.length);}
if (v && v.top==2){this.ftop2.push(this.f.length);}
this.f.push(new Arbre(n,nb,nbf,this,v));
this.fn.push(n);
}
else{
i=array_search(a[0],this.fn);
if (i>=0){
a.shift();
n=a.join("/");
this.f[i].add(n,nb,nbf,v);
}
}
}
}
this.addA=function(a){for (i=0;i<a.length;i++){this.add(a[i][0],a[i][1],a[i][2],a[i][3]);}}
this.toString=function(){var esp="",i,r;for (i=-1;i<this.l;i++) esp+=" ";r=esp+"n="+this.n+"\n";if (this.p!=null) r+=esp+"p="+this.p.n+"\n";r+=esp+"nbf="+this.nbf+"\n";r+=esp+"nb="+this.nb+"\n";r+=esp+"f.length="+this.f.length+"\n";for(i=0;i<this.f.length;i++) r+=esp+"f "+i+" = \n"+this.f[i];r+=esp+" L ? "+((this.f.length==this.nbf)?"O":"N")+"\n";return r;}

this.url=function(){
var r="";
if (this.t=="Fiches techniques"){
r="/fiche-technique";
if (this.l>-1){
return this.p.url()+"/"+txt2URI_(this.n);
}
}
if (this.t=="Photos"){
r="/photo/";
if (this.l>-1){
return this.p.url()+txt2URI_(this.n)+"/";
}
}
return r;
}
this.rep=function(){if (this.l<=0) return this.n;return this.p.rep()+"/"+this.n;}        
this.toJSON=function(check,hid){
var a,b,c,f,i,r,s,n,u;
n=(this.l==-1)?this.t:this.n;
if (check===undefined) check=1;
if (hid===undefined) hid="";
u=this.url();

var ic=["a",{href:u,id:this.jsvar+"_"+hid,onclick:function(){var t=(this.id).split("_");window[t[0]].openById(this.id);return false;}},["img",{src:"/b",id:this.jsvar+"i_"+hid,className:"s ac",width:"18",height:"18",border:"0"}]];
var io=["a",{href:u,id:this.jsvar+"_"+hid,onclick:function(){var t=(this.id).split("_");window[t[0]].openById(this.id);return false;}},["img",{src:"/b",id:this.jsvar+"i_"+hid,className:"s ao",width:"18",height:"18",border:"0"}]];
var iv=["a",{href:u,id:this.jsvar+"_"+hid},["img",{src:"/b",id:this.jsvar+"i_"+hid,className:"s vide",width:"18",height:"18",border:"0"}]];
a=["li",{id:"li_"+hid}];
b=[];
do{
if (this.nbf==0 || this.nb==1){this.isO.push(hid);this.isL=true;this.isLH.push(hid);if(this.f.length==1){b.push(io);}else{b.push(iv);}break;}
if (this.f.length==this.nbf){if (check){b.push(io);this.isO.push(hid);}else{b.push(ic);}this.isL=true;this.isLH.push(hid);break;}
b.push(ic);
}while(false);
if (u==location.pathname){b.push(["a",{href:u},["b",{},n]]);}else{b.push(["a",{href:u},n]);}

if (this.v && this.v.info){b.push(["small",{}," ("+this.v.info+")"]);}
f=this.toJSONNode(check,hid);
b.push(["ul",{id:this.jsvar+"ul_"+hid,style:{display:((check==2 || in_array(hid,this.isO))?"list-item":"none")}},f]);
a.push(b);
return a;
}
this.toJSONNode=function(check,hid){
var i,f=[];
if (check==1) check=0;
if (!hid) hid="";

if (this.f.length>1){
for(i=0;i<this.ftop2.length;i++){f.push(this.f[this.ftop2[i]].toJSON(check,hid+((hid=="")?this.ftop2[i]+"-2":"."+this.ftop2[i]+"-2")));}
for(i=0;i<this.ftop.length;i++){f.push(this.f[this.ftop[i]].toJSON(check,hid+((hid=="")?this.ftop[i]+"-1":"."+this.ftop[i]+"-1")));}
if ((this.ftop2.length>0 && this.f.length-this.ftop2.length>0) || this.ftop.length>0) f.push(["hr",{width:"80px",align:"left"}]);
for(i=0;i<this.f.length;i++){if (!in_array(i,this.ftop2)) f.push(this.f[i].toJSON(check,(hid+((hid=="")?""+i:"."+i))));}
}
else{for(i=0;i<this.f.length;i++){f.push(this.f[i].toJSON(check,(hid+((hid=="")?""+i:"."+i))));}}
if (f.length==1) f=f[0];
if (f.length==0) f="";
return f;
}
}
