
	
	function Rubrique(int_id,str_titre, str_type, str_dir){

/******************************************/
/**********DECLARATION DE PROPRIETE********/
/******************************************/
	this.titre = str_titre;
	this.type = str_type; //soit "infos", soit "projets"
	this.dir = "content/" + str_dir + "/";
	this.ouvert = false;
	this.index = int_id;
	this.id = "rub_" + int_id;
	this.content = new Array();
	this.html = "";
	this.scriptPath  = "a_rubrique["+this.index+"]";
		
/******************************************/
/**********DECLARATION DE METHODE********/
/******************************************/

//ouverture/fermeture de la rubrique
//-----------------------------------------
	this.switchOuverture = function() {
//		alert('test')	;
		oDiaporama.hideDiapo();
		if (this.content.length == 0) {
			this.initBlocs();			
		}else{			
			this.togleBlocs();	
			this.setCss();
		}
	//	this.setBottom(false);
	}

//***********************
//initialise un ï¿½tat d'ouverture
//***********************
this.setOuverture = function(b) {	
	var div = $('content_'+this.id);
	if (b==true) {
		div.show();
		this.ouvert = true;
		this.setCss();
	}else{
		div.hide();
		this.ouvert = false;
		this.setCss();
	}
	//this.setBottom(false);
	setBtStatus();
	setBgStatus();
}


//affichage/masquage du content
//-------------------------------------	
	this.togleBlocs = function(){
		//blocs
		var div = $('content_'+this.id);		
		if (div.visible()==false) {
			div.show();
		//	if (this.content[this.content.length-1].ouvert) this.setBottom(true);
			this.ouvert = true;
		}else{
			div.hide();	
		//	this.setBottom(false);
			this.ouvert = false;
		}
		setBtStatus();	
		setBgStatus();
		
		var divSub = $('content_'+this.content[this.content.length - 1].id);
		//alert("divSub = " + divSub + " - " + divSub.visible());
		var divBot = $('bottom_'+this.id);
		if ((divSub.visible())&&(this.ouvert)&&(this.type=="projets")) {
			//this.setBottom(true);
			divBot.show();	
		}else{
			divBot.hide();
			//this.setBottom(false);
		}
		
	}
	
	this.setBottom = function(b) {		
		var div = $('bottom_'+this.id);
		//alert(div + "-" + b);
		if (b==false) {
			div.hide();
		}else{
			div.show();		
		}

	}


//affectation du style CSS
//----------------------------
	this.setCss = function(){
		
		var div = $(this.id);
		if (this.ouvert==true) {
			div.removeClassName('rubrique_off');
			div.addClassName('rubrique_on');					
		}else{
			div.removeClassName('rubrique_on');
			div.addClassName('rubrique_off');	
		}
		
	}

//HTML de la rubrique (appelï¿½ une seule fois, ï¿½ la premiï¿½re ouverture)
//------------------------
	this.createHtml = function () {
		var specLast = "";
		//alert(this.index + " -- " + a_rubrique.length);
		if (this.index== a_rubrique.length-1) {
			specLast = "_last";
		}
		var str_html = new String();
		str_html+="<div id=\"" + this.id + "\" class=\"rubrique_off\">\n";
		str_html+="<div id=\"titre_"+this.id+"\" class=\"rubrique_titre"+specLast+"\" onClick=\""+this.scriptPath+".switchOuverture();\">"+this.titre+"</div>\n";
		str_html+="<div id=\"content_"+this.id+"\" class=\"rubrique_content\">\n</div>\n";	
		str_html+="<div id=\"bottom_"+this.id+"\" class=\"bloc_bottom_rubrique_projets\"><div>&nbsp;</div></div>";	
		str_html+="</div>\n";	
		this.html = str_html;	
	
	}
	
//content (appelï¿½ une seule fois, ï¿½ la premiï¿½re ouverture)
//-----------------------------------------------------------------

	this.initBlocs = function() {
				
		var thisObj = this;
		var tagXML = Left(this.type, this.type.length-1);
			
		new Ajax.Request("func/detectFolder.php", {
			method: 'post',
			parameters: {
				dir: this.dir,
				xmlFile : "proprietes_"+tagXML+".xml"
			},
			onSuccess: function(transport){
				thisObj.parse(transport.responseXML);
			}
		});
		
		this.parse = function(xmlDoc){
			
			var tagXML = Left(this.type, this.type.length-1);

			var tab = new Array();
			var tabXML = xmlDoc.getElementsByTagName(tagXML);

			for (var iP = 0; iP < tabXML.length; iP++) {				
				
				//propriï¿½tï¿½s de l'objet
				var obj_index = iP;
				var obj_parent = this;
				var obj_dir = "";
				var obj_nom_projet = "&nbsp;";
				var obj_titre = "&nbsp;";
				var obj_chapeau = "&nbsp;";
				var obj_texte = "&nbsp;";
				var obj_deployable = "non";
				var obj_deploye = "oui";
						
				//vï¿½rification et affectation des valeurs
				if (verifXMLNodes(tabXML[iP].getElementsByTagName('dir'))) obj_dir = tabXML[iP].getElementsByTagName('dir')[0].firstChild.nodeValue;
				if (verifXMLNodes(tabXML[iP].getElementsByTagName('nom_projet'))) obj_nom_projet = tabXML[iP].getElementsByTagName('nom_projet')[0].firstChild.nodeValue;
				if (verifXMLNodes(tabXML[iP].getElementsByTagName('titre'))) obj_titre = tabXML[iP].getElementsByTagName('titre')[0].firstChild.nodeValue;
				if (verifXMLNodes(tabXML[iP].getElementsByTagName('chapeau'))) obj_chapeau = tabXML[iP].getElementsByTagName('chapeau')[0].firstChild.nodeValue;
				if (verifXMLNodes(tabXML[iP].getElementsByTagName('texte'))) obj_texte = tabXML[iP].getElementsByTagName('texte')[0].firstChild.nodeValue;							
				if (verifXMLNodes(tabXML[iP].getElementsByTagName('deployable'))) obj_deployable = tabXML[iP].getElementsByTagName('deployable')[0].firstChild.nodeValue;							
				if (verifXMLNodes(tabXML[iP].getElementsByTagName('deployé'))) obj_deploye = tabXML[iP].getElementsByTagName('deployé')[0].firstChild.nodeValue;							
				
				//retraitement pour les noeuds le nï¿½cessitant
				if (obj_deployable=="non") {
					obj_deployable = false;
				}else{
					obj_deployable = true;
				}
				if (obj_deploye=="non") {
					obj_deploye = false;
				}else{
					obj_deploye = true;
				}
						
				//creation des objets PROJETS ou BLOCS		
				var vi_parent;		
				if (this.type=="projets") {					
					tab.push(new Projet(obj_index, obj_parent, obj_nom_projet, obj_dir));	
					var tab_temp = new Array();
					obj_dir = "";
					tab_temp.push(new Bloc(0, tab[obj_index], obj_titre, obj_chapeau, obj_texte, obj_dir, obj_deployable, obj_deploye));
					tab[obj_index].content = tab_temp;
					vi_parent = tab[obj_index].content[0];
				}else{
					tab.push(new Bloc(obj_index, obj_parent, obj_titre, obj_chapeau, obj_texte, obj_dir, obj_deployable, obj_deploye));
					 vi_parent = tab[obj_index];
				}


				//Crï¿½ation des objets VIGNETTES associï¿½
				if (verifXMLNodes(tabXML[iP].getElementsByTagName('vignette'))) {
					var a_vign = new Array();
					var arr_illus = tabXML[iP].getElementsByTagName('vignette');
					for (var iI = 0; iI < arr_illus.length; iI++) {
					
						//propriï¿½tï¿½ des vignettes
						var vi_ligne = "1";
						var vi_diaporama = "";
						var vi_fichier = "";
						var vi_preview = "";
						var vi_hauteur = "";
						var vi_largeur = "";
						
						//vï¿½rification et affectation des valeurs
						if (verifXMLNodes(arr_illus[iI].getElementsByTagName('ligne'))) 
							vi_ligne = arr_illus[iI].getElementsByTagName('ligne')[0].firstChild.nodeValue;
						if (verifXMLNodes(arr_illus[iI].getElementsByTagName('diaporama'))) 
							vi_diaporama = arr_illus[iI].getElementsByTagName('diaporama')[0].firstChild.nodeValue;
						if (verifXMLNodes(arr_illus[iI].getElementsByTagName('fichier'))) 
							vi_fichier = arr_illus[iI].getElementsByTagName('fichier')[0].firstChild.nodeValue;
						if (verifXMLNodes(arr_illus[iI].getElementsByTagName('preview'))) 
							vi_preview = arr_illus[iI].getElementsByTagName('preview')[0].firstChild.nodeValue;
						if (verifXMLNodes(arr_illus[iI].getElementsByTagName('hauteur'))) 
							vi_hauteur = arr_illus[iI].getElementsByTagName('hauteur')[0].firstChild.nodeValue;
						if (verifXMLNodes(arr_illus[iI].getElementsByTagName('largeur'))) 
							vi_largeur = arr_illus[iI].getElementsByTagName('largeur')[0].firstChild.nodeValue;
							
						//crï¿½ation de l'objet Vignette
						a_vign.push(new Vignette(iI, vi_parent, vi_ligne, vi_diaporama, vi_fichier, vi_preview, vi_hauteur, vi_largeur));
						
						//affectation
						if (this.type == "projets") {
							tab[obj_index].content[0].content = a_vign;
						}
						else {
							tab[obj_index].content = a_vign;
						}
					}
					

				}

			}
			
			this.content = tab;			
			this.displayBlocs();
		}
		
	}
	
	this.displayBlocs = function()  {
		
		var div = $('content_'+this.id);
		if (div.empty()) {
			var str_display = "";
			for (var iR = 0; iR < this.content.length; iR++) {
				this.content[iR].createHtml();
				str_display += this.content[iR].html;
				
			}
			div.update(str_display);
			if (this.type == "projets") {
				for (var iR = 0; iR < this.content.length; iR++) {
					this.content[iR].close();
				}
			}
			div.hide();	
			
			if (this.type != "projets") {
				this.togleBlocs();		
				this.setCss();
							
			}
			

			for (var i = 0; i < this.content.length; i++) {
				if (!this.content[i].deploye) {
					this.content[i].togleThis();
				}
				else {
					//this.setBottom(false);
				}
			}				

		}

		this.switchOuverture();
		this.setBottom(false);	
		resizeMg();		
		
	}
	

	
}