// Autor: Andrzej Florek
var gallery = {
	cache: '' ,
	index_current: 1,
	image_c: 	'.gallery_c',
	image_class: '.gallery',
	image_duration:	'1000',
	image_move: 588,
	blocked: false,
	
	desc_c: '.project_desc_c',
	desc_class: '.project_desc',
	desc_duration:	'200',
	desc_move: 170,	
		
	init:function( project_index ){
		$( "#project_" +  project_index  + " " +  this.image_c + " " + this.image_class ).each(function( index ){
			$( this ).css({ left: ( index * gallery.image_move ) + 'px' });
		});	
		
		$( "#project_" +  project_index  + " " +  this.desc_c + " " + this.desc_class ).each(function( index ){
			$( this ).css({ left: ( index * gallery.desc_move ) + 'px' }); 
		});	
	},
	
	view: function( image_index, desc_index ){
		if( gallery.blocked == true )
			return false;
			
		gallery.blocked = true;	
		$(  "#project_" + data.project_index + ' ' + this.image_c ).animate( { left:( image_index - 1 ) * gallery.image_move * -1 } , this.image_duration,
			function(){
				$(  "#project_" +  data.project_index  + " " + '.project_gallery_nav a').removeClass('selected');
				$(  "#project_" +  data.project_index  + " " +  '.project_gallery_nav .nav_' + image_index ).addClass('selected');
				$(  "#project_" + data.project_index + ' ' + gallery.desc_c ).animate( { left:( desc_index - 1 ) * gallery.desc_move * -1 } , gallery.desc_duration,
					function(){
						gallery.blocked = false; 
					}
				);
		    }																			 
		);
	}	
}
