//This file concentrates all exhibition variable data in one place for easy update and to drive the front page picture slideshow
//The latest exhibition should be at the start of the array, so you need to swap The "Autumn 2010" and "Spring 2011" sections to suit. Then the slideshow shows the latest exhibition first, and "gallery latest.htm" and "gallery previous.htm" show the latest and previous exhibitions automatically. Don't forget to change the array access variables below to suit the array i.e.if more or fewer rows are needed.

//Items needing change for each exhibition
	var imagelist= [	//"*thumbnail", "*picture", "target", "exhibition", "category", "artist", "picture title"]
		//Spring exhibition awards
		["gallery spring/thumbnails/Peter Coatman Trophy Winner S11.jpg",  "gallery spring/Peter Coatman Trophy Winner S11.jpg",  "_new", "Spring 2011", "Peter Coatman Trophy", "Helen Blake", "The Gulley"],
		["gallery spring/thumbnails/Peter Coatman Trophy RU S11.jpg",      "gallery spring/Peter Coatman Trophy RU S11.jpg",      "_new", "Spring 2011", "Peter Coatman Trophy", "Christine Temple", "Rivelin Valley, Sheffield"],
		["gallery spring/thumbnails/Oona Lowsby Winner S11.jpg",           "gallery spring/Oona Lowsby Winner S11.jpg",           "_new", "Spring 2011", "Oona Lowsby award",    "Gill Hamilton", "Tellaro, Italy"],
		["gallery spring/thumbnails/Oona Lowsby RU S11.jpg",               "gallery spring/Oona Lowsby RU S11.jpg",               "_new", "Spring 2011", "Oona Lowsby award",    "Gillian French", "Golden Days"],
		["gallery spring/thumbnails/Basil Morrison Winner S11.jpg",        "gallery spring/Basil Morrison Winner S11.jpg",        "_new", "Spring 2011", "Basil Morrison award", "Liz Greenwood", "Two for Tea"],
		["gallery spring/thumbnails/Basil Morrison RU S11.jpg",            "gallery spring/Basil Morrison RU S11.jpg",            "_new", "Spring 2011", "Basil Morrison award", "Mike Harrison", "Landing, Air Brakes On"],
		["gallery spring/thumbnails/Snelson Bronze Winner S11.jpg",        "gallery spring/Snelson Bronze Winner S11.jpg",        "_new", "Spring 2011", "Snelson Bronze award", "Judith Durrant", "Blue Bell Woods"],
		["gallery spring/thumbnails/Snelson Bronze RU S11.jpg",            "gallery spring/Snelson Bronze RU S11.jpg",            "_new", "Spring 2011", "Snelson Bronze award", "Don McLaren", "Alvor Portugal"],
		["gallery spring/thumbnails/Fred Taylor Winner S11.jpg",           "gallery spring/Fred Taylor Winner S11.jpg",           "_new", "Spring 2011", "Fred Taylor award",    "Chris Dook", "Lakeside"],
		["gallery spring/thumbnails/Fred Taylor RU S11.jpg",               "gallery spring/Fred Taylor RU S11.jpg",               "_new", "Spring 2011", "Fred Taylor award",    "Sue Brereton", "Sledging in the park"],
		["gallery spring/thumbnails/commended1 S11.jpg", "gallery spring/commended1 S11.jpg", "_new", "Spring 2011", "Commended 1", "Mary Atherton", "Weekend in Conwy"],
		["gallery spring/thumbnails/commended2 S11.jpg", "gallery spring/commended2 S11.jpg", "_new", "Spring 2011", "Commended 2", "Margaret Berry", "The Setter Dog"],
		["gallery spring/thumbnails/commended3 S11.jpg", "gallery spring/commended3 S11.jpg", "_new", "Spring 2011", "Commended 3", "Mike Harrison", "Seashore Surf"],
		["gallery spring/thumbnails/commended4 S11.jpg", "gallery spring/commended4 S11.jpg", "_new", "Spring 2011", "Commended 4", "L Hutchinson", "Kitten Interrupted"],
		["gallery spring/thumbnails/commended5 S11.jpg", "gallery spring/commended5 S11.jpg", "_new", "Spring 2011", "Commended 5", "Marjorie Kenny", "The White Sail"],
		["gallery spring/thumbnails/commended6 S11.jpg", "gallery spring/commended6 S11.jpg", "_new", "Spring 2011", "Commended 6", "Jan Lees", "Pancake day"],
		["gallery spring/thumbnails/commended7 S11.jpg", "gallery spring/commended7 S11.jpg", "_new", "Spring 2011", "Commended 7", "Joanne Lunn", "Blue Rocks"],
		["gallery spring/thumbnails/commended8 S11.jpg", "gallery spring/commended8 S11.jpg", "_new", "Spring 2011", "Commended 8", "Alan Pedder", "The Last Race"],
		["gallery spring/thumbnails/commended9 S11.jpg", "gallery spring/commended9 S11.jpg", "_new", "Spring 2011", "Commended 9", "Brian Stone", "Manchester Portal 3"],
		["gallery spring/thumbnails/commended10 S11.jpg", "gallery spring/commended10 S11.jpg", "_new", "Spring 2011", "Commended 10", "Will Swindlehurst", "Honfleur, France"],
		//Autumn exhibition awards
		["gallery autumn/thumbnails/George Caley Winner A10.jpg", "gallery autumn/George Caley Winner A10.jpg", "_new", "Autumn 2010", "George Caley award", "Don McLaren", "Bolton by Bowlands"],
		["gallery autumn/thumbnails/George Caley RU A10.jpg",     "gallery autumn/George Caley RU A10.jpg",     "_new", "Autumn 2010", "George Caley award", "Gillian French", "Mousehole"],
		["gallery autumn/thumbnails/Betty Day Winner A10.jpg",    "gallery autumn/Betty Day Winner A10.jpg",    "_new", "Autumn 2010", "Betty Day award",    "J. Moffett", "Zambi"],
		["gallery autumn/thumbnails/Betty Day RU A10.jpg",        "gallery autumn/Betty Day RU A10.jpg",        "_new", "Autumn 2010", "Betty Day award",    "Christine Temple", "Aero Space"],
		["gallery autumn/thumbnails/Neville Mudd Winner A10.jpg", "gallery autumn/Neville Mudd Winner A10.jpg", "_new", "Autumn 2010", "Neville Mudd award", "Zita Elliott", "Blue Zing"],
		["gallery autumn/thumbnails/Neville Mudd RU A10.jpg",     "gallery autumn/Neville Mudd RU A10.jpg",     "_new", "Autumn 2010", "Neville Mudd award", "Gillian French", "Propellers"],
		["gallery autumn/thumbnails/Wilshire Winner A10.jpg",     "gallery autumn/Wilshire Winner A10.jpg",     "_new", "Autumn 2010", "Wilshire Cup",       "Pat Brown", "Alsager Evening"],
		["gallery autumn/thumbnails/Wilshire RU A10.jpg",         "gallery autumn/Wilshire RU A10.jpg",         "_new", "Autumn 2010", "Wilshire Cup",       "Mike Harrison", "Wave Crest"],
		["gallery autumn/thumbnails/commended1 A10.jpg", "gallery autumn/commended1 A10.jpg", "_new", "Autumn 2010", "Commended 1", "Sue Brereton", "Sunflower"],
		["gallery autumn/thumbnails/commended2 A10.jpg", "gallery autumn/commended2 A10.jpg", "_new", "Autumn 2010", "Commended 2", "Shirley Cock", "Tide's out, Cornish Harbour"],
		["gallery autumn/thumbnails/commended3 A10.jpg", "gallery autumn/commended3 A10.jpg", "_new", "Autumn 2010", "Commended 3", "Mike Harrison", "Old Jetty, Caernarfon"],
		["gallery autumn/thumbnails/commended4 A10.jpg", "gallery autumn/commended4 A10.jpg", "_new", "Autumn 2010", "Commended 4", "Juliet Jones", "Allotment Sunflower"],
		["gallery autumn/thumbnails/commended5 A10.jpg", "gallery autumn/commended5 A10.jpg", "_new", "Autumn 2010", "Commended 5", "Anne Kennedy", "Village on the Point"],
		["gallery autumn/thumbnails/commended6 A10.jpg", "gallery autumn/commended6 A10.jpg", "_new", "Autumn 2010", "Commended 6", "Sylvia Kenyon-Case", "When Beech trees were a mystery"],
		["gallery autumn/thumbnails/commended7 A10.jpg", "gallery autumn/commended7 A10.jpg", "_new", "Autumn 2010", "Commended 7", "Lynne Mallard", "White Hydrangea"],
		["gallery autumn/thumbnails/commended8 A10.jpg", "gallery autumn/commended8 A10.jpg", "_new", "Autumn 2010", "Commended 8", "J. Moffett", "Michael"],
		["gallery autumn/thumbnails/commended9 A10.jpg", "gallery autumn/commended9 A10.jpg", "_new", "Autumn 2010", "Commended 9", "Alan Pedder", "Pin Mill, monochrome"],
		["gallery autumn/thumbnails/commended10 A10.jpg", "gallery autumn/commended10 A10.jpg", "_new", "Autumn 2010", "Commended 10", "Christine Temple", "Fort Grey, Guernsey"],
		["gallery autumn/thumbnails/visitors choice A10.jpg", "gallery autumn/visitors choice A10.jpg", "_new", "Autumn 2010", "Visitors' Choice", "Harry Smith", "Richard"],
	]

