(function($) { 
		
	// static constructs
	$.tools = $.tools || {};
	
	$.tools.scrollable = {
		version: '1.1.2',
		
		conf: {
			
			// basics
			size: 5,
			vertical: false,
			speed: 400,
			keyboard: false,		
			
			// by default this is the same as size
			keyboardSteps: null, 
			
			// other
			disabledClass: 'disabled',
			hoverClass: null,		
			clickable: false,
			activeClass: 'active', 
			easing: 'swing',
			loop: false,
			
			items: '.scrollitems',
			item: null,
			
			// navigational elements			
			prev: '.prev',
			next: '.next',
			prevPage: '.scrollprevpage',
			nextPage: '.scrollnextpage', 
			api: false,

			line: '.clearBoth'
			
			// CALLBACKS: onBeforeSeek, onSeek, onReload			
		} 
	};
				
	var current;		
	
	// constructor
	function Scrollable(root, conf) {   
		
		// current instance
		var self = this, $self = $(this),
			 horizontal = !conf.vertical,
			 wrap = root.children(),
			 index = 0,
			 forward;  

		//CHANGE-----------------------------------
		var items=wrap.children(conf.item);
		var lines=items.filter(conf.line);
		var isEbiz=false;

		if(lines && lines.length){
			isEbiz=true;

			var lastItem=items.filter(":last");				
			if(!lastItem.hasClass("clearBoth")){
				wrap.append($(lines[0]).clone());
				items=wrap.children(conf.item);
				lines=items.filter(conf.line);
			}
		}		
		//-----------------------------------------
		
		
		if (!current) { current = self; }
		
		// bind all callbacks from configuration
		$.each(conf, function(name, fn) {
			if ($.isFunction(fn)) { $self.bind(name, fn); }
		});
		
		if (wrap.length > 1) { wrap = $(conf.items, root); }
		
		// navigational items can be anywhere when globalNav = true
		function find(query) {
			var els = $(query);
			return conf.globalNav ? els : root.parent().find(query);	
		}
		
		// to be used by plugins
		root.data("finder", find);
		
		// get handle to navigational elements
		var prev = find(conf.prev),
			 next = find(conf.next),
			 prevPage = find(conf.prevPage),
			 nextPage = find(conf.nextPage);

		//CHANGE---------------------------------------------------------------------------------------------------------
		$self.bind("onStart", function(e,i){			
			//if (!e.preventDefault()) {			
				// prev/next buttons disabled flags			
				var pp=prev.add(prevPage);
				//(i === 0) ? pp.addClass(conf.disabledClass) : pp.removeClass(conf.disabledClass);

				var np=next.add(nextPage);
				//(i >= self.getSize() - conf.size) ? np.addClass(conf.disabledClass) : np.removeClass(conf.disabledClass);
			
			//}						
		});

		$self.bind("onBeforeSeek", function(e,i,time,item,fn){
			//if (!e.preventDefault()) {
				// get the (possibly altered) speed
				if (time === undefined || $.isFunction(time)) { time = conf.speed; }
				
				function callback() {
					if (fn) { fn.call(self, i); }
					$self.trigger("onSeek", [i]);
				}
				
				//alert(conf.effect);
				if (horizontal) {
					if(conf.effect=="fade"){
						var l= -item.position().left;
						wrap.fadeOut(function(){
							wrap.css({left: l});
							wrap.fadeIn(callback);						
						});
					}else
						wrap.animate({left: -item.position().left}, time, conf.easing, callback);			
				} else {
					if(conf.effect=="fade"){
						var t= -item.position().top;
						wrap.fadeOut(function(){
							wrap.css({top: t});
							wrap.fadeIn(callback);						
						});
					}else
						wrap.animate({top: -item.position().top}, time, conf.easing, callback);							
				}
				
				
				current = self;
				index = i;				
			
				$self.trigger("onStart", [i]);	
			//}	
		});
		// --------------------------------------------------------------------------------------------------------

		// methods
		$.extend(self, {
			
			getIndex: function() {
				return index;	
			},
			
			getClickIndex: function() {
				var items = self.getItems(); 
				return items.index(items.filter("." + conf.activeClass));	
			},
	
			getConf: function() {
				return conf;	
			},
			
			getSize: function() {				
				//CHANGE----------------------------------
				var allItems = self.getItems(); 
				var allLines=allItems.filter(conf.line);
				if(isEbiz){
					if(!conf.vertical)
						return allItems.index(allLines[0]);
					else
						return allLines.size();
				}

				return allItems.size();	
				//----------------------------------------
			},
	
			getPageAmount: function() {
				return Math.ceil(this.getSize() / conf.size); 	
			},
			
			getPageIndex: function() {
				return Math.ceil(index / conf.size);	
			},

			getNaviButtons: function() {
				return prev.add(next).add(prevPage).add(nextPage);	
			},
			
			getRoot: function() {
				return root;	
			},
			
			getItemWrap: function() {
				return wrap;	
			},
			
			getItems: function() {
				return wrap.children(conf.item);	
			},
			
			getVisibleItems: function() {
				return self.getItems().slice(index, index + conf.size);	
			},
			
			/* all seeking functions depend on this */		
			seekTo: function(i, time, fn) {

				if (i < 0) { i = 0; }				
				
				// nothing happens
				if (index === i) { return self; }				
				
				// function given as second argument
				if ($.isFunction(time)) {
					fn = time;
				}

				// seeking exceeds the end
				//CHANGE-----------------------------------------
				var size= self.getSize();
				var allItems,allLines;
				if(isEbiz){
					allItems=self.getItems();
					allLines=allItems.filter(conf.line);

					if(!conf.vertical)
						size=allItems.index(allLines[0]);
					else
						size=allLines.size();											
				}
				//-----------------------------------------------
				if (i > size - conf.size) { 
					return conf.loop ? self.begin() : this.end(); 
				}

				//CHANGE-----------------------------------------
				var item;
				if(isEbiz && conf.vertical){					
					var index=allItems.index(allLines[i-1])+1;
					item = self.getItems().eq(index);					
				}else
					item = self.getItems().eq(i);				
				//-----------------------------------------------
				if (!item.length) { return self; }				
				
				// onBeforeSeek
				//CHANGE-----------------------------------------
				$self.trigger("onBeforeSeek", [i,time,item,fn]);
				//-----------------------------------------------
				return self; 
			},			
			
				
			move: function(offset, time, fn) {
				forward = offset > 0;
				return this.seekTo(index + offset, time, fn);
			},
			
			next: function(time, fn) {
				return this.move(1, time, fn);	
			},
			
			prev: function(time, fn) {
				return this.move(-1, time, fn);	
			},
			
			movePage: function(offset, time, fn) {
				forward = offset > 0;
				var steps = conf.size * offset;
				
				var i = index % conf.size;
				if (i > 0) {
				 	steps += (offset > 0 ? -i : conf.size - i);
				}
				
				return this.move(steps, time, fn);		
			},
			
			prevPage: function(time, fn) {
				return this.movePage(-1, time, fn);
			},  
	
			nextPage: function(time, fn) {
				return this.movePage(1, time, fn);
			},			
			
			setPage: function(page, time, fn) {
				return this.seekTo(page * conf.size, time, fn);
			},			
			
			begin: function(time, fn) {
				forward = false;
				return this.seekTo(0, time, fn);	
			},
			
			end: function(time, fn) {
				forward = true;
				var to = this.getSize() - conf.size;
				return to > 0 ? this.seekTo(to, time, fn) : self;	
			},
			
			reload: function() {				
				$self.trigger("onReload");
				return self;
			},			
			
			focus: function() {
				current = self;
				return self;
			},
			
			click: function(i) {
				
				var item = self.getItems().eq(i), 
					 klass = conf.activeClass,
					 size = conf.size;			
				
				// check that i is sane
				if (i < 0 || i >= self.getSize()) { return self; }
				
				// size == 1							
				if (size == 1) {
					if (conf.loop) { return self.next(); }
					
					if (i === 0 || i == self.getSize() -1)  { 
						forward = (forward === undefined) ? true : !forward;	 
					}
					return forward === false  ? self.prev() : self.next(); 
				} 
				
				// size == 2
				if (size == 2) {
					if (i == index) { i--; }
					self.getItems().removeClass(klass);
					item.addClass(klass);					
					return self.seekTo(i, time, fn);
				}				
		
				if (!item.hasClass(klass)) {				
					self.getItems().removeClass(klass);
					item.addClass(klass);
					var delta = Math.floor(size / 2);
					var to = i - delta;
		
					// next to last item must work
					if (to > self.getSize() - size) { 
						to = self.getSize() - size; 
					}
		
					if (to !== i) {
						return self.seekTo(to);		
					}
				}
				
				return self;
			},
			
			// bind / unbind
			bind: function(name, fn) {
				$self.bind(name, fn);
				return self;	
			},	
			
			unbind: function(name) {
				$self.unbind(name);
				return self;	
			},
				
			isEbiz: function() {
				return isEbiz;
			},

			getLines: function() {
				return lines;
			}
			
		});
		
		// callbacks	
		$.each("onBeforeSeek,onStart,onSeek,onReload".split(","), function(i, ev) {
			self[ev] = function(fn) {
				if(fn)
					return self.bind(ev, fn);	
			};
		});  
			
			
		// prev button		
		prev.addClass(conf.disabledClass).click(function() {
			self.prev(); 
		});
		

		// next button
		next.click(function() { 
			self.next(); 
		});
		
		// prev page button
		nextPage.click(function() { 
			self.nextPage(); 
		});
		
		if (self.getSize() < conf.size) {
			next.add(nextPage).addClass(conf.disabledClass);	
		}
		

		// next page button
		prevPage.addClass(conf.disabledClass).click(function() { 
			self.prevPage(); 
		});		
		
		
		// hover
		var hc = conf.hoverClass, keyId = "keydown." + Math.random().toString().substring(10); 
			
		self.onReload(function() { 

			// hovering
			if (hc) {
				self.getItems().hover(function()  {
					$(this).addClass(hc);		
				}, function() {
					$(this).removeClass(hc);	
				});						
			}
			
			// clickable
			if (conf.clickable) {
				self.getItems().each(function(i) {
					$(this).unbind("click.scrollable").bind("click.scrollable", function(e) {
						if ($(e.target).is("a")) { return; }	
						return self.click(i);
					});
				});
			}				
			
			// keyboard			
			if (conf.keyboard) {				
				
				// keyboard works on one instance at the time. thus we need to unbind first
				$(document).unbind(keyId).bind(keyId, function(evt) {

					// do nothing with CTRL / ALT buttons
					if (evt.altKey || evt.ctrlKey) { return; }
					
					// do nothing for unstatic and unfocused instances
					if (conf.keyboard != 'static' && current != self) { return; }
					
					var s = conf.keyboardSteps;				
										
					if (horizontal && (evt.keyCode == 37 || evt.keyCode == 39)) {					
						self.move(evt.keyCode == 37 ? -s : s);
						return evt.preventDefault();
					}	
					
					if (!horizontal && (evt.keyCode == 38 || evt.keyCode == 40)) {
						self.move(evt.keyCode == 38 ? -s : s);
						return evt.preventDefault();
					}
					
					return true;
					
				});
				
			} else  {
				$(document).unbind(keyId);	
			}				

		});
		
		self.reload(); 
		
	} 

		
	// jQuery plugin implementation
	$.fn.scrollable = function(conf) { 
			
		// already constructed --> return API
		var el = this.eq(typeof conf == 'number' ? conf : 0).data("scrollable");
		if (el) { return el; }		 
 
		var globals = $.extend({}, $.tools.scrollable.conf);
		conf = $.extend(globals, conf);
		
		conf.keyboardSteps = conf.keyboardSteps || conf.size;
		
		this.each(function() {			
			el = new Scrollable($(this), conf);
			$(this).data("scrollable", el);	
		});
		
		return conf.api ? el: this; 
		
	};
			
	
})(jQuery);


