var count = 0;
Event.observe(window, 'load', slide_load);

function slide_next() {
	new Effect.Move($('mod_stiller_slides'), { x: -207, y: 0, duration: 0.3, queue: "end"});
	count += 1;
	
	if(count == 0) { $('mod_stiller_control_previous').appear({ duration: 0.3 }); }
	if(count == (number - 2)) { $('mod_stiller_control_next').hide(); }
	
	$('mod_stiller_control_zoom').href = $('mod_stiller_a_'+(count+1)).href;
	$('mod_stiller_control_zoom').title = $('mod_stiller_a_'+(count+1)).title;
}

function slide_previous(){
	new Effect.Move($('mod_stiller_slides'), {
		x: 207,
		y: 0,
		duration: 0.3,
		queue: "end"
	});
	
	if (count == 0) {
		$('mod_stiller_control_previous').hide();
	}
	count -= 1;
	
	if (count <= (number - 3) || number == 2) {
		$('mod_stiller_control_next').appear({
			duration: 0.3
		});
	}
	
	$('mod_stiller_control_zoom').href = $('mod_stiller_a_' + (count + 1)).href;
	$('mod_stiller_control_zoom').title = $('mod_stiller_a_' + (count + 1)).title;
}

function slide_load() {
	if(number == 0) {
		// if no entries -> hide controls
		$('mod_stiller_control_previous').hide();
		$('mod_stiller_control_zoom').hide();
		$('mod_stiller_control_next').hide();
	}
	if(number == 1) {
		slide_previous();
		$('mod_stiller_control_next').hide();
	}
	if(number == 2) {
		$('mod_stiller_control_next').hide();
	}
}
