$(function() {
update_superbgOptions();
	// update superbgimage options
	function update_superbgOptions() {

		var newspeed = 'normal';
		var newinterval = 5000;
		var newtransitionout = 0;
		var newrandomtransition = 0;
		var newrandomimage = 0;
		
		if ($.superbg_slideshowActive) { // restart slideshow
			clearInterval($.superbg_interval);
			return $('#thumbs').startSlideShow();
		}
		
		// onclick-callback off
		onclickfunc = null;
			$('#superbgimage img').each(function() { // remove click-callback from all images
			$(this).unbind('click');
		});
		
		// onshow-callback
			onshowfunc = superbgimage_show;
		
		// update options
		$.fn.superbgimage.options = { 
			transition: 1,
			speed: newspeed,
			slide_interval: newinterval,
			transitionout: parseInt(newtransitionout, 10),
			randomtransition: parseInt(newrandomtransition, 10),
			randomimage: parseInt(newrandomimage, 10),
			onClick: onclickfunc,
			onShow: onshowfunc
		};
	
	}
	
	// fade overlay with controls, fade container to display titles
	//$('#overlay').fadeTo('slow', 1);

	// prev slide
	$('a.prev').click(function() {
		return $('#thumbs').prevSlide();
	});

	// next slide
	$('a.next').click(function() {
		return $('#thumbs').nextSlide();
	});

	// start slideshow
	$('a.start').click(function() {
		update_superbgOptions();
		return $('#thumbs').startSlideShow();
	});

	// stop slideshow
	$('a.stop').click(function() {
		my_slideshowActive = false;
		return $('#thumbs').stopSlideShow();
	});

	
});
