/*
  Author...: Andrea Galligani
  Copyright: Copyright (c) 2008 Andrea Galligani
  Created..: 16-03-2008
	Note.....: To be used together with images.js
  
  Modified.: 17-04-2009
  Note.....: Allow controls to be disabled
*/
var hInterval;
var ShowState = 0;
	 
function play()
{
	hInterval = window.setInterval( next, 4000 );
	ShowState = 0;
  
  if ( ShowControls )
    updateIndicator( sPhoto );
}
	 
function pause()
{
  window.clearInterval( hInterval );
	ShowState = 1;
  
  if ( ShowControls )
    updateIndicator( sPhoto );
}
	 
function stop()
{
  window.clearInterval( hInterval );
	ShowState = 2;
		
	iImage = 0;
    
	document.getElementById( "mainImage" ).src = Images[iImage];
  if ( ShowControls )
    updateIndicator( sPhoto );
}
	 
function updateIndicator()
{
  if ( !ShowControls )
    return;
    
	btn = document.getElementById( "playbtn" );
	lnk = document.getElementById( "playlink" );
	bullet = document.getElementById( "bull" );

	if ( ShowState == 0 )
	{
		btn.src = "../img/pause2.png";
		lnk.href ="javascript:pause();"
	}
	else {
		btn.src = "../img/play2.png";
		lnk.href ="javascript:play();"
	}
	pos = ( 110 - 20 ) * iImage / nImages;
	bullet.style.left = pos + "px";
}
 