function NXCGallery()
{
	return {
		
		active: false,
		
		fullView: false,
		albumOverview: false,
		albumOverviewParams: { 'width': 0, 'height': 0, 'count': 0 },
		albumOverviewRoot: 'div.albums',
		albumRoot: 'div.album',
		pictureRoot: 'div.picture',
		previousTitle: 'span.previous_title',
		currentTitle: 'span.current_title',
		nextTitle: 'span.next_title',
		albumMenu: 'ul.house_menu a.nxc_gallery_album',
		albumRels: '',
		picturesPerAlbums: new Array(),
		
		currentAlbum: 0,
		
		slidingStatus: false,
		
		mouseHover: false,
		
		currentWindowSize: { 'width': 0, 'height': 0 },
		
		control: { 'next': 'div.nxc_gallery div.middle_section>div.next_album',
				   'prev': 'div.nxc_gallery div.middle_section>div.previous_album',
				   'next_alias': 'div.navigation_part a.right_arrow',
				   'prev_alias': 'div.navigation_part a.left_arrow',
				   'top': 'div.nxc_gallery div.middle_section>div.next_picture, div.nxc_gallery div.bottom_navigation div.next_picture',
				   'bottom': 'div.nxc_gallery div.middle_section>div.previous_picture, div.nxc_gallery div.bottom_navigation div.previous_picture' },
		controlStandard: { 'lefts': 'div.nxc_gallery div.middle_section div.album div.previous_picture',
						   'rights': 'div.nxc_gallery div.middle_section div.album div.next_picture',
						   'allLefts': $( 'div.nxc_gallery div.middle_section div.album div.previous_picture' ),
						   'allRights': $( 'div.nxc_gallery div.middle_section div.album div.next_picture' )},
		initialize: function()
		{
			this.active = true;
			if( $( 'div.nxc_gallery' ).hasClass( 'full' ) )
			{
				this.fullView = true;
				this.setFullViewOptions();
			}
			else
			{
				this.fullView = false;
				this.setStandardViewOptions();
			}
			
			this.albumOverviewInitialize();
			this.updateTitle();
			
			//$( this.control.bottom ).hide();
			//$( this.control.prev ).hide();
			this.updatingButtonVisibilityOverview();
			
			this.addEvents();
		},
		
		setFullViewOptions: function()
		{
			var ths = this;
			
			if( !this.albumOverview )
			{
				this.currentWindowSize.width = parseInt( $( window ).width() );
				this.currentWindowSize.height = parseInt( $( window ).height() );
				$( 'div.nxc_gallery' ).css( { 'width': this.currentWindowSize.width, 'height': this.currentWindowSize.height } );
				$( 'div.nxc_gallery div.middle_section' ).css( { 'width': this.currentWindowSize.width, 'height': this.currentWindowSize.height - 35 } );
				$( 'div.nxc_gallery div.middle_section div.albums' ).css( { 'width': this.currentWindowSize.width, 'height': this.currentWindowSize.height - 35 } );
				$( 'div.nxc_gallery div.middle_section div.album' ).css( { 'width': '50000px', 'height': this.currentWindowSize.height - 35, 'float': 'none', 'position': 'relative' } );
				$( 'div.nxc_gallery div.middle_section div.album div.cover' ).css( { 'width': this.currentWindowSize.width, 'height': this.currentWindowSize.height - 35 } );
				$( 'div.nxc_gallery div.middle_section div.album div.pictures' ).css( { 'width': '48000px', 'height': this.currentWindowSize.height - 35 } );
				$( 'div.nxc_gallery div.middle_section div.album div.pictures_wrapper' ).css( { 'width': '48000px', 'height': this.currentWindowSize.height -35 } );
				$( 'div.nxc_gallery div.middle_section div.album div.picture' ).css( { 'width': this.currentWindowSize.width, 'height': this.currentWindowSize.height - 35, 'float': 'left' } );
				
				$.each( $( 'div.nxc_gallery' ).find( 'img.original' ),
					function( index, item )
					{
						var currentWidth = $( item ).width();
						var currentHeight = $( item ).height();
						var tempHeight = 0;
						if( currentWidth > ths.currentWindowSize.width && currentHeight > ths.currentWindowSize.height - 35 )
						{
							var aspectRatio = currentHeight / currentWidth;
							var originalAspectRatio = ths.currentWindowSize.height / ths.currentWindowSize.width;
							if( aspectRatio < originalAspectRatio )
							{
								$( item ).removeAttr( 'height' );
								$( item ).attr( 'width', ths.currentWindowSize.width );
							}
							else
							{
								$( item ).removeAttr( 'width' );
								$( item ).attr( 'height', ths.currentWindowSize.height - 35 );
							}
						}
						else if( currentWidth > ths.currentWindowSize.width )
						{
							$( item ).removeAttr( 'height' );
							$( item ).attr( 'width', ths.currentWindowSize.width );
						}
						else if( currentHeight > ths.currentWindowSize.height - 35 )
						{
							$( item ).removeAttr( 'width' );
							$( item ).attr( 'height', ths.currentWindowSize.height - 35 );
						}
						else
						{
							
						}
					}
				);
			}
			else
			{
				this.currentWindowSize.width = parseInt( $( window ).width() );
				this.currentWindowSize.height = parseInt( $( window ).height() );
				$( 'div.nxc_gallery' ).css( { 'width': this.currentWindowSize.width, 'height': this.currentWindowSize.height } );
				$( 'div.nxc_gallery div.middle_section' ).css( { 'width': this.currentWindowSize.width, 'height': this.currentWindowSize.height - 35 } );
				$( 'div.nxc_gallery div.middle_section div.album' ).each(
					function( index, item )
					{
						$( item ).removeAttr( 'style' );
					}
				);
				$( 'div.nxc_gallery div.middle_section div.album div.picture' ).each(
					function( index, item )
					{
						$( item ).removeAttr( 'style' );
					}
				);
				//$( 'div.nxc_gallery div.middle_section div.album div.picture' ).removeAttr( 'style' );
				$( 'div.nxc_gallery div.middle_section div.album div.pictures' ).css( { 'width': this.currentWindowSize.width - 250, 'height': 'auto' } );
			}
		},
		
		setStandardViewOptions: function()
		{
			var ths = this;
			
			if( !this.albumOverview )
			{
				this.currentWindowSize.width = parseInt( $( 'div.nxc_gallery div.middle_section' ).width() );
				this.currentWindowSize.height = parseInt( $( 'div.nxc_gallery div.middle_section' ).height() );
				$( 'div.nxc_gallery div.middle_section' ).css( { 'width': this.currentWindowSize.width, 'height': this.currentWindowSize.height } );
				$( 'div.nxc_gallery div.middle_section div.albums' ).css( { 'width': this.currentWindowSize.width, 'height': this.currentWindowSize.height } );
				$( 'div.nxc_gallery div.middle_section div.album' ).css( { 'width': '20000px', 'height': this.currentWindowSize.height, 'float': 'none' } );
				$( 'div.nxc_gallery div.middle_section div.album div.cover' ).css( { 'width': this.currentWindowSize.width, 'height': this.currentWindowSize.height } );
				$( 'div.nxc_gallery div.middle_section div.album div.pictures' ).css( { 'width': '18000px', 'height': this.currentWindowSize.height } );
				$( 'div.nxc_gallery div.middle_section div.album div.pictures_wrapper' ).css( { 'width': '18000px', 'height': this.currentWindowSize.height } );
				$( 'div.nxc_gallery div.middle_section div.album div.picture' ).css( { 'width': this.currentWindowSize.width, 'height': this.currentWindowSize.height, 'float': 'left' } );
			}
			else
			{
				this.currentWindowSize.width = parseInt( $( 'div.nxc_gallery div.middle_section' ).width() );
				this.currentWindowSize.height = parseInt( $( 'div.nxc_gallery div.middle_section' ).height() );
				$( 'div.nxc_gallery div.middle_section' ).css( { 'width': this.currentWindowSize.width, 'height': this.currentWindowSize.height } );
				$( 'div.nxc_gallery div.middle_section div.album' ).css( { 'width': '20000px', 'height': this.currentWindowSize.height, 'float': 'left' } );
				$( 'div.nxc_gallery div.middle_section div.album' ).each(
					function( index, item )
					{
						$( item ).removeAttr( 'style' );
						$( item ).attr( 'style', "" );
						$( item ).find( 'div.cover' ).removeAttr( 'style' );
						$( item ).find( 'div.cover' ).attr( 'style', "" );
						$( item ).find( 'div.pictures' ).removeAttr( 'style' );
						$( item ).find( 'div.pictures' ).attr( 'style', "" );
						$( item ).find( 'div.pictures_wrapper' ).removeAttr( 'style' );
						$( item ).find( 'div.pictures_wrapper' ).attr( 'style', "" );
					}
				);
				$( 'div.nxc_gallery div.middle_section div.album div.picture' ).each(
					function( index, item )
					{
						$( item ).removeAttr( 'style' );
						$( item ).attr( 'style', "" );
					}
				);
				$( 'div.nxc_gallery div.middle_section div.album div.pictures' ).css( { 'width': this.currentWindowSize.width - 250, 'height': 'auto' } );
			}
		},
		
		albumOverviewInitialize: function()
		{
			var ths = this;
			this.albumRels = $( this.albumOverviewRoot ).find( this.albumRoot );
			this.albumOverviewParams.count = this.albumRels.length;
			this.albumOverviewParams.width = parseInt( $( this.albumOverviewRoot ).parent().width() );
			this.albumOverviewParams.height = parseInt( $( this.albumOverviewRoot ).parent().height() );
			$.each( this.albumRels,
				function( index, item )
				{
					var pictures = $( item ).find( ths.pictureRoot );
					ths.picturesPerAlbums[index] = pictures.length + 1;
				}
			);
		},
		
		sliding: function( direction, index )
		{
			if( !this.albumOverview )
			{
				this.slidingAlbumOverview( direction );
			}
			else
			{
				if( typeof index == "undefined" )
				{
					var index = this.currentAlbum;
				}
				this.slidingAlbumStandard( direction, index );
			}
		},
		
		vSliding: function( direction )
		{
			if( !this.albumOverview )
			{
				this.vSlidingAlbumOverview( direction );
			}
			else
			{
				this.vSlidingAlbumStandard( direction );
			}
		},
		
		updatingButtonVisibilityStandardDefault: function()
		{
			var ths = this;
			$.each( this.albumRels,
				function( index, item )
				{
					var currentWidth = $( item ).find( 'div.picture' ).outerWidth( true );
					var currentGeneralWidth = ( ths.picturesPerAlbums[index] - 1 ) * currentWidth;
					var currentLeft = parseInt( $( item ).find( 'div.pictures_wrapper' ).css( 'left' ) );
					
					if( currentGeneralWidth < $( item ).find( 'div.pictures' ).width() )
					{
						$( ths.controlStandard.allLefts[index] ).hide();
						$( ths.controlStandard.allRights[index] ).hide();
					}
					else
					{
						if( currentLeft == 0 )
						{
							$( ths.controlStandard.allLefts[index] ).hide();
						}
						else
						{
							$( ths.controlStandard.allLefts[index] ).show();
						}
						if( currentLeft == - ( currentGeneralWidth - $( item ).find( 'div.pictures' ).width() ) )
						{
							$( ths.controlStandard.allRights[index] ).hide();
						}
						else
						{
							$( ths.controlStandard.allRights[index] ).show();
						}
					}
				}
			);
		},
		
		updatingButtonVisibilityStandard: function( index )
		{
			var currentWidth = $( this.albumRels[index] ).find( 'div.picture' ).outerWidth( true );
			var currentGeneralWidth = ( this.picturesPerAlbums[index] - 1 ) * currentWidth;
			var currentLeft = parseInt( $( this.albumRels[index] ).find( 'div.pictures_wrapper' ).css( 'left' ) );
			
			if( currentGeneralWidth < $( this.albumRels[index] ).find( 'div.pictures' ).width() )
			{
				$( this.controlStandard.allLefts[index] ).hide();
				$( this.controlStandard.allRights[index] ).hide();
			}
			else
			{
				if( currentLeft == 0 )
				{
					$( this.controlStandard.allLefts[index] ).hide();
				}
				else
				{
					$( this.controlStandard.allLefts[index] ).show();
				}
				if( currentLeft == - ( currentGeneralWidth - $( this.albumRels[index] ).find( 'div.pictures' ).width() ) )
				{
					$( this.controlStandard.allRights[index] ).hide();
				}
				else
				{
					$( this.controlStandard.allRights[index] ).show();
				}
			}
			/*var currentHeight = $( this.albumRels[this.currentAlbum] ).outerHeight() + ( $( this.albumRels[this.currentAlbum] ).outerHeight( true ) - $( this.albumRels[this.currentAlbum] ).outerHeight() ) / 2;
			var currentTop = parseInt( $( this.albumOverviewRoot ).css( 'top' ) );
			
			if( currentTop == 0 )
			{
				$( this.control.bottom ).hide();
			}
			else
			{
				$( this.control.bottom ).show();
			}
			if( currentTop == - ( currentHeight * ( this.albumOverviewParams.count - 3 ) ) )
			{
				$( this.control.top ).hide();
			}
			else
			{
				$( this.control.top ).show();
			}*/
			
			if( this.currentAlbum == 0 )
			{
				$( this.control.bottom ).hide();
			}
			else
			{
				$( this.control.bottom ).show();
			}
			if( this.currentAlbum == ( this.albumOverviewParams.count - 1 ) )
			{
				$( this.control.top ).hide();
			}
			else
			{
				$( this.control.top ).show();
			}
		},
		
		updatingButtonVisibilityOverview: function()
		{
			var currentLeft = parseInt( $( this.albumRels[this.currentAlbum] ).css( 'left' ) );
			if( currentLeft == 0 )
			{
				$( this.control.prev ).hide();
			}
			else
			{
				$( this.control.prev ).show();
			}
			if( currentLeft == - ( this.albumOverviewParams.width * ( this.picturesPerAlbums[this.currentAlbum] - 1 ) ) )
			{
				$( this.control.next ).hide();
			}
			else
			{
				$( this.control.next ).show();
			}
			
			$( this.control.bottom ).hide();
			$( this.control.top ).hide();
			
			/*var currentTop = parseInt( $( this.albumOverviewRoot ).css( 'top' ) );
			if( currentTop == 0 )
			{
				$( this.control.bottom ).hide();
			}
			else
			{
				$( this.control.bottom ).show();
			}
			if( currentTop == - ( this.albumOverviewParams.height * ( this.albumOverviewParams.count - 1 ) ) )
			{
				$( this.control.top ).hide();
			}
			else
			{
				$( this.control.top ).show();
			}*/
		},
		
		slidingAlbumStandard: function( direction, index )
		{
			var ths = this;
			var currentWidth = $( this.albumRels[index] ).find( 'div.picture' ).outerWidth( true );
			var currentGeneralWidth = ( this.picturesPerAlbums[index] - 1 ) * currentWidth;
			var currentLeft = parseInt( $( this.albumRels[index] ).find( 'div.pictures_wrapper' ).css( 'left' ) );
			if( currentGeneralWidth < $( this.albumRels[index] ).find( 'div.pictures' ).width() )
			{
				var nextLeft = 0;
			}
			else
			{
				var nextLeft = currentLeft + ( direction * 200 );
				if( nextLeft > 0 )
				{
					nextLeft = 0;
				}
				if( Math.abs( nextLeft ) > ( currentGeneralWidth - $( this.albumRels[index] ).find( 'div.pictures' ).width() ) )
				{
					nextLeft = - ( currentGeneralWidth - $( this.albumRels[index] ).find( 'div.pictures' ).width() );
				}
			}
			
			if( !this.slidingStatus )
			{
				if( nextLeft != currentLeft )
				{
					this.slidingStatus = true;
					$( this.albumRels[index] ).find( 'div.pictures_wrapper' ).animate( { 'left': nextLeft }, 400, function(){
							ths.slidingStatus = false;
							ths.updatingButtonVisibilityStandard( index );
						}
					);
				}
				else
				{
					this.updatingButtonVisibilityStandard( index );
				}
				//this.updateTitle();
			}
		},
		
		vSlidingAlbumStandard: function( direction )
		{
			var ths = this;
			var currentHeight = $( this.albumRels[this.currentAlbum] ).outerHeight() + ( $( this.albumRels[this.currentAlbum] ).outerHeight( true ) - $( this.albumRels[this.currentAlbum] ).outerHeight() ) / 2;
			var currentTop = parseInt( $( this.albumOverviewRoot ).css( 'top' ) );
			var nextTop = currentTop + ( direction * currentHeight );
			
			if( !this.slidingStatus )
			{
				//calculating actived album
				$( this.albumRels[this.currentAlbum] ).removeClass( 'actived' );
				this.currentAlbum -= direction;
				if( this.currentAlbum < 0 )
				{
					this.currentAlbum = 0;
				}
				if( this.currentAlbum >= this.albumOverviewParams.count )
				{
					this.currentAlbum = this.albumOverviewParams.count - 1;
				}
				$( this.albumRels[this.currentAlbum] ).addClass( 'actived' );
				
				if( nextTop > 0 )
				{
					nextTop = 0;
				}
				if( Math.abs( nextTop ) > ( currentHeight * ( this.albumOverviewParams.count - 3 ) ) )
				{
					nextTop = - ( currentHeight * ( this.albumOverviewParams.count - 3 ) );
				}
				if( nextTop != currentTop )
				{
					this.slidingStatus = true;
					$( this.albumOverviewRoot ).animate( { 'top': nextTop }, 500, function(){
							ths.slidingStatus = false;
							ths.updatingButtonVisibilityStandard( ths.currentAlbum );
						}
					);
				}
				else
				{
					this.updatingButtonVisibilityStandard( this.currentAlbum );
				}
				this.updateTitle();
			}
		},
		
		slidingAlbumOverview: function( direction )
		{
			var ths = this;
			var currentLeft = parseInt( $( this.albumRels[this.currentAlbum] ).css( 'left' ) );
			var nextLeft = currentLeft + ( direction * this.albumOverviewParams.width );
			if( nextLeft > 0 )
			{
				nextLeft = 0;
			}
			if( Math.abs( nextLeft ) > ( this.albumOverviewParams.width * ( this.picturesPerAlbums[this.currentAlbum] - 1 ) ) )
			{
				nextLeft = - ( this.albumOverviewParams.width * ( this.picturesPerAlbums[this.currentAlbum] - 1 ) );
			}
			
			if( !this.slidingStatus )
			{
				if( nextLeft != currentLeft )
				{
					this.slidingStatus = true;
					$( this.albumRels[this.currentAlbum] ).animate( { 'left': nextLeft }, 500, function(){
							ths.slidingStatus = false;
							ths.updatingButtonVisibilityOverview();
						}
					);
				}
				else
				{
					this.updatingButtonVisibilityOverview();
				}
			}
		},
		
		vSlidingAlbumOverview: function( direction )
		{
			var ths = this;
			var currentTop = parseInt( $( this.albumOverviewRoot ).css( 'top' ) );
			var nextTop = currentTop + ( direction * this.albumOverviewParams.height );
			if( nextTop > 0 )
			{
				nextTop = 0;
			}
			if( Math.abs( nextTop ) > ( this.albumOverviewParams.height * ( this.albumOverviewParams.count - 1 ) ) )
			{
				nextTop = - ( this.albumOverviewParams.height * ( this.albumOverviewParams.count - 1 ) );
			}
			
			if( !this.slidingStatus )
			{
				if( nextTop != currentTop )
				{
					this.currentAlbum -= direction;
					//this.slidingStatus = true;
					$( this.albumRels[this.currentAlbum] ).css( 'left', '0px' );
					$( this.albumOverviewRoot ).css( { 'top': nextTop } );
					this.updatingButtonVisibilityOverview();
					/*$( this.albumOverviewRoot ).animate( { 'top': nextTop }, 500, function(){
							ths.slidingStatus = false;
							ths.updatingButtonVisibilityOverview();
						}
					);*/
				}
				else
				{
					this.updatingButtonVisibilityOverview();
				}
				this.updateTitle();
			}
		},
		
		hoveringButton: function()
		{
			
		},
		
		updateAlbum: function( nextAlbum )
		{
			direction = this.currentAlbum - nextAlbum;
			
			if( !this.albumOverview )
			{
				this.vSlidingAlbumOverview( direction );
			}
			else
			{
				this.vSlidingAlbumStandard( direction );
			}
		},
		
		updateTitle: function()
		{
			var allMenuItem = $( 'ul.house_menu a.nxc_gallery_album' );
			$( allMenuItem ).removeClass( 'active' );
			$( allMenuItem[this.currentAlbum] ).addClass( 'active' );
			/*if( typeof this.albumRels[ this.currentAlbum - 1 ] != "undefined" )
			{
				$( this.previousTitle ).text( $( this.albumRels[ this.currentAlbum - 1 ] ).find( 'div.album_title' ).text() );
			}
			else
			{
				$( this.previousTitle ).text( '' );
			}
			
			if( typeof this.albumRels[ this.currentAlbum ] != "undefined" )
			{
				$( this.currentTitle ).text( $( this.albumRels[ this.currentAlbum ] ).find( 'div.album_title' ).text() );
			}
			else
			{
				$( this.currentTitle ).text( '' );
			}
			
			if( typeof this.albumRels[ this.currentAlbum + 1 ] != "undefined" )
			{
				$( this.nextTitle ).text( $( this.albumRels[ this.currentAlbum + 1 ] ).find( 'div.album_title' ).text() );
			}
			else
			{
				$( this.nextTitle ).text( '' );
			}
			this.alignTitleWidth();*/
		},
		
		alignTitleWidth: function()
		{
			var centerWidth = parseInt( $( this.currentTitle ).parent().width() );
			var generalWidth = $( 'div.bottom_navigation' ).width();
			var leftWidth = Math.abs( generalWidth - centerWidth );
			$( this.previousTitle ).parent().css( 'width', leftWidth / 2 );
			$( this.nextTitle ).parent().css( 'width', leftWidth / 2 );
		},
		
		setPosition: function()
		{
			$( this.albumOverviewRoot ).css( { 'left': 0, 'top': 0 } );
			$( this.albumRoot ).css( { 'left': 0, 'top': 0 } );
		},
		
		goToStandardView: function()
		{
			$( 'div.nxc_gallery div.middle_section div.next_album' ).hide();
			$( 'div.nxc_gallery div.middle_section div.previous_album' ).hide();
			$( 'div.bottom_navigation' ).children().hide();
			$( this.albumRels[0] ).addClass( 'actived' );
			//hide buttons
			this.updatingButtonVisibilityStandard();
			this.updateTitle();
			var ths = this;
			window.setTimeout( function() { ths.updatingButtonVisibilityStandardDefault(); }, 200 );
			
			if( this.fullView )
			{
				this.setFullViewOptions();
			}
			else
			{
				this.setStandardViewOptions();
			}
			this.currentAlbum = 0;
		},
		
		goToAlbumOverview: function()
		{
			$( 'div.nxc_gallery div.middle_section div.next_album' ).show();
			$( 'div.nxc_gallery div.middle_section div.previous_album' ).show();
			$( 'div.bottom_navigation' ).children().show();
			$( this.albumRels ).removeClass( 'actived' );
			//hide buttons
			this.updatingButtonVisibilityOverview();
			this.updateTitle();
			if( this.fullView )
			{
				this.setFullViewOptions();
			}
			else
			{
				this.setStandardViewOptions();
			}
			
			this.currentAlbum = 0;
		},
		
		addEvents: function()
		{
			var ths = this;
			
			$( this.control.prev + ', ' + this.control.prev_alias ).click(
				function( event )
				{
					ths.sliding( 1 );
					return false;
				}
			);
			$( this.control.next + ', ' + this.control.next_alias ).click(
				function( event )
				{
					ths.sliding( -1 );
					return false;
				}
			);
			
			$( this.control.top ).click(
				function( event )
				{
					ths.vSliding( -1 );
					return false;
				}
			);
			$( this.control.bottom ).click(
				function( event )
				{
					ths.vSliding( 1 );
					return false;
				}
			);
			
			$( this.control.prev ).mouseenter(
				function( event )
				{
					ths.hoveringButton( this, true );
					return false;
				}
			);
			$( this.control.next ).mouseenter(
				function( event )
				{
					ths.hoveringButton( this, false );
					return false;
				}
			);
			
			$( this.control.prev ).mouseleave(
				function( event )
				{
					ths.hoveringButton( this, true ); 
					return false;
				}
			);
			$( this.control.next ).mouseleave(
				function( event )
				{
					ths.hoveringButton( this, false );
					return false;
				}
			);
			$( 'a.album_overview' ).click(
				function( event )
				{
					$( this ).toggleClass( 'active' );
					$( 'div.nxc_gallery' ).toggleClass( 'album_overview' );
					if( $( 'div.nxc_gallery' ).hasClass( 'album_overview' ) )
					{
						ths.albumOverview = true;
						ths.goToStandardView();
					}
					else
					{
						ths.albumOverview = false;
						ths.goToAlbumOverview();
					}
					ths.setPosition();
					return false;
				}
			);
			
			$.each( $( this.controlStandard.lefts ),
				function( index, item )
				{
					$( item ).click(
						function( event )
						{
							ths.sliding( 1, index );
							return false;
						}
					);
				}
			);
			$.each( $( this.controlStandard.rights ),
				function( index, item )
				{
					$( item ).click(
						function( event )
						{
							ths.sliding( -1, index );
							return false;
						}
					);
				}
			);
			
			$( 'div.nxc_gallery' ).mouseenter(
				function( event )
				{
					ths.mouseHover = true;
				}
			);
			
			$( 'div.nxc_gallery' ).mouseleave(
				function( event )
				{
					ths.mouseHover = false;
				}
			);
			
			$( document ).keydown(
				function( event )
				{
					//if( ths.mouseHover )
					//{
						if( event.keyCode == 37 )
						{
							ths.sliding( 1 );
							return false;
						}
						else if( event.keyCode == 39 )
						{
							ths.sliding( -1 );
							return false;
						}
						else if( event.keyCode == 38 )
						{
							ths.vSliding( 1 );
							return false;
						}
						else if( event.keyCode == 40 )
						{
							ths.vSliding( -1 );
							return false;
						}
					//}
				}
			);
			
			$( 'div.album_description' ).click(
				function( event )
				{
					$( this ).toggleClass( 'hide_desc' );
					return false;
				}
			);
			
			$.each( $( this.albumMenu ),
				function( index, item )
				{
					$( item ).click(
						function( event )
						{
							ths.updateAlbum( index );
							return false;
						}
					);
				}
			);
			
			$( 'a.go_to_the_top' ).click(
				function( event )
				{
					ths.vSliding( ths.picturesPerAlbums[ths.currentAlbum] );
					return false;
				}
			);
		}
		
	}
}
