var currentProductPage = 0;
function showAllProducts()
{
	for (a = 0; a <= productPagesCount; a++)
	{
		if (document.getElementById('product_image_grid_'+a))
		{
			productPageObject = document.getElementById('product_image_grid_'+a);
			productPageObject.style.display = 'block';
		}
	}
	if (document.getElementById('product_block'))
	{
		productBlock = document.getElementById('product_block');
		productBlock.style.display = 'none';
	}
	if (document.getElementById('category_picture'))
	{
		document.getElementById('category_picture').style.display = 'none';
	}
	hideNavigationButtons();
}
function showNextProducts()
{
	var currentProductPageId = 'product_image_grid_'+currentProductPage;
	var newProductPageId = 'product_image_grid_'+(currentProductPage+1);
	
	if (document.getElementById(currentProductPageId))
	{
		currentProductPageObject = document.getElementById(currentProductPageId);
	}
	if (document.getElementById(newProductPageId))
	{
		newProductPageObject = document.getElementById(newProductPageId);
	}
	if (currentProductPageObject && newProductPageObject)
	{
		currentProductPageObject.style.display = 'none';
		newProductPageObject.style.display = 'block';
		
		currentProductPage = currentProductPage+1;
	}
	checkNavigationButtons();
}
function showPreviousProducts()
{
	var currentProductPageId = 'product_image_grid_'+currentProductPage;
	var newProductPageId = 'product_image_grid_'+(currentProductPage-1);
	
	if (document.getElementById(currentProductPageId))
	{
		currentProductPageObject = document.getElementById(currentProductPageId);
	}
	if (document.getElementById(newProductPageId))
	{
		newProductPageObject = document.getElementById(newProductPageId);
	}
	if (currentProductPageObject && newProductPageObject)
	{
		currentProductPageObject.style.display = 'none';
		newProductPageObject.style.display = 'block';
		
		currentProductPage = currentProductPage-1;
	}
	checkNavigationButtons();
}
function checkNavigationButtons()
{
	if (document.getElementById('previous_products'))
	{
		previousProductsObject = document.getElementById('previous_products');
	}
	if (document.getElementById('next_products'))
	{
		nextProductsObject = document.getElementById('next_products');
	}
	if (nextProductsObject)
	{
		newProductPageId = 'product_image_grid_'+(currentProductPage+1);
		if (document.getElementById(newProductPageId))
		{
			nextProductsObject.style.display = 'inline';
		}
		else
		{
			nextProductsObject.style.display = 'none';
		}
	}
	
	if (previousProductsObject)
	{
		newProductPageId = 'product_image_grid_'+(currentProductPage-1);
		if (document.getElementById(newProductPageId))
		{
			previousProductsObject.style.display = 'inline';
		}
		else
		{
			previousProductsObject.style.display = 'none';
		}
	}
}
function hideNavigationButtons()
{
	if (document.getElementById('see_all_next'))
	{
		buttonsObject = document.getElementById('see_all_next');
	}
	
	
	if (buttonsObject)
	{
		buttonsObject.style.visibility = 'hidden';
	}
}
