jQuery(document).ready(function($){
	if ($("#slideshow").length) {
		curimg = 0;
		images = new Array();
		totalimages = $("#slideshow ul li").length;
		$("#slideshow ul li").each(function(i){
			images[i] = $(this).find("img").attr("src");
			$(this).remove();
		});
		var img = "<image src='" + images[curimg] + "' />";
		$(img).load(function(){
			$("<li>" + img + "</li>").appendTo("#slideshow ul").show();
		});
		curimg++;
		if (totalimages > 1) {
			setTimeout("slideMe()",3500);
		}
	}
});

function slideMe() {
	curimg++;
	if (curimg >= totalimages) {
		curimg = 0;
	}
	jQuery("#slideshow li").addClass("fader");
	var img = "<image src='" + images[curimg] + "' />";
	jQuery(img).load(function(){
		jQuery("<li>" + img + "</li>").appendTo("#slideshow ul").hide().fadeIn("slow",function(){
			jQuery("#slideshow .fader").remove();
			setTimeout("slideMe()",3500);
		});
	});
}
