<!--
	
	/*   PARTOUCHE POKER TOUR   */
	/*     GROUPE PARTOUCHE     */
	
	/* Libraire necessaire : jQuery */
	
	SubMenu = function(fParams) {
		
		this.n = fParams["name"] ? fParams["name"] : "" ;
		this.container = fParams["container"] ? fParams["container"] : "" ;
		
		this.menus = new Array();
		this.uid = new Date().getTime();
		this.cid = 0;
		this.hideDelay = 350;
		
		// Ajout de sous-menus
		
		this.add = function(fSub) {
			
			fSub = fSub ? fSub : new Array() ;
			
			this.cid++;
			this.menus[this.cid] = fSub;
			
			return(true);
			
		};
		
		// Initialisation
		
		this.init = function() {
			
			for ( var i = 0 ; i < this.menus.length ; i++ ) {
				if (this.menus[i]) {
					var myObjects = this.menus[i]["obj"].split(",");
					for ( var j = 0 ; j < myObjects.length ; j++ ) {
						eval("$(this.e(myObjects[" + j + "])).mouseover(function() { " + this.n + ".show({ \"id\":" + i + " , \"obj\":this }); " + this.n + ".restartMenu(); });");
						eval("$(this.e(myObjects[" + j + "])).mouseout(function() { " + this.n + ".cancelMenu(); });");
					}
				}
			}
			
		};
		
		// Affichage du menu
		
		this.show = function(fParams) {
			
			var myId = fParams["id"];
			var myObj = fParams["obj"];
			
			var mBuff = "";
			
			var myLeft = this.getPosition(myObj,"x");
			var myTop = this.getPosition(myObj,"y") + myObj.offsetHeight;
			var myWidth = myObj.offsetWidth;
			
			mBuff += "<div class=\"subm s-global\" style=\"left:" + myLeft + "px; top:" + myTop + "px; width:" + myWidth + "px;\" onmouseover=\"" + this.n + ".restartMenu();\" onmouseout=\"" + this.n + ".cancelMenu();\">";
			for ( var i = 0 ; i < this.menus[myId]["items"].length ; i++ ) {
				
				if (this.menus[myId]["items"][i]["childs"] != undefined && this.menus[myId]["items"][i]["childs"] != "" && this.menus[myId]["items"][i]["childs"].length > 0) { var HasChilds = true; } else { var HasChilds = false; }
				
				if (HasChilds) {
					mBuff += " <a class=\"subm s-line" + ( this.menus[myId]["items"][i]["selected"] ? " selected" : "" ) + "\" href=\"" + this.menus[myId]["items"][i]["link"] + "\" onmouseover=\"" + this.n + ".hideSubmenus(" + myId + "); " + this.n + ".showSubmenu(" + i + ",this);\">";
				} else {
					mBuff += " <a class=\"subm s-line" + ( this.menus[myId]["items"][i]["selected"] ? " selected" : "" ) + "\" href=\"" + this.menus[myId]["items"][i]["link"] + "\" onmouseover=\"" + this.n + ".hideSubmenus(" + myId + ");\">";
				}
				
				mBuff += "<span class=\"subm s-bg\"></span><span class=\"subm s-str\">" + this.menus[myId]["items"][i]["name"] + "</span>" + ( HasChilds ? "<span class=\"subm s-ch\"></span>" : "" ) + "</a>";
				
				if (HasChilds) {
					mBuff += "<div id=\"submchild_" + i + "\" class=\"subm s-child\">";
					for ( var j = 0 ; j < this.menus[myId]["items"][i]["childs"].length ; j++ ) {
						mBuff += "<a href=\"" + this.menus[myId]["items"][i]["childs"][j]["link"] + "\" class=\"subm s-line" + ( this.menus[myId]["items"][i]["childs"][j]["selected"] ? " selected" : "" ) + "\"><span class=\"subm s-bg\"></span><span class=\"subm s-str\">" + this.menus[myId]["items"][i]["childs"][j]["name"] + "</span></a>";
					}
					mBuff += "</div>";
				}
				
			}
			mBuff += "</div>";
			
			e(this.container).innerHTML = mBuff;
			
			var Childs = e(this.container).getElementsByTagName("a");
			for ( var i = 0 ; i < Childs.length ; i++ ) {
				Childs[i].style.height = Childs[i].getElementsByTagName("span")[1].offsetHeight + "px";
				Childs[i].getElementsByTagName("span")[0].style.height = Childs[i].getElementsByTagName("span")[1].offsetHeight + "px";
			}
			
			this.hideSubmenus(myId);
			
		};
		
		this.hide = function() {
			
			e(this.container).innerHTML = "";
			
			clearTimeout(this.timeout);
			
		};
		
		this.cancelMenu = function() {
			
			this.timeout = setTimeout(this.n+".hide()",this.hideDelay);
			
		};
		
		this.restartMenu = function() {
			
			clearTimeout(this.timeout);
			
		};
		
		this.showSubmenu = function(fId,fObj) {
			
			var myLeft = fObj.offsetLeft + fObj.offsetWidth;
			var myTop = fObj.offsetTop;
			
			this.e("submchild_" + fId).style.left = myLeft + "px";
			this.e("submchild_" + fId).style.top = myTop + "px";
			
			this.e("submchild_" + fId).style.display = "block";
			this.e("submchild_" + fId).style.visibility = "visible";
			
		};
		
		this.hideSubmenus = function(fMenu) {
			
			for ( var i = 0 ; i < this.menus[fMenu]["items"].length ; i++ ) {
				if (this.e("submchild_" + i)) {
					this.e("submchild_" + i).style.display = "none";
					this.e("submchild_" + i).style.visibility = "hidden";
				}
			}
			
		};
		
		// Fonctions privees
		
		this.getPosition = function(fObj,fAxe) {
			
			var myPosition = (fAxe=="x") ? e(fObj).offsetLeft : e(fObj).offsetTop ;
			var myParent = e(fObj).parentNode;
			while (myParent && myParent.nodeName.toLowerCase() != "html") {
				myPosition += (fAxe=="x") ? myParent.offsetLeft : myParent.offsetTop ;
				var myParent = myParent.parentNode;
			}
			
			return(myPosition);
			
		};
		
		this.e = function(fObj) { return( typeof(fObj) == "object" ? fObj : document.getElementById(fObj) ); }
		
	};
	
-->