jQuery(document).ready(function(){


	jQuery('.anythingSlider' ).live( 'mouseenter',  function() {
		if(jQuery(this).find('ul').hasClass('sliderWithArrows'))
		{
			jQuery(this).find('span.arrow').show();
		}
    });

    jQuery('.anythingSlider' ).live( 'mouseleave',  function() {
		if(jQuery(this).find('ul').hasClass('sliderWithArrows'))
		{
			jQuery(this).find('span.arrow').hide();
		}
    });


	jQuery('.sliderWithArrows')
	.anythingSlider({
		width               : 720,
		height              : 248,
		buildNavigation   	: false,
		delay              	: 8000,
		startStopped        : false,
		startText         	: '',
		stopText         	: ''
	})



	.anythingSliderFx({
		inFx: {
			'.caption-top'    : { top: 0, opacity: 0.75, time: 400 },
			'.caption-right'  : { right: 10 , opacity: 0.75, time: 400 },
			'.caption-bottom' : { bottom: 0, opacity: 0.75, time: 400 },
			'.caption-left'   : { left: 0, opacity: 0.75, time: 400 }
		},
		outFx: {
			'.caption-top'    : { top: -50, opacity: 0, time: 350 },
			'.caption-right'  : { right: -150, opacity: 0, time: 350 },
			'.caption-bottom' : { bottom: -50, opacity: 0, time: 350 },
			'.caption-left'   : { left: -150, opacity: 0, time: 350 }
		}
	})
	// add a close button (x) to the caption
	.find('div[class*=caption]')
		.css({ position: 'absolute' })
		.prepend('<span class="close">x</span>')
		.find('.close').click(function(){
			var cap = jQuery(this).parent(),
				ani = { bottom : -50 }; // bottom
			if (cap.is('.caption-top')) { ani = { top: -50 }; }
			if (cap.is('.caption-left')) { ani = { left: -150 }; }
			if (cap.is('.caption-right')) { ani = { right: -150 }; }
			cap.animate(ani, 400, function(){ cap.hide(); } );
		});

	/*  use this code if you only want the caption to appear when you hover over the panel
	.find('.panel')
		.find('div[class*=caption]').css({ position: 'absolute' }).end()
		.hover(function(){ showCaptions( jQuery(this) ) }, function(){ hideCaptions( jQuery(this) ); });

	showCaptions = function(el){
		var jQuerythis = el;
		if (jQuerythis.find('.caption-top').length) { jQuerythis.find('.caption-top').show().animate({ top: 0, opacity: 1 }, 400); }
		if (jQuerythis.find('.caption-right').length) { jQuerythis.find('.caption-right').show().animate({ right: 0, opacity: 1 }, 400); }
		if (jQuerythis.find('.caption-bottom').length) { jQuerythis.find('.caption-bottom').show().animate({ bottom: 0, opacity: 1 }, 400); }
		if (jQuerythis.find('.caption-left').length) { jQuerythis.find('.caption-left').show().animate({ left: 0, opacity: 1 }, 400); }
	};
	hideCaptions = function(el){
		var jQuerythis = el;
		if (jQuerythis.find('.caption-top').length) { jQuerythis.find('.caption-top').stop().animate({ top: -50, opacity: 0 }, 400, function(){ jQuerythis.find('.caption-top').hide(); }); }
		if (jQuerythis.find('.caption-right').length) { jQuerythis.find('.caption-right').stop().animate({ right: -150, opacity: 0 }, 400, function(){ jQuerythis.find('.caption-right').hide(); }); }
		if (jQuerythis.find('.caption-bottom').length) { jQuerythis.find('.caption-bottom').stop().animate({ bottom: -50, opacity: 0 }, 400, function(){ jQuerythis.find('.caption-bottom').hide(); }); }
		if (jQuerythis.find('.caption-left').length) { jQuerythis.find('.caption-left').stop().animate({ left: -150, opacity: 0 }, 400, function(){ jQuerythis.find('.caption-left').hide(); }); }
	};

	// hide all captions initially
	hideCaptions( jQuery('#slider3 .panel') );
*/
	jQuery('.sliderWithArrows').parent().parent().find('span.arrow').hide();

});
