(function($) {

	// jQuery plugin definition
	$.fn.mouseoverSlideshow = function(params) {

		// traverse all nodes
		this.each(function() {
			
			// express a single node as a jQuery object
			var $t = $(this);

			$t.children("img").each(function(e, $ob){
				var $imgs = $t.children("img")[e];
				
				if(e > 0) {
					$($imgs).css("display", "none");
				}
			});
			
			
			
			$t.mousemove(function(event) {
  				  				
				var spacing = $t.width() / $t.children("img").size();
				var found = false;
  				
  				$t.children("img").each(function(e, $ob){
					var $imgs = $t.children("img")[e];
					var $offsetLeft = $t.offset().left;
					
					
					if((event.pageX - $offsetLeft) > e*spacing && (event.pageX - $offsetLeft) < (e*spacing)+spacing) {
						$($imgs).css("display", "inline");
						found = true;
					} else {
						$($imgs).css("display", "none");
					}
				});
			
				if(found == false) {
					$($t.children("img")[0]).css("display", "inline");
				}
			});
			

		});

		// allow jQuery chaining
		return this;
	};

})(jQuery);

