/* ---------- 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 box(){
	$.each($.filho($('idmnh').o,'li'),function(){
		var f = $.filho(this,'a,span,div');
		if(f.length<2)return;
		var a = f[0];
		var s = f[1];
		f = f[2];
		var f2 = $.filho(f,'div');
		if(!f2.length)return;
		f2 = f2[0];
		var h = f2.scrollHeight;
		f.style.height = h+3+'px';
		$(f2).a = new $.anime({v:1.5,st:'marginTop',e:{fim:function(){if(this.a==-h-3)f.className = 'smnh out';}}},f2);
		$(f2).a.set(-h-3);
	
		$.addEvent(this,'mouseover',function(){
			a.className = 'at';
			s.style.display = 'block';
			f.className = 'smnh';
			clearTimeout($(f2).id);
			$(f2).a.go(3);
		});
		$.addEvent(this,'mouseout',function(){
			$(f2).id = setTimeout(function(){
				a.className = '';
				s.style.display = 'none';
				$(f2).a.go(-h-3);
			},400);
		});
	});
}
