var actual = 0;
var timeout = 10000;

function init(delay, first) {

  timeout = delay; 
  actual = first

  setTimeout("changePic()", timeout);
  
}

function displayPics() {

	var photos = document.getElementById('HPgalleryList');
	var liens = photos.getElementsByTagName('a') ;
	
	for (var i = 0 ; i < liens.length ; ++i) {
	
		liens[i].onclick = function() {
		  change(this);
		  return false;
		}
	
	}
	
}

function change(lien) {

  big_photo = document.getElementById('big');
  titre_photo = document.getElementById('photo').getElementsByTagName('dt')[0] ;
	
  big_photo.src = lien.href; 
	big_photo.alt = lien.title; 
	
	titre_photo.firstChild.nodeValue = lien.title; 

}

function changePic() {

  photos = document.getElementById('HPgalleryList');
  liens = photos.getElementsByTagName('a');
  lien = liens[actual];
  
  change(lien);
  
  actual = (actual == liens.length - 1) ? 0 : actual + 1;

  setTimeout("changePic()", timeout);
	
}