window.onload = choosePic;

var myPix = new
Array(

"images/random/01.jpg",
"images/random/02.jpg",
"images/random/03.jpg",
"images/random/04.jpg",
"images/random/05.jpg",
"images/random/06.jpg",
"images/random/07.jpg",
"images/random/08.jpg",
"images/random/09.jpg",
"images/random/10.jpg",
"images/random/11.jpg",
"images/random/12.jpg",
"images/random/13.jpg",
"images/random/14.jpg",
"images/random/15.jpg",
"images/random/16.jpg",
"images/random/17.jpg",
"images/random/18.jpg");

thisPic = 0;
currentID = "pane_1";


function choosePic()
{
	thisPic = Math.floor((Math.random() * myPix.length));
	
	$(currentID).src = myPix[thisPic];
	
	$(currentID).style.width = 'auto';
	$(currentID).style.height = 'auto';
	
	
	
	Effect.Appear(currentID, {delay: 1.0, duration: 2.0 });
	
	setTimeout('cycle_gallery()', 5000);
}



function cycle_gallery()
{
	thisPic++;
	if (thisPic == myPix.length) 
	{
		thisPic = 0;
	}
	
	Effect.Fade(currentID, {duration: 1.0 });
	
	if (currentID == "pane_1")
	{// alternate
		currentID = "pane_2";
	} else {
		currentID = "pane_1";
	}
	// set the new image 
	$(currentID).src = myPix[thisPic];
	// fade it in 
	Effect.Appear(currentID, {delay: 1.0, duration: 2.0 });
	$(currentID).style.width = 'auto';
	$(currentID).style.height = 'auto';
	
	// start the timer over
	setTimeout('cycle_gallery()', 5000);

}