// Create the array
photo = [
'img 001.jpg', 'img 005.jpg', 'img 006.jpg', 'img 007.jpg', 'img 011.jpg', 'img 016.jpg', 'img 017.jpg', 'img 018.jpg', 'img 019.jpg', 'img 020.jpg', 
'img 022.jpg', 'img 024.jpg', 'img 025.jpg', 'img 026.jpg', 'img 027.jpg', 'img 029.jpg', 'img 030.jpg', 'img 031.jpg', 'img 032.jpg', 'img 033.jpg', 
'img 036.jpg', 'img 037.jpg', 'img 039.jpg', 'img 040.jpg', 'img 041.jpg', 'img 042.jpg', 'img 044.jpg', 'img 045.jpg', 'img 046.jpg', 'img 047.jpg', 
'img 048.jpg', 'img 049.jpg', 'img 050.jpg', 'img 051.jpg', 'img 052.jpg', 'img 054.jpg', 'img 055.jpg', 'img 056.jpg', 'img 057.jpg', 'img 058.jpg', 
'img 059.jpg', 'img 060.jpg', 'img 061.jpg', 'img 062.jpg', 'img 066.jpg', 'img 067.jpg',
'MVN Last Ditch 072009 011.jpg', 'MVN Last Ditch 072009 013.jpg', 'MVN Last Ditch 072009 015.jpg', 'MVN Last Ditch 072009 016.jpg', 'MVN Last Ditch 072009 018.jpg', 'MVN Last Ditch 072009 019.jpg', 'MVN Last Ditch 072009 020.jpg', 'MVN Last Ditch 072009 021.jpg', 'MVN Last Ditch 072009 023.jpg', 'MVN Last Ditch 072009 027.jpg', 
'MVN Last Ditch 072009 029.jpg', 'MVN Last Ditch 072009 032.jpg', 'MVN Last Ditch 072009 038.jpg', 'MVN Last Ditch 072009 053.jpg', 'MVN Last Ditch 072009 055.jpg', 'MVN Last Ditch 072009 056.jpg', 'MVN Last Ditch 072009 057.jpg', 'MVN Last Ditch 072009 058.jpg', 'MVN Last Ditch 072009 059.jpg', 'MVN Last Ditch 072009 065.jpg', 
'MVN Last Ditch 072009 068.jpg', 'MVN Last Ditch 072009 072.jpg', 'MVN Last Ditch 072009 078.jpg', 'MVN Last Ditch 072009 081.jpg', 'MVN Last Ditch 072009 083.jpg', 'MVN Last Ditch 072009 098.jpg', 'MVN Last Ditch 072009 102.jpg', 'MVN Last Ditch 072009 105.jpg', 'MVN Last Ditch 072009 108.jpg', 'MVN Last Ditch 072009 110.jpg', 
'MVN Last Ditch 072009 119.jpg', 'MVN Last Ditch 072009 127.jpg', 'MVN Last Ditch 072009 131.jpg', 'MVN Last Ditch 072009 135.jpg', 'MVN Last Ditch 072009 138.jpg', 'MVN Last Ditch 072009 144.jpg', 'MVN Last Ditch 072009 150.jpg', 'MVN Last Ditch 072009 152.jpg', 'MVN Last Ditch 072009 153.jpg', 'MVN Last Ditch 072009 155.jpg', 
'MVN Last Ditch 072009 156.jpg', 'MVN Last Ditch 072009 159.jpg', 'MVN Last Ditch 072009 162.jpg', 'MVN Last Ditch 072009 163.jpg', 'MVN Last Ditch 072009 165.jpg', 'MVN Last Ditch 072009 166.jpg', 'MVN Last Ditch 072009 169.jpg', 'MVN Last Ditch 072009 171.jpg', 'MVN Last Ditch 072009 173.jpg', 'MVN Last Ditch 072009 179.jpg', 
'MVN Last Ditch 072009 184.jpg', 'MVN Last Ditch 072009 185.jpg', 'MVN Last Ditch 072009 189.jpg', 'MVN Last Ditch 072009 190.jpg', 'MVN Last Ditch 072009 193.jpg', 'MVN Last Ditch 072009 202.jpg', 'MVN Last Ditch 072009 207.jpg', 'MVN Last Ditch 072009 210.jpg', 'MVN Last Ditch 072009 215.jpg', 'MVN Last Ditch 072009 218.jpg', 
'MVN Last Ditch 072009 222.jpg', 'MVN Last Ditch 072009 225.jpg', 'MVN Last Ditch 072009 226.jpg', 'MVN Last Ditch 072009 227.jpg'

];

