
function paintingObj(filename, title, dimensions, medium) {
	this.filename = filename;
	this.title = title;
	this.dimensions = dimensions;
	this.medium = medium;
}

var PAINTING_NUM = 57;
var RANDOM_RANGE = 10;
var curPainting = 0;
var paintings = new Array(PAINTING_NUM);
var paintingLoc = "images/paintings_medium/";
var thumbLoc = "images/thumbs_medium/";

paintings[0] = new paintingObj("AfternoonShadow.jpg",           "Afternoon Shadow",         		"18 x 24", "Guache on Paper");
paintings[1] = new paintingObj("AroundTheBend.jpg",             "Around the Bend - 2009",          	"20 x 30", "Guache on Paper");
paintings[2] = new paintingObj("BarnOn66.jpg",                  "The Barn on 66",           		"18 x 24", "Guache on Paper");
paintings[3] = new paintingObj("BayPark.jpg",                   "Bay Park",                 		"18 x 24", "Guache on Paper");
paintings[4] = new paintingObj("BerkshireWinter.jpg",           "Berkshire Winter",         		"18 x 24", "Guache on Paper");
paintings[5] = new paintingObj("CemetaryRoad.jpg",              "Cemetary Road - 2010",            	"14 x 20", "Guache on Paper");
paintings[6] = new paintingObj("ChathamCrossing.jpg",           "Chatham Crossing",         		"18 x 20", "Guache on Paper");
paintings[7] = new paintingObj("CrossingAtSunset.jpg",          "The Crossing At Sunset",   		"18 x 24", "Guache on Paper");
paintings[8] = new paintingObj("DoyleStreetCanal.jpg",          "The Doyle Street Canal",   		"18 x 24", "Guache on Paper");
paintings[9] = new paintingObj("EarlyMorningLight.jpg",         "Early Morning Light",      		"18 x 24", "Guache on Paper");
paintings[10] = new paintingObj("EarlySnow.jpg",                "Early Snow",              	 	"18 x 24", "Guache on Paper");
paintings[11] = new paintingObj("EnteringChatham.jpg",          "Entering Chatham - 2009",         	"20 x 30", "Guache on Paper");
paintings[12] = new paintingObj("FadingLight.jpg",              "Fading Light - 2006",             	"18 x 24", "Guache on Paper");
paintings[13] = new paintingObj("FebruaryAfternoon.jpg",        "February Afternoon",       		"20 x 28", "Guache on Paper");
paintings[14] = new paintingObj("FireInTheSky.jpg",             "Fire in the Sky - 2010",          	"", "Guache on Paper");
paintings[15] = new paintingObj("FirstSnowfall.jpg",            "First Snowfall - 2009",           	"22 x 30", "Guache on Paper");
paintings[16] = new paintingObj("FrontLawn.jpg",                "The Front Lawn",           		"18 x 24", "Guache on Paper");
paintings[17] = new paintingObj("HagarAtTheWell.jpg",           "Hagar at the Well - 2007",        	"15 x 20", "Guache on Paper");
paintings[18] = new paintingObj("HouseNearTheBridge.jpg",       "House Near the Bridge - 2010",    	"18 x 24", "Guache on Paper");
paintings[19] = new paintingObj("January.jpg",                  "January",                  		"18 x 24", "Guache on Paper");
paintings[20] = new paintingObj("LakeAtSunset.jpg",             "Lake at Sunset - 2010",           	"22 x 30", "Guache on Paper");
paintings[21] = new paintingObj("LightThroughTheTrees.jpg",     "Light Through the Trees",  		"18 x 24", "Guache on Paper");
paintings[22] = new paintingObj("Local.jpg",                    "The Local",                		"20 x 28", "Guache on Paper");
paintings[23] = new paintingObj("LoversLane.jpg",               "Lover's Lane",             		"18 x 24", "Guache on Paper");
paintings[24] = new paintingObj("Moses.jpg",                    "Moses",                    		"20 x 28", "Guache on Paper");
paintings[25] = new paintingObj("NearWestHill.jpg",             "Near West Hill",           		"16 x 20", "Guache on Paper");
paintings[26] = new paintingObj("NewLebanon.jpg",               "New Lebanon",              		"16 x 20", "Guache on Paper");
paintings[27] = new paintingObj("PathToTheRiver.jpg",           "The Path to the River",    		"18 x 24", "Guache on Paper");
paintings[28] = new paintingObj("RedBarn.jpg",                  "Red Barn",                 		"18 x 24", "Guache on Paper");
paintings[29] = new paintingObj("Route20.jpg",                  "Route 20 - 2010",                 	"22 x 30", "Guache on Paper");
paintings[30] = new paintingObj("Route295.jpg",                 "Route 295 - 2010",                	"16 x 29", "Guache on Paper");
paintings[31] = new paintingObj("StepsToTheGarden.jpg",         "Steps to the Garden",      		"18 x 24", "Guache on Paper");
paintings[32] = new paintingObj("SloopChannel.jpg",             "The Sloop Channel",        		"18 x 24", "Guache on Paper");
paintings[33] = new paintingObj("Suburbia.jpg",                 "Suburbia",                 		"18 x 24", "Guache on Paper");
paintings[34] = new paintingObj("TipOfTheJetty.jpg",            "Tip of the Jetty - 2002",         	"17 x 21", "Guache on Paper");
paintings[35] = new paintingObj("TradeTools.jpg",               "Trade Tools",              		"16 x 20", "Guache on Paper");
paintings[36] = new paintingObj("TreesInTheMeadow.jpg",         "Trees In The Meadow",      		"18 x 24", "Guache on Paper");
paintings[37] = new paintingObj("WarwickCrossing.jpg",          "The Warwick Crossing",     		"16 x 20", "Guache on Paper");
paintings[38] = new paintingObj("WestHillSunset.jpg",           "West Hill Sunset -2010",         	"14 x 20", "Guache on Paper");
paintings[39] = new paintingObj("Where5AMeets20.jpg",           "Where 5A Meets 20",        		"18 x 24", "Guache on Paper");
paintings[40] = new paintingObj("WinterPasture.jpg",            "Winter Pasture",           		"18 x 20", "Guache on Paper");
paintings[41] = new paintingObj("Canal.jpg",                    "The Canal",                		"18 x 24", "Oil on Canvas");
paintings[42] = new paintingObj("KewForest.jpg",                "Kew Forest",               		"42 x 34", "Oil on Canvas");
paintings[43] = new paintingObj("VariegatedFig.jpg",            "The Variegated Fig",       		"36 x 42", "Oil on Canvas");
paintings[44] = new paintingObj("ApothocaryJars.jpg",           "Apothocary Jars - 2000",           	"24 x 36", "Oil on Canvas");
paintings[45] = new paintingObj("AugustAfternoon.jpg",          "August Afternoon - 2009",           	"48 x 68", "Oil on Canvas");
paintings[46] = new paintingObj("EndOfTheJetty.jpg",            "End of the Jetty - 1990",           	"29 x 40", "Oil on Canvas");
paintings[47] = new paintingObj("GrandmaAndSammy.jpg",          "Grandma & Sammy - 1984",           	"26 x 36", "Oil on Canvas");
paintings[48] = new paintingObj("HighTide.jpg",             	"High Tide - 2001",           		"27 x 39", "Oil on Canvas");
paintings[49] = new paintingObj("MrColemansClass.jpg",      	"Mr Coleman's Class - 1983",           	"24 x 36", "Oil on Canvas");
paintings[50] = new paintingObj("SamAndGriff.jpg",             	"Sam & Griff - 1995",           	"36 x 42", "Oil on Canvas");
paintings[51] = new paintingObj("Splash.jpg",             	"Splash - 2009",           		"34 x 42", "Oil on Canvas");
paintings[52] = new paintingObj("SundayAfternoon.jpg",   	"Sunday Afternoon - 2006",           	"28 x 36", "Oil on Canvas");
paintings[53] = new paintingObj("Tanning.jpg",             	"Tanning - 1995",           		"36 x 46", "Oil on Canvas");
paintings[54] = new paintingObj("TheBestToday.jpg",             "The Best Today - 1997",           	"30 x 37", "Oil on Canvas");
paintings[55] = new paintingObj("TheInlet.jpg",             	"The Inlet - 2001",           		"30 x 40", "Oil on Canvas");
paintings[56] = new paintingObj("ToolsOfTheTrade.jpg",  	"Tools of the Trade - 2000",           	"42 x 36", "Oil on Canvas");

