
// SEITE LADEN

	$(document).ready(function() {
		$.multiSlider.init({ item: 'images', width: 908, padding: 1, speed: 500 });

	});



// SLIDER

	$.extend({
		multiSlider: {
			init: function(opt) {
				this.saveOpt(opt);
				if(this.num > 1) {
					this.setPositions();
					this.addActions();
				}
			},
			setPositions: function() {
				this.ul.children('li').each(function(i) {
					$(this).width($.multiSlider.liw);
					$(this).css('left', (i*($.multiSlider.liw+$.multiSlider.padding)));
					$(this).attr('rel', i);
				});
			},
			addActions: function() {
				this.ul.children('li').hover(function() {
					var me = $(this).attr('rel');
					var x = 0;
					$.multiSlider.ul.children('li').each(function(i) {
						var w = (i == me) ? $.multiSlider.liwl : $.multiSlider.liws;
						$(this).stop().animate({ width: w, left: x }, $.multiSlider.speed);
						if(i == me) x += $.multiSlider.liwl+$.multiSlider.padding;
						else x += $.multiSlider.liws+$.multiSlider.padding;
					});
				}, function() {
					$.multiSlider.ul.children('li').each(function(i) {
						var w = $.multiSlider.liw;
						var l = i*($.multiSlider.liw+$.multiSlider.padding);
						$(this).stop().animate({ width: w, left: l }, $.multiSlider.speed);
					});
				});
			},
			saveOpt: function(opt) {
				this.ul = $('#'+opt.item);
				this.ulw = opt.width;
				this.num = this.ul.children('li').size();
				this.liw = Math.round(this.ulw / this.num);
				this.liws = Math.round(this.liw/2);
				this.liwl = this.ulw - (this.liws*(this.num-1));
				this.padding = opt.padding;
				this.speed = opt.speed;
			}
		}
	});




