var gallery = new Array();
var currentPic;
var currentGallery = "regulars";
var pictureTitles = new Array();
var galleryDescription;

function guitarGalInit() {
	var image = new Image;
	currentGallery = "guitairs";
	gallery = new Array("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11");
	pictureTitles = new Array("Some of the gutiars on display in the bar.", 
					   	"Hand engraved resonator guitar. Nickel plated copper", 
						"Hand engraved 12 string resonator. Nickel plate over brass", 
						"1965 Framus acoustic elelctric undergoing restoration", 
						"Hand carved Gibson ES355 copy with active circuitry, flamed Ash", 
						"Walnut semi acoustic Telecaster under construction for a local musician. Mahogany neck with Rosewood fingerboard and body back", 
						"5 string fretless bass with active on board chorus and distortion", 
						"Semi acoustic Telecaster with 50's style Humbucker pick-ups, nice warm tone, great for blues. Dyed Beechwood body Maple neck", 
						"Hand beaten resonator made for the same local musician as the Walnut Tele. Nickel over brass", 
						"Not one of mine this time. A 1961 Masetti Jazz Archtop from Modena Italy, made by Luthier Paolo Coriani. It's missing it's original scratchplate and pick-ups - Davoli - but is still lovely. Hand carved in quilted Maple. In 1961 it cost 50,000 Italian lire. About six weeks wages!",
						"Interesting project this one. I threw it together from bits I had laying around and it made a surprisingly good guitar!");
	document.getElementById("picture").src = 
		"graphics/photos/gallery/guitairs/"+ gallery[0] +".jpg";
	currentPic = 0;
	galleryDescription = "Guitars? What's that got to do with a bar? I've been a Luthier for over 25 years. I've made and repaired axes for some very well known artists, some of them in the UK but mostly here in Italy. I work exclusively with a very large music store, Strumenti Musicali Irritti. Here're some examples of my work. I make custom instruments to order. Interested? Mail me...";
	createIndex();
	setTitle();
	setGalleryDescription();
}

function artistsGalInit() {
	var image = new Image;
	currentGallery = "artistsandevents";
	gallery = new Array("Franco Fajjii", "Luca Bassi, Bassman with Best on odd occasions", 
				  "Maurizio Bestetti", "Robby Zech and Rick Orsi", 
				  "The host! He's terrible!");
	document.getElementById("picture").src = 
		"graphics/photos/gallery/artistsandevents/"+ gallery[0] +".jpg";
	currentPic = 0;
	galleryDescription = "Maurizio Bestetti is one of Italy's top Jazz/Blues players and is a regular here. There're some tracks from one of his concerts (recorded here) that you can download from this website. Franco's from Verona, he's crazy. He's also mega talented. Listen to 'Down the line'. He uses no drum machine or bass. Just a slight echo effect. Amazing! I'm recording a blues album with him. I'm singing-badly, and playing harmonica and washboard. Skiffle stuff! Love it.";
	setGalleryDescription();
	createIndex();
	setTitle();
}

function gardenGalInit() {
	var image = new Image;
	currentGallery = "garden";
	gallery = new Array("View of our garden", "victims!", 
				  "Our Garden as seen from the Captains garden", "December 2005");
	document.getElementById("picture").src = "graphics/photos/gallery/garden/"+ gallery[0] +".jpg";
	currentPic = 0;
	galleryDescription = "Well we started off with five tables, twenty chairs and some borrowed table cloths, five years back, and not long after this we decided to start planting a few things. The vines took three years to form a full canopy and this fourth 'vine' year, 2006 we rebuilt the 'pergola' with a sturdier framework. We also take bookings for weddings and can manage small groups of up to 25 people. We offer sandwiches and cold snacks served in a buffet style.";
	setGalleryDescription();
	createIndex();
	setTitle();
}

function malcesineGalInit() {
	currentGallery = "malcesine";
	gallery = new Array("A February Sunset 2006", "Across the lake to Limone", 
					"Arial view of Malcesine", "A tranquil February afternoon", 
					"Another nice sunset from our back door", "December 2005 in the afternoon", 
					"From an olive grove", "December 2005", 
					"High Street", "Lake Garda, looking over the Monte Baldo range", 
					"Malcesine castle early december 2005");
	document.getElementById("picture").src = 
		"graphics/photos/gallery/malcesine/"+ gallery[0] +".jpg";
	galleryDescription = "The Lake is particularly beautiful in the winter. Most places close down and the tourists go home leaving a strange calm which, once you get used to it after the chaos of the summer, is very relaxing. Here's a few views of Malcesine and the Lake in general.";
	setGalleryDescription();
	currentPic = 0;
	createIndex();
	setTitle();
}

