$(document).ready(function(){
/* EXAMPLE SYNTAX
	 $("a").click(function(){
	   alert("Example");
	 });
	$('#gallery a').lightBox(); // Lightbox script. 
*/
	$('.mapNe').lightBox(); 
	$('.mapNw').lightBox();
	$('.mapSw').lightBox();
	$('.mapCe').lightBox();
	
	$('#po1').lightBox();
	$('#po2').lightBox();
	$('#po3').lightBox();
	$('#po4').lightBox();
	$('#po5').lightBox();
	
	$('#ds1').lightBox();
	$('#ds2').lightBox();
	$('#ds3').lightBox();
	$('#ds4').lightBox();			
	$('#ds5').lightBox();			
	
	$('#sixpics1').lightBox();			
	$('#sixpics2').lightBox();			
	$('#sixpics3').lightBox();			
	$('#sixpics4').lightBox();			
	$('#sixpics5').lightBox();			
		
	$('#pa4').lightBox();			
		
	$("#sixpics a").hover(function(){
		$(this).addClass("hover");
	},function(){
		$(this).removeClass("hover");
	});
	$("img",".leaf").css({visibility:"hidden"});
	$("span",".leaf").fadeOut(500);
	$(".leaf").hover(function(){
		$("img",this).css({visibility:"visible"});
	},function(){
		$("img",this).css({visibility:"hidden"});
	})
	$(".leaf").click(function(){
		if ($("span",$(this)).length>0) {
			if ($("span",$(this)).css("display")=="none") {
				$("span",$(this)).fadeIn(200);
			} else {
				$("span",$(this)).fadeOut(200);
			}
			return false;
		}
	});
	$("#mainNav li").hover(function(){
		$("ul",$(this)).fadeIn(100);
		$(this).addClass("hover");
	},function(){
		$("ul",$(this)).fadeOut(100);
		$(this).removeClass("hover");
	});

	$(".mapHover").mouseover(function(){
		$("#"+$(this).attr("id")+"Img").css({visibility:"visible"});
	});
	$(".mapHover").mouseout(function(){
		$("#"+$(this).attr("id")+"Img").css({visibility:"hidden"});
	});
	$("span",".ir").css("display","none");
	
	$("#formWrapper").load("actions/form.html",function(){
	$("#loader").hide();
	$("#success").hide();
	
	jQuery().ajaxStart(function() {
		$("#loader").show(100);
	}).ajaxStop(function() {
		$("#loader").hide(100);
		
	}).ajaxError(function(a, b, e) {
		throw e;
	});
	function showResponse (argument) {
		$("#success").show(300);
	}
	$('#form').validate({
		submitHandler: function(form) {
			jQuery(form).ajaxSubmit({
				success: showResponse,
				clearForm: true
			});
		},
		rules: {
			name: "required",
			company: "required",
			question: "required",
			email: {
				required: true,
				email: true
			}			
		},
		messages: {
			name: "Please enter your name",
			company: "Please enter your company or affiliation",
			question: "Please enter your question",
			email: "Please enter a valid email address"
		}
	});
	
	
});


	
});