// Create the array
photo = [
'MVN-Blu-LC 014.jpg', 'MVN-Blu-LC 015.jpg', 'MVN-Blu-LC 020.jpg', 'MVN-Blu-LC 024.jpg', 'MVN-Blu-LC 030.jpg', 'MVN-Blu-LC 034.jpg', 'MVN-Blu-LC 037.jpg', 'MVN-Blu-LC 039.jpg', 'MVN-Blu-LC 054.jpg', 'MVN-Blu-LC 055.jpg', 
'MVN-Blu-LC 056.jpg', 'MVN-Blu-LC 058.jpg', 'MVN-Blu-LC 060.jpg', 'MVN-Blu-LC 061.jpg', 'MVN-Blu-LC 063.jpg', 'MVN-Blu-LC 074.jpg', 'MVN-Blu-LC 075.jpg', 'MVN-Blu-LC 077.jpg', 'MVN-Blu-LC 082.jpg', 'MVN-Blu-LC 084.jpg', 
'MVN-Blu-LC 086.jpg', 'MVN-Blu-LC 087.jpg', 'MVN-Blu-LC 091.jpg', 'MVN-Blu-LC 096.jpg', 'MVN-Blu-LC 097.jpg', 'MVN-Blu-LC 101.jpg', 'MVN-Blu-LC 104.jpg', 'MVN-Blu-LC 109.jpg', 'MVN-Blu-LC 110.jpg', 'MVN-Blu-LC 117.jpg', 
'MVN-Blu-LC 120.jpg', 'MVN-Blu-LC 123.jpg', 'MVN-Blu-LC 128.jpg', 'MVN-Blu-LC 131.jpg', 'MVN-Blu-LC 132.jpg', 'MVN-Blu-LC 134.jpg', 'MVN-Blu-LC 138.jpg', 'MVN-Blu-LC 143.jpg', 'MVN-Blu-LC 144.jpg', 'MVN-Blu-LC 146.jpg', 
'MVN-Blu-LC 147.jpg', 'MVN-Blu-LC 151.jpg', 'MVN-Blu-LC 153.jpg', 'MVN-Blu-LC 155.jpg', 'MVN-Blu-LC 159.jpg', 'MVN-Blu-LC 165.jpg', 'MVN-Blu-LC 166.jpg', 'MVN-Blu-LC 168.jpg', 'MVN-Blu-LC 170.jpg', 'MVN-Blu-LC 175.jpg', 
'MVN-Blu-LC 179.jpg', 'MVN-Blu-LC 183.jpg', 'MVN-Blu-LC 186.jpg', 'MVN-Blu-LC 191.jpg', 'MVN-Blu-LC 193.jpg', 'MVN-Blu-LC 197.jpg', 'MVN-Blu-LC 199.jpg', 'MVN-Blu-LC 206.jpg', 'MVN-Blu-LC 209.jpg', 'MVN-Blu-LC 212.jpg', 
'MVN-Blu-LC 214.jpg', 'MVN-Blu-LC 225.jpg', 'MVN-BlueLC 003.jpg', 'MVN-BlueLC 004.jpg', 'MVN-BlueLC 006.jpg', 'MVN-BlueLC 009.jpg', 'MVN-BlueLC 011.jpg', 'MVN-BlueLC 016.jpg', 'MVN-BlueLC 018.jpg', 'MVN-BlueLC 021.jpg', 
'MVN-BlueLC 024.jpg', 'MVN-BlueLC 027.jpg', 'MVN-BlueLC 033.jpg', 'MVN-BlueLC 039.jpg', 'MVN-BlueLC 047.jpg', 'MVN-BlueLC 052.jpg', 'MVN-BlueLC 061.jpg', 'MVN-BlueLC 063.jpg', 'MVN-BlueLC 067.jpg', 'MVN-BlueLC 069.jpg', 
'MVN-BlueLC 071.jpg', 'MVN-BlueLC 079.jpg', 'MVN-BlueLC 084.jpg', 'MVN-BlueLC 088.jpg', 'MVN-BlueLC 092.jpg', 'MVN-BlueLC 095.jpg', 'MVN-BlueLC 098.jpg', 'MVN-BlueLC 103.jpg', 'MVN-BlueLC 108.jpg', 'MVN-BlueLC 112.jpg', 
'MVN-BlueLC 114.jpg', 'MVN-BlueLC 116.jpg', 'MVN-BlueLC 118.jpg', 'MVN-BlueLC 123.jpg', 'MVN-BlueLC 128.jpg', 'MVN-BlueLC 136.jpg', 'MVN-BlueLC 138.jpg', 'MVN-BlueLC 140.jpg', 'MVN-BlueLC 146.jpg', 'MVN-BlueLC 147.jpg', 
'MVN-BlueLC 148.jpg', 'MVN-BlueLC 162.jpg', 'MVN-BlueLC 164.jpg', 'MVN-BlueLC 166.jpg', 'MVN-BlueLC 170.jpg', 'MVN-BlueLC 172.jpg', 'MVN-BlueLC 174.jpg', 'MVN-BlueLC 176.jpg', 'MVN-BlueLC 177.jpg', 'MVN-BlueLC 180.jpg', 
'MVN-BlueLC 181.jpg', 'MVN-BlueLC 183.jpg', 'MVN-BlueLC 185.jpg', 'MVN-BlueLC 187.jpg', 'MVN-BlueLC 189.jpg', 'MVN-BlueLC 194.jpg', 'MVN-BlueLC 199.jpg', 'MVN-BlueLC 200.jpg', 'MVN-BlueLC 201.jpg', 'MVN-BlueLC 209.jpg', 
'MVN-BlueLC 215.jpg', 'MVN-BlueLC 220.jpg', 'MVN-BlueLC 223.jpg', 'MVN-BlueLC 225.jpg', 'MVN-BlueLC 233.jpg', 'MVN-BlueLC 238.jpg', 'MVN-BlueLC 245.jpg', 'MVN-BlueLC 246.jpg', 'MVN-BlueLC 252.jpg', 'MVN-BlueLC 258.jpg', 
'MVN-BlueLC 265.jpg'
];

// variable setup
var currentslide=0;
var numslides=photo.length-1;
var session = [0, 8, 62, 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";
	}
}