var totalRows = 39;	//total number of rows in imagelist array
var previousExhibitionOffset = 20;	//row offset of previous exhibition block from imagelist array start
//var currentGallery = "gallery autumn";	//use these after the Autumn exhibition but before the Spring exhibition
//var previousGallery = "gallery spring";
var currentGallery = "gallery spring";	//use these after the Spring exhibition but before the Autumn exhibition
var previousGallery = "gallery autumn";
var springExhibitionDate = "April 2011";
var autumnExhibitionDate = "October 2010";
var visitorsChoice = -1;	//use a negative number until the choice is known, then alter this to point to the visitors choice row. If non-award winning picture is chosen, create a new row for it
var websitePeriod = "Spring 2011 to Autumn 2011";	//Change this to reflect the period for which the website content is valid
//End of items needing change


//imagelist array access variables. Change if the order or number of columns changes
var thumbnail = 0;		//column offset of thumnails path
var painting = 1;		//column offset of path to painting image
var targetCol = 2;		//column offset of target container
var exhibition = 3;		//column offset of exhibition (spring or autumn)
var award = 4;			//column offset of award text
var artist = 5;			//column offset of artist's name
var picture_title = 6;	//column offset of picture name


//gallery paths
var contentPagecurrentGallery = currentGallery+".htm";
var contentPagePreviousGallery = previousGallery+".htm";

