/*
 *  
 *  @author Guido Brauer
 *  
 *  
 */

 
(function(jQuery){
	
	jQuery.fn.makeSmallSlide = function(){	
		return this.each(function(){		
				
			/*
			 * l : 		Gesamtanzahl der li Elemente
			 * w : 		Breite des Div's der die Liste beinhaltet
			 * s : 		Gesamtanzahl - 1
			 * count:	Zähler  
			 */ 
			
			obj = jQuery(this);			
			var l = jQuery("li", obj).length;
			var w = obj.width();			
			var s = l-1;
			var count = 0;
			var amount = 9;
	
			jQuery("ul", obj).css("width", amount*190);
	
			jQuery("#prevBt2").css('background-image','url(/WebRoot/StoreTypes/6.12.3/Store/img_Design2012/bt_prevLogo_bg_dis.png)');
		
			jQuery("#nextBt2").click(function(){
				
				jQuery("#prevBt2").css('background-image','url(/WebRoot/StoreTypes/6.12.3/Store/img_Design2012/bt_prevLogo_bg.png)');
				animateLogo("next");				
				if (count >= amount) {
					jQuery(this).css('background-image','url(/WebRoot/StoreTypes/6.12.3/Store/img_Design2012/bt_nextLogo_bg_dis.png)');
					jQuery("#prevBt2").css('background-image','url(/WebRoot/StoreTypes/6.12.3/Store/img_Design2012/bt_prevLogo_bg.png)');
				}
			});			
			
			jQuery("#prevBt2").click(function(){
		
				jQuery("#nextBt2").css('background-image','url(/WebRoot/StoreTypes/6.12.3/Store/img_Design2012/bt_nextLogo_bg.png)');
			animateLogo("prev");				
			
			if (count <= 0) {
				jQuery(this).css('background-image','url(/WebRoot/StoreTypes/6.12.3/Store/img_Design2012/bt_prevLogo_bg_dis.png)');
				jQuery("#nextBt2").css('background-image','url(/WebRoot/StoreTypes/6.12.3/Store/img_Design2012/bt_nextLogo_bg.png)');
			}
			});		
			
		
		function animateLogo(dir){
			//debugger;
			if(dir == "next"){
				count = (count>=amount) ? amount : count+1;	
			}			
			else {
				count = (count<=0) ? 0 : count-1;
			};		
			p = (count*190*-1);
			jQuery("ul","#slider2").animate({ marginLeft: p }, 200);	
				
				
						
		};
	});	
};
})(jQuery);
