/* Author: QuillDesign, Zane Taylor

*/
$(function()
{
	if ($("#gallery a").length) $("#gallery a").lightBox(); // init lightboxes on all gallery pages
	
	Galleria.loadTheme('/js/galleria/themes/classic/galleria.classic.min.js');
	$("#slideshow").galleria({ 
		width:456, 
		height:406,
		image_crop: true,
		transition: 'fade',
		autoplay: 5000,
		clicknext: true,
		transitionSpeed:700 
		});
	
	// this is for telling friends
	$("#tell-a-friend form").submit(function(e)
	{
		var emailRegEx = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		var email_val = $("#tell-a-friend input:first").val();
		if(email_val.match(emailRegEx))
		{
			$.post($(this).attr("action"), $(this).serialize(), function(data)
			{

				$("#tell-a-friend").animate({ opacity:0 }, 500, function()
				{
					$(this).html("<h3>Success!</h3><p>A link to this page has been sent to your friend.</p>").animate({ opacity:1 }, 500);
				});
			});
		} else
		{
			$("#tell-a-friend label").addClass("error").text("Please enter a valid email address.");
		}
		
		e.preventDefault();
	});
});
























