function teasers()
{
	return {
		
		currentTeasers: [0,0,0],
		countTeasers: [0,0,0],
		
		mouseover: false,
		started: false,
		
		lastRotationTime: new Date().getTime(),
		
		initialize: function( block1, block2, block3, left, right )
		{
			this.block = new Array();
			this.block[0] = $( block1 );
			this.block[1] = $( block2 );
			this.block[2] = $( block3 );
			this.left = $( left );
			this.right = $( right );
			
			this.calculateCount();
			this.addMouseoverEvents();
			if( this.started )
			{
				this.addEvents();
				this.run( -100 );
			}
			
		},
		
		calculateCount: function()
		{
			ths = this;
			$.each( this.block,
				function( index, item )
				{
					ths.countTeasers[index] = item.length;
					if( item.length > 1 )
					{
						ths.started = true;
					}
				}
			);
		},
		
		run: function( direction )
		{
			ths = this;
			function updating( direction )
			{
				if( ths.mouseover )
				{
					ths.lastRotationTime = new Date().getTime();
				}
				var currentTime = new Date().getTime();
				if( ( ( currentTime - ths.lastRotationTime ) >= 7000 ) || ( direction != 0 ) )
				{
					$.each( ths.block,
						function( index, item )
						{
							var lastTIndex = ths.currentTeasers[index];
							if( ( direction == 1 ) || ( direction == 0 ) )
							{
								ths.currentTeasers[index]++;
								if( ths.currentTeasers[index] >= ths.countTeasers[index] )
								{
									ths.currentTeasers[index] = 0;
								}
							}
							else
							{
								ths.currentTeasers[index]--;
								if( ths.currentTeasers[index] < 0 )
								{
									ths.currentTeasers[index] = ths.countTeasers[index] - 1;
								}
							}
							if( direction != -1 )
							{
								setTimeout( function()
								{
									$( item[ lastTIndex ] ).fadeOut( 800 );
									$( item[ ths.currentTeasers[index] ] ).fadeIn( 800 );
								}, index * 250 );
							}
							else
							{
								setTimeout( function()
								{
									$( item[ lastTIndex ] ).fadeOut( 800 );
									$( item[ ths.currentTeasers[index] ] ).fadeIn( 800 );
								}, ( 2 - index ) * 250 );
							}
						}
					);
					ths.lastRotationTime = new Date().getTime();
				}
			}
			if( direction == -100 )
			{
				setInterval( function() { updating( 0 ); }, 300 );
			}
			else
			{
				updating( direction );
			}
		},
		
		addEvents: function()
		{
			var ths = this;
			$( this.left ).click(
				function( event )
				{
					ths.run( -1 );
					return false;
				}
			);
			
			$( this.right ).click(
				function( event )
				{
					ths.run( 1 );
					return false;
				}
			);
		},
		
		addMouseoverEvents: function()
		{
			var ths = this;
			
			$.each( this.block[0],
				function( index, item )
				{
					$( item ).mouseenter(
						function( event )
						{
							$( this ).find( 'div.teaser_content_extended' ).fadeIn( 300 );
							$( this ).parent().css( 'z-index', 1000 );
							ths.mouseover = true;
						}
					);
					
					$( item ).mouseleave(
						function( event )
						{
							$( this ).find( 'div.teaser_content_extended' ).fadeOut( 300 );
							$( this ).parent().css( 'z-index', 1 );
							ths.mouseover = false;
						}
					);
				}
			);
			$.each( this.block[1],
				function( index, item )
				{
					$( item ).mouseenter(
						function( event )
						{
							$( this ).find( 'div.teaser_content_extended' ).fadeIn( 300 );
							$( this ).parent().css( 'z-index', 1000 );
							ths.mouseover = true;
						}
					);
					
					$( item ).mouseleave(
						function( event )
						{
							$( this ).find( 'div.teaser_content_extended' ).fadeOut( 300 );
							$( this ).parent().css( 'z-index', 1 );
							ths.mouseover = false;
						}
					);
				}
			);
			$.each( this.block[2],
				function( index, item )
				{
					$( item ).mouseenter(
						function( event )
						{
							$( this ).find( 'div.teaser_content_extended' ).fadeIn( 300 );
							$( this ).parent().css( 'z-index', 1000 );
							ths.mouseover = true;
						}
					);
					
					$( item ).mouseleave(
						function( event )
						{
							$( this ).find( 'div.teaser_content_extended' ).fadeOut( 300 );
							$( this ).parent().css( 'z-index', 1 );
							ths.mouseover = false;
						}
					);
				}
			);
		}
		
	}
}

