<!--
var nTimerId = null;
var nTimerInterval = 3000;


/*
 * This function is used to turn on the automatic slideshow.
 */
function TurnOnAutoSlideShow( )
{
	if( nSelectedIndex >= aGalleryNames.length-1 )
	{
		ShowGalleryImage( 0 );
	}

	var oDivOn = document.getElementById( 'oAutoSlideShowOn' ).style.display = "none";
	var oDivOff = document.getElementById( 'oAutoSlideShowOff' ).style.display = "block";
	
	var strTimeoutScript = "AutoShowNextImage()"
	bIsAutoSlideShow = true;
	nTimerId = setTimeout( strTimeoutScript, nTimerInterval );  
}
/*
 * This function is used to show the next image
 */
function AutoShowNextImage()
{
	if( bIsAutoSlideShow )
	{
		ShowGalleryImage( (nSelectedIndex+1 ) );
		var strTimeoutScript = "AutoShowNextImage()"
		if( nSelectedIndex < aGalleryNames.length-1 )
		{
			nTimerId = setTimeout( strTimeoutScript, nTimerInterval );  
		}
		else
		{
			TurnOffAutoSlideShow();
		}	
	}
}
/*
 * This Function is used to run of the automatic slideshow.
 */
function TurnOffAutoSlideShow()
{
	var oDivOn = document.getElementById( 'oAutoSlideShowOn' ).style.display = "block";
	var oDivOff = document.getElementById( 'oAutoSlideShowOff' ).style.display = "none";
	bIsAutoSlideShow = false;
	clearTimeout( nTimerId );
}
/*
 * This Function is used to display image
 */
function ShowGalleryImage( nIndex )
{
	nSelectedIndex = nIndex;
	if( nSelectedIndex < aGalleryNames.length )
	{
		var strImage = "/files/"+aGalleryLinknames[ nIndex ];

		document.getElementById( 'oImageLinkname' ).src = strImage;
		document.getElementById( 'oGalleryName' ).innerHTML = aGalleryNames[ nIndex ];
		document.getElementById( 'oGalleryText' ).innerHTML = aGalleryTexts[ nIndex ];

		CreatePageControl( nIndex );
	}
}
/*
 * This Function is used to create the pageing control
 */
function CreatePageControl( nSelectedIndex )
{
	var strLinks = "";
	if( nSelectedIndex > 0 )
	{
		strLinks = "<a href='javascript:ShowGalleryImage( "+( nSelectedIndex-1 )+" )'>Fyrri</a>&nbsp;|&nbsp;";
	}
	for( i=1; i<=aGalleryLinknames.length; i++ )
	{
		if( nSelectedIndex == (i-1) )
		{
			strLinks += i;
		}
		else
		{
			strLinks += "<a href='javascript:ShowGalleryImage( "+ (i-1) +" )'>"+ i +"</a>";
		}
				
		if( i < aGalleryLinknames.length )
		{
			strLinks += " | ";
		}
	}
	if( nSelectedIndex < aGalleryLinknames.length-1 )
	{
		strLinks += " | <a href='javascript:ShowGalleryImage( "+( nSelectedIndex + 1 )+" )'>Nęsta</a>";
	}
	document.getElementById( 'oGalleryPageControl' ).innerHTML = strLinks;
}
//-->

