	function clicked(){

			var hash = this.href;
			if (hash == undefined) {
				hash=""
			}
			hash = hash.replace(/^.*#/, '');
			$.historyLoad(hash);
			return false;
		};

	jQuery.extend({ 
	  	exhibitionData:null,
		overview:null,
		initialized:false,
		exhibitionInit: function(){
			$.getJSON(year+"/exhibition.json", function(data){
			$.exhibitionData = data;
			$.initialized=true;
			$.populateOverview();
			$.historyInit(pageload);	
		});
	

		},
		
		populateOverview:function() {
			if (!$.initialized) {
				$.exhibitionInit();
				return;
			}
			var data = $.exhibitionData;
			var nrExhibitors = data.exhibitors.length;
			var titles = 0;
			var col = 0;
			document.getElementById("images").innerHTML = "";
			document.getElementById("titles").innerHTML = "";
			document.getElementById("exhibitors").innerHTML = "";

  			$.each(data.exhibitors, function(i,item){
			
	  			$.each(item.images, function(j,image){

				$("#images").createAppend('a',{href:year+"/photos/"+image.url+".jpg",title:item.name+" - "+image.title}).createAppend('img', {src:year+"/photos/"+image.url+"_small.jpg"}).addClass("thumb");

					$("#titles").createAppend('div',{}).addClass("imagetitle").createAppend('a',{href:"#"+i+"."+j}, image.title).click(clicked);
		  		});

				$( "#exhibitors" ).createAppend('a',{href:"#"+i+".0"}, ['span', {}, item.name]).click(clicked).createAppend('br');
	  		});
			$('#images  a').lightbox();
		}
	});

	 	function pageload(hash) {

		$('#overview').hide();
		$('#details').hide();

		if(hash != "") {
			var item = hash.split(".");
			var person = $.exhibitionData.exhibitors[parseInt(item[0])];
			var images = person.images
			var image = images[parseInt(item[1])];

			var imageTag = document.getElementById('image');
		
			document.getElementById('name').innerHTML = '"' + image.title + '" by ' + person.name ;
			document.getElementById('name2').innerHTML = person.name;

			imageTag.src = year+"/photos/"+image.url+".jpg";
			imageTag.alt = image.title+" - "+person.name;
			$("#"+'details').show();

			if (images.length == 1) {
				$("#"+'also').hide();
			} else {
				$("#"+'also').show();
				var a = document.getElementById('also');
				var tmp = document.getElementById("alsoimages");
				if (tmp != null && tmp.childNodes != null) {
					while (tmp.childNodes.length != 0)
						tmp.removeChild(tmp.childNodes[0]);
				}
				var i = parseInt(item[0]);
				for (x=0;x<images.length;x++) {
					if (x!=parseInt(item[1])) {
						var image = images[x];
						$("#"+"alsoimages").createAppend('a',{href:"#"+i+"."+x}).click(clicked).createAppend('img', {src:year+"/photos/"+image.url+"_small.jpg"}).addClass("thumb");
					}
				}
			}

		} else {
			document.getElementById('image').src="/images/lightbox-ico-loading.gif";
			$('#overview').show();
		}
		
	}
	

