<!--
	
	/*   PARTOUCHE POKER TOUR   */
	/*     GROUPE PARTOUCHE     */
	
	/* Libraire necessaire : jQuery */
	
	PhotoAlbum = function(fParams) {
		
		this.n = fParams["name"];
		this.container = fParams["container"];
		this.width = fParams["width"];
		this.height = fParams["height"];
		this.thumbs_width = fParams["thumbs_width"];
		this.thumbs_height = fParams["thumbs_height"];
		
		this.xpos = 0;
		this.items = new Array();
		this.currentplay = 0;
		this.uid = new Date().getTime();
		
		this.add = function(fSrc,fThumb,fName,fDescription) {
			
			fSrc         = fSrc         ? fSrc         : "" ;
			fThumb       = fThumb       ? fThumb       : "" ;
			fName        = fName        ? fName        : "" ;
			fDescription = fDescription ? fDescription : "" ;
			
			this.items.push({ "src":fSrc , "thumb":fThumb , "name":fName , "description":fDescription });
			
		};
		
		this.init = function() {
			
			var oCnt = this.e(this.container);
			var cntInner = "";
			
			cntInner += "<div class=\"photoalbum\" style=\"width:" + this.width + "px; height:" + ((this.height*1)+(this.thumbs_height)+10) + "px;\">";
			
			cntInner += "<div id=\"" + this.n + "_preload\" class=\"photoalbum-preload\"></div>";
			
			cntInner += "<div class=\"photoalbum-loader\"><div id=\"" + this.n + "_load\"><img src=\"\" alt=\"\" id=\"" + this.n + "_img\" /></div></div>";
			
			cntInner += "<div class=\"photoalbum-thumbs\" style=\"width:" + this.width + "px;\">";
			cntInner += "<div class=\"photoalbum-thumbs-in\" style=\"width:" + (this.width-50) + "px; height:" + this.thumbs_height + "px;\">";
			cntInner += "<div class=\"photoalbum-thumbs-in-slide\" id=\"" + this.n + "_thumbsld\" style=\"width:" + (this.items.length*(this.thumbs_width+5)) + "px; height:" + this.thumbs_height + "px;\">";
			for ( var i = 0 ; i < this.items.length ; i++ ) cntInner += "<a href=\"javascript:;\" onclick=\"" + this.n + "._LoadPicture_(" + i + ");\"><img src=\"" + this.items[i]["thumb"] + "\" /></a>";
			cntInner += "</div>";
			cntInner += "</div>";
			cntInner += "<a href=\"javascript:;\" onclick=\"" + this.n + "._ScrollTo_('left');\" class=\"photoalbum-thumbs-left\"></a>";
			cntInner += "<a href=\"javascript:;\" onclick=\"" + this.n + "._ScrollTo_('right');\" class=\"photoalbum-thumbs-right\"></a>";
			cntInner += "</div>";
			
			cntInner += "</div>";
			
			oCnt.innerHTML = cntInner;
			
			this._LoadPicture_(0);
			
		};
		
		this._LoadPicture_ = function(fId) {
			
			var oLoad = this.e(this.n + "_load");
			var oImg = this.e(this.n + "_img");
			
			oImg.onload = null;
			eval("$(oImg).fadeOut(\"slow\",function() { " + this.n + "._LoadNowPicture_(oImg,fId); });");
			
		};
		
		this._LoadNowPicture_ = function(myImg,myId) {
			
			var func = "";
			func += "var tryImg = new Image();";
			func += "tryImg.src = '"+this.items[myId]["src"]+"';";
			func += "tryImg.onload = function() {";
			func +=   "myImg.style.left = (( " + this.n + ".width / 2 ) - ( tryImg.width / 2 )) + \"px\";";
			func +=   "myImg.style.top = (( " + this.n + ".height / 2 ) - ( tryImg.height / 2 )) + \"px\";";
			func +=   "myImg.src = '"+this.items[myId]["src"]+"';";
			//func +=   "myImg.onload = function() { $(myImg).fadeIn(\"slow\"); };";
			func +=   "$(myImg).fadeIn(\"slow\");";
			func += "};";
			eval(func);
			
		};
		
		this._ScrollTo_ = function(fTo) {
			
			var oSlider = this.e(this.n + "_thumbsld");
			var numTo = -1;
			
			if (oSlider.offsetWidth > (this.width-50)) {
				
				switch (fTo) {
					case "left":
						numTo = this.xpos + ( this.thumbs_width + 5 );
						if (numTo > 0) numTo = 0;
					break;
					case "right":
						numTo = this.xpos - ( this.thumbs_width + 5 );
						if (numTo < (oSlider.offsetWidth-(this.width-50))*-1 ) numTo = (oSlider.offsetWidth-(this.width-50))*-1;
					break;
				}
				
				if (numTo != -1) {
					$(oSlider).animate({ "left":numTo + "px" }, 250 );
					this.xpos = numTo;
				}
				
			}
			
		};
		
		this.e = function(fObj) { return( typeof(fObj) == "object" ? fObj : document.getElementById(fObj) ); }
		
	};
	
-->