$(document).ready(function(){
	
	var iCountImg 		= $('div.sidebar_teaser_partner img').size();
	var iCurrentId 		= 1;
	var iIdHelper		= 1;
	var t;

	$('div.sidebar_teaser_partner').find('div.sidebar_teaser_image').each(function(){
		
		$(this).attr('id', 'logo'+iIdHelper);
		
		if(iIdHelper == 1){
			$(this).css('z-index', '100');	
		}else{
			$(this).css({opacity: 0.0, display: 'block'});	
		}
		iIdHelper++;
	});
	
	iIdHelper 			= 1;
	
	function animateTeaser(){
		
		var iIdNow 		= iCurrentId;
		(iCurrentId == iCountImg) ? iCurrentId = 1 : iCurrentId = iCurrentId+1;
		
		$('div#logo'+iIdNow).css('z-index', '1');
		$('div#logo'+iCurrentId).css('z-index', '100');
		
		$('div#logo'+iIdNow).animate({
				opacity: 0.0
			}, 2000, 'linear', function(){
				
			}
		);
		
		$('div#logo'+iCurrentId).animate({
				opacity: 1.0
			}, 2000, 'linear', function(){
				
				t = setTimeout(animateTeaser, 5000);
			}
		);
	}
	
	var tWait = setTimeout(animateTeaser, 5000);
	
});

