function h$(i){ return document.getelementbyid(i) } function h$$(c, p){ return p.getelementsbytagname(c) } var downpaly = function(){ function init(o){ this.id = o.id; this.at = o.auto ? o.auto : 3; this.o = 0; this.pos(); } init.prototype = { pos : function(){ clearinterval(this.__b); this.o = 0; var el = h$(this.id), li = h$$('li', el), l = li.length; var _t = li[l-1].offsetheight; var cl = li[l-1].clonenode(true); el.insertbefore(cl, el.firstchild); el.style.top = -_t + 'px'; this.anim(); }, anim : function(){ var _this = this; this.__a = setinterval(function(){_this.animh()}, 20); }, animh : function(){ var _t = parseint(h$(this.id).style.top), _this = this; if(_t >= -1){ clearinterval(this.__a); h$(this.id).style.top = 0; var list = h$$('li',h$(this.id)); h$(this.id).removechild(list[list.length-1]); this.__c = setinterval(function(){_this.animo()}, 20); //this.auto(); }else { var __t = math.abs(_t) - math.ceil(math.abs(_t)*.07); h$(this.id).style.top = -__t + 'px'; } }, animo : function(){ this.o += 2; if(this.o == 100){ clearinterval(this.__c); this.auto(); }else{ } }, auto : function(){ var _this = this; this.__b = setinterval(function(){_this.pos()}, this.at*200); } } return init; }(); new downpaly({id:'downpaly'})