$(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");

	$("#rotator, #rotator2, #rotator3").cycle({timeout:7000});

	//function rotateFooter(){
	//$pause(4000);
	
//		$.getJSON("/assets/img/footers/imgJSON.asp", function(data){
//			$('#rotator').ctRotator(data, {
//				showCount:1,
//				speed: 5000,
//				itemRenderer:function(item) {
//					return '<img src="/assets/img/footers/' + item.image + '" alt="Briggs Metals Limited"/>';
//				}
//			})
//		})
	//};
	
	//setInterval(rotateFooter, 5000);
	//});

});


