jQuery(function($){
	// identify external links
	$('#content a.ext')
		.attr('title','External Link')
		// find internal links that open a new window
		.add('#content a.pop')
		//.append('<span>&#x2197;</span>')
		.bind("click",function(){
			window.open( this.href );
			return false;
		});	
	// toggle fixed position of the side bar when the document scrolls
	var $win = $( window ).bind("scroll",function(){
		var top = $doc.scrollTop();
		$side.stop( true, true ).animate({
			"top":  top < sidetop ? 0 : top - sidetop + 8 
		}, 200 );
	});
	// reference the doc for later
	$doc = $( document ),
	// locate the content container
	$content = $('#content'),
	// locate the side bar element
	$side = $content.find('.side'), 
	// locate the starting position
	sidetop = $side.offset().top;
	// make the Page Contents jump links scroll
	$content.find('.jump').bind("click",function(){
		var id = this.href.split('#').pop();
		$('html').stop( true, true ).animate({
			"scrollTop": id ? $('#'+ id ).offset().top - 8 : 0
		}, 800, function(){
			window.location = '#'+ id;
		});
		return false;
	});
	// initialize the scrolled state
	$win.triggerHandler("scroll");
});
