var galleryarray=new Array();
galleryarray[0]="QGardens_img_01.jpg";
galleryarray[1]="QGardens_img_02.jpg";
galleryarray[2]="QGardens_img_03.jpg";
galleryarray[3]="QGardens_img_04.jpg";
galleryarray[4]="QGardens_img_05.jpg";
galleryarray[5]="QGardens_img_06.jpg";
galleryarray[6]="QGardens_img_07.jpg";
galleryarray[7]="QGardens_img_08.jpg";
galleryarray[8]="QGardens_img_09.jpg";
galleryarray[9]="QGardens_img_10.jpg";
galleryarray[10]="QGardens_img_11.jpg";
galleryarray[11]="QGardens_img_12.jpg";
galleryarray[12]="QGardens_img_13.jpg";
galleryarray[13]="QGardens_img_14.jpg";
galleryarray[14]="QGardens_img_15.jpg";

var curimg=0

function resetStart(){
	curimg=0;
}

function autoRotate(){
	curimg=(curimg<galleryarray.length-1)? curimg+1 : 0;
	intervalId = setInterval("rotateimages()", 3500);
	var button = document.getElementById("autoButton");
    button.setAttribute("value", "Stop");    
    button.onclick = manualRotate;
    var nxt = document.getElementById("nextButton");
    nxt.innerText = ""
    var prv = document.getElementById("prevButton");
    prv.innerText = ""

}

function manualRotate(){
	window.clearInterval(intervalId);
	var button = document.getElementById("autoButton");
    button.setAttribute("value", "Play"); 
    button.onclick = autoRotate;
    var nxt = document.getElementById("nextButton");
    nxt.innerText = "Next >"
    var prv = document.getElementById("prevButton");
    prv.innerText = "< Prev"
}


function rotateimages(){
	var theSlide = "Portfolio/images/"+galleryarray[curimg];
	var theContent = document.getElementById("slideshow");
	crossfade(theContent, theSlide, "1", "");
	curimg=(curimg<galleryarray.length-1)? curimg+1 : 0;
}

function nextImage(){
	curimg=(curimg<galleryarray.length-1)? curimg+1 : 0;
	var theSlide = "Portfolio/images/"+galleryarray[curimg];
	var theContent = document.getElementById("slideshow");
	crossfade(theContent, theSlide, "1", "");
}	

function prevImage(){
	curimg=(curimg!=0)? curimg-1 : galleryarray.length-1;
	var theSlide = "Portfolio/images/"+galleryarray[curimg];
	var theContent = document.getElementById("slideshow");
	crossfade(theContent, theSlide, "1", "");
}
