function appshotshow(appleid, index)
{
	for (var i = 0; i < 100; i++)
	{
		var elem = document.getElementById("appshot_" + appleid + "_" + i);
		if (elem == null) break;
		
		if (i == index) elem.style.display = "inline";
		else elem.style.display = "none";
	}
	
	var caption = "Screenshot " + (index + 1) + " of " + i;
	elemcap = document.getElementById("appcaption_" + appleid);
	elemcap.innerHTML = caption;
}

function appshotnext(appleid)
{
	var index = 0;
	
	for (var i = 0; i < 100; i++)
	{
		var elem = document.getElementById("appshot_" + appleid + "_" + i);
		if (elem == null) break;
		
		if (elem.style.display == "inline") index = i;
	}
	
	if (++index == i) index = 0;

	appshotshow(appleid,index);
}

function appshotprev(appleid)
{
	var index = 0;
	
	for (var i = 0; i < 100; i++)
	{
		var elem = document.getElementById("appshot_" + appleid + "_" + i);
		if (elem == null) break;
		
		if (elem.style.display == "inline") index = i;
	}
	
	if (--index == -1) index = i - 1;
	
	appshotshow(appleid,index);
}

$(document).ready(function() {
	$("#gamesDescriptionTextReadMore").click(function() {
		$("#gamesDescriptionTextRemainder").slideToggle('slow', function() {
			if($("#gamesDescriptionTextRemainder").css('display') == 'none') {
				$("#gamesDescriptionTextRemainder").addClass('descriptionTextRemainder_expanded');
				$("#gamesDescriptionTextRemainder").removeClass('descriptionTextRemainder_collapsed');
				
				var elem = document.getElementById("gamesDescriptionTextReadMore");
				elem.innerHTML = "Show more";
			}
			else {
				$("#gamesDescriptionTextRemainder").addClass('descriptionTextRemainder_collapsed');
				$("#gamesDescriptionTextRemainder").removeClass('descriptionTextRemainder_expanded');

				var elem = document.getElementById("gamesDescriptionTextReadMore");
				elem.innerHTML = "Show less";
			}
		});
	});
});
