on_load('run_slide_show();');

var scroll_distance = -1;

// Starts the slideshow
function run_slide_show(){
	// Internet Explorer
	if(isIE()){
		win = document.getElementById('slideshow_window');
		scroll_distance = win.childNodes[0].offsetHeight + 13;
		win.scrollTop = 0;
	}
	// Start scrolling
	setInterval('step_slideshow();', 30);
}

// Scroll the slideshow window by 1 pixel
function step_slideshow(){
	win = document.getElementById('slideshow_window');
	if(scroll_distance > 0){
		scroll_distance--;
		win.scrollTop = win.scrollTop + 1;
	}
	else {
		if(scroll_distance >= 0){
				// Find the first slide
				i = 0;
				while(win.childNodes[i].id == undefined){
					i++;
				}
				top_slide = win.childNodes[i];
				// Move it to the bottom of the list
				win.removeChild(top_slide);
				win.appendChild(top_slide);
				// Find the new top slide
				i = 0;
				while(win.childNodes[i].id == undefined){
					i++;
				}
		}
		// Reset the scrolling
		scroll_distance = win.childNodes[i].offsetHeight + 13;
		win.scrollTop = 0;
	}
}

function isIE(){
	return /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent);
}