function animate(dir,clicked){
u = true;
switch(dir){
case 'next':
t = t+1;
m = (-(t*w-w));
current(t);
if(o.autoHeight){autoHeight(t);}
$(o.slides,obj).animate({left: m}, o.slidespeed,function(){
if (t===s+1) {
t = 1;
$(o.slides,obj).css({left:0},function(){$(o.slides,obj).animate({left:m})});
$(o.slides,obj).children(':eq(0)').css({left: 0});
$(o.slides,obj).children(':eq('+(s-1)+')').css({ position:'absolute',left:-w});
}
if (t===s) $(o.slides,obj).children(':eq(0)').css({left:(s*w)});
if (t===s-1) $(o.slides,obj).children(':eq('+(s-1)+')').css({left:s*w-w});
u = false;
});
break;
case 'prev':
t = t-1;
m = (-(t*w-w));
current(t);
if(o.autoHeight){autoHeight(t);}
$(o.slides,obj).animate({left: m}, o.slidespeed,function(){
if (t===0) {
t = s;
$(o.slides,obj).children(':eq('+(s-1)+')').css({position:'absolute',left:(s*w-w)});
$(o.slides,obj).css({left: -(s*w-w)});
$(o.slides,obj).children(':eq(0)').css({left:(s*w)});
}
if (t===2 ) $(o.slides,obj).children(':eq(0)').css({position:'absolute',left:0});
if (t===1) $(o.slides,obj).children(':eq('+ (s-1) +')').css({position:'absolute',left:-w});
u = false;
});
break;