function randomRangeSec( min , max )
{
  return min * 1000;
  if( min == max ) { return min * 1000 }
  var rand_no = Math.random();
  rand_no = rand_no * max * 1000 ;
  return Math.floor( rand_no ) + ( min * 1000 ) ;
}

$(document).ready(function() {

    //rotatePics1(1, 2000);
    $('#box1').cycle({
        fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
        ,speed:  1500 
    });
});

var _time = 6000;

function rotatePics1(currentPhoto, time ) {
  var numberOfPhotos = $('#box1 img').length;
  if(numberOfPhotos <= 1) return;
  currentPhoto = currentPhoto % numberOfPhotos;
  $('#box1 img').eq(currentPhoto).fadeOut(function() {
    // re-order the z-index
    $('#box1 img').each(function(i) {
      $(this).css(
      'zIndex', ((numberOfPhotos - i) + currentPhoto) %
      numberOfPhotos
      ).removeClass('hidden');
    });
    //$(this).show().fadeIn(2000);
    setTimeout(function() {rotatePics1(++currentPhoto, _time );}, time );
  });
}
