var images;
var current_image = 0;
var min_images;
var max_images;

$(document).ready(function() {
	
	hide_all_images();
	show_image(current_image);
	
	min_images = 0;
	max_images = $('#portfolio img').length - 1;
	
});

function hide_all_images()
{
	
	$('#portfolio img').each(function(index) {
		$(this).hide();
	});
	
}

function show_image(i)
{

	$('#portfolio img').each(function(index){
		
		if(i == index)
		{
			$(this).show();
		}
		
	});
	
}

function prev_image()
{
	
	if(current_image > min_images)
	{
		current_image--;
		hide_all_images();
		show_image(current_image);
	}
	
}

function next_image()
{
	
	if(current_image < max_images)
	{
		current_image++;
		hide_all_images();
		show_image(current_image);
	}
	
}
