function randa( min, max ) { // http://kevin.vanzonneveld.net // + original by: Leslie Hoare // + bugfixed by: Onno Marsman // * example 1: rand(1, 1); // * returns 1: 1 var argc = arguments.length; if (argc == 0) { min = 0; max = 2147483647; } else if (argc == 1) { throw new Error('Warning: rand() expects exactly 2 parameters, 1 given'); } return Math.floor(Math.random() * (max - min + 1)) + min; } var wht = new Array(); max = 15; var actual = 0; var i=max; var tmo = false; function change_pics(){ $('.pic:eq('+actual+') img').fadeOut('slow',function(){ $(this).css('z-index','1000'); $(this).remove(); }); newimg = $(''); rnd = randa(1,1000); $(newimg).attr('id','img'+actual+i+rnd); $(newimg).attr('src','http://www.rany.co.il/public/images/top-pics/'+i+'.jpg'); $(newimg).hide(); $('.pic:eq('+actual+')').append($(newimg)); $('#img'+actual+i+rnd).fadeIn('slow'); i=i-1; if(i==0)i=max; actual++; if(actual==4)actual=0; tmo=setTimeout('change_pics()',2000); } $(document).ready(function(){ tmo=setTimeout('change_pics()',2000); });