jQuery.fn.gallScroll = function(_options){
	// defaults options	
	var _options = jQuery.extend({
		duration: 700,
		autoSlide: 5000
	},_options);

	return this.each(function(){
		var _hold = $(this);
		var _speed = _options.duration;
		var _timer = _options.autoSlide;
		var _wrap = _hold.find('ul');
		var _el = _hold.find('ul > li');
		var _next = _hold.find('a.link-next');
		var _prev = _hold.find('a.link-prev');
		var _count = _el.index(_el.filter(':last'))-1;
		var _w = _el.eq(0).outerWidth();
		var _t;
		var _active = 0;
		function scrollEl(){
			_wrap.eq(0).animate({
				marginLeft: -(_w * _active) + "px"
			}, {queue:false, duration: _speed});
		}
		function timeGo(){
			_t = setInterval(function(){
				_active++;
				if (_active > (_count)) _active = 0;
				scrollEl();
			}, _timer);
		}
		timeGo();
		_hold.hover(function(){
			if(_t) clearTimeout(_t);
		}, function(){
			timeGo();
		});
		_next.click(function(){
			_active++;
			if (_active > (_count)) _active = 0;
			scrollEl();
			return false;
		});
		_prev.click(function(){
			_active--;
			if (_active < 0) _active = _count;
			scrollEl();
			return false;
		});
	});
}
