if (!String.prototype.endsWith) {
	String.prototype.endsWith = function(suffix) {
		var startPos = this.length - suffix.length;
		if (startPos < 0) {
			return false;
		}
		return (this.lastIndexOf(suffix, startPos) == startPos);
	};
}

$(function() {
	// make the drop down menus work in ie6
	if ($.browser.msie && $.browser.version < 7) {
		$('#header ul li').hover(
			function() {
				$('ul', this).css('top', '6.25em' )
				$(this).addClass('selected')
			},
			function() {
				$('ul', this).css('top', '-100em');
				$(this).removeClass('selected')
			}
		);
		// add last and first child classes to lists
		$('ul li:first-child').addClass('first-child');
		$('ul li:last-child').addClass('last-child');
	}
	
	$('.gallery-item').each(function(i) {
		// $('a', this).attr('title', $('p:last', this).text());
		$('a', this).attr('rel', 'gallery');
	});
	
    $(".gallery-item a").lightbox({fitToScreen: true});
	
	$("#content a").each(function(){
		if ($(this).attr('href').endsWith('.pdf')) {
			$(this).mousedown(function() { 
				pageTracker._trackPageview($(this).attr('href'));
			});
		}
	});
	
});