var bannerCounter = 0;
var displayNewBannerAt = 10;

function goToCollectionPage(collectionPage)
{	
	var objAjax = new ajax();
	
	bannerCounter++;
	
	objAjax.addForm("memberForm");
	objAjax.addParam("doAjaxFor", "collection");
	objAjax.addParam("bannerCounter", bannerCounter);
	objAjax.addParam("displayNewBannerAt", displayNewBannerAt);
	
	checkBannerCounter();
	
	// Since the value of collectionPage was fetched from the existing form, we need to change
	// it to the nr of the page we want to go to.
	objAjax.arrParams["collectionPage"] = collectionPage;
	
	// Give the post function a dummy value to make it reload the current page.
	objAjax.post("ajax");
}

function goToImage(collectionImage)
{
	var objAjax = new ajax();
	
	bannerCounter++;
	
	objAjax.addForm("memberForm");
	objAjax.addParam("doAjaxFor", "image");
	objAjax.addParam("bannerCounter", bannerCounter);
	objAjax.addParam("displayNewBannerAt", displayNewBannerAt);
	
	checkBannerCounter();
	
	// Since the value of collectionPage was fetched from the existing form, we need to change
	// it to the nr of the page we want to go to.
	objAjax.arrParams["collectionImage"] = collectionImage;
	
	// Give the post function a dummy value to make it reload the current page.
	objAjax.post("ajax");
}

function checkBannerCounter()
{
	if(bannerCounter >= displayNewBannerAt)
	{
		bannerCounter = 0;
	}
}
