(function ($) {
	var FeaturedVehcilesElevator = function(settings) {
		settings = $.extend({
			slideshowFeaturedVehicles:false,
			slideshowFadeSpeed:'normal',
			slideshowTimeout:4000,
			slideshowSlideOrder:'random'
		}, settings);
		var hideFvShowCase = function() {//fvWrap is the jquery obj passed in by the hoverinent plugin
		  $('.fvShowCase').removeClass("show").addClass("hide");
			return false;
		};
		var showFvShowcase = function(fvWrap) {//fvWrap is the jquery obj passed in by the hoverinent plugin
			var getIdToShow = $(fvWrap).attr('id');
			$('.fvShowCase').removeClass('show').addClass('hide');
			$('.fvShowCase[class*='+getIdToShow+']').removeClass('hide').addClass('show');
		};
		var init = function() {
			$("div.fvWrap").click(function() {
				window.location = $(this).find("a").attr("href");
			});
			$('.fvSClose').click(function() {
				$('.fvShowCase').removeClass("show").addClass("hide");
			  	return false;
			});
			$('#fvPage .widgetWrap').change(function() {
				hideFvShowCase();
				$('#fvPage .widgetWrap li .wrap').css({overflow:'hidden'});
				$('#fvPage .widgetWrap li.selected .wrap').css({overflowY:'auto',overflowX:'hidden'});
			});
			/*settign up jquery plugins
			* accordian
			* hoverIntent
			* innerfade
			* */
			$('.fvWrap').hoverIntent({
				sensitivity: 3, // number = sensitivity threshold (must be 1 or higher)
				interval: 150, // number = milliseconds for onMouseOver polling interval
				over: function() {
					showFvShowcase(this);
				}, // function = onMouseOver callback (REQUIRED)
				timeout: 200, // number = milliseconds delay before onMouseOut
				out: function() {
						$('.fvShowCase[class*="show"]').hover(function(){
							return false;
						},function(){
							hideFvShowCase();
						});
					return false;
				} // function = onMouseOut callback (REQUIRED)
			});
			$("div.fvWrap").hover(function() {
				$(this).addClass("fvOver").addClass("hand");
				window.status = $(this).find("a").attr("href");
			}, function () {
				$(this).removeClass("fvOver").removeClass("hand");
				window.status = "";
			});

			if (settings.slideshowFeaturedVehicles == 'true') {
				$('.slidesWrap').each(function() {
					$(this).innerfade({
						animationtype: 'fade',
						speed: settings.slideshowFadeSpeed,
						timeout: settings.slideshowTimeout,
						type: settings.slideshowSlideOrder
					});
				});
			}

		};
		init();
		};

	window.DDC.FeaturedVehcilesElevator = FeaturedVehcilesElevator;
})(jQuery);
