var gallery_timeout = null;
var gallery_slideshow_stopped = false;

function galleryShowPhoto(photo_url)
{
	thumbs_element = document.getElementById('thumbnails');
	photo_element = document.getElementById('photo');
	
	if (thumbs_element)
		thumbs_element.style.display = 'none';
		
	if (photo_element)
	{
		photo_element.innerHTML = '<a href="javascript:galleryHidePhoto()"><img src="' + photo_url + '" /></a>';
		photo_element.style.display = 'block';
	}
}

function galleryHidePhoto()
{
	thumbs_element = document.getElementById('thumbnails');
	photo_element = document.getElementById('photo');
	
	if (thumbs_element)
		thumbs_element.style.display = 'block';
		
	if (photo_element)
		photo_element.style.display = 'none';
}

function galleryToggleMP3(mp3_id)
{
	for (i = 0; i < 3; i++)
	{
		mp3_a = document.getElementById('mp3_' + i);
		if (mp3_a)
			mp3_a.className = 'mp3 off';
	}
	
	document.getElementById(mp3_id).className = 'mp3 on';
}

function gallerySlideshow()
{
	gallery_timeout = window.setTimeout("galleryNext()", 2500);
	document.getElementById('slideshow').style.display = 'none';
	document.getElementById('stop').style.display = 'inline';
}

function galleryStopSlideshow()
{
	window.clearTimeout(gallery_timeout);
	document.getElementById('slideshow').style.display = 'inline';
	document.getElementById('stop').style.display = 'none';
	
	gallery_slideshow_stopped = true;
}

function galleryNext(force_slideshow)
{
	if (!gallery_slideshow_stopped || force_slideshow)
		window.location = document.getElementById('slideshow-next').innerHTML;
}

