// Swift Custom Homes JavaScript Page

//********** On Contact page, validates the form to ensure the manditory fields are filled out **********
function validateForm()
{
	//If all of the mandatory fields are filled, continue with the submission
	if((document.SCHcontactForm.contact_name.value != "") && (document.SCHcontactForm.contact_email.value != ""))
	{
		return true;
	}
	//If any of the mandatory fields are not filled, create a message for the user to complete the form and cancel the submission
	else
	{
		var message = "The following fields must be completed before submitting the form:\n\n";
	
		if(document.SCHcontactForm.contact_name.value == "")
		{
			message += "Your Name";
		}
		if(document.SCHcontactForm.contact_email.value == "")
		{
			message += "\nCompany Name (or write \"Personal Use\" if that's the case)";
		}
		
		alert(message);
		
		return false;
	}
}

//********** On Contact Form page verifies that the user really wants to reset the form **********
function allowReset()
{
	return window.confirm("Are you sure you want to reset the form?");
}
