// 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
	// Also add activeLink to the parent link
  var path = location.pathname.substring(1);
	if (path=='') {
		path = '/index.php';
	}
  $('#nav li a[@href$="' + path + '"]').addClass('activeLink').click( function() { return false; } ).parents('li.primaryNav').addClass('activeLink');;
	
	// 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;");
		$(this).wrap('<div style="float:'+myFloat+';margin:'+myMargin+';padding: 0;width:'+myWidth+'px; " ><\/div>');
		$(this).after('<p class="caption">'+myCaption.substring(4)+'<\/p>');
	});
	
	return false;
			
});
