	function set_current_nav(id_suffix) {
		$("#nav .current").removeClass('current');
		$('#nav_' + id_suffix).addClass('current');
		}
	
	function set_current_content(id) {
		$('#all_content .current').removeClass('current');
		$('#' + id).addClass('current');
		}
		
	function goto_content(id_prefix, speed) {
		if(!speed)
			var speed = 500;
		var id = id_prefix + '_content';
		if($('#' + id).length) {
			/*$('#all_content .current').fadeTo(speed, 0);*/
			/*$('#' + id).fadeTo(speed, .9999);*/ /*.9999 avoids some opacity bugs with text anti-aliasing*/
			set_current_content(id);
			$('#all_content').animate({
				left: 20 - $('#' + id).position().left
				}, speed);
			 }
		}

	function hide_more() {
		$('.more_link').show(200);
		$('.more_content').hide(600);
		}
	
	function toggle_more(link_el) {
		$('#' + link_el.attr('id') + '_content').slideToggle(200);
		link_el.toggle(100);
		}
	
	function check_search(speed) {
		var search_str = document.location.search;
		if(search_str.indexOf('article=') != -1) {
			goto_content('resources', speed);
			set_current_nav('resources');
			hide_more();
			}
		}
			
	function init() {
		var speed = 600;
		jQuery.easing.def = "easeOutQuint";
		hide_more();
		check_search(speed);
		/*$('#all_content .content:not(.current)').fadeTo(5, 0);
		$('#all_content .content:not(.current)').css("visibility", "visible");*/
		$("#nav_home").click(function(e) {
			goto_content('home', speed);
			set_current_nav('home');
			hide_more();
			e.preventDefault();
			});
		$("#nav_about").click(function(e) {
			goto_content('about', speed);
			set_current_nav('about');
			hide_more();
			e.preventDefault();
			});
		$("#nav_services").click(function(e) {
			goto_content('services', speed);
			set_current_nav('services');
			hide_more();
			e.preventDefault();
			});
		$("#nav_resources").click(function(e) {
			goto_content('resources', speed);
			set_current_nav('resources');
			hide_more();
			e.preventDefault();
			});
		$('.more_link').click(function() {
			toggle_more($(this));
			});
		}
		
	//initiate when the document is ready
	$(document).ready(function(){
		init();	 
	});