Salve, ho modificato un codice Java Script per creare una piccolo slideshow di immagini in una pagina html. Il codice è impostato per mandare lo slide in loop ma io vorrei si fermasse dopo aver visualizzato tutte le immagini una sola volta. Qualcuno sa dirmi cosa devo modificare? Grazie mille per l'aiuto. Ecco il codice:

<script type="text/javascript">
function slideshow(){
max_number_img = 5;
i = 3;
dispari = true;
timer_cambio_img = setInterval('rullo()', 3000);
}
function rullo(){
browser = null;
if (window.ActiveXObject) {
if (navigator.userAgent.toLowerCase().indexOf("msie 5") != -1) {
browser = "ie";
} else {
browser = "ie";
}
}
if (!browser && typeof(XMLHttpRequest) != 'undefined') {
browser = "ch";
}
if(i < 10){
src = "img_" + "0" + i;
} else {
src = "img_" + i;
}

timer_fade = setInterval('fade()', 100)
}
function fade(){
if(browser == "ie"){
if(dispari){
var valore1 = document.getElementById("box_01").filters.alpha.op acity;
var valore2 = document.getElementById("box_02").filters.alpha.op acity;
var incremento = 5;
if (valore1 < 100){
valore1 = valore1 + incremento;
document.getElementById("box_01").filters.alpha.op acity = valore1;
valore2 = valore2 - incremento;
document.getElementById("box_02").filters.alpha.op acity = valore2;
} else {
stop_timer(timer_fade);
dispari = false;
document.getElementById("box_02").src = "images/"+ src + ".jpg";
if(i<max_number_img){
i++;
} else {
i = 1;
}

}
} else {
var valore1 = document.getElementById("box_02").filters.alpha.op acity;
var valore2 = document.getElementById("box_01").filters.alpha.op acity;
var incremento = 5;
if (valore1 < 100){
valore1 = valore1 + incremento;
document.getElementById("box_02").filters.alpha.op acity = valore1;
valore2 = valore2 - incremento;
document.getElementById("box_01").filters.alpha.op acity = valore2;
} else {
stop_timer(timer_fade);
dispari = true;
document.getElementById("box_01").src = "images/"+ src + ".jpg";
if(i<max_number_img){
i++;
} else {
i = 1;
}
}
}
} else {
if(dispari){
var valore1 = document.getElementById("box_01").style.opacity;
var valore2 = document.getElementById("box_02").style.opacity;
var incremento = 0.1;
if (valore1 < 1){
valore1 = eval(valore1) + eval(incremento);
document.getElementById("box_01").style.opacity = valore1;
valore2 = eval(valore2) - eval(incremento);
document.getElementById("box_02").style.opacity = valore2;
} else {
stop_timer(timer_fade);
dispari = false;
document.getElementById("box_02").src = "images/"+ src + ".jpg";
if(i<max_number_img){
i++;
} else {
i = 1;
}

}
} else {
var valore1 = document.getElementById("box_02").style.opacity;
var valore2 = document.getElementById("box_01").style.opacity;
var incremento = 0.1;
if (valore1 < 1){
valore1 = eval(valore1) + eval(incremento);
document.getElementById("box_02").style.opacity = valore1;
valore2 = eval(valore2) - eval(incremento);
document.getElementById("box_01").style.opacity = valore2;
} else {
stop_timer(timer_fade);
dispari = true;
document.getElementById("box_01").src = "images/"+ src + ".jpg";
if( i < max_number_img ){
i++;
} else {
i = 1;
}
}
}
}
}
function stop_timer(id){
clearInterval(id);
}

</script>