// product images

function updateBigImage(inIndex) {	
	fadeDuration = 0.2;
	appearDuration = 0.7;
	imageName = imageList[inIndex];
	thumbId = "t"+inIndex;
	
	$('big-image-src').fade({ duration: fadeDuration, afterFinish: function(){
	   $('big-image-src').observe("load", function(){
	  		setThumb(thumbId); 
		   	$('big-image-src').appear({duration: appearDuration});  
	   });	
	   $('big-image-src').writeAttribute('src', ''); 
	   $('big-image-src').writeAttribute('src', imageName); 	   
	   $('big-image-src').setStyle({ width: "auto", height:"auto"});   
     } 
	}); 
   	imageListIndex = inIndex;
   	return false;
}


function setThumb(inID) {
	var ts = $$('#project-images div.selected');
	ts[0].removeClassName('selected');
	$(inID).addClassName('selected');
}

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;
}
