// theme.js
$(document).ready(function() {

	$('#navigation li a').click(function() {
		var elementClicked = $(this).attr("href");
		var destination = $(elementClicked).offset().top;
		$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination-20}, { duration: 2000, easing: 'easeInOutExpo' });
		return false;
	});

	$('#about #execboard').hide();
	$('#about div.sectiontitle a').click(function() {
		$('#about #abouttext').fadeOut(1000, function() {
			$('#about #execboard').fadeIn(1000);
		});
		return false;
	});

	$('#about div.sectionbody a').click(function() {
		$('#about #execboard').fadeOut(1000, function() {
			$('#about #abouttext').fadeIn(1000);
		});
		return false;
	});

	$('#slideshow').fadeIn();
	$('#slideshow').cycle();

	$('#contact form').validate({
		submitHandler: function(form) {
			$(form).ajaxSubmit(function(response) {
				console.log('Form submitted');
				console.log(response);
				if (response == 'SUCCESS') {
					$('#contactstatus').html('Thank you! Your message has been sent.').addClass('success');
				} else {
					$('#contactstatus').html('There was a problem sending your message.<br />Please try again.').addClass('error');
				}
			});
			return false;
		 }
	});
	
	$('.fancybox').fancybox({
		'width'          : 650,
		'height'         : 500,
		'autoDimensions' : false,
		'autoScale'      : false
	});

});
