
	// Demo functions
	// **************
	jQuery(function(){

		// External Link
		jQuery("a.muppet").click(function(){
			jQuery('#slider1, #slider2').anythingSlider(5);
			jQuery(document).scrollTop(0); // make the page scroll to the top so you can watch the video
			return false;
		});

		// Report Events to console & features list
		jQuery('#slider1, #slider2').bind('before_initialize initialized swf_completed 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;
			jQuery('#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'];
		jQuery('#currentTheme').change(function(){
			var theme = jQuery(this).val();
			jQuery('#slider1, #slider2').closest('div.anythingSlider')
				.removeClass( jQuery.map(themes, function(t){ return 'anythingSlider-' + t; }).join(' ') )
				.addClass('anythingSlider-' + theme);
			jQuery('#slider1, #slider2').anythingSlider(); // update slider - needed to fix navigation tabs
		});

		// Add a slide
		var imageNumber = 1;
		jQuery('button.add').click(function(){
			jQuery('#slider1, #slider2')
				.append('<li><img src="demos/images/slide-tele-' + (++imageNumber%2 + 1)  + '.jpg" alt="" /></li>')
				.anythingSlider(); // update the slider
		});
		jQuery('button.remove').click(function(){
			jQuery('#slider1 > li:not(.cloned):last, #slider2 > li:not(.cloned):last').remove();
			jQuery('#slider1, #slider2').anythingSlider(); // update the slider
		});

	});
	// Set up Sliders
	// **************
	jQuery(function(){
		jQuery('#slider1, #slider2').anythingSlider({
			theme               : 'metallic',
		//	easing              : 'easeInOutBack',
			easing              : 'easeInOutCirc',
			delay               : 10000,
			animationTime       : 2000,
		/*	buildArrows         : true, */
			buildStartStop      : false,
			autoPlay            : true,
//			autoPlayLocked      : true,  // If true, user changing slides will not stop the slideshow
//			resumeDelay         : 10000, // Resume slideshow after user interaction, only if autoplayLocked is true (in milliseconds).
			onSlideComplete     : function(slider){
				// alert('Welcome to Slide #' + slider.currentPage);
			}
		});

	//	clono i controlli in un altro posto
		var anyControls = jQuery('.anythingControls');
		var anyControlsHTML = anyControls.html();
		if ( anyControls.length > 0 )
		{
		//	anyControls.remove();
		//	jQuery('.newAnythingControls').html('<div class="anythingControls">'+anyControlsHTML+'</div>');
		}
	//	newAnythingControls
	});

	timeOutAutoSlide = null;
	function resetAutoAnimation(base)
	{
		clearTimeout(timeOutAutoSlide);
		var baseOD = base;
		timeOutAutoSlide = setTimeout(function() {

			var base = baseOD;
			base.playing = true;
			base.startStop(base.playing, true);
		},500);
	}
