function OpenWindow (sUri, iWidth, iHeight)
{
	var sWindowName = 'win' + Math.floor (Math.random() * 1000)
	var iRealWidth = iWidth ? iWidth : 600
	var iRealHeight = iHeight ? iHeight : screen.height - 300

	var iLeft = Math.round ((screen.width - iRealWidth) / 2)
	var iTop =  Math.round ((screen.height - iRealHeight) / 2) - 35

	var sWindowOptions = 'status=yes,menubar=no,toolbar=no'
	sWindowOptions += ',resizable=yes,scrollbars=yes,location=no'
	sWindowOptions += ',width='  + iRealWidth
	sWindowOptions += ',height=' + iRealHeight
	sWindowOptions += ',left='   + iLeft
	sWindowOptions += ',top='    + iTop

	var win = window.open (sUri, sWindowName, sWindowOptions)
	win.focus()
}

function ShowGalleryImage (galleryName, imageNumber)
{
	document.getElementById ('viewing-img').src = '/_i/gallery/' + galleryName + '/' + imageNumber + '.jpg';
	var c_ancor = null
	var c_img = null
	var c
	for (c = 1; ; c++)
	{	

		c_ancor = document.getElementById ('thumbnail-ancor' + c)		
		c_img = document.getElementById ('thumbnail-img' + c)		
		if (c_ancor == null || c_img == null) break
		c_ancor.className = 'inactive'
		c_img.className = 'inactive'
	}
	document.getElementById ('thumbnail-ancor' + imageNumber).className = 'selected'
	document.getElementById ('thumbnail-img' + imageNumber).className = 'selected'
}
