﻿function	not()	{
	location.href = "thank_you.php#getOnlineQuote";
}

function	submitform()	{
	$form = $("#contact-form");
	$name = $form.find("[name=name]");
	$email = $form.find("[name=email]");
	$phone = $form.find("[name=phone]");
	$message = $form.find("[name=message]");
	$status = "";
	if ((!$.trim($name.val())) || ($name.val() == 'Name:'))
		$status += 'The field \"Name\" is empty or invalid.\n';
	if ((!$.trim($phone.val())) || ($phone.val() == 'Phone:'))
		$status += 'The field \"Phone\" is empty or invalid.\n';
	if ((!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test($.trim($email.val()))) || ($email.val() == "Email:"))
		$status += 'The field \"E-mail\" is empty or invalid.\n';
	if ((!$.trim($message.val())) || ($message.val() == 'Project Description: '))
		$status += 'The field \"Project Description\" is empty or invalid.\n';
	if ($status != '')	{
		alert($status);
	}	else	{
		$.post("mail_send.php?act=send", {owner_email: "stonecraftinc@bellnet.ca", serverProcessorType: "php", smtpMailServer: "localhost", stripHTML: "true", name: $name.val(), email: $email.val(), phone: $phone.val(), message: $message.val()},	function(data)	{
			if (data != 'send_ok')
				alert(data);
			else	{
				not();
			}
		});
	}
}
