/*
 * 	Easy Slider - jQuery plugin
 *	written by Alen Grakalic	
 *	http://cssglobe.com/post/3783/jquery-plugin-easy-image-or-content-slider
 *
 *	Copyright (c) 2009 Alen Grakalic (http://cssglobe.com)
 *	Dual licensed under the MIT (MIT-LICENSE.txt)
 *	and GPL (GPL-LICENSE.txt) licenses.
 *
 *	Built for jQuery library
 *	http://jquery.com
 *
 */
 
/*
 *	markup example for $("#images").easySlider();
 *	
 * 	<div id="images">
 *		<ul>
 *			<li><img src="images/01.jpg" alt="" /></li>
 *			<li><img src="images/02.jpg" alt="" /></li>
 *			<li><img src="images/03.jpg" alt="" /></li>
 *			<li><img src="images/04.jpg" alt="" /></li>
 *			<li><img src="images/05.jpg" alt="" /></li>
 *		</ul>
 *	</div>
 *
 */

(function($) {

	$.fn.easySlider = function(options){
	  
		// default configuration properties
		var defaults = {
			speed: 			400			
		}; 
		
		var options = $.extend(defaults, options);  
		
		return this.each(function() {  
			obj = $(this); 				
			var size = $("li.listobject", obj).length;
			var width = obj.width(); 
			var height = obj.height(); 
			var ts = size-1;
			var t = 0;
			
			$("ul#list", obj).css('width',size*width);	
      $("li.listobject", obj).css('float','left');
			
      $("#leistungen_untermenu li a").click(function(){
        var index = $("#leistungen_untermenu li a:parent").index(this);
        animate(index);
			});
		
  	  function animate(index)
      {								
        highindex = index + 1;
        p = (index*width);
        h = $("#leistungen_detailtext li.listobject:nth-child(" + highindex + ") div").height();
        $("ul#list",obj).animate(
        	{
            marginLeft: -p ,
            height: h+10
          }, 
        	options.speed
        );	
      }
      
    });
  };
})
(jQuery);
