function contactDecode(anchor) {
	  		var href = anchor.attr('href');
	  		var address = href.replace(/.*contact\/([a-z0-9._%-]+)\+([a-z0-9._%-]+)\+([a-z.]+)/i, '$1' + '@' + '$2' + '.' + '$3');
	  		if (href != address) {
	    		anchor.attr('href','mailto:' + address);
			}
		}
		
		var activeInfoDiv = '';
		
		function toggleInfo(id) {
		    if (activeInfoDiv != '') {
		   		$("div#" + activeInfoDiv).hide();
		    }
		    activeInfoDiv = id;
			$("div#" + id).slideDown("slow");
			//selectMenu($("a" +id));
		}		
		var activeMenu = '';

    	$(document).ready(function() {
    	
    		// pre-open info panel?
			var shouldSelectMenu = '';
			
			var hash = document.location.hash;
			if (hash != '') {
				shouldSelectMenu = hash.replace("#","");
			}
			
			var currentPage = document.location.href.replace(document.location.protocol + '//' + document.location.host + '/', '');
			currentPage = currentPage.replace('.php', '');
			    	
			// wrap inner content of each anchor with first layer and append background layer
			$("#menu li a").wrapInner( '<span class="out"></span>' ).append( '<span class="bg"></span>' );

			// loop each anchor and add copy of text content
			$("#menu li a").each(function() {
				$( '<span class="over">' +  $(this).text() + '</span>' ).appendTo( this );
				//$(this).attr("onClick", "toggleInfo('" + $(this).attr('id').replace('a_', '') + "');");
				if ("a_" + currentPage == $(this).attr('id')) {
					selectMenu(this);
					toggleInfo($(this).attr('id').replace('a_', ''));
					activeMenu = this;
				}
				$(this).bind("click", function(){
					toggleInfo($(this).attr('id').replace('a_', ''));
					if (activeMenu != '') {
						deselectMenu(activeMenu);
					}
					activeMenu = this;
				});
			});

			$("#menu li a").hover(function() {
				selectMenu(this);
			}, function() {
				if (activeMenu != this) {
					deselectMenu(this);
				}
			});

			//contactDecode($('a.email'));
		
		});
		
		function selectMenu(m) {
			// this function is fired when the mouse is moved over
			$(".out",	m).stop().animate({'top':	'45px'},	250); // move down - hide
			$(".over",	m).stop().animate({'top':	'0px'},		250); // move down - show
			$(".bg",	m).stop().animate({'top':	'0px'},		120); // move down - show
		}
		
		function deselectMenu(m) {
			// this function is fired when the mouse is moved off
			$(".out",	m).stop().animate({'top':	'0px'},		250); // move up - show
			$(".over",	m).stop().animate({'top':	'-45px'},	250); // move up - hide
			$(".bg",    m).stop().animate({'top':	'-45px'},	120); // move up - hide
		}