


var curimg=0;
var curimg1=0;
var i = 2;
var path = "img/shows/home/";
var getOut = 0;
var gIntervalID;

function rotateimages(){
	//var path = "";
	//path = "img/shows/home/";
	gDelayMorph = 0.5;
	gDelayAppear = 0.5;
	//pfLog("file mane: " + path+galleryarray[curimg]);
	if(i == 2){
		i = 1;
		new Effect.Fade('slideshow1', { duration: gDelayAppear, queue: 'end' });
		new Effect.Appear('slideshow2', { duration: gDelayAppear, queue: 'end' });
		//new Effect.SlideUp('test', { duration: gDelayAppear, queue: 'end' });
		//new Effect.Appear('slideshow2', { duration: gDelayAppear, queue: 'end' });
		$("slideshow2").setAttribute("src", path+galleryarray[curimg]);
	}else{
		i = 2;
		new Effect.Fade('slideshow2', { duration: gDelayAppear, queue: 'end' });
		new Effect.Appear('slideshow1', { duration: gDelayAppear, queue: 'end' });
		//new Effect.SlideDown('test', { duration: gDelayAppear, queue: 'end' });
		//new Effect.Appear('slideshow1', { duration: gDelayAppear, queue: 'end' });
		$("slideshow1").setAttribute("src", path+galleryarray[curimg]);
	}

//	document.getElementById("slideshow").setAttribute("src", path+galleryarray[curimg])
//	$("slideshow").setAttribute("src", path+galleryarray[curimg])
	curimg = (curimg < galleryarray.length - 1) ? curimg + 1 : 0
	//alert("here" + galleryarray.length)
}

//window.onload=function(){	
function startshow(){	
//Go preload images
 	gIntervalID = setInterval("preload()", 1000);	
	setInterval("rotateimages()", 4000);
}

function pfLog(msg){
   if (navigator.userAgent.indexOf('AppleWebKit/') > -1)
      window.console.log(msg);
}

function preload(){
	//pfLog("galleryarray: " + galleryarray.length);
	pfLog("file mane: " + path+galleryarray[curimg1]);
	$("hiding").setAttribute("src", path+galleryarray[curimg1])
	curimg1=(curimg1<galleryarray.length-1)? curimg1+1 : 0;
	//pfLog("galleryarray: " + galleryarray.length);
	if(galleryarray.length <= getOut){
		//pfLog("file mane: " + path+galleryarray[curimg1]);
		window.clearInterval(gIntervalID);
		//gIntervalID = setInterval("rotateimages()", 2500);
	}else{
		getOut = getOut + 1;
		
	}
}
