function getPhotosAndCountsForKraftRecipe(recipeId, callback, pageNum) {
	function onbatchcomplete(responseBatch) {
		//console.dir(responseBatch);
		if (responseBatch.Messages[0].Message.toLowerCase() == "ok") {
			var response = responseBatch.Responses[0].CustomCollectionPage;

			//call the callback
			getPhotosAndCountsForKraftRecipe.callbackFtn( parseInt(response.NumberOfItems), response.Items );
		} else {
			if (console && console.log) console.log("Photo loader didn't find any photos");
		}
	}
	
	getPhotosAndCountsForKraftRecipe.callbackFtn = callback;

	var onPage = pageNum || 1; //default

	var collectionId = "recipePhotos_kraftRecipe_" + recipeId;
	var requestBatch = new RequestBatch();
	requestBatch.AddToRequest( new CustomCollectionPage( new CustomCollectionKey(collectionId), 10, onPage ) );
	
	requestBatch.BeginRequest(serverUrl, onbatchcomplete);
}




function getPhotosAndCountsForMemberRecipe(recipeId, callback, pageNum) {
	function oncomplete() {
		//call the callback
		getPhotosAndCountsForMemberRecipe.callbackFtn( getPhotosAndCountsForMemberRecipe.photoCount, 
			getPhotosAndCountsForMemberRecipe.photos );
	}
	
	function onbatchcomplete(responseBatch) {
		//console.dir(responseBatch);
		for (var i = 0; i < responseBatch.Responses.length; i++) {
			var response = responseBatch.Responses[0].CustomCollectionPage;
			getPhotosAndCountsForMemberRecipe.photoCount += parseInt(response.NumberOfItems);
			for (var j = 0; j < response.Items.length; j++) {
				getPhotosAndCountsForMemberRecipe.photos.push( response.Items[j] );
			}
			oncomplete();
		}
	}
	
	getPhotosAndCountsForMemberRecipe.photoCount = 0;
	getPhotosAndCountsForMemberRecipe.photos = [];
	getPhotosAndCountsForMemberRecipe.callbackFtn = callback;
	
	var onPage = pageNum || 1; //default
	var requestBatch = new RequestBatch();
	requestBatch.AddToRequest( new CustomCollectionPage( new CustomCollectionKey("recipePhotos_memberRecipe_" + recipeId + "_owner"), 10, onPage ) );
	requestBatch.AddToRequest( new CustomCollectionPage( new CustomCollectionKey("recipePhotos_memberRecipe_" + recipeId), 10, onPage ) );
	
	requestBatch.BeginRequest(serverUrl, onbatchcomplete);

}
