Hi to all,
I'm having a problem deciphering this script.
This is a 3 image slot machine script(I guess)
Can someone explain to me how this code works?
And how can I make it show the same result?

here it goes:
var chaosMachineSpinCtr = 0;
function chaos_machine_attempt(params) {
params.on_start(params);
$.post(params.post_url, {}, function(data) {
var ret = JSON.parse(data);
spinResults = ret.spin_results;
chaosMachineSpinCtr = 0;
chaos_machine_spin_slot(params, ret);
});

}

function chaos_machine_spin_slot(params, ret) {
spinResults = ret.spin_results;
if(chaosMachineSpinCtr < 25) {
$('#'+params.ul_id+' li[rel=1] > img').attr('src', params.images[array_rand(params.images)]);
} else if(chaosMachineSpinCtr == 25) {
$('#'+params.ul_id+' li[rel=1] > img').attr('src', spinResults.images[0]);
}

if(chaosMachineSpinCtr >= 25 && chaosMachineSpinCtr < 50) {
$('#'+params.ul_id+' li[rel=2] > img').attr('src', params.images[array_rand(params.images)]);
} else if(chaosMachineSpinCtr == 50) {
$('#'+params.ul_id+' li[rel=2] > img').attr('src', spinResults.images[1]);
}

if(chaosMachineSpinCtr >= 50 && chaosMachineSpinCtr < 75) {
$('#'+params.ul_id+' li[rel=3] > img').attr('src', params.images[array_rand(params.images)]);
} else if(chaosMachineSpinCtr == 75) {
$('#'+params.ul_id+' li[rel=3] > img').attr('src', spinResults.images[2]);
}

chaosMachineSpinCtr++;

if(chaosMachineSpinCtr <= 75) {
setTimeout(function() {chaos_machine_spin_slot(params, ret);}, 50);
} else {
params.on_end(params, ret);
}
}