	var featItemAnimate = function(cur,nex)
	{
		fiWrapper.filter(cur).fadeOut(3000);
		fiWrapper.filter(nex).addClass('curImg').fadeIn(3000);
	}		
						
	var featItemRun = function()
	{						
		fiCurentImg++;	
		fiCurentImg = fiCurentImg > fiCount ? 1 : fiCurentImg;
		
		featItemAnimate('.curImg','#mainPicture'+fiCurentImg);
	
		// Update navigation buttons
		$('div.galleryNavigation a').removeClass('active');
		$('div.galleryNavigation a#i'+fiCurentImg).addClass('active');
	}			
						
	var featItemInit = function() 
	{		
		fiWrapper = $('.galleryContainer > div');				
		fiCurentImg = 1
		fiCount = fiWrapper.size();
																																		
		// Show first image	
		fiWrapper.filter(':first').show().addClass('curImg');						
		
		// Run slide show
		fiInterval = setInterval("featItemRun()",5000);
		
		// Set navigation buttons onclick	
		$('div.galleryNavigation a').click(function () 
		{
			clearInterval(fiInterval);								
			if (this.className.indexOf('active') == -1) 
			{
				featItemAnimate('.curImg',this.hash);								
				$('div.galleryNavigation a').removeClass('active');
				$(this).addClass('active');
			}
			return false;
		});		
	}

