function Gallery(elements, path, thumbs)
{
	this.path = null;
	this.contents = null;
	this.mainpane = null;
	this.lastactive = "g1";
	this.thumbChanges = (thumbs)?thumbs:false;
	this.init  = function(e, p)
	{
		this.contents = e;
		var el;
		this.mainpane = getElement("imgMP");
		this.path = p;
		for(i in this.contents)
		{
			el=getElement(i);
			el.onclick = this.highlight;
		}
	};
	this.highlight = function()
	{
		var a = null;
		var b = null;
		if(this.thumbChanges)
		{
			if(g.contents[this.id].thumbnail_off != g.contents[this.id].thumbnail_on)
			{
				a = getElement(this.id);			
				a.src = g.path+g.contents[this.id].thumbnail_on;			
			}
			if(g.lastactive != null && (g.contents[g.lastactive].thumbnail_off != g.contents[g.lastactive].thumbnail_on))
			{
				b = getElement(g.lastactive);
				b.src = g.path+g.contents[g.lastactive].thumbnail_off;
			}
		}
		else
		{
			a = getElement(this.id);
			a.style.borderColor = "#00426D";
			b = getElement(g.lastactive);
			if(a!=b)
				b.style.borderColor = "#FFFFFF";
		}
		g.lastactive = this.id;
		g.mainpane.src = g.path+g.contents[this.id].original;
		getElement("caption").innerHTML = g.contents[this.id].caption;
	}
	this.init(elements, path);
}
