function slideShow(){ var total_img_interval = ((parseInt($("#stands_total").html()))-1)*100; for(i=0;i<=total_img_interval;i++){ if(i>0){ setTimeout("moveRight()", (4000*(i+1))); }else{ setTimeout("moveRight()", 4000); } } } function moveRight(){ var total_img = parseInt($("#stands_total").html()); var current_img = $("#current_img").html(); var next_img = parseInt(current_img)+1; if(next_img <= total_img){ $("#stands_"+next_img).fadeIn(1000); $("#stands_titulo_"+next_img).fadeIn(1000); $("#stands_"+current_img).fadeOut(1000); $("#stands_titulo_"+current_img).fadeOut(1000); $("#current_img").html(next_img); }else{ $("#stands_1").fadeIn(1000); $("#stands_titulo_1").fadeIn(1000); $("#stands_"+total_img).fadeOut(1000); $("#stands_titulo_"+total_img).fadeOut(1000); $("#current_img").html('1'); } } function moveLeft(){ var total_img = parseInt($("#stands_total").html()); var current_img = $("#current_img").html(); var prev_img = parseInt(current_img)-1; if(prev_img >= 1){ $("#stands_"+prev_img).fadeIn(1000); $("#stands_titulo_"+prev_img).fadeIn(1000); $("#stands_"+current_img).fadeOut(1000); $("#stands_titulo_"+current_img).fadeOut(1000); $("#current_img").html(prev_img); }else{ $("#stands_"+total_img).fadeIn(1000); $("#stands_titulo_"+total_img).fadeIn(1000); $("#stands_1").fadeOut(1000); $("#stands_titulo_1").fadeOut(1000); $("#current_img").html(total_img); } }