// Create the array
photo = [
'20090109MVN 001.jpg', '20090109MVN 002.jpg', '20090109MVN 003.jpg', '20090109MVN 004.jpg', '20090109MVN 005.jpg', '20090109MVN 006.jpg', '20090109MVN 007.jpg', '20090109MVN 008.jpg', '20090109MVN 009.jpg', '20090109MVN 010.jpg', 
'20090109MVN 011.jpg', '20090109MVN 012.jpg', '20090109MVN 014.jpg', '20090109MVN 016.jpg', '20090109MVN 017.jpg', '20090109MVN 019.jpg', '20090109MVN 021.jpg', '20090109MVN 023.jpg', '20090109MVN 024.jpg', '20090109MVN 025.jpg', 
'20090109MVN 027.jpg', '20090109MVN 028.jpg', '20090109MVN 029.jpg', '20090109MVN 030.jpg', '20090109MVN 031.jpg', '20090109MVN 032.jpg', '20090109MVN 033.jpg', '20090109MVN 036.jpg', '20090109MVN 038.jpg', '20090109MVN 039.jpg', 
'20090109MVN 040.jpg', '20090109MVN 041.jpg', '20090109MVN 042.jpg', '20090109MVN 043.jpg', '20090109MVN 045.jpg', '20090109MVN 046.jpg', '20090109MVN 047.jpg', '20090109MVN 049.jpg', '20090109MVN 050.jpg', '20090109MVN 053.jpg', 
'20090109MVN 055.jpg', '20090109MVN 057.jpg', '20090109MVN 058.jpg', '20090109MVN 059.jpg', '20090109MVN 060.jpg', '20090109MVN 062.jpg', '20090109MVN 063.jpg', '20090109MVN 065.jpg', '20090109MVN 067.jpg', '20090109MVN 069.jpg', 
'20090109MVN 071.jpg', '20090109MVN 072.jpg', '20090109MVN 074.jpg', '20090109MVN 075.jpg', '20090109MVN 076.jpg', '20090109MVN 078.jpg', '20090109MVN 079.jpg', '20090109MVN 080.jpg', '20090109MVN 081.jpg', '20090109MVN 082.jpg', 
'20090109MVN 083.jpg', '20090109MVN 084.jpg', '20090109MVN 085.jpg', '20090109MVN 086.jpg', '20090109MVN 087.jpg', '20090109MVN 088.jpg', '20090109MVN 089.jpg', '20090109MVN 090.jpg', '20090109MVN 091.jpg', '20090109MVN 093.jpg', 
'20090109MVN 094.jpg', '20090109MVN 096.jpg', '20090109MVN 097.jpg', '20090109MVN 098.jpg', '20090109MVN 101.jpg', '20090109MVN 103.jpg', '20090109MVN 104.jpg', '20090109MVN 106.jpg', '20090109MVN 107.jpg', '20090109MVN 108.jpg', 
'20090109MVN 110.jpg', '20090109MVN 111.jpg', '20090109MVN 112.jpg', '20090109MVN 113.jpg', '20090109MVN 117.jpg', '20090109MVN 118.jpg', '20090109MVN 120.jpg', '20090109MVN 122.jpg', '20090109MVN 123.jpg', '20090109MVN 124.jpg', 
'20090109MVN 125.jpg', '20090109MVN 128.jpg', '20090109MVN 130.jpg', '20090109MVN 136.jpg', '20090109MVN 137.jpg', '20090109MVN 138.jpg', '20090109MVN 141.jpg', '20090109MVN 144.jpg', '20090109MVN 145.jpg',

'2009 Blue MVN 001.jpg', '2009 Blue MVN 002.jpg', '2009 Blue MVN 006.jpg', '2009 Blue MVN 009.jpg', '2009 Blue MVN 013.jpg', '2009 Blue MVN 015.jpg', '2009 Blue MVN 019.jpg', '2009 Blue MVN 021.jpg', '2009 Blue MVN 023.jpg', '2009 Blue MVN 030.jpg', 
'2009 Blue MVN 035.jpg', '2009 Blue MVN 039.jpg', '2009 Blue MVN 051.jpg', '2009 Blue MVN 059.jpg', '2009 Blue MVN 062.jpg', '2009 Blue MVN 076.jpg', '2009 Blue MVN 081.jpg', '2009 Blue MVN 083.jpg', '2009 Blue MVN 085.jpg', '2009 Blue MVN 090.jpg', 
'2009 Blue MVN 091.jpg', '2009 Blue MVN 108.jpg', '2009 Blue MVN 112.jpg', '2009 Blue MVN 116.jpg', '2009 Blue MVN 123.jpg', '2009 Blue MVN 130.jpg', '2009 Blue MVN 133.jpg', '2009 Blue MVN 136.jpg', '2009 Blue MVN 140.jpg', '2009 Blue MVN 142.jpg', 
'2009 Blue MVN 144.jpg', '2009 Blue MVN 146.jpg', '2009 Blue MVN 151.jpg', '2009 Blue MVN 164.jpg', '2009 Blue MVN 165.jpg', '2009 Blue MVN 167.jpg', '2009 Blue MVN 169.jpg', '2009 Blue MVN 173.jpg', '2009 Blue MVN 174.jpg', '2009 Blue MVN 175.jpg', 
'2009 Blue MVN 177.jpg', '2009 Blue MVN 178.jpg', '2009 Blue MVN 180.jpg', '2009 Blue MVN 182.jpg', '2009 Blue MVN 183.jpg', '2009 Blue MVN 184.jpg', '2009 Blue MVN 194.jpg', '2009 Blue MVN 201.jpg', '2009 Blue MVN 204.jpg', '2009 Blue MVN 206.jpg', 
'2009 Blue MVN 219.jpg', '2009 Blue MVN 220.jpg', '2009 Blue MVN 235.jpg', '2009 Blue MVN 239.jpg', '2009 Blue MVN 245.jpg', '2009 Blue MVN 250.jpg', '2009 Blue MVN 261.jpg', '2009 Blue MVN 264.jpg', '2009 Blue MVN 268.jpg', '2009 Blue MVN 274.jpg', 
'2009 Blue MVN 276.jpg', '2009 Blue MVN 278.jpg', '2009 Blue MVN 282.jpg', '2009 Blue MVN 284.jpg', '2009 Blue MVN 289.jpg', '2009 Blue MVN 292.jpg', '2009 Blue MVN 302.jpg', '2009 Blue MVN 307.jpg', '2009 Blue MVN 318.jpg', '2009 Blue MVN 321.jpg', 
'2009 Blue MVN 323.jpg', '2009 Blue MVN 331.jpg', '2009 Blue MVN 334.jpg', '2009 Blue MVN 338.jpg', '2009 Blue MVN 345.jpg', '2009 Blue MVN 347.jpg', '2009 Blue MVN 353.jpg', '2009 Blue MVN 356.jpg', '2009 Blue MVN 362.jpg', '2009 Blue MVN 363.jpg', 
'2009 Blue MVN 365.jpg', '2009 Blue MVN 367.jpg', '2009 Blue MVN 372.jpg', '2009 Blue MVN 374.jpg', '2009 Blue MVN 375.jpg', '2009 Blue MVN 376.jpg', '2009 Blue MVN 379.jpg', '2009 Blue MVN 386.jpg', '2009 Blue MVN 387.jpg', '2009 Blue MVN 397.jpg', 
'2009 Blue MVN 398.jpg', '2009 Blue MVN 401.jpg', '2009 Blue MVN 404.jpg', '2009 Blue MVN 407.jpg', '2009 Blue MVN 409.jpg', '2009 Blue MVN 412.jpg', '2009 Blue MVN 419.jpg', '2009 Blue MVN 427.jpg', '2009 Blue MVN 434.jpg', '2009 Blue MVN 436.jpg', 
'2009 Blue MVN 441.jpg', '2009 Blue MVN 446.jpg', '2009 Blue MVN 451.jpg', '2009 Blue MVN 458.jpg', '2009 Blue MVN 470.jpg', '2009 Blue MVN 474.jpg', '2009 Blue MVN 484.jpg' 

];

// variable setup
var currentslide=0;
var numslides=photo.length-1;
var session = [0, 64, 99, 136, 0];
var portraitnumber = 500;
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";
	}
}