$(document).ready(function() {	//Hide contact form for use with js	$('.contact').toggle();	$('span.js-remove').remove();	$('.js-show').toggle();		if($('.contact .content .status').val() == "sent")	{		var button = $(".contactButton");		button.toggle();		$("h2#info").text("Thank you for your message, we will get back to you as soon as possible.");	}		setupContactArea($('.contact'));		$(".area img").click(function() {		var image = $(this);		imageClickEvent(image);	});});/* Setup*/function setupContactArea(area){	setupField($(".field .name", area), "Name");	setupField($(".field .email", area), "Email");	setupField($(".field .comments", area), "Comments");		$('.contactButton').click(function() {		// Hide the title and button.		$('h2#info').fadeToggle("fast");		$(this).fadeToggle("fast", function()		{			// Display the contact area.			area.slideToggle("slow");		});		return false;	});		$('.sendbutton', area).click(function() {		//Get related fields		var textName = $(this).parent().find('.name');		var textEmail = $(this).parent().find('.email');		var valid = true;					valid = isValid(textName);		valid = isValidEmailAddress(textEmail) && valid;					if(!valid)			return false;	});}function setupField(field, value){	field.val(value);	field.css("width", "100%");		field.focusin(function() {		if($(this).val() == value)		{			$(this).removeClass("empty");			$(this).val("");		}	});		field.focusout(function() {		if($(this).val() == "")		{			$(this).addClass("empty");			$(this).val(value);		}	});}function imageClickEvent(image){	if(image.hasClass("hover")) //Needs reseting	{		image.removeClass("hover").stop()			.animate({				top: '0',				left: '0',				width: '250px'			}, 400, function() {				image.css({'z-index' : '1'});				image.attr("src", image.attr("src").replace("800","250"));			});	}	else	{		$(".area image.hover").click(); //Force any already hovering images to reset		image.css({'z-index' : '10'});		image.addClass("hover").stop() 			.animate({				left: ($(window).width() / 2) - 400 - image.offset().left + $(window).scrollLeft() + "px",				top: ($(window).height() / 2) - 300 - image.parent().offset().top + $(window).scrollTop() + "px",				width: "800px"			}, 400, function() {			image.attr("src", image.attr("src").replace("250","800"));			});	}}/* End of Setup *//* Form Validation */function isValid(field){	var isValid = false;	if(!field.hasClass('empty'))	{		field.removeClass('invalid');		isValid = true;	}	else		field.addClass('invalid');			return isValid;}function isValidEmailAddress(emailField) {    var pattern = new RegExp(/^(("[\w-+\s]+")|([\w-+]+(?:\.[\w-+]+)*)|("[\w-+\s]+")([\w-+]+(?:\.[\w-+]+)*))(@((?:[\w-+]+\.)*\w[\w-+]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][\d]\.|1[\d]{2}\.|[\d]{1,2}\.))((25[0-5]|2[0-4][\d]|1[\d]{2}|[\d]{1,2})\.){2}(25[0-5]|2[0-4][\d]|1[\d]{2}|[\d]{1,2})\]?$)/i);    var isValid = pattern.test(emailField.val());		if(isValid)		emailField.removeClass('invalid');	else		emailField.addClass('invalid');			return isValid;};/* End of Form Validation */
