function mooGallery() {
	this.Images;
	this.Width;
	this.Height;
	this.RowCount;
	this.HorizontalGap;
	this.BackgroundColor;
	this.ScrollButtonsColor;
	this.PreviewWidth;
	this.PreviewHeight;
	this.PreviewColor;	
	this.TitleColor;	
	this.DescriptionColor;	
	this.PreviewCorner;
	this.Setimages = function(data) { this.images = data; }
	this.Getimages = function() 	{ return this.images; }
	this.show = function() { 
		if (typeof(this.BackgroundColor)    == 'string') { this.BackgroundColor    = gx.color.html(this.BackgroundColor);    }
		if (typeof(this.ScrollButtonsColor) == 'string') { this.ScrollButtonsColor = gx.color.html(this.ScrollButtonsColor); }
		if (typeof(this.PreviewColor)       == 'string') { this.PreviewColor       = gx.color.html(this.PreviewColor);       }
		if (typeof(this.TitleColor)         == 'string') { this.TitleColor         = gx.color.html(this.TitleColor);         }
		if (typeof(this.DescriptionColor)   == 'string') { this.DescriptionColor   = gx.color.html(this.DescriptionColor);   }
		var ctlId		 = this.ControlName;
		var ctlW		 = Number(this.Width.replace('px',''));
		var ctlH		 = Number(this.Height.replace('px',''));
		var ctlB		 = this.BackgroundColor.Html;
		var preC		 = [this.PreviewColor.R, this.PreviewColor.G, this.PreviewColor.B];
		var preD		 = this.PreviewColor.Html;
		var preTC		 = this.TitleColor.Html;
		var preDC		 = this.DescriptionColor.Html;
		var preR		 = this.PreviewCorner;		
		var preW		 = this.PreviewWidth;
		var preH		 = this.PreviewHeight;
		var itmH		 = this.HorizontalGap;
		var itmC		 = this.images.length;		
		var barW		 = 15;
		var barH		 = ctlH;		
		var conW		 = ctlW-2*barW;
		var conH		 = ctlH;
		var barK		 = this.ScrollButtonsColor.Html; 
		var buffer		 = '<div id="'+ctlId+'" style="width:'+ctlW+'; height:'+ctlH+'; background:'+ctlB+'; margin:0 0 0 0; padding:0 0 0 0;-moz-user-select:none;-khtml-user-select:none;user-select:none;selectable:none;">';
		buffer			+= '	<table id="'+ctlId+'_ScrollLeft" border="0" callpadding="0" cellspacing="0" style="float:left; cursor:pointer; width:'+barW+'; height:'+barH+'; background:'+barK+'; color:white; font-size:9pt; margin:0 0 0 0; padding:0 0 0 0;"><tr><td style="height:100%;text-align:center;">&lt;</td><tr/></table>';
		buffer			+= '	<div id="'+ctlId+'_Content" style="float:left; overflow:hidden; background:'+ctlB+'; width:'+conW+'; height:'+conH+'; margin:0 0 0 0; padding:0 0 0 0;">';
		buffer			+= '		<table><tr>';
	    for (var i = 0; i < itmC; i++) { var item = this.images[i];
			buffer		+= '			<td><img alt="'+item.Name+'" title="'+item.Description+'" src="'+item.Thumb+'" style="height:'+(conH-3.2*itmH)+'; cursor:pointer; vertical-align:top; padding:0 0 0 0; margin:'+itmH+' 0 0 '+itmH+';"/></td>';
		}
		buffer			+= '		</tr></table>';
		buffer			+= '	</div>';
		buffer			+= '	<table id="'+ctlId+'_ScrollRight" border="0" callpadding="0" cellspacing="0" style="float:right; cursor:pointer; width:'+barW+'; height:'+barH+'; background:'+barK+'; color:white; font-size:9pt; margin:0 0 0 0; padding:0 0 0 0;"><tr><td style="height:100%;text-align:center;">&gt;</td><tr/></table>';
		buffer			+= '</div>';
		this.setHtml(buffer);	
		var body	= $(document.body);		
		var control = $(ctlId); 
		var content = $(ctlId+'_Content'); 
		var scrollL = $(ctlId+'_ScrollLeft' );
		var scrollR = $(ctlId+'_ScrollRight');				
		$$('#'+ctlId+'_Content img').each(function(item){ 
			item.addEvent('click', function(e) { e = new Event(e).stop(); 
				if ($('imagepreview')) { $('imagepreview').destroy(); }
				var img			= $(new Image()); 
				img.id			= ctlId+'_image_preview';
				img.onload		= function() { 
									var coef = Math.min(preW/img.width,preH/img.height);
									var dimX = img.width*coef;
									var dimY = img.height*coef;
									img.setStyles({width: dimX, height: dimY}); 
									var posX = (body.getSize().x-dimX)/2+body.getScroll().x;
									var posY = (body.getSize().y-dimY)/2+body.getScroll().y;
									var frm  = new MochaUI.Window({ id: 'imagepreview', title: item.get('alt'), content: img, width: dimX+50, height: dimY+55, x: posX, y: posY, padding: {left: 25, right: 25, top: 0, bottom: 0}, cornerRadius: preR, headerStartColor: preC, headerStopColor: preC, bodyBgColor: preC, contentBgColor: preD, shadowBlur: 0, restrict: false, scrollbars: false, resizable: false }); 
									frm.titleEl.setStyles({color: preTC, textAlign: 'center'});
									frm.contentEl.set('html',[frm.contentEl.get('html'),'<span style="color:'+preDC+';text-align:justify">'+(item.get('title')||'')+'</span>']);
								}; 		
				var iefix		= (Browser.Engine.trident)?'?'+Math.random():'';
				img.src			= item.get('src').replace('/Thumbs','')+iefix;
				if (Browser.Engine.trident) { img.inject(body); }
			}); 
		});	
		var pos     = 0;
		var scroll  = new Fx.Scroll(content, { offset: {'x': 0, 'y': 0}, wheelStops: false, transition: Fx.Transitions.Sine.easeInOut });
		scrollL.addEvent('click', 		function(e) { e = new Event(e).stop(); pos = Math.max(pos-3, 0);      						if (pos < 0) 		{ pos = 0; } 		scroll.start($$('#'+ctlId+'_Content td')[pos].getPosition(content).x-2*itmH); });
		scrollR.addEvent('click', 		function(e) { e = new Event(e).stop(); pos = Math.min(pos+3, itmC-1); 						if (pos >= itmC) 	{ pos = itmC-1; } 	scroll.start($$('#'+ctlId+'_Content td')[pos].getPosition(content).x-2*itmH); });
		content.addEvent('mousewheel', 	function(e) { e = new Event(e).stop(); pos = Math.min(pos-Math.round(e.wheel,0), itmC-1);	if (pos < 0) 		{ pos = 0; } 		scroll.start($$('#'+ctlId+'_Content td')[pos].getPosition(content).x-2*itmH); });
	}
}

