function customizeCaption(caption) {
	if ($(caption).length) {
		var link = $(caption).children("#lightbox-caption-title");
		var lowres = $(caption).children("#lightbox-caption-title").attr("href");
		var highres = lowres.replace(/low([-_])/g,"hi$1");
		var newlinks = '<br/>(download this photo as <a class="downloadphoto" href="'+lowres+'">low-res</a> or <a class="downloadphoto" href="'+highres+'">high-res</a>)';
		if ($(caption).children("#download-caption").length) {// modify first time only
			$(caption).children("#download-caption").html(newlinks);
		} else {
			$(caption).append('<span id="download-caption">'+newlinks+'</span>');
		}
		if ($(link).css('display') != 'none') {// modify first time only
			$(link).after('<strong>'+$(link).text()+'</strong>');
			$(link).css('display','none');
		}
		$('.downloadphoto').click(function(){window.open($(this).attr('href')); return false;});
	}
}

$(document).ready(function() {
	// GLOBAL
	// First, fix PNGs (this is the last time, IE... the last time)
	$(document).pngFix();
	// ...then allow for effect by updating titlebar a:hover...
	$('#titlebar ul li a').addClass('hasjs');
	// ...then apply nav effect
	$('#titlebar ul li').hover(function(){
		});
	$('#titlebar ul li').ahover({moveSpeed: 100, hoverEffect: function() {
			$(this)
				.animate({opacity: 0.5}, 750)
				.animate({opacity: 1.0}, 750)
				.dequeue();
			$(this).queue(arguments.callee);
		}});
	// PRESS
	if ($('body.press').length) {

		//Bio read more/less
		$('#read-more').click(function(e) {
			e.preventDefault();
			$('#ellipsis').html('.');
			$('#read-more').hide();
			$('#read-less').show();
			$('#second-choice').show();
			$('#choice').hide();
			$('#full-bio').show();

				$('#read-less').click(function(e) {
					e.preventDefault();
					$('#ellipsis').html('.');
					$('#read-more').show();
					$('#choice').show();
					$('#second-choice').hide();
					$('#full-bio').hide();
					$('#read-less').hide();
					$('#ellipsis').html('...');
				});
		});

		//Reviews 1-3, read more/less
//		$('#more-one').click(function(e) {
//			e.preventDefault();
//			$('#teaser-one').hide();
//			$('#full-one').show();
//
//				$('#less-one').click(function(e) {
//					e.preventDefault();
//					$('#teaser-one').show();
//					$('#full-one').hide();
//				})
//		});
//
//		$('#more-two').click(function(e) {
//			e.preventDefault();
//			$('#teaser-two').hide();
//			$('#full-two').show();
//
//				$('#less-two').click(function(e) {
//					e.preventDefault();
//					$('#teaser-two').show();
//					$('#full-two').hide();
//				})
//		});
//
//		$('#more-three').click(function(e) {
//			e.preventDefault();
//			$('#teaser-three').hide();
//			$('#full-three').show();
//
//				$('#less-three').click(function(e) {
//					e.preventDefault();
//					$('#teaser-three').show();
//					$('#full-three').hide();
//				})
//		});


		// email address bot-safe swap
		if ($("span.emailaddress").length) {
			$("span.emailaddress").each(function(){
				var mailtag = $(this);
				var at = / at /;
				var addr = $(mailtag).text().replace(at,"&#64;");
				$(mailtag).after('<a href="mailto:'+addr+'">'+ addr +'</a>');
				$(mailtag).remove();
			});
		}
	}
	// PRESSE
	if ($('body.presse').length) {
		$("#content").hover(
			function () {
				$(this).attr('class','active');
			},
			function () {
				$(this).removeAttr('class');
			}
		);

		$("li a").hover(
			function () {
				$(this).parent().attr('class','active');
			},
			function () {
				$(this).parent().removeAttr('class');
			}
		);
	}

});


