  $(function(){
  $('a[href*=#]').click(function() {
  if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
  && location.hostname == this.hostname) {
  var $target = $(this.hash);
  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, function(){ location.hash = target;});
  return false;
  }
  }
  });

  });

$().ready(function() {
	$("#volunteerForm").validate({
		errorElement: "em",
		errorPlacement: function(error, element) {
			error.appendTo( element.prev("span") );
			element.addClass('error');
		},
		success: function(label) {
			label.text(".").addClass("success");
		},
		rules: {
			emailAddress: {
				required:true,
				email:true
			},
			name: {
				required:true,
				minLength:4
			},
			phone: {
				required:true,
				minLength:12
			}
		},
		
		messages: {
			name: "Please enter your full name",
			phone: "Please enter your phone number",
			emailAddress: "Please enter a valid email address",
		
		},

	});
	
	$("#phone").mask("(999) 999-9999");

	//Activate FancyBox
	$("a.lightbox").fancybox({
		'hideOnContentClick': true,
		'overlayOpacity': 0,
		'overlayShow':	true,
		zoomSpeedIn:		250,
		zoomSpeedOut:		250,
		frameWidth: 900,
		frameHeight: 600

	});
	
	if (jQuery.fn.pngFix) $(document).pngFix();
	
});
	

