$(document).ready(function(){
    if(($.browser.msie && $.browser.version > 7) || !$.browser.msie){
		 $('#slider')
		  .anythingSlider({
				width        : 940,
				height       : 350,
				resizeContents      : true,      // If true, solitary images/objects in the panel will expand to fit the viewport
				startPanel          : 1,         // This sets the initial panel
				hashTags            : false,      // Should links change the hashtag in the URL?
				buildArrows         : true,      // If true, builds the forwards and backwards buttons
				buildNavigation     : false,      // If true, buildsa list of anchor links to link to each panel
				navigationFormatter : false,      // Details at the top of the file on this use (advanced use)
				forwardText         : "&raquo;", // Link text used to move the slider forward (hidden by CSS, replaced with arrow image)
				backText            : "&laquo;", // Link text used to move the slider back (hidden by CSS, replace with arrow image)
				
				// Slideshow options
				autoPlay            : true,      // This turns off the entire slideshow FUNCTIONALY, not just if it starts running or not
                startStop           : false,				
				startStopped        : false,     // If autoPlay is on, this can force it to start stopped
				pauseOnHover        : false,      // If true & the slideshow is active, the slideshow will pause on hover
				resumeOnVideoEnd    : false,      // If true & the slideshow is active & a youtube video is playing, it will pause the autoplay until the video has completed
				stopAtEnd           : false,     // If true & the slideshow is active, the slideshow will stop on the last page
				playRtl             : false,     // If true, the slideshow will move right-to-left
				startText           : "Start",   // Start button text
				stopText            : "Stop",    // Stop button text
				delay               : 8000,      // How long between slideshow transitions in AutoPlay mode (in milliseconds)
				animationTime       : 600,       // How long the slideshow transition takes (in milliseconds)
				easing              : "swing"    // Anything other than "linear" or "swing" requires the easing plugin
		  })
		  
		  .anythingSliderFx({
		   inFx: {
			'.caption'  : { right: 0, opacity: 1, time: 400 }
		   },
		   outFx: {
			'.caption'  : { right: -150, opacity: 0, time: 350 }
		   }
		  });
	}else{

	 $('#slider')
		.anythingSlider({
		width        : 940,
		height       : 350,
		startPanel          : 1,         // This sets the initial panel
		hashTags            : false,      // Should links change the hashtag in the URL?
		buildArrows         : true,      // If true, builds the forwards and backwards buttons
		buildNavigation     : false,      // If true, buildsa list of anchor links to link to each panel
		navigationFormatter : false,      // Details at the top of the file on this use (advanced use)
		forwardText         : "&raquo;", // Link text used to move the slider forward (hidden by CSS, replaced with arrow image)
		backText            : "&laquo;", // Link text used to move the slider back (hidden by CSS, replace with arrow image)
		
		// Slideshow options
		autoPlay            : true,      // This turns off the entire slideshow FUNCTIONALY, not just if it starts running or not
		startStopped        : false,     // If autoPlay is on, this can force it to start stopped
		pauseOnHover        : false,      // If true & the slideshow is active, the slideshow will pause on hover
		resumeOnVideoEnd    : false,      // If true & the slideshow is active & a youtube video is playing, it will pause the autoplay until the video has completed
		stopAtEnd           : false,     // If true & the slideshow is active, the slideshow will stop on the last page
		playRtl             : false,     // If true, the slideshow will move right-to-left
		startText           : "Start",   // Start button text
		stopText            : "Stop",    // Stop button text
		delay               : 8000,      // How long between slideshow transitions in AutoPlay mode (in milliseconds)
		animationTime       : 600,       // How long the slideshow transition takes (in milliseconds)
		easing              : "swing"    // Anything other than "linear" or "swing" requires the easing plugin
	  })
	//   this code will make the caption appear when you hover over the panel
	//    remove the extra statements if you don't have captions in that location 
	  .find('.panel')
		.find('div[class*=caption]').css({ position: 'absolute' }).end()
		(
			function(){ showCaptions( $(this) )},
			function(){ hideCaptions( $(this) );}
		);
	
	  showCaptions = function(el){
		var $this = el;
		if ($this.find('.caption').length) {
		  $this.find('.caption')
			.show()
			.animate({ right: 0});
		}
	  };
	  hideCaptions = function(el){
		var $this = el;
		if ($this.find('.caption').length) {
		  $this.find('.caption')
			.stop()
			.animate({ right: -150}, 350, function(){
			  $this.find('.caption').hide(); }); 
		}
	  };
	  // hide all captions initially
	  hideCaptions( $('#slider .panel') );
	};
});





