function updateBigImage(inIndex) {	
	fadeDuration = 0.05;
	appearDuration = 0.15;
	imageDir='images/';
	imageName = imageList[inIndex];
	imageCaption = captionList[inIndex];
	paginationIndex = inIndex + 1;
	if(paginationIndex < 10) {
		paginationIndex = "0"+paginationIndex.toString(); }

	$('serie_description').hide();

	$('bigImage').fade({ duration: fadeDuration, afterFinish: function(){
		if (imageName == "serie_description") {
			$('serie_description').show();
			$('image_caption').update(imageCaption);
			$('image_caption').innerHTML;
			$('pagination_index').update(paginationIndex);
			$('pagination_index').innerHTML; }
		else {
		   $('bigImage').observe("load", function(){
			   	$('bigImage').appear({duration: appearDuration});  
			   	$('image_caption').update(imageCaption);
			   	$('image_caption').innerHTML;
			   	$('pagination_index').update(paginationIndex);
			   	$('pagination_index').innerHTML;
		   });	
		   $('bigImage').writeAttribute('src', ''); 
		   $('bigImage').writeAttribute('src', imageDir+imageName); 	   
		   $('bigImage').setStyle({ height: "463px", width:"auto"});   
		}
     } 
	}); 

   	imageListIndex = inIndex;
   	return false;
}

function prevImage() {
	if(imageListIndex == 0) {
		imageListIndex = imageList.length-1; }
	else {
		imageListIndex--; }
	updateBigImage(imageListIndex);
	return false;
}

function nextImage() {
	if(imageListIndex == imageList.length-1) {
		imageListIndex = 0; }
	else {
		imageListIndex++; }
	updateBigImage(imageListIndex);
	return false;
}
