
(function($) {
	$.fn.recGallery = function(options) {
		$this = $(this);
			
		return this.each(function() {
			var imgtitle = $("#currenttitle", $this);
			var imgdesc = $("#currentdescription", $this);
			var imgband = $("#imgband", $this);
			var imgtext = $("#imgtext", $this);
			var img = $("#image img", $this);
			
			//$(window).load(function(){
			//	/* update width of background and make it same size as img */
			//	imgband.css("width", img.width());
			//	imgtext.css("width", img.width()-10);
			//});
			
			$("button", $this).click(function(){
				/* manage html */
				var imageId = $(this).attr("id").replace("btn_","");
				imgtitle.html($("#cntnt_" + imageId + " .title").html());
				imgdesc.html($("#cntnt_" + imageId + " .desc").html());
				img.attr("src", $("#cntnt_" + imageId + " img.hiddenimg").attr("src"));
				/* update width of background and make it same size as img */
				//imgband.css("width", img.width());
				//imgtext.css("width", img.width()-10);

				/* manage active button */
				//$(".image button", $this).removeClass("active");
				$(".image button.active").removeClass("active");
				$(this).addClass("active");
			});
			
			$(".image button").hover(
				function () {
				$(this).addClass("hover");
				}, 
				function () {
				$(this).removeClass("hover");
				}
			);
		});
	};
})(jQuery);







