
lib_obj.prototype.add = function(g,h){
						this.oTop[g] = new lib_obj('divTop'+h+'_'+g,'divCont'+h);
						this.oSub[g] = new lib_obj('divSub'+h+'_'+g,'divCont'+h+'.document.divTop'+h+'_'+g);
						this.oSub[g].vis = 1;
						}

function C0(a,b,c){
	rd = (rd_sub[a][b] != 0)?c:2;
	if(bw.ns4) eval("oCont["+a+"].oTop["+b+"].ref.images['i"+a+"_"+b+"'].src = switchImgs["+rd+"]");
	else eval("document.images['i"+a+"_"+b+"'].src = switchImgs["+rd+"]");
}
/************************************************************************************
This is the function that changes the sub menus to folded or unfolded state.
************************************************************************************/
function menu(a,b){
	if(bw.bw){
			 t = oCont[a].oSub[b];
			 // ---
			 if(t.vis == 0){
					   	   t.showIt();
						   t.vis = 1;
						   C0(a,b,0)
					   	   }
			 else{
				 t.hideIt();
				 t.vis = 0;
				 C0(a,b,1)
				 }
			
			 for(i=1;i<oCont[a].nm;i++){ 
			 	if(oCont[a].oSub[i-1].vis == 1){
					oCont[a].oTop[i].moveIt(0,oCont[a].oTop[i-1].y + ((!bw.ns4)?oCont[a].oTop[i-1].h:oCont[a].oTop[i-1].ref.height) + oCont[a].oSub[i-1].h + offset_y[a][i]);
				} 
				else oCont[a].oTop[i].moveIt(0,oCont[a].oTop[i-1].y + ((!bw.ns4)?oCont[a].oTop[i-1].h:oCont[a].oTop[i-1].ref.height) + offset_y[a][i]);
			 }
			 if(t.vis == 0) clip_vl[a] -= t.h
			 else clip_vl[a] += t.h
			 oCont[a].clipTo(0,148,clip_vl[a],0,1);
	}
			 // ---
}

function initFoldout(){
	switchImgs = ['/img/close.gif','/img/open.gif','/img/_blank.gif'];
	oCont = [];
	//Create Object
	for(h=0;h<numContSub.length;h++){
									oCont[h] = new lib_obj('divCont'+h);//remplaçant new makeMenu('divCont'+h)
									oCont[h].showIt();
									oCont[h].nm = numContSub[h];
									oCont[h].oTop = [];
									oCont[h].oSub = [];
									for(i=0;i<oCont[h].nm;i++){
											  				  //alert("-------> h = "+h+"\n-------> i = "+i);
											  				  oCont[h].add(i,h);
											  				  if(i == oCont[h].nm-1) oCont[h].oTop[0].moveIt(0,0);
											  				  }
									}
	//p = new lib_doc_size(0);
	if(bw.ns4) oCont[1].moveIt(600,90);
	
	clip_vl = [0,0]
	//Positionning Object
	for(h=0;h<numContSub.length;h++){
			for(i=0;i<oCont[h].nm;i++){
					//
					(vs_sub[h][i] == 0)?C0(h,i,1):C0(h,i,0);
					//

					//
					if(vs_sub[h][i] == 0){
						oCont[h].oSub[i].hideIt();
						oCont[h].oSub[i].vis = 0;
					}
					//

					//
					if(vs_sub[h][i-1] == 0){
						if(i != 0){
						oCont[h].oTop[i].moveIt(0,oCont[h].oTop[i-1].y + ((!bw.ns4)?oCont[h].oTop[i-1].h:oCont[h].oTop[i-1].ref.height) + offset_y[h][i]);
						}
						else oCont[h].oTop[i].moveIt(0,0);
					}
					//

					//
					else{
						if(i != 0){
						oCont[h].oTop[i].moveIt(0,oCont[h].oTop[i-1].y + ((!bw.ns4)?oCont[h].oTop[i-1].h:oCont[h].oTop[i-1].ref.height) + oCont[h].oSub[i-1].h + offset_y[h][i]);
						oCont[h].oSub[i].moveIt(0,((!bw.ns4)?oCont[h].oTop[i].h:oCont[h].oTop[i].ref.height));
						}
						else{
						oCont[h].oTop[i].moveIt(0,0)
						oCont[h].oSub[i].moveIt(0,oCont[h].oTop[i].y + ((!bw.ns4)?oCont[h].oTop[i].h:oCont[h].oTop[i].ref.height));
						}
					}
					//
					clip_vl[h] += ((!bw.ns4)?oCont[h].oTop[i].h:oCont[h].oTop[i].ref.height) + ((vs_sub[h][i] == 1)?((!bw.ns4)?oCont[h].oSub[i].h:oCont[h].oSub[i].ref.height):0) + offset_y[h][i]
					//

			}
	oCont[h].clipTo(0,148,clip_vl[h],0,1);
	}
}