<!--
	
	/*   PARTOUCHE POKER TOUR   */
	/*     GROUPE PARTOUCHE     */
	
	/* Libraire necessaire : jQuery */
	
	ListBox = function(fParams) {
		
		this.n = fParams["name"] ? fParams["name"] : "" ;
		this.container = fParams["container"] ? fParams["container"] : "" ;
		
		this.offsetWidth = fParams["offsetWidth"] ? fParams["offsetWidth"] : 0 ;
		
		this.items = new Array();
		this.uid = new Date().getTime();
		this.visible = false;
		this.donthide = false;
		
		// Ajout d'elements
		
		this.add = function(fItem) {
			
			fItem = fItem ? fItem : new Array() ;
			this.items.push(fItem);
			return(true);
			
		};
		
		// Affichage de la liste
		
		this.show = function(fParams) {
			
			var myCnt = this.e(this.container);
			var myObj = this.e(fParams["obj"]);
			
			myCnt.innerHTML = "";
			var output = "";
			
			var posLeft = this.getPosition(myObj,"x");
			var posTop = this.getPosition(myObj,"y") + myObj.offsetHeight;
			var posWidth = myObj.offsetWidth + this.offsetWidth;
			
			output += "<div class=\"listbox-menu\" style=\"position:absolute; left:"+posLeft+"px; top:"+posTop+"px; width:"+posWidth+"px;\"><div class=\"lbm-into\">";
			
			for ( var i = 0 ; i < this.items.length ; i++ ) {
				if (this.items[i]) {
					output += "<a href=\"javascript:;\" onclick=\"" + this.n + ".selectIt(" + i + ");\">" + this.items[i]["name"] + "</a>";
				}
			}
			
			output += "</div></div>";
			
			myCnt.innerHTML = output;
			
			this.visible = true;
			this.donthide = true;
			
		};
		
		this.hide = function() {
			
			if (this.donthide == false) {
				var myCnt = this.e(this.container);
				myCnt.innerHTML = "";
				this.visible = false;
			} else {
				this.donthide = false;
			}
			
		};
		
		this.toogle = function(fParams) {
			
			if (this.visible) {
				this.hide();
			} else {
				this.show(fParams);
			}
			
		};
		
		this.selectIt = function(fNum) {
			
			this.onchange(this.items[fNum]["value"],this.items[fNum]["name"]);
			
		};
		
		this.onchange = function() {};
		
		eval("$(document.body).click(function() { " + this.n + ".hide(); });");
		
		// Fonctions privees
		
		this.getPosition = function(fObj,fAxe) {
			
			var myPosition = (fAxe=="x") ? this.e(fObj).offsetLeft : this.e(fObj).offsetTop ;
			var myParent = this.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) ); }
		
	};
	
-->