$(document).ready(function() {
	
	$('#toggle-footer').click(function(e) {
		$('.con-footer').toggleClass('show-footer')
		
		if( $('.show-footer').length > 0 )
		{
			$('.con-footer').animate({ bottom: '0px' }, 1000);
		}
		else
		{
			$('.con-footer').animate({ bottom: '-201px' }, 1000);
		}
	});
	
	$('.columns').find('a').hover(function() {
		$(this).find('img').attr("src", $(this).find('img').attr("src").split(".").join("-hover."));
	}, function() {
		$(this).find('img').attr("src", $(this).find('img').attr("src").split("-hover.").join("."));
	});
		
});

function isPhone(strValue) { return /^(?:\([0-9]\d{2}\)\ ?|[0-9]\d{2}(?:\-?|\ ?|\.?))[0-9]\d{2}[- \.]?\d{4}$/.test(strValue); }
function isEmail(strValue) { return /^[-!#\$%\*\+\/\?\|\^&{}`~\w]+(\.[-!#\$%\*\+\/\?\|\^&{}`~\w]+)*@[-\w]+(\.[-\w]+)+$/.test(strValue); } 
function isZIP(strValue) { return /(^\d{5}$)|(^\d{5}-\d{4}$)/.test(strValue); } 

function validateContact(objForm)
{

	var strReqMsg = "";
	var strValidationMsg = "";
	
	if(objForm.name.value.replace(/\s+/g, "") == "")
	{ strReqMsg += "    - Name\n"; }
	
	if(objForm.email.value.replace(/\s+/g, "") == "")
	{ strReqMsg += "    - Email\n"; }
	
	if(objForm.email.value.length && !isEmail(objForm.email.value))
	{ strValidationMsg += "    - Email must be in the format username@domain.com\n"; }
		
	// Assemble all of the error messates together to display to the user
	if(strReqMsg.length || strValidationMsg.length)
	{
		var strDisplay = "";
		if(strReqMsg.length)
		{ strDisplay += "The following fields are required to be completed:\n\n" + strReqMsg; }

		if(strValidationMsg.length)
		{ strDisplay += "The following fields are not filled in correctly:\n\n" + strValidationMsg; }

		alert(strDisplay);
		return false;
	}
	else
	{
		return true;
	}
}