function barGalInit() {
	currentGallery = "theBar";
	gallery = new Array("Doesn't look much from outside", "This all looks a bit dismal", 
					"Then things open out a bit", "Our big screen video", 
					"Our billiards room", "Another Christmas view");
	document.getElementById("picture").src = 
		"graphics/photos/gallery/theBar/"+ gallery[0] +".jpg";
	galleryDescription = "It's kind of hidden away if you see what I mean, not easy to find if you haven't been told where it is. That can have its advantages sometimes as there's only the two of us here and when it gets really busy.... Imagine if everyone knew, our feet wouldn't make contact with the floor!";
	setGalleryDescription();
	currentPic = 0;
	createIndex();
	setTitle();
}



function regularsGalInit() {
	currentGallery = "regulars";
	gallery = new Array("My dad and his girlfriend",
						"Some old git called Robin. He's a Brit too!", 
					  "One of the regulars....a German nutter called Gunther",
					  "MOJO! A local idiot!",
					  "Mojo in a less obnoxious mood....unusual!",
					  "Me and My 1950 Wolseley 680");
	document.getElementById("picture").src = 
		"graphics/photos/gallery/regulars/"+ gallery[0] +".jpg";
	galleryDescription = "We get regular customers returning year after year as well as our club members. It's nice to see old faces again. Nice to be remembered.";
	setGalleryDescription();
	currentPic = 0;
	createIndex();
	setTitle();
}


function nextPic() {
	if(currentPic < gallery.length-1) {
		document.getElementById("picture").src = 
			"graphics/photos/gallery/"+ currentGallery +"/"+ gallery[++currentPic] +".jpg";
	}
	setTitle();
}

function previousPic() {
	if(currentPic > 0) {
		document.getElementById("picture").src = 
			"graphics/photos/gallery/"+ currentGallery +"/"+ gallery[--currentPic] +".jpg";
	}
	setTitle();
}


function createIndex() {

	var index = "";
	for(var i = 1; i<=gallery.length; i++)
		index = index + i + " ";

	var oldNode = document.getElementById("indexNumbers");
	oldNode.removeChild(oldNode.firstChild);

	var newNode = document.createTextNode(index);
	document.getElementById("indexNumbers").appendChild(newNode);
}

function setGalleryDescription() {

	var node = document.getElementById("galDescription");
	node.removeChild(node.firstChild);

	var newDescriptionNode = document.createTextNode(galleryDescription);
	node.appendChild(newDescriptionNode);
}


	

function setTitle() {

	var node = document.getElementById("picTitle");
	node.removeChild(node.firstChild);

	if(currentGallery == "guitairs") {
	 	var newTitleNode = document.createTextNode(pictureTitles[currentPic]) 
	} else {
		var newTitleNode = document.createTextNode(gallery[currentPic]);
	}
	node.appendChild(newTitleNode);
}

	

/*---------- preload variables for gallery nav rollovers ----------*/

var malcesineOver = new Image;
var malcesineOut = new Image;
var barOver = new Image;
var barOut = new Image;
var regularsOver = new Image;
var regularsOut = new Image;
var guitarsOver = new Image;
var guitarsOut = new Image;
var artistsOver = new Image;
var artistsOut = new Image;
var gardenOver = new Image;
var gardenOut = new Image;

malcesineOver.src = 'graphics/photos/gallery/galSelection/malcesine.jpg';
malcesineOut.src = 'graphics/photos/gallery/galSelection/malcesine2.jpg'; 

barOver.src = 'graphics/photos/gallery/galSelection/theVenue.jpg';
barOut.src = 'graphics/photos/gallery/galSelection/theVenue2.jpg';

regularsOver.src = 'graphics/photos/gallery/galSelection/regulars.jpg';
regularsOut.src = 'graphics/photos/gallery/galSelection/regulars2.jpg';

guitarsOver.src = 'graphics/photos/gallery/galSelection/guitars.jpg';
guitarsOut.src = 'graphics/photos/gallery/galSelection/guitars2.jpg';

artistsOver.src = 'graphics/photos/gallery/galSelection/artistsandevents.jpg';
artistsOut.src = 'graphics/photos/gallery/galSelection/artistsandevents2.jpg';

gardenOver.src = 'graphics/photos/gallery/galSelection/garden1.jpg';
gardenOut.src = 'graphics/photos/gallery/galSelection/garden2.jpg';
