jQuery.fn.gallery = function (options) {		
	
	return this.each( function () {
		
		var ns = $(this);
		var scrollWidth = $(ns).find('.scrollable ul li').size()*101;
		if( scrollWidth <= 707 ) $(ns).find('.nav').css('display', 'none');	
		else {			
			$(ns).find('.next').click( function () {				
				$(ns).find('.scrollable').scrollTo('+=707px', 500);				
			});
			$(ns).find('.prev').click( function () {				
				$(ns).find('.scrollable').scrollTo('-=707px', 500);				
			});
		}
		
		$(ns).find('.scrollable ul').width(scrollWidth);		
		
		$(ns).find('.scrollable img').each( function () {				
			$(this).parents('li').css('background','url('+$(this).attr('src')+')');
			$(this).remove();
		});
		
		$(ns).find('.scrollable a').click( function () {
			$(ns).find('.scrollable li').removeClass('current');
			$(this).parents('li').addClass('current');
			$(ns).find('#content_').html($(this).parents('li').find('.content_').html());
			$(ns).find('.fullimg').html($(this).parents('li').find('.fullimg_').html());
			$(ns).find('#image img').attr('src', $(this).attr('href'));
			return false;
		});
	});
}

