/* ---------- anime ---------- */
Anime = function(o,w,t,l,d,s){
	this.o = o;
	this.w = w;
	this.d= d;
	this.t = t;
	this.i = 0;
	this.q = l.q;
	this.l = l.l;
	this.s = s;
	var _ = this;
	this.a = new $$.anime({st:'left',e:{fim:function(){_.time();}}},o);
}

Anime.prototype = {
time:function(){
	var _ = this;
	_.id = setTimeout(function(){_.prox();},_.t);
	return _;
},
prox:function(){
	this.ir(this.i+this.q);
	return this;
},
ir:function(i){
	if(i>=this.d.length)i = 0;
	else if((this.q<this.l)&&i+this.l>this.d.length)i = 0;
	else if(this.d.length-i<this.l)i = (this.d.length-i)-this.l+i;
	this.i = i;
	this.a.go(-i*this.w);
	return this;
},
go:function(){
	if(this.i==(this.d.length)-this.q){
		this.i = 0;
		return this.stop().ir(this.i);
	}
	return this.stop().ir(this.i+1);
},
back:function(){
	if(this.i==0)this.i = this.d.length;
	return this.stop().ir(this.i-1);
},
stop:function(){
	clearTimeout(this.id);
	this.o = null;
	return this;
},
gerar:function(){
	var t = '';
	for(var i=0,v;v=this.d[i++];){
		if(v.e)this.o.innerHTML += '<div style="position: relative;float: left;"><a href="'+v.l+'">'+v.e+'</a></div>';
	}
	this.o.style.width = this.d.length*this.w+'px';
	this.a.set(0);
	this.a.v = 4;
	this.time();
	return this;
}
}
/* ---------- /anime ---------- */
function buscaL(o,s){
	if(o.value=='Digite sua pesquisa'&&!s)o.value = '';
	else if(!o.value&&s)o.value = 'Digite sua pesquisa';
}
