<!--

	function InitializeImageGallery()
	{
		iNumberPages = parseInt(iNumberPagesFloat);
		if(iNumberPages < iNumberPagesFloat){(iNumberPages += 1);}
		RenderImageGallery(0);
		window.setTimeout('ViewGalleryNextSlide()', iTimeUntilSlideShowStarts);
	}

	function RenderImageGallery(ixPageIndex)
	{

		if(  (ixPageIndex > (iNumberPages - 1)))
		{
			return;
		}
		else if ((ixPageIndex < 0) )
		{
			return;
		}
		var imgObject = document.images["resort_image_gallery_1"];
		var ixMax = imgGalleryCount;
		var ixFrom = 4 * ixPageIndex;
		var ixTo = (ixFrom + 4) ;
		if(ixTo > ixMax)
		{
			ixTo = ixMax;
		}

		for(ix = 0; ix < 4; ix++)
		{
			var sImgName = "resort_image_thumbnail_" + ix;
			var imgGalleryIndex = ix + ixFrom;
			if(imgGalleryIndex < imgGalleryCount)
			{
				document.images[sImgName].src= imgGalleryThumbnail[imgGalleryIndex].src;
			}
			else
			{
				document.images[sImgName].src = imgGalleryBlankImage.src;
			}
		}

		iCurrentPageIndex = ixPageIndex;

		if(iCurrentPageIndex == 0)
		{
			document.images["imgGalleryPagePrevious"].src = imgGalleryPagePreviousDisabled.src;
		}
		else if(iCurrentPageIndex > 0)
		{
			document.images["imgGalleryPagePrevious"].src = imgGalleryPagePreviousEnabled.src;
		}

		if(iCurrentPageIndex < (iNumberPages -1))
		{
			document.images["imgGalleryPageNext"].src = imgGalleryPageNextEnabled.src;
		}
		else
		{
			document.images["imgGalleryPageNext"].src = imgGalleryPageNextDisabled.src;
		}
	}

	function GalleryImageClicked(ix, obj)
	{
		blnDisableSlideShow = true;
		GalleryImageShow(ix);
	}

	function GalleryImageShow(ix)
	{
		var imgGalleryIndex = ix + (iCurrentPageIndex * 4);
		if(imgGalleryIndex < imgGalleryCount)
		{
			document.images["resort_main_image"].src = imgGalleryImage[imgGalleryIndex ].src;
		}
	}

	function GalleryPage(direction)
	{
		var imgPageNext = document.images["imgGalleryPagePrevious"];
		var imgPagePrev = document.images["imgGalleryPageNext"];
		var ixPageIndex = iCurrentPageIndex + direction;

		if(direction == 1)
		{
			if( (iCurrentPageIndex+1) == iNumberPages )
			{
				return;
			}
		}
		else if(direction == -1)
		{
			if( (iCurrentPageIndex) == 0 )
			{
				return;
			}
		}
		else
		{
			return;
		}
		RenderImageGallery(ixPageIndex );
	}


	function StartGallerySlideShow()
	{
		iNextSlideIndex = -1;
		blnDisableSlideShow=false;
		ViewGalleryNextSlide();
	}

	function StopGallerySlideShow()
	{
		blnDisableSlideShow=true;
	}

	function ViewGalleryNextSlide()
	{
		if(blnDisableSlideShow == true)
		{
			return;
		}
		if(iNextSlideIndex+1 < (imgGalleryCount) )
		{
			iNextSlideIndex +=1;
			document.images["resort_main_image"].src = imgGalleryImage[iNextSlideIndex].src;
		}
		else
		{

			iNextSlideIndex = -1;
			document.images["resort_main_image"].src = imgResortMainImageFile.src;
		}
		window.setTimeout('ViewGalleryNextSlide()', iSlideShowDisplayTime);
	}
//-->