this.close = function(){ timeRate(step,function(c,r){ var h1 = h *(1-r); b.height(h1); if(r==1){b.hide();} }); }
function timeRate(step,fn){ var t = now(); var count = 1; var timeId = setInterval(function(){ var t1 = now(); var rate = ((t1-t)>step) ? 1 : (t1-t)/step; fn(count,rate); if(rate==1){clearInterval(timeId);} count++; },time); }