// Create the array
photo = [
'SET Blue LC 001.jpg', 'SET Blue LC 002.jpg', 'SET Blue LC 004.jpg', 'SET Blue LC 005.jpg', 'SET Blue LC 006.jpg', 'SET Blue LC 007.jpg', 'SET Blue LC 008.jpg', 'SET Blue LC 016.jpg', 'SET Blue LC 019.jpg', 'SET Blue LC 021.jpg', 
'SET Blue LC 027.jpg', 'SET Blue LC 037.jpg', 'SET Blue LC 043.jpg', 'SET Blue LC 047.jpg', 'SET Blue LC 051.jpg', 'SET Blue LC 056.jpg', 'SET Blue LC 059.jpg', 'SET Blue LC 062.jpg', 'SET Blue LC 063.jpg', 'SET Blue LC 067.jpg', 
'SET Blue LC 071.jpg', 'SET Blue LC 073.jpg', 'SET Blue LC 074.jpg', 'SET Blue LC 075.jpg', 'SET Blue LC 077.jpg', 'SET Blue LC 082.jpg', 'SET Blue LC 088.jpg', 'SET Blue LC 089.jpg', 'SET Blue LC 094.jpg', 'SET Blue LC 096.jpg', 
'SET Blue LC 098.jpg', 'SET Blue LC 102.jpg', 'SET Blue LC 106.jpg', 'SET Blue LC 107.jpg', 'SET Blue LC 110.jpg', 'SET Blue LC 111.jpg', 'SET Blue LC 113.jpg', 'SET Blue LC 114.jpg', 'SET Blue LC 119.jpg', 'SET Blue LC 120.jpg', 
'SET Blue LC 121.jpg', 'SET Blue LC 129.jpg', 'SET Blue LC 134.jpg', 'SET Blue LC 143.jpg', 'SET Blue LC 147.jpg', 'SET Blue LC 152.jpg', 'SET Blue LC 156.jpg', 'SET Blue LC 164.jpg', 'SET Blue LC 166.jpg', 'SET Blue LC 168.jpg', 
'SET Blue LC 171.jpg', 'SET Blue LC 177.jpg', 'SET Blue LC 178.jpg', 'SET Blue LC 181.jpg', 'SET Blue LC 184.jpg', 'SET Blue LC 185.jpg', 'SET Blue LC 188.jpg', 'SET Blue LC 191.jpg', 'SET Blue LC 192.jpg', 'SET Blue LC 194.jpg', 
'SET Blue LC 200.jpg', 'SET Blue LC 202.jpg', 'SET Blue LC 204.jpg', 'SET Blue LC 206.jpg', 'SET Blue LC 208.jpg', 'SET Blue LC 212.jpg', 'SET Blue LC 219.jpg', 'SET Blue LC 222.jpg', 'SET Blue LC 224.jpg', 'SET Blue LC 225.jpg', 
'SET Blue LC 235.jpg', 'SET Blue LC 237.jpg', 'SET Blue LC 242.jpg', 'SET Blue LC 250.jpg', 'SET Blue LC 254.jpg', 'SET Blue LC 256.jpg', 'SET Blue LC 263.jpg', 'SET Blue LC 265.jpg', 'SET Blue LC 266.jpg', 'SET Blue LC 272.jpg', 
'SET Blue LC 277.jpg', 'SET Blue LC 288.jpg', 'SET Blue LC 290.jpg', 'SET Blue LC 293.jpg', 'SET Blue LC 298.jpg', 'SET Blue LC 301.jpg', 'SET Blue LC 302.jpg', 'SET Blue LC 305.jpg', 'SET Blue LC 309.jpg', 'SET Blue LC 312.jpg', 
'SETx Blue LC 001.jpg', 'SETx Blue LC 003.jpg', 'SETx Blue LC 004.jpg', 'SETx Blue LC 009.jpg', 'SETx Blue LC 011.jpg', 'SETx Blue LC 012.jpg', 'SETx Blue LC 016.jpg', 'SETx Blue LC 017.jpg', 'SETx Blue LC 021.jpg', 'SETx Blue LC 026.jpg', 
'SETx Blue LC 028.jpg', 'SETx Blue LC 031.jpg', 'SETx Blue LC 032.jpg', 'SETx Blue LC 034.jpg'
];

// variable setup
var currentslide=0;
var numslides=photo.length-1;
var session = [0, 14, 90, 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";
	}
}