// Below is the code that picks an item at random to display
jQuery.jQueryRandom = 0;  
jQuery.extend(jQuery.expr[":"],  
{  
    random: function(a, i, m, r) {  
        if (i == 0) {  
            jQuery.jQueryRandom = Math.floor(Math.random() * (r.length -1));  
        };  
        return i == jQuery.jQueryRandom;  
    }  
}); 

// The below function repeatedly gets called, to do the rotating
function show_next_rotating_item(t){
	jQuery(t).fadeOut('slow');

	var next_rotating_item = jQuery(t).siblings('.rotating_item:random');
	if(!next_rotating_item.attr('class')){
		next_rotating_item = jQuery('#rotatingpics div.rotating_item:first');
	}
	next_rotating_item.fadeIn('slow');

	showing = next_rotating_item;	
}

jQuery(document).ready(function(){
      jQuery(".rotating_item").hide();
      showing = jQuery(".rotating_item:random");
      showing.show();
      setInterval("show_next_rotating_item(showing)", 4000); // Set the rotate time to 5 seconds
});