jQuery.jQueryRandom = 0;
jQuery.extend(jQuery.expr[":"],
{
    random: function(a, i, m, r) {
        if (i == 0) {
            jQuery.jQueryRandom = Math.floor(Math.random() * r.length);
        };
        return i == jQuery.jQueryRandom;
    }
});

$(function()
{
	var changeslide = function()
	{
		$('.slideshow img').hide();
	    img = $('.slideshow').find('img:not(:last-child):random').fadeIn('slow');
		id = img.attr('id').replace('p_','c_');
		img.appendTo('.slideshow');
		$('#sidebar .comment p').hide(); 
		$('.comment #'+id).fadeIn('slow');
	}
	setInterval(changeslide, 13000);
	changeslide();
});
