$(document).ready(function(){
	$('#collapse_the_anchor_panel').click(function(){
		close_anchor_panel()
		return false;
	})

	$('#expand_the_anchor_panel').click(function(){
		open_anchor_panel()
		return false;
	})
	
	$('.anchor_panel_lists ul li a').click(function(){
		close_anchor_panel(); //close the panel after link is clicked
		anchor = $(this).attr('href').slice(1); //get the href value of the clicked link, and strip off the '#'
		if(anchor != '') //make sure the link actually had a href value
		{
			jumped_to = $('h4[id='+anchor+']');
			jumped_to.css('background-color', '#f5faeb'); //highlight the jumped-to link #f5faeb #ebf4d7
			jumped_to.animate( { backgroundColor: '#ffffff' }, 2500); //fade the highlight
		}
	})
	$('#alphaSelector li a').click(function(){
		close_anchor_panel(); //close the panel after link is clicked
		anchor = $(this).attr('href').slice(1); //get the href value of the clicked link, and strip off the '#'
		if(anchor != '') //make sure the link actually had a href value
		{
			jumped_to = $('h4[id='+anchor+'] span');
			jumped_to.css('background-color', '#f5faeb'); //highlight the jumped-to link #f5faeb #ebf4d7
			jumped_to.animate( { backgroundColor: '#ffffff' }, 2500); //fade the highlight
		}
	})
})

close_anchor_panel = function()
{
	$('#new_anchor_panel_container').fadeOut('fast');
}

open_anchor_panel = function()
{
	$('#new_anchor_panel_container').fadeIn('fast');
}
