		var intTotalPhotoCount;
		var intCurrentPhotoCounter;
		var objRecipeCounterLabel;
		var objRecipeTotalCountLabel;
		var objRecipeImageHolder1;
		var objRecipeImageHolder2;
		var objRecipeImageDivHolder2;
		var objRecipeImageAuthor;
		var objRecipeUploadLink;
		var objVideoHolder;
		var objVideoBy;
		var objPhotoBy;
		var arrayPhotoURL = [];
		//var arrayPhotoHeight = [];
		//var arrayPhotoWidth = [];
		var intWidth;
		var arrayPhotoAuthor = [];

		//if (bVideo)
		//{
		//	intTotalPhotoCount = 2;			
		//}
		//else
		//{
		intTotalPhotoCount = 1;
		//}
		intCurrentPhotoCounter = 1;

		objRecipeCounterLabel = document.getElementById('divPhotoCounter');
		objRecipeTotalCountLabel = document.getElementById('divPhotoTotalCount');

		if (bMemberRecipe)
		{ 
			objRecipeImageHolder1 = document.getElementById('imgRecipeHeaderImage'); 
		}
		else
		{
			if (bVideo)
			{ 
				//objRecipeImageHolder1 = document.getElementById(strVideoPhotoClientID + '_imgRecipe'); 
				objRecipeImageHolder1 = document.getElementById('videoPhoto'); 
				objVideoHolder = document.getElementById('videoFlash');
				objVideoBy = document.getElementById('videoBy');
				objPhotoBy = document.getElementById('photoBy');
				objRecipeImageDivHolder2 = document.getElementById('userPhoto');

			}
			else	
			{ 
				objRecipeImageHolder1 = document.getElementById(strPhotoClientID + '_imgRecipeHeaderImage'); 
			}
		}

		objRecipeImageHolder2 = document.getElementById('imgUploadedPhotos');
		objRecipeImageAuthor = document.getElementById('divRecipePhotoBy');
		objRecipeUploadLink = document.getElementById('lnkRecipeUpload');

		if (bMemberRecipe)
		{ 
			getPhotosAndCountsForMemberRecipe(strPhotoRecipeID, showMemberPhotos, 1); 
		}
		else
		{

			// Initialize RecipePhoto
			arrayPhotoURL[0] = objRecipeImageHolder1.src;
			arrayPhotoAuthor[0] = 'kraft';
			if (bVideo)
			{ intWidth = 426; }
			else
			{ intWidth = objRecipeImageHolder1.width; }
 
			objRecipeTotalCountLabel.innerHTML = intTotalPhotoCount;
			objRecipeCounterLabel.innerHTML = intCurrentPhotoCounter;

			getPhotosAndCountsForKraftRecipe(strPhotoRecipeID, showKraftPhotos, 1); 
		}

		
		

		function showKraftPhotos(totalPhotoCount, photoObjects) {
			//alert("Kraft photo result");
			//alert("totalPhotoCount=" + totalPhotoCount);
			//console.dir(photoObjects);
			//console.groupEnd();
			
			//in here, you would use totalPhotoCount to add to the number of Kraft photos shown in the carousel
			//and loop over photoObjects to do whatever GUI effects you need
			//to get to the URL of the photo (given i as a loop counter):
			//url = photoObjects[0].Photo.PhotoUrl
			//for (prop in photoObjects[0].Photo.Image.Large)
			//{
			//	alert(prop);
			//}
			//alert(photoObjects[0].Photo.Author.DisplayName);
			//alert(url);

			var objPhoto;
			var intIndex;

			if (totalPhotoCount > 10) {
				totalPhotoCount = 10;
			}

			intIndex = 0;

			for (i=1;i<=totalPhotoCount;i++ )
			{
				if (photoObjects[i - 1])
				{
					if (photoObjects[i - 1].Photo)
					{
						objPhoto = photoObjects[i - 1].Photo;
						if (isPhotoValid(objPhoto))
						{
							intIndex = intIndex + 1;
							arrayPhotoURL[intIndex] = objPhoto.Image.Large;
							arrayPhotoAuthor[intIndex] = objPhoto.Author.DisplayName;			
						}
					}
				}
			}

			//if (bVideo)
			//{ intTotalPhotoCount = totalPhotoCount + 2; }
			//else
			//{ intTotalPhotoCount = totalPhotoCount + 1; }

			//intTotalPhotoCount = totalPhotoCount + 1;
			intTotalPhotoCount = intIndex + 1;

			objRecipeTotalCountLabel.innerHTML = intTotalPhotoCount;
			objRecipeCounterLabel.innerHTML = intCurrentPhotoCounter;
			
		}
		
		//member recipe
		function showMemberPhotos(totalPhotoCount, photoObjects) {
			//alert("Member photo result");
			//alert("totalPhotoCount=" + totalPhotoCount);
			//console.dir(photoObjects);
			//console.groupEnd();
			
			//what do we do here? see the note above

			var objPhoto;
			var intIndex;

			intWidth = objRecipeImageHolder1.width;

			if (totalPhotoCount > 10) {
				totalPhotoCount = 10;
			}

			intIndex = 0;

			for (i=0;i<totalPhotoCount;i++ )
			{
				if (photoObjects[i])
				{
					if (photoObjects[i].Photo)
					{
						objPhoto = photoObjects[i].Photo;

						if (isPhotoValid(objPhoto))
						{
							arrayPhotoURL[intIndex] = objPhoto.Image.Large;
							arrayPhotoAuthor[intIndex] = objPhoto.Author.DisplayName;
							intIndex = intIndex + 1;
						}
					}
				}
			}

			//intTotalPhotoCount = totalPhotoCount;
			intTotalPhotoCount = intIndex;
			if (intIndex > 0)
			{
				objRecipeTotalCountLabel.innerHTML = intTotalPhotoCount;
				objRecipeCounterLabel.innerHTML = intCurrentPhotoCounter;
	
				UpdateRecipePhoto();
			}
		}

		function UpdateRecipePhoto()
		{
			objRecipeCounterLabel.innerHTML = intCurrentPhotoCounter;

			if (bMemberRecipe)
			{
				objRecipeImageHolder1.style.display = 'none';
				objRecipeImageHolder2.style.display = 'block';

				objRecipeImageHolder2.src = arrayPhotoURL[intCurrentPhotoCounter - 1];
				objRecipeImageHolder2.style.width = intWidth + 'px';
			}
			else
			{
				if (intCurrentPhotoCounter == 1)
				{
					if (bVideo)
					{
						objVideoHolder.style.display = 'block';
						objRecipeImageHolder1.style.display = 'none';
						objRecipeImageDivHolder2.style.display = 'none';
						objRecipeImageHolder2.style.display = 'none';
						objVideoBy.style.display = 'block';
						objPhotoBy.style.display = 'none';

					}
					else
					{
						objRecipeImageHolder1.style.display = 'block';
						objRecipeImageHolder2.style.display = 'none';

					}
				}
				else
				{
					if (bVideo)
					{
						objVideoHolder.style.display = 'none';
						objVideoBy.style.display = 'none';
						objPhotoBy.style.display = 'block';

						//if (intCurrentPhotoCounter == 2)
						//{
						//	objRecipeImageHolder1.style.display = 'block';
						//	objRecipeImageDivHolder2.style.display = 'none';
						//	objRecipeImageHolder2.style.display = 'none';

						//}
						//else
						//{
							objRecipeImageHolder1.style.display = 'none';
							objRecipeImageDivHolder2.style.display = 'block';
							objRecipeImageHolder2.style.display = 'block';
							//objRecipeImageHolder2.src = arrayPhotoURL[intCurrentPhotoCounter - 2];
							objRecipeImageHolder2.src = arrayPhotoURL[intCurrentPhotoCounter - 1];
							objRecipeImageHolder2.style.width = intWidth + 'px';
						//}
					}
					else
					{

						objRecipeImageHolder1.style.display = 'none';
						objRecipeImageHolder2.style.display = 'block';
						objRecipeImageHolder2.src = arrayPhotoURL[intCurrentPhotoCounter - 1];
						objRecipeImageHolder2.style.width = intWidth + 'px';
					}
				}
			}

			//if (bVideo)
			//{ objRecipeImageAuthor.innerHTML = arrayPhotoAuthor[intCurrentPhotoCounter - 2]; }
			//else
			//{ objRecipeImageAuthor.innerHTML = arrayPhotoAuthor[intCurrentPhotoCounter - 1]; }
			objRecipeImageAuthor.innerHTML = arrayPhotoAuthor[intCurrentPhotoCounter - 1];

		}

		function recipePhotosMoveBack()
		{
			if (intTotalPhotoCount > 1)
			{
				if (intCurrentPhotoCounter == 1)
					intCurrentPhotoCounter = intTotalPhotoCount;
				else
					intCurrentPhotoCounter = intCurrentPhotoCounter - 1;

				UpdateRecipePhoto();
			}
		}

		function recipePhotosMoveForward()
		{
			if (intTotalPhotoCount > 1)
			{
				if (intCurrentPhotoCounter == intTotalPhotoCount)
					intCurrentPhotoCounter = 1;
				else
					intCurrentPhotoCounter = intCurrentPhotoCounter + 1;
	
				UpdateRecipePhoto();
			}
		}

		