function displayImages (rowNo){
	document.write("<a href=\"../"+imagelist[rowNo][painting]+"\" target=\"_blank\"><img src=\"../"+imagelist[rowNo][thumbnail]+"\" alt=\""+imagelist[rowNo][picture_title]+"\"></a>");
}

function targetSpringGallery () {
	var springGal = "<a href=\"current gallery.htm\">";
	if (currentGallery == "gallery autumn")
		springGal = "<a href=\"previous gallery.htm\">";
	return springGal;
}

function targetAutumnGallery () {
	var autumnGal = "<a href=\"current gallery.htm\">";
	if (currentGallery == "gallery spring")
		autumnGal = "<a href=\"previous gallery.htm\">";
	return autumnGal;
}


//Visitors' choice default image and text. This can't be in the imagelist array or it will be shown in the slideshow. This array MUST have the same structure as an imagelist row.
var visitorsChoiceList = ["gallery autumn/awaiting photograph.jpg", "gallery autumn/awaiting photograph.jpg","_new", "", "Visitor's choice", "Unknown", ""];

function visitorsChoiceText (colNo){
	var vcText;
	if (visitorsChoice < 0){
		vcText = visitorsChoiceList[colNo];
	}
	else {
		vcText = imagelist[visitorsChoice][colNo];
	}
	return vcText;
}

function visitorsChoiceImage (){
	if (visitorsChoice < 0){
		document.write('<a href="../'+visitorsChoiceList[painting]+'" target="_blank"><img src="../'+visitorsChoiceList[thumbnail]+'" alt="'+visitorsChoiceList[picture_title]+'"></a>');
	}
	else {
		displayImages (visitorsChoice);
	}
}


//Gallery file leading text
var autumnText="<p class=\"illum\">At the Autumn exhibition, held at Altrincham College of Arts in "+autumnExhibitionDate+", the pictures below were prize winners, runners up or commended.</p><p class=\"illum\">Competition categories were the <b>Betty Day</b> award for human portraiture in any medium, the <b>George Caley</b> award for line and watercolour wash, the <b>Neville Mudd</b> award for abstract and the <b>Wilshire Cup</b> for oils, acrylics used as oils and oil pastels. </p><p class=\"illum\">The <b>Visitors' choice</b> is an award given by the ASA to the painting gaining the most votes from visitors to the exhibition.</p>";

function previousExhibitionName (){
	var chosenText = "Autumn";
	if (currentGallery == "gallery autumn")
		chosenText = "Spring";
	return chosenText;
}

var previousExhibition = "<p class=\"illum\">To view the paintings in the <b>"+previousExhibitionName()+" exhibition</b>, please click <a href=\"previous gallery.htm\" name=\"Gallery\">here.</p></a>";

var springText="<p class=\"illum\">In the Spring exhibition, held at Altrincham College of Art in "+springExhibitionDate+", the pictures below were prize winners or commended.</p><p class=\"illum\">Competition categories were the <b>Basil Morrison</b> award for line drawing, the <b>Fred Taylor</b> award for watercolour, the <b>Snelson Bronze</b> for pastels, the <b>Oona Lowsby</b> award for mixed media and the <b>Peter Coatman</b> trophy for landscape in any medium.</p>";

function currentText (){
	var chosenText = springText+previousExhibition;
	if (currentGallery == "gallery autumn")
		chosenText = autumnText+previousExhibition;
	document.write(chosenText);
}

function previousText (){
	var chosenText = springText;
	if (previousGallery == "gallery autumn")
		chosenText = autumnText;
	document.write(chosenText);
}

function randomPicture (){
	var randomIndex = 0;
	randomIndex = Math.floor(Math.random()*(totalRows+1));
	displayImages (randomIndex);
	document.write("<br />"+imagelist[randomIndex][artist]+"<br /><i>"+imagelist[randomIndex][picture_title]+"</i>");
}



