// jQuery to be included at the top of all pages (via Template)

jQuery(function($) {
	// Add active class to list element of current page; remove (thereby disable) link
  var path = location.pathname.substring(1);
	if (path=='') {
		path = '/index.php';
	}
  $('#navigation li a[@href$="' + path + '"]').addClass('activeLink').click( function() { return false; } );
	
	
		// add captions to pictures
			$('img[@alt^=CAP:]').each(function() {
				var myCaption = this.alt;
				var myWidth = $(this).outerWidth();
				var myFloat = $(this).css("float");
				var myMargin = $(this).css("margin-top")+' '
					+$(this).css("margin-right")+' '
					+$(this).css("margin-bottom")+' '
					+$(this).css("margin-left");
				var myPadding = $(this).css("padding-top")+' '
					+$(this).css("padding-right")+' '
					+$(this).css("padding-bottom")+' '
					+$(this).css("padding-left");
				$(this).attr("style","float: none;margin: 0;padding:0;");
				$(this).wrap('<div style="float:'+myFloat+';margin:'+myMargin+';padding:'+myPadding+';width:'+myWidth+'px; " ><\/div>');
				$(this).after('<p class="caption">'+myCaption.substring(4)+'<\/p>');
			});
   	return false;
			
});