// JavaScript Document
// JavaScript Document

var picture_count = 1;
var array_pictures = Array();

function startGallery(arr_pictures){
	arr_pictures = arr_pictures;
	
	showNextPicture();
}

function showNextPicture(){
	
	img1 = window.document.getElementById('gallery_pic1');	
	img2 = window.document.getElementById('gallery_pic2');
	
	img2.src = img1.src;
		
	MM_effectAppearFade(img2, 2000, 0, 100, false);
	setTimeout("DoGalleryFade()", 2000);
}

function DoGalleryFade(){
	
	img1 = window.document.getElementById('gallery_pic1');	
	img2 = window.document.getElementById('gallery_pic2');

	img1.src = arr_pictures[picture_count];
			
	picture_count+=1;
	if(picture_count >= arr_pictures.length){
		picture_count = 0;
	}
	
	MM_effectAppearFade(img2, 2000, 100, 0, false);
	
	setTimeout("showNextPicture()", 5000);
}

function MM_effectAppearFade(targetElement, duration, from, to, toggle)
{
	Spry.Effect.DoFade(targetElement, {duration: duration, from: from, to: to, toggle: toggle});
}