var loadedImages = new Array(PAINTING_NUM);

function preloadImages() {
	for (var i = 0; i < PAINTING_NUM; i++) {
	  loadedImages[i] = new Image();
	  loadedImages[i].src = paintingLoc + paintings[i].filename;
	}
}

function swapImgOver(id) {
	document.getElementById(id).src = "images/" + id + "_over.gif";
	document.getElementById(id).style.cursor = "pointer";
}

function swapImgOff(id) {
	document.getElementById(id).src = "images/" + id + ".gif";
}

function show(id, v, d) {
	if (v) 	{	document.getElementById(id).style.visibility = "visible";  }
	if (d)	{	document.getElementById(id).style.display = "";	}
}

function hide(id, v, d) {
	if (v) 	{	document.getElementById(id).style.visibility = "hidden";  }
	if (d)	{	document.getElementById(id).style.display = "none";	}
}

function showSpecificPic(num) {
	curPainting = num;
	document.getElementById('currentPic').src = loadedImages[curPainting].src;
	changePicDetails();
}

function changePicDetails() {
	document.getElementById('detailText').innerHTML = 	
        paintings[curPainting].title + 
        "<br>" + paintings[curPainting].medium +
        " (" + paintings[curPainting].dimensions + ")";
}

function loadThumbs() {
	for (var i = 0; i < PAINTING_NUM; i++) {
		if (!document.getElementById('thumbSlot'+i).src) {
			document.getElementById('thumbSlot'+i).src = thumbLoc + paintings[i].filename;
		}
	}
}

function showRandomPic() {
	var rndpic = Math.floor(Math.random() * (RANDOM_RANGE-1));
	document.getElementById('entryPic').src = loadedImages[rndpic].src;
	showSpecificPic(rndpic);
}

function showInfo(bio, contact) {
	bioDisplay = (bio) ? "" : "none";
	contactDisplay = (contact) ? "" : "none";

	document.getElementById('bioInfo').style.display = bioDisplay;
	document.getElementById('contactInfo').style.display = contactDisplay;
}
