


Ape.Element.bilder_teaser = function(){
	var that 			= this,
		AnzahlFotoshows = 0,
		action			= 0,
		bewegungsbereich= 0,
		animation		= 'easeOutBack';
	
	/* Basics */
	function setAnimationType(){
		
		if(typeof that.animation === 'undefined'){
			that.animation = animation;
		}
		
		if(this.animation !== ''){
			jQuery.easing.def = that.animation; 
		}
	}
	function resetAnimationType(){
		jQuery.easing.def = 'linear';
	}
	this.start = function(){
		
		
		
		if (that.AnzahlFotoshows <= 4){
			
			$('.fotoslider .weiter a').addClass('inaktiv');
			
		} 
	     
	    $('.fotoslider .zurueck').bind('click',function(){
	     	
	     	if(that.action === 0){
	     		
	     		setAnimationType();
	     		
			     var oldLeft = parseInt($('.fotoslider .thumbs').css('left'));
			     that.action = 1;
			     if(oldLeft <= -73){
			     	$('.fotoslider .weiter a').removeClass('inaktiv');
			     	$(this).addClass('statistik-click').bind('click.statistik-click', statistikclick);
			     	//setStatistikBindings();
				    var newLeft = oldLeft + that.bewegungsbereich;
				    $('.fotoslider .thumbs').animate({left:newLeft+"px"}, 300, '', function(){
				    	that.action = 0;
				    	resetAnimationType();
				    } );                                            
			     }
				 if (oldLeft > -90) {
			     	$('a', this).addClass('inaktiv');
			     	$(this).removeClass('statistik-click').unbind('click.statistik-click');
			     	that.action = 0;
			     }
		     }
	    	 return false;
	     });
	     
	     $('.fotoslider .weiter').bind('click',function(){
	     	
			if (that.action === 0){		
			 	
				setAnimationType();
				
				var oldLeft = parseInt($('.fotoslider .thumbs').css('left'));	
			 	that.action = 1;
				var gesammtbreite = parseInt($('.fotoslider .thumbs').css('width'));
				if((oldLeft*-1) < gesammtbreite-that.bewegungsbereich*5 ){
					$('.fotoslider .zurueck a').removeClass('inaktiv');
					$(this).addClass('statistik-click').bind('click.statistik-click', statistikclick);;
					//setStatistikBindings();
			       var newLeft = oldLeft - that.bewegungsbereich;
			       $('.fotoslider .thumbs').animate({left:newLeft+"px"}, 300, '', function(){
				    	that.action = 0;
				    	resetAnimationType();
				    } );  
				} 
				if (oldLeft < -gesammtbreite+that.bewegungsbereich*6){
					$('a', this).addClass('inaktiv');
					$(this).removeClass('statistik-click').unbind('click.statistik-click');
					that.action = 0;
				}  
			}                                                     
			return false;
	     });
	};

};