/*
* Put any code in page_set() that needs to be run on window load
*/
function page_set(){
  if(typeof(photos_total) != 'undefined' && photos_total > 1){
    setTimeout('photo_display(1)', 3000);
  } 
}


/*
* Slideshow for a group of photos
*/

var current_slide_id=0;
var current_slide=false;

function show_slides(id){
}

var idPhotoCurr='img-0';
var iCountCurr=0;

var thumb_slide;
var next_photo;
function photo_display(count){

	var id='img-' + count;
	if(idPhotoCurr!=id){
		// new Effect.Appear(id, {duration: 1.5});
		$('#' + id).fadeIn(1500)
	}

	if(idPhotoCurr!='' && idPhotoCurr!=id){
		photoClose(idPhotoCurr);
	}
	
	idPhotoCurr=id;
	iCountCurr=count;
	
	if(count+1 == photos_total){
		next_photo=0;
	}else{
		next_photo=count+1;
	}
	setTimeout('photo_display(next_photo)', 5000);
}

function photoClose(id){
	// new Effect.Fade(id, {duration: 1.5});
	$('#' + id).fadeOut(1500);
}


window.onload = function () { page_set(); };
