;(function($) {
	$.fn.featureList = function(options) {
		var tabs	= $(this);
		var output	= $(options.output);

		new jQuery.featureList(tabs, output, options);
		return this;	
	};

	$.featureList = function(tabs, output, options) {
		function slide(nr) {
			
			// Überprüft, die Reihenfolge/Null Wert
			if (typeof nr == "undefined") {
				nr = visible_item + 1;
				nr = nr >= total_items ? 0 : nr;
			}
			


			output.stop(true, true).filter(":visible").fadeOut(1,function() {
			visible_item = nr;	
			}); 
			
	
				output.stop(true, true).filter(":visible").fadeOut(0,function() {
					visible_item = nr;	
				}); 
			
			$("ul#output li img").filter(function (index) {
		                  return $(this).attr("height") == "350";
		                }).width(930);
			$("ul#output li img").filter(function (index) {
		                  return $(this).attr("height") == "350";
		                }).height(350);
						//
			// Hinzufügen der CSS Klasse, zum derzeitigen aktuellen Navigationspunkt
			tabs.removeClass('current').filter(":eq(" + nr + ")").addClass('current');
			// Einblendung der neuen Position
			// Die Zeit für fadeIn+animate muß unter 8000 liegen. Sicherheitspuffer beruecksichtigen!
			output.filter(":eq(" + nr + ")").fadeIn(0,function() {
			visible_item = nr;	
				
					// Bestimmung des Bildes aus der neuen Position und zoom es 50 PX größer
					// MKR: vorher 980 / 368
					// Aktuelles Verh�ltnis: 1,35
		            $("ul#output li img").filter(function (index) {
		                  return $(this).attr("height") == "350";
		                })
		            .animate({
		            	'opacity':'1.0','width':'1255px','height':'472px'
		            	},
		            	7950,
		            	"linear"
		            	); 
			});
		}

		var options			= options || {}; 
		// Anzahl der Anzeige Themen
		var total_items		= tabs.length;
		var visible_item	= options.start_item || 0;
		
		// Wenn Mouseover, dann Stop
		options.pause_on_hover		= options.pause_on_hover		|| true;
		// Intervall für den Wechsel
		options.transition_interval	= options.transition_interval	|| 8000;

		output.hide().eq( visible_item ).fadeIn("slow");
		tabs.eq( visible_item ).addClass('current');

		// Lade die angeklickte Position (Positionsübergabe)
		tabs.click(function() {
			if ($(this).hasClass('current')) {

				/* Bildwechsel auslösen */
				
				return false;	
			}

			slide( tabs.index( this) );
		});

		if (options.transition_interval > 0) {
			var timer = setInterval(function () {
				slide();
			}, options.transition_interval);
					
			if (options.pause_on_hover) {
				tabs.mouseenter(function() {
					clearInterval( timer );

				}).mouseleave(function() {
					clearInterval( timer );
					timer = setInterval(function () {
						slide();
					}, options.transition_interval);
				});
			}
		}
	};
})(jQuery);
