var slider2 = ['Recipe', 'Quote', 'Image', 'Quote #2', 'Image #2'];
function formatText(index, panel){
	return slider2[index - 1];
}

$(function () {
	$('#slider1').anythingSlider({
		startStopped    : false, // If autoPlay is on, this can force it to start stopped
		width           : 565,  // Override the default CSS width
		height			: 90,
		delay			: 6000,
		//toggleControls  : true, // if true, then slide in controls on hover and slider change, hide @ other times
		//theme           : 'minimalist-round',
		onSlideComplete : function(slider){
			// alert('Welcome to Slide #' + slider.currentPage);
		}
	});

	$('#slider2').anythingSlider({
		width               : 600,        // if resizeContent is false, this is the default width if panel size is not defined
		height              : 350,        // if resizeContent is false, this is the default height if panel size is not defined
		resizeContents      : false,      // If true, solitary images/objects in the panel will expand to fit the viewport
		startStopped        : true,       // If autoPlay is on, this can force it to start stopped
		navigationFormatter : formatText  // Format navigation labels with text
	});

	$("#slide-jump").click(function(){
		$('#slider2').anythingSlider(4);
		return false;
	});

	// Report Events to console
	$('.anythingSlider').bind('slideshow_start slideshow_stop slideshow_paused slideshow_unpaused slide_init slide_begin slide_complete',function(e, slider){
		// show object ID + event (e.g. "slider1: slide_begin")
		var txt = slider.$el[0].id + ': ' + e.type + ', now on panel #' + slider.currentPage;
		$('#status').text(txt);
		if (window.console && window.console.firebug){ console.debug(txt); } // added window.console.firebug to make this work in Opera
	});

	// Theme Selector (This is really for demo purposes only)
	var themes = ['minimalist-round','minimalist-square','metallic','construction','cs-portfolio'];
	$('#currentTheme').change(function(){
		var theme = $(this).val();

		if (!$('link[href*=' + theme + ']').length) {
			$('body').append('<link rel="stylesheet" href="http://www.itomedia.se/include/slide/css/theme-' + theme + '.css" type="text/css" media="screen" />');
		}
		$('#slider1').closest('div.anythingSlider')
			.removeClass( $.map(themes, function(t){ return 'anythingSlider-' + t; }).join(' ') )
			.addClass('anythingSlider-' + theme);
	});

});
