$(function(){
	$(".IE6 #gnav li, .IE6 #lnav li").hover(function(){$(this).addClass('hover');}, function(){$(this).removeClass('hover');});
	$('#gnav li, #lnav li').css('cursor','pointer').click(function(e){e.stopPropagation(); if(this.firstChild.href)window.location=this.firstChild.href;});
	$(".IE6 li:first-child").addClass("first-child");
	$("a[rel=external]").live("click", function(){this.target="_blank"});
	if($(".PhotoGallery").length > 0){
		$('.PhotoGallery li img:not(img.magnify)').lightBox();
		$('.PhotoGallery img.magnify, .PhotoGallery .view').click(function(){$('.PhotoGallery li:first-child img').click(); return false;});
		$(".PhotoGallery .last").click(function(){
			var crumbs = $("#lnav .crumb")
			if( crumbs.prev().length == 1 )
				window.location = crumbs.prev().children("a").attr("href");
			else
				window.location = $("#lnav li:last-child").children("a").attr("href");	
			return false;
		});
		$(".PhotoGallery .next").click(function(){
			var crumbs = $("#lnav .crumb")
			if( crumbs.next().length == 1 )
				window.location = crumbs.next().children("a").attr("href");
			else
				window.location = $("#lnav li:first-child").children("a").attr("href");
			return false;
		});
	}
	$("form").bind("submit",validate);
});

function PhotoGallery(){
	$("#content").addClass("gallery");
	$("#body").css("width","539px");
}
function validate(){

	var validated = true;
	$(this).find(".required").each(function(){
		var i = $(this).closest("p").find("input,textarea");
		if( i.val()== "" ){
			window.alert(i.attr("name") + " is a required field");
			validated = false;
		}
		
	});
	
	if(validated)
		return true;
	else
		return false;
}


