if (isValidUrl())
{
	if (paintingSet == null)
	{
		paintingSet = new PaintingSet();
	}
	
	if (productSet == null)
	{
		productSet = new ProductSet();
	}
	
	var keyValue = document.location.href.split("=");
	var total_paintings = paintingSet.getPaintingCount() ;
	var total_per_page = PAINTING_THUMBNAIL_ROWS * PAINTING_THUMBNAIL_COLUMNS;
	var total_pages = parseInt(total_paintings / total_per_page) + (total_paintings % total_per_page == 0 ? 0 : 1);
	var page = parseInt(keyValue[1]);
	if (page == null || isNaN(page) || page < 1 || page > total_pages)
	{
		page = 1;
	}
	
	/*
	if ((location.protocol != "http:" && location.protocol != "https:") || (location.hostname != "pinkneylaptop" && location.hostname != "localhost" && location.hostname != "mylespinkney.com" && location.hostname != "www.mylespinkney.com"))
	{
		document.location = "../common/error.html";
	}
	*/
	
	document.title = "Gallery - Page " + page + " - The Myles Pinkney Online Gallery";
}