/* holds timeout */
var switchLargeImageTimeout;

/* start onload */
addLoadEvent(startSwitchLargeImage);

function startSwitchLargeImage()
{
	/* start looping */
	switchLargeImageTimeout = window.setTimeout(function(){ switchLargeImage(0); }, 5000);
}

function switchLargeImage(itemIndex)
{
	if (largeImages.length > 1)
	{
		/* save image i as background image on parent element */
		$("reservation-hotel-info").style.backgroundImage = 'url("' + largeImages[itemIndex] + '")';

		/* hide "image" div */
		hideElement($("reservation-hotel-info-image"));

		/* get next image */
		itemIndex++;
		if (itemIndex >= largeImages.length) itemIndex = 0;

		/* save next image on "image" div */
		$("reservation-hotel-info-image").style.backgroundImage = 'url("' + largeImages[itemIndex] + '")';

		/* fade in "image" div */
		appear("reservation-hotel-info-image", { "duration": 2 });

		/* loop */
		switchLargeImageTimeout = window.setTimeout(function(){ switchLargeImage(itemIndex); }, 5000 + 2000);
	}
}

function stopSwitchLargeImage()
{
	/* stop timeout */
	window.clearTimeout(switchLargeImageTimeout);

	/* clean up */
	$("reservation-hotel-info").style.backgroundImage = 'none';
	showElement($("reservation-hotel-info-image"));
}
