function theRotator() {
  $('div#rotator div').css({opacity: 0.0});
  $('div#rotator div:first').css({opacity: 1.0});
  setInterval('rotate()',5000);
}
//ротация картинок в шапке
function rotate() {  
  var current = ($('div#rotator div.show')? $('div#rotator div.show') : $('div#rotator div:first'));
  var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div#rotator div:first') :current.next()) : $('div#rotator div:first'));  
// begin - показ картинки в случайном порядке
	var sibs = current.siblings();
	var rndNum = Math.floor(Math.random() * sibs.length );
	var next = $( sibs[ rndNum ] );
// end - показ картинки в случайном порядке	
  next.css({opacity: 0.0})
  .addClass('show')
  .animate({opacity: 1.0}, 1000);
  current.animate({opacity: 0.0}, 1000)
  .removeClass('show');
};

<!--вызов фунции ротации картинок в шапке--> 
$(document).ready(function() {  
  theRotator();
});
