function Ex(o){for(var k in o)this[k]=o[k];return this};
function UIs(tag){return Ex.call([],this.getElementsByTagName(tag))};
var slide=function (ini){
	this.bind(ini,this);
	this.autoIndex=0;
};
Ex.call(slide.prototype,{
	'bind':function (ini,me){
		if(ini.btns.length < 2) return;
		if(typeof ini.timer == 'undefined') ini.timer = 2000; 
		var dir=ini.dir=='top'?'scrollTop':'scrollLeft',pan=$(ini.contentID);
		var start=function (o){
				Each(ini.btns,function(){this.className=''});
				o.className=ini.className;
				me.autoIndex=o.index;
				me.begin(o.index,pan,ini.len,dir);		
		};
		pan.onmouseover=function (){me.stop=true};
		Each(ini.btns,function (i){
			this.index=i;
			this.onmouseover=function (){me.stop=true;start(this)};
			pan.onmouseout=this.onmouseout=function(){me.stop=false}
		});
		var auto=function(){
				if(!me.stop){
					me.autoIndex=me.autoIndex==ini.btns.length - 1?0:++me.autoIndex;
					start(ini.btns[me.autoIndex]);
				}
		};
		if(ini.auto)this.autoPlay=window.setInterval(auto,ini.timer);
	},
	'begin':function (i,o,len,dir){
		var b=o[dir],c=i*len -b,d=100,t=0,ttl=1000 /d;
		(function (me){
			clearInterval(me.only);
			me.only=setInterval(function (){
				o[dir] = Math.ceil(Tweener.easeOutExpo(t,b,c,d)) ;
				if(t<d) t++; 
				else clearInterval(me.only);
			},ttl)
		})(this)
	}
});