/**
 * uGallery jQuery plugin
 * Author: Miro Zoricak (zoricak at udesign.sk)
 * Website: http://zori.udesign.sk
 * v 1.0 beta
 */
(function($){
	var settings = {
		width: 620,
		height: 420,
		thumbWidth: 75,
		thumbHeight: 50,
		thumbOpacity: 0.6,
		thumbHoverOpacity: 1,
		displayAlt: false
	}
	
	$.newGallery = function(userSettings){
		var contentWidth = 0;
		
		$("#gal-thumbs>a>img").each(function(index, element){
			//alert("Adding width of " + parseInt(element.width));
			contentWidth += parseInt(element.width);
			contentWidth += 4;
		});
		
		if (contentWidth < 200)
		{
			alert("There was an error while downloading the small images used in the gallery control, please refresh the page");
		}
		
		// create thumb strip moving behaviour on mousemove
		$("#gal-thumbs").bind("mousemove", function(e){
			//alert("This should be the mousemove function");
			var thumbs = $("#gal-thumbs");
			viewWidth = 600;
			// contentWidth = 924;
			movableWidth = contentWidth - viewWidth;
			var margin = -Math.round(((e.clientX - 347) / viewWidth) * movableWidth); // -347 added to compensate left margin
			thumbs.css({"margin-left": margin+"px"});
		});
	}
})(jQuery)
