// JavaScript Document

//var globale pour accès dans displayThumbs() et setPhoto() 
var nbrePhotos ;	//stores number of photos/album


function displayThumbs(albumName) {

//Paramètres des albums
var albumTitle;
var subtitle;
	if (albumName == "album1") { 
		nbrePhotos = 10; 
		albumTitle = "Studio | Le th&eacute; et la justice";
		subtitle = "par Rachel C&ocirc;t&eacute;";
	};
		
	if (albumName == "album2") { 
		nbrePhotos = 16; 
		albumTitle = "Vid&eacute;oclips";
		subtitle = "par Rachel C&ocirc;t&eacute;";
	};
	
	if (albumName == "album3") { 
		nbrePhotos = 16;
		albumTitle = "Tourn&eacute;e | juillet 2007";
		subtitle = "par Guilaume Larose, PL Beaulieu et Louis Dup&eacute;r&eacute;";
	};
	
	if (albumName == "album4") { 
		nbrePhotos = 10;
		albumTitle = "C&ocirc;te-Nord | octobre 2006";
		subtitle = "par ANDR&Eacute;";
	};
	
	if (albumName == "album5") { 
		nbrePhotos = 0;
		albumTitle = "Titre";
		subtitle = "";
	};
	

//Loading thumbnails avec liens sur chacun 
	var contentThumbs = "";
	var i = 1;	 	
	for (i=1; i<=nbrePhotos; i++) {
		contentThumbs = contentThumbs + "<a href='#' onClick=\"setPhoto('"+albumName+"', " + (i) + ");\"><img src='images/photos/" + albumName + "_thumbs/thumb" + (i) + ".jpg' alt='photo " + (i) + "' width='70' height='47' /></a> ";
	}

//Displaying thumbnails :
	inject('boxPhotosThumbs', contentThumbs);
	
	
//Section principale avec la grosse photo
//Initialisation du contenu 
	var contentTitle = "";
	contentTitle = "<h1>" + albumTitle + "</h1> ";
	contentTitle = contentTitle + subtitle;
	
//Displaying title:
	inject('boxPhotosHeader', contentTitle);
	
}
	
		
function setPhoto(albumNum, photoNumber) {
	//Formatting de photo suivante et precedente selon si c,est la premiere ou derniere photo. Greys out / link selon le cas.
		var photoprecedente;
		if (photoNumber==1) {
			photoprecedente = "<span class='greyout'>Photo pr&eacute;c&eacute;dente</span>";
		} else photoprecedente = "<a href='#' onClick=\"setPhoto('"+albumNum+"', " + (photoNumber-1) + ");\">Photo pr&eacute;c&eacute;dente</a>";
		
		var photosuivante ;
		if (photoNumber == nbrePhotos ) {
			photosuivante = "<span class='greyout'>Photo suivante</span>";
		} else photosuivante = "<a href='#' onClick=\"setPhoto('"+albumNum+"', " + (photoNumber+1) + ");\" >photo suivante</a>";
		
	
		var zephoto = "<img src='images/photos/"+albumNum+"/photo"+photoNumber+".jpg' alt='photo"+photoNumber +"' />";

//Displaying the back & next links + the photo
	var contentPhoto = "<p align='center'> "+photoprecedente+" | "+photosuivante+" <br /><br />"+zephoto+"</p>";
	inject('boxPhotos', contentPhoto);
}

	
	