$(document).ready(function(){
	
	$("img.popup").each(function(){
		
		var href = $(this).attr("src").replace('/lores/','/hires/');
		var title = $(this).attr("alt");
		$(this).wrap("<a></a>")
			.parent("a")
				.attr("href",href)
				.attr("title",title)
				.attr("rel","inpage")
				.addClass("thickbox")	
	});
		
	$("ul.gallery li a, ul.sidegallery li a").each(function(){
		$tit = $("img", this).attr("alt");
		$(this)
			.prepend("<p>" + $tit + "</p>")
	})
	
	$("img[@src$=png], ul.gallery p, ul.sidegallery p,#head, #foot, #footwrapper, li.current a").pngfix();
			  
			    $('a[href*=#]').click(function() {
				if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
				&& location.hostname == this.hostname) {
				  var $target = $(this.hash);
				  $target = $target.length && $target
				  || $('[name=' + this.hash.slice(1) +']');
				  if ($target.length) {
					var targetOffset = $target.offset().top;
					$('html,body')
					.animate({scrollTop: targetOffset}, 1000);
				   return false;
				  }
				}
			  });
			  
			  $("li.photo a").addClass("thickbox").attr("rel","galleryimg");
	
	//makes nav bar items (LIs) clickable, rather than just the contained anchors.
	$(".dropdown li > ul > li, #page_submenu > ul > li, .news-events-archive > ul > li").click(function() {
		document.location = $(this).children("a").attr("href");
	});

});
