	function planComptable(nv){
		getAllSoldes();orderComptes();Idx=0
		fnt="planComptable(\\\'"+nv+"\\\')";
		popUp("<font color=orange><b>Plan Comptable "+(nv!=-1?"FILTRÉ":"COMPLET")+" et Comptes</b></font>","<div style='width:550px'>"+buildPlan(nv!=-1?1:0)+"</div>");
		document.getElementById("popFrame").style.display="none";
			showComptes();
		document.getElementById("popFrame").style.display="block"
		if(nv!=-1)dspCmpt(nv);
	}
	function filterPlan(){
		plan=Array();for(i=0;i<planComplet.length;i++)if(gotSld.indexOf(","+planComplet[i][0])!=-1)plan[plan.length]=planComplet[i]
	}
	function buildPlan(f){
		Idx=0;ouvert=",";if(f)filterPlan();else plan=planComplet
		t=styles(330,70)+"<a href='javascript:showAllPlan()'>Ouvrir en entier</a><br><br>";
		pl=0;ok=Array(0,0,0,0,0,0);for(i=0;i<plan.length;i++){
			pl0=(i>0?plan[i-1][0].length:1)
			pl1=(i<plan.length-1?plan[i+1][0].length:1);
			t+="<div class=cl id="+plan[i][0]+(pl>1?" style='display:none'":"")+">"+
					(pl1>pl?"<a id=a"+plan[i][0]+" href=\"javascript:opnCls('"+plan[i][0]+"')\" class=acl>+</a>":"")+
					(plan[i][0]+"    ").substr(0,6).replace(/ /g,"&nbsp;")+plan[i][1]+"<br>";ok[pl]=1
			for(j=pl1;j<=pl;j++){t+="</div>";ok[j]=0}
			pl=pl1
		}
		return t
	}
	function opnCpt(no){
		var ops=document.getElementById("ops"+no).style;var v=document.getElementById("aOps"+no);
		if(ops.display=="block"){
			ops.display="none";v.innerHTML="+";
		}else{
			ops.display="block";v.innerHTML="-";
		}
	}
	function opnCls(no){
		noc=no+",";if(ouvert.indexOf(","+noc)!=-1){
			ouvert=ouvert.replace(noc,"");a="+";stl="none"
		}else{
			if(ouvert.indexOf(","+noc)==-1)ouvert+=noc;a="-";stl="block"
		}
		var v=document.getElementById("a"+no);if(v)v.innerHTML=a
		var x=document.getElementById(no).childNodes;
		for(var i=0;i<x.length;i++)
			if(x[i].tagName=="DIV")
				if(x[i].id.substr(0,no.length)==no)x[i].style.display=stl
	}
	function searchInsertPoint(no){
		var j="";
		for(var i=0;i<no.length;i++){
			j+=no.substr(i,1);
			if(document.getElementById(j))var id=j;else i=no.length
		}
		return id
	}
	function insertCompte(no,t){
		id=searchInsertPoint(no)
		var tx=document.getElementById(id).innerHTML;var s=tx.indexOf("<div")
		if(s>-1)tx=tx.substr(0,s)+t+tx.substr(s);else tx=tx+t
		document.getElementById(id).innerHTML=tx
	}
	function dspCmpt(no){
		for(var i=0;i<plan.length;i++){
			var u=plan[i][0];var v=document.getElementById(u).style;l=u.length;
			if(no.substr(0,l-1)!=u.substr(0,l-1)){
				v.display="none";
			}else{
				v.display="block";
				var w=document.getElementById("a"+u);
				if(w)if(no.substr(0,l)==u.substr(0,l)){
					w.innerHTML="-"
					if(ouvert.indexOf(","+u+",")==-1)ouvert+=u+","
				}
			}
		}
		opnCpt(no+Idx)
	}
	function showAllPlan(){
		ouvert=",";for(var i=0;i<plan.length;i++){
			var u=plan[i][0];document.getElementById(u).style.display="block"
			var v=document.getElementById("a"+u);
			if(v){
				v.innerHTML="- &nbsp;"
				ouvert+=u+","
			}
		}
	}