// variable setup
var currentslide=0;
var numslides=photo.length-1;
var session = [0, 46, 71, 0, 0];
var portraitnumber = 999;
var slidesize = 500;


// setup screen
window.onload = function() {
        document.getElementById("setphoto").onclick = SetPhoto;
        
        document.getElementById("set1").onclick = function(evt) { setSessionPhoto( session[0] ); };
        document.getElementById("set2").onclick = function(evt) { setSessionPhoto( session[1] ); };
        document.getElementById("set3").onclick = function(evt) { setSessionPhoto( session[2] ); };
//        document.getElementById("set4").onclick = function(evt) { setSessionPhoto( session[3] ); };
//        document.getElementById("set5").onclick = function(evt) { setSessionPhoto( session[4] ); };
//        document.getElementById("set6").onclick = function(evt) { setSessionPhoto( session[5] ); };

        document.getElementById("prevphoto").onclick = PrevPhoto;
        document.getElementById("nextphoto").onclick = NextPhoto;
        document.getElementById("set500").onclick = Set500;
        document.getElementById("set1000").onclick = Set1000;
        
        document.getElementById("photomax").readOnly=true;
        document.getElementById("photomax").value=numslides+1;
        document.getElementById("set500").style.background = "#00FFFF";
        document.getElementById("set1000").style.background = "#00FFFF";
        
        document.getElementById("photosel").value = session[0]+1;
        SetPhoto();
        Set500();
}

function CheckSize() {
	if (slidesize=500) {
		Set500();
	} else {
		Set1000();
	}
}

function NextPhoto() {
	currentslide++;
	if (currentslide > numslides) {
		currentslide = 0;
	}
	document.getElementById("photo1").src = photo[currentslide];
	document.getElementById("photosel").value = currentslide+1;
	CheckSize();
}

function PrevPhoto() {
	currentslide--;
	if (currentslide < 0) {
		currentslide = numslides;
	}
	document.getElementById("photo1").src = photo[currentslide];
	document.getElementById("photosel").value = currentslide+1;
	CheckSize();
}

function SetPhoto() {
	currentslide = document.getElementById("photosel").value-1;
	if (currentslide < 1) currentslide = 0;
	if (currentslide > numslides) currentslide = numslides;
	document.getElementById("photo1").src = photo[currentslide];
	document.getElementById("photosel").value = currentslide+1;
	CheckSize();
}

function setSessionPhoto(sessionStart) {
	currentslide = sessionStart;
	document.getElementById("photo1").src = photo[currentslide];
	document.getElementById("photosel").value = currentslide+1;
	CheckSize();
}

function Set1000() {
	slidesize=1000;
	if (currentslide < portraitnumber) {
		document.getElementById("photo1").width = "1000";
		document.getElementById("photo1").height = "750";
	} else {
		document.getElementById("photo1").width = "750";
		document.getElementById("photo1").height = "1000";
	}
}

function Set500() {
	slidesize=500;
	if (currentslide < portraitnumber) {
		document.getElementById("photo1").width = "500";
		document.getElementById("photo1").height = "375";
	} else {
		document.getElementById("photo1").width = "375";
		document.getElementById("photo1").height = "500";
	}
}