(function($) {

	// version number
	var t = $.tools.scrollable; 
	t.plugins = t.plugins || {};
	
	t.plugins.circular = {
		version: '0.5.1', 
		conf: { 
			api: false,
			clonedClass: 'cloned'
		} 		
	};

	
	$.fn.circular = function(opts)  {
	
		var config = $.extend({}, t.plugins.circular.conf), ret;
		$.extend(config, opts);
		
		this.each(function() {			
 
			var api = $(this).scrollable(),
				 items = api.getItems(), 
				 conf = api.getConf(), 
				 wrap = api.getItemWrap(), 
				 index = 0;
				 
			if (api) { ret = api; }
				
					
			
			//CHANGE-------------------------------------------------------------------------------	
			var isEbiz=api.isEbiz();
			var lines=api.getLines();

			// too few items. no need for this plugin.
			if(!isEbiz)
				if (items.length < conf.size) { return false; }	
			
			if(isEbiz){		
				if(!conf.vertical){
					var column=items.index(lines[0]);
					if(conf.effect=="liner")
						conf.size=column;
					if (column < conf.size) { return false; }

					$.each(lines, function(i, line){						
						var postion=items.index(line);							
						if(i>0){
							var position2=items.index(lines[i-1]);
							if(postion-position2-1<conf.size){
								return false;
							}
						}					

						var begin=i==0 ? 0 : items.index(lines[i-1])+1;						
						items.slice(begin, begin+conf.size).each(function(i) {					
							$(this).clone().insertBefore(line).addClass(config.clonedClass);			
						});	
		
						var tail = $.makeArray(items.slice(postion-conf.size,postion));
						$(tail).each(function(i) {
							$(this).clone().insertBefore(items[begin]).addClass(config.clonedClass);				
						});								
					});
				}else{
					var size=conf.size;
					var row=lines.size();
					if(conf.effect=="liner")
						size=row;
					if(row < size) { return false; }

					var begin=items.index(lines[size-1])+1;
					items.slice(0,begin).each(function(i) {					
						$(this).clone().appendTo(wrap).addClass(config.clonedClass);			
					});	

					var end=items.index(lines[lines.size()-1-size])+1;
					var tail = $.makeArray(items.slice(end,items.size())).reverse();					
					$(tail).each(function(i) {
						$(this).clone().prependTo(wrap).addClass(config.clonedClass);				
					});							
				}
				//----------------------------------------------------------------------------------------
			}else{				
				// clone first visible elements and append them to the end			
				items.slice(0, conf.size).each(function(i) {
					$(this).clone().appendTo(wrap).click(function()  {
						api.click(items.length + i);						
					}).addClass(config.clonedClass);			
				});	

				var tail = $.makeArray(items.slice(-conf.size)).reverse();

				// clone last set of elements to the beginning in reversed order			
				$(tail).each(function(i) {
					$(this).clone().prependTo(wrap).click(function()  {
						api.click(-i -1);			
						
					}).addClass(config.clonedClass);				
				});				
			}
						
			var allItems = wrap.children(conf.item);
			
			
			// reset hovering for cloned items too
			var hc = conf.hoverClass;
			
			if (hc) {
				allItems.hover(function()  {
					$(this).addClass(hc);		
				}, function() {
					$(this).removeClass(hc);	
				});						
			}
		 
			// custom seeking function that does not trigger callbacks
			//CHANGE----------------------------------------
			var allLines=allItems.filter(conf.line);
			function seek(i) {				
				if(isEbiz && conf.vertical)
					i=allItems.index(allLines[i-1])+1;				
			//----------------------------------------------
				
				var item = allItems.eq(i);
				
				if (conf.vertical) {						
					wrap.css({top: -item.position().top});
				} else {
					wrap.css({left: -item.position().left});							
				}					
			}
			
			// skip the clones at the beginning
			if(conf.effect!="liner")
				seek(conf.size);			

			// overridden scrollable API methods
			$.extend(api, {

				move: function(offset, time, fn, click) {
					var to = index + offset + conf.size;				
					var exceed = to > api.getSize() - conf.size; 
					
					if (to <= 0 || exceed) {
						//CHANGE--------------------------------------------------------------------
						var fix = index + conf.size + (exceed ? -api.getLength() : api.getLength());
						//--------------------------------------------------------------------------
						seek(fix);
						to = fix + offset;
					} 
					
					if (click) {
						allItems.removeClass(conf.activeClass)
							.eq(to + Math.floor(conf.size / 2)).addClass(conf.activeClass);
					}
					
					// nothing happens
					if (to === index + conf.size) { return self; }					

					return api.seekTo(to, time, fn);
				},			
				
				begin: function(time, fn) {
					return this.seekTo(conf.size, time, fn);	
				},
				
				end: function(time, fn) {				
					return this.seekTo(items.length, time, fn);	
				},
				
				click: function(i, time, fn) {		
					
					if (!conf.clickable) { return self; }
					if (conf.size == 1) { return this.next(); }
					
					var to = i - index, klass = conf.activeClass;				
					to -= Math.floor(conf.size / 2);				
					
					return this.move(to, time, fn, true);
				},
				
				getIndex: function() {
					return index;  
				},
				
				setPage: function(page, time, fn) {
					return this.seekTo(page * conf.size + conf.size, time, fn);	
				},
				
				getPageAmount: function()  {
					//CHANGE--------------------------------------					
					return Math.ceil(api.getLength() / conf.size);
					//--------------------------------------------
				},
				
				getPageIndex: function()  {            	
					if (index < 0) { return this.getPageAmount() -1; }
					//CHANGE------------------------------------					
					if (index >= api.getLength()) { return 0; }
					//------------------------------------------
					var i = (index + conf.size) / conf.size -1;
					return i;
				},

				getVisibleItems: function() {
					var i = index + conf.size;
					return allItems.slice(i, i + conf.size);	
				},
				
				//CHANGE---------------------------------
				getLength: function() {
					var result;
					if(isEbiz){
						if(!conf.vertical)			
							result=column;
						else
							result=row;
					}else
						result=items.length;

					return result;	
				}
				//----------------------------------------
			});  
			
			// update index 
			api.onStart(function(e, i) {		
				index = i - conf.size;
				
				// navi buttons are never disabled
				return false;
			});				
			
			api.getNaviButtons().removeClass(conf.disabledClass);
			
				
		});
		
		return config.api ? ret : this;
		
	};

		
})(jQuery);
		
