// JavaScript Document //
// One or more not special email characters, @, 1 or more letter/number/dash, 0 or more dot & letter/number/dash, dot 2 to 6 letter. //
function isEmail(string){
	return (/^[^\s()<>@,;:\\"\/\[\]?=]+@\w[\w-]*(\.\w[\w-]*)*\.[a-z]{2,}$/i).test(string);
}

//(1 or 2 letters, 1 or 2 letters or numbers)(0 or more spaces)(1 number, 2 letters)
function isUkPostcode(string){
	return (/^[a-z]{1,2}\w{1,2}\s+\d[a-z]{2}$/i).test(string);
}
		
// Last tested 26/04/2001 - this should be reviewed regularly as phone numbers change regularly
// Allows parenthesis around area code and spaces in the number
// Accepts the format (01962) 339441 but not +44 1962 339441
function isUkPhone(string){
	return (/^\(?0[1278][\d\s\)]{6,14}$/).test(string);
}
		
function isCharacters(string){
	return (/./).test(string);
}
		
function checkForm(form){
	var reportText = "";
	if (!isCharacters(corporatemoving.customers_name.value)) reportText += "You have not entered a name.\n";
	if (!isCharacters(corporatemoving.companyname.value)) reportText += "You have not entered a company name.\n";
	if (!isCharacters(corporatemoving.phone.value)) reportText += "You have not entered a preferred phone number.\n";
	// if (isCharacters(form.customer_email.value) && !isEmail(form.customer_email.value)) reportText += "You don't appear to have entered a valid e-mail address.\n";

	if (reportText) {
		reportIntro = "Sorry, the form is not complete: \n-------------------\n\n"
		reportText = reportIntro + reportText;
		alert(reportText);
	}
	else form.submit();
}
