function TArbre(idArbre) {
//Attributs
	this.ARacine		= null;
	this.AId			= idArbre;
	this.ARepImg		= "IncClient/images/";
	this.AStyleMenu		= "border: #666666 1px solid;background-color:#777777;text-align:left;font-size:9pt;color:white;font-family: Arial Verdana;cursor:default;padding:1px;z-index:99;";
	this.AStyleClick	= "border: #333333 1px solid;background-color:#555555;text-align:left;font-size:9pt;color:white;font-family: Arial Verdana;cursor:default;padding:1px;z-index:99;";
	this.AStyleOver		= "border: #666666 1px solid;background-color:#777777;text-align:left;font-size:9pt;color:white;font-family: Arial Verdana;cursor:default;padding:1px;z-index:99;";
	this.AStyleOut		= "border: #666666 1px solid;background-color:#CCCCCC;text-align:left;font-size:9pt;color:black;font-family: Arial Verdana;cursor:default;padding:1px;z-index:99;";
	this.AStyleEntete	= "border: #666666 1px solid;background-color:#777777;text-align:center;font-size:9pt;color:white;font-family: Arial Verdana;cursor:default;padding:1px;z-index:99;";
	this.AStyleFontOver	= "";
	this.AStyleFontOut	= "";
	this.ATypeMenu		= 0; 
	this.ATypeAnim		= 0;
	this.AVitesseAnim	= 7; 	
	this.ASelect		= null;
	this.AWidthMenu		= 200;
	this.AEcartMenu		= 2;
	this.AImgSubMenu	= "IncClient/images/Fleche.gif";
	this.AImgSubMenuBar	= "IncClient/images/FlecheBas.gif";
	this.AMinutor		= null;
	this.ATimer			= 1000;
//M&eacute;thodes
	this.MGetNoeud		= TMGetNoeud;
	this.MGetArbre		= TMGetArbre;
	this.MAddNoeud		= TMAddNoeud;
	this.MSupNoeud		= TMSupNoeud;
	this.MDisplayDebug	= TMDisplayArbreDebug;
}

function TNoeud(idNoeud, valeur, img, action, is_open, objet) {
//Attributs
	this.AId			= idNoeud;
	this.APos			= 0;
	this.ACorps			= (valeur != undefined)?valeur:"";
	this.AParent		= null;
	this.AAction		= (action != undefined)?action:null;
	this.AOpen			= (is_open != undefined)?is_open:true;
	this.AImage			= (img != undefined)?img:null;
	this.AFeuilles		= new Array;
	this.ASelected		= false;
	this.AObject		= (objet != undefined)?objet:null;
	
//M&eacute;thodes
	this.MIsMe			= TMIsMe;
	this.MIsSubFeuille	= TMIsSubFeuille;
	this.MGetArbre		= TMGetArbre;
	this.MAddFeuille	= TMAddFeuille;
	this.MSupFeuille	= TMSupFeuille;
	this.MDisplayDebug	= TMDisplayNoeudDebug;
}

function TMIsMe(idNoeud) {
	var trouve = null,n = 0;
	if(this.AId == idNoeud)	return this;
	else
	{
		while(!trouve && this.AFeuilles[n])
			trouve = this.AFeuilles[n++].MIsMe(idNoeud);
		return trouve;
	}
}

function TMDisplayNoeudDebug() {
	var i = 0;
	document.write("<blockquote>");
	document.write("*NOEUD*<br>");
	document.write("Noeud ID : " + this.AId + "<br>");
	document.write("Noeud Corps : " + this.ACorps + "<br>");
	document.write("Noeud Pos : " + this.APos + "<br>");
	document.write("Noeud Parent : " + this.AParent.AId + "<br>");
	document.write("Nb feuilles : " + this.AFeuilles.length + "<br>");
	while(this.AFeuilles[i]) 
		this.AFeuilles[i++].MDisplayDebug();
	document.write("</blockquote>");
}

function TMAddFeuille(noeud) {return this.AFeuilles.push(noeud);}

function TMSupFeuille(position) {
	if(position != undefined) {
		this.AFeuilles.splice(position, 1);
		return true;
	}
	else return false;
}

function TMIsSubFeuille(noeud) {
	var n = 0, trouve = false;
	if(this === noeud) return true;
	else {
		while(this.AFeuilles[n] && !trouve)	trouve = this.AFeuilles[n++].MIsSubFeuille(noeud);
		return trouve;
	}
}

function TMAddNoeud(id, noeud) {
	if(id == null) {
		this.ARacine = noeud;
		this.ARacine.AParent = this;
	}
	else {
		noeud.AParent = this.MGetNoeud(id);
		noeud.APos = noeud.AParent.MAddFeuille(noeud)-1;
	}
}

function TMSupNoeud(id) {
	var noeud = this.MGetNoeud(id);
	noeud.AParent.MSupFeuille(noeud.APos);
}

function TMDisplayArbreDebug() {if(this.ARacine) this.ARacine.MDisplayDebug();}

function TMGetArbre() {return (this.AParent)?this.AParent.MGetArbre():this;}

function TMGetNoeud(id) {return this.ARacine.MIsMe(id);}