/*--------------------------------------------------------------------------------------*/
(function($) {		

	var t = $.tools.scrollable; 
	t.plugins = t.plugins || {};
	
	t.plugins.autoscroll = {
		version: '1.0.1',
		
		conf: {
			autoplay: true,
			interval: 3000,
			autopause: true,
			steps: 1,
			api: false
		}
	};	
	
	// jQuery plugin implementation
	$.fn.autoscroll = function(conf) { 

		if (typeof conf == 'number') {
			conf = {interval: conf};	
		}
		
		var opts = $.extend({}, t.plugins.autoscroll.conf), ret;
		$.extend(opts, conf);   	
		
		this.each(function() {		
				
			var api = $(this).scrollable();			
			if (api) { ret = api; }
			
			// interval stuff
			var timer, hoverTimer, stopped = true;
	
			api.play = function() {
	
				// do not start additional timer if already exists
				if (timer) { return; }
				
				stopped = false;
				
				// construct new timer
				timer = setInterval(function() { 
					api.move(opts.steps);				
				}, opts.interval);
				
				api.move(opts.steps);
			};	

			api.pause = function() {
				timer = clearInterval(timer);	
			};
			
			// when stopped - mouseover won't restart 
			api.stop = function() {
				api.pause();
				stopped = true;	
			};
		
			/* when mouse enters, autoscroll stops */
			if (opts.autopause) {
				api.getRoot().add(api.getNaviButtons()).hover(function() {			
					api.pause();
					clearInterval(hoverTimer);
					
				}, function() {
					if (!stopped) {						
						hoverTimer = setTimeout(api.play, opts.interval);						
					}
				});
			}			
			
			if (opts.autoplay) {
				setTimeout(api.play, opts.interval);				
			}

		});
		
		return opts.api ? ret : this;
		
	}; 
	
})(jQuery);
(function(b){var a=b.tools.scrollable;a.plugins=a.plugins||{};a.plugins.navigator={version:"1.0.2",conf:{navi:".scrollnavi",naviItem:null,activeClass:"active",indexed:false,api:false,idPrefix:null}};b.fn.navigator=function(d){var e=b.extend({},a.plugins.navigator.conf),c;if(typeof d=="string"){d={navi:d}}d=b.extend(e,d);this.each(function(){var i=b(this).scrollable(),f=i.getRoot(),l=f.data("finder").call(null,d.navi),g=null,k=i.getNaviButtons();if(i){c=i}i.getNaviButtons=function(){return k.add(l)};function j(){if(!l.children().length||l.data("navi")==i){l.empty();l.data("navi",i);for(var m=0;m<i.getPageAmount();m++){l.append(b("<"+(d.naviItem||"a")+"/>"))}g=l.children().each(function(n){var o=b(this);o.click(function(p){i.setPage(n);return p.preventDefault()});if(d.indexed){o.text(n)}if(d.idPrefix){o.attr("id",d.idPrefix+n)}})}else{g=d.naviItem?l.find(d.naviItem):l.children();g.each(function(n){var o=b(this);o.click(function(p){i.setPage(n);return p.preventDefault()})})}g.eq(0).addClass(d.activeClass)}i.onStart(function(o,n){var m=d.activeClass;g.removeClass(m).eq(i.getPageIndex()).addClass(m)});i.onReload(function(){j()});j();var h=g.filter("[href="+location.hash+"]");if(h.length){i.move(g.index(h))}});return d.api?c:this}})(jQuery);
(function(b){b.fn.wheel=function(e){return this[e?"bind":"trigger"]("wheel",e)};b.event.special.wheel={setup:function(){b.event.add(this,d,c,{})},teardown:function(){b.event.remove(this,d,c)}};var d=!b.browser.mozilla?"mousewheel":"DOMMouseScroll"+(b.browser.version<"1.9"?" mousemove":"");function c(e){switch(e.type){case"mousemove":return b.extend(e.data,{clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY});case"DOMMouseScroll":b.extend(e,e.data);e.delta=-e.detail/3;break;case"mousewheel":e.delta=e.wheelDelta/120;break}e.type="wheel";return b.event.handle.call(this,e,e.delta)}var a=b.tools.scrollable;a.plugins=a.plugins||{};a.plugins.mousewheel={version:"1.0.1",conf:{api:false,speed:50}};b.fn.mousewheel=function(f){var g=b.extend({},a.plugins.mousewheel.conf),e;if(typeof f=="number"){f={speed:f}}f=b.extend(g,f);this.each(function(){var h=b(this).scrollable();if(h){e=h}h.getRoot().wheel(function(i,j){h.move(j<0?1:-1,f.speed||50);return false})});return f.api?e:this}})(jQuery);


