function initLayersGallery() {
	var uk2010 = $("#UK2010").get(0);
	
	$("#Election05").bind('mouseover', function() {
		uk2010.hideLayersGallery();
	});
	
	$("#Analysis").bind('mouseover', function() {
		uk2010.showLayersGallery();				
	});
	
	$("#Predictions").bind('mouseover', function() {
		uk2010.hideLayersGallery();		
	});
}

function showingLayerGallery(state) {
	if (state == true) {
		$("#contentTitle").addClass('showingLayerGallery');
	}
	else {
		$("#contentTitle").removeClass('showingLayerGallery');
	}
}

// js
var menu = {
	debug: false,
	chref: "",
	init: function(){
		window.setInterval(this.check, 500);
	},
	
	check: function(){
		var h = document.location.href;
		if( h != this.chref ){
			this.chref = h;
			if(this.debug) console.log("menu.chref: document.location changed into: "+ this.chref);
			
			var es = this.chref.split("/#/");			
			if( es.length > 1 ){
				
				var e = es[1].split("/")[0];
				if(this.debug) console.log( e );
				
				$("#contentTitle").children().each(function(idx, item) {
					if(this.debug) console.log( item );
					$(item).removeClass('selected');
				});
				$("#"+e).addClass('selected');
			}
		}
		
	}
};

menu.init();
