// -> all links inside the element of ID "contents" with a rel attribute

window.onload = function () {

var image_count = $$('#flash img');
var page = location.href.substring(location.href.lastIndexOf('/')+1);
if(image_count.length > 0 && page != "location.php")
	start_slideshow(1, image_count.length, 4000);
	
	//Random Comment
	objrandomline = new Ajax.PeriodicalUpdater('comment', 'comments.php', 
		{
			method: 'post', 
			frequency: 5, 
			decay: 1
		});
	
}
 
 
function start_slideshow(start_frame, end_frame, delay) {
	setTimeout(switch_slides(start_frame,start_frame,end_frame, delay), delay);
}
						
function switch_slides(frame, start_frame, end_frame, delay) {
	return (function() {
		Effect.Fade('slideshow' + frame);
		if (frame == end_frame) { frame = start_frame; } else { frame = frame + 1; }
		setTimeout("Effect.Appear('slideshow" + frame + "');", 1250);
		setTimeout(switch_slides(frame, start_frame, end_frame, delay), delay + 900);
	})
}