(function($) {		

	var t = $.tools.scrollable; 
	t.plugins = t.plugins || {};
	
	t.plugins.liner = {
		version: '1.0.0',
		
		conf: {			
			api: false
		}
	};		
	
	$.fn.liner = function(conf) { 
		var opts = $.extend({}, t.plugins.liner.conf), ret;
		$.extend(opts, conf);   	
		
		this.each(function() {
			var api = $(this).scrollable();
			var itemWrap=api.getItemWrap();
			var items=api.getItems();
			if(!items || items.size() <= 0)
				return;

			var offset=$(this).position();			

			var vertical=false;
			if(conf.scrollDirection=="up" || conf.scrollDirection=="down")
				vertical=true;

			var begin=0;
			var children=items.not(".cloned");
			if(children && children.size()>0){
				var firstItem=$(children[0]).position();
				if(!vertical){
					begin=-(firstItem.left-offset.left);
				}else{
					begin=-(firstItem.top-offset.top);
				}
			}

			var end;			
			var clears=items.filter(".clearBoth");
			if(clears && clears.length){
				var lastItem;

				if(conf.scrollDirection=="left"){
					var lines=children.filter(".clearBoth");
					var index=children.index(lines[0])-1;
					index=items.index(children[index])+1;
					lastItem=$(items[index]).position();
				}else if(conf.scrollDirection=="up"){
					lastItem=children.filter(":last");
					var index=items.index(lastItem)+1;
					lastItem=$(items[index]).position();
				} else {
					lastItem=$(items[0]).position();
				}				
				
				if(!vertical)
					end=-(lastItem.left-offset.left);
				else
					end=-(lastItem.top-offset.top);
			}else{
				var lastItem=$(items).children(":last");
				
				if(!vertical)
					end=-lastItem.position().left
				else
					end=-lastItem.position().top;					
			}
			
			var isForward=true;
			if(conf.scrollDirection=="right" || conf.scrollDirection=="down")
				isForward=false;
			
			var speed=conf.speed || 10;	
			begin=Math.abs(begin);end=Math.abs(end);
			if(isForward){
				var beginTemp=Math.min(begin,end);
				var endTemp=Math.max(begin,end);
				begin=beginTemp;
				end=endTemp;
			}else{
				var beginTemp=Math.max(begin,end);
				var endTemp=Math.min(begin,end);
				begin=beginTemp;
				end=endTemp;
			}

			var root=this;
			!vertical? root.scrollLeft=begin : root.scrollTop=begin;
			function Marquee(){
				var position=!vertical ? root.scrollLeft : root.scrollTop;
				if(position==end){
					!vertical? root.scrollLeft=begin : root.scrollTop=begin;					
				}else{
					isForward ? position++ : position--;
					!vertical? root.scrollLeft=position : root.scrollTop=position;
				}
			}
			var myMar=setInterval(Marquee,speed);
			$(root).mouseover(function(){
				clearInterval(myMar)
			});
			$(root).mouseout(function(){
				myMar=setInterval(Marquee,speed)
			});
		});

		return opts.api ? ret : this;
	}; 	
})(jQuery);
