use = 0;

function check_form()
{
if ( use != 1 )
{
if (document.client_contact.message.value.length >= 4000 || document.client_contact.address.value.length >=4000)
	{
	alert("Your message is to large for this Contact form. Please e-mail 'Virtual Designs' at:- enquiries@virtual-designs.co.uk.");
	return false;
	}
	else
	{
		if (document.client_contact.email.value.length <= 1 && document.client_contact.telephone.value.length <= 1 && document.client_contact.fax.value.length <= 1)
	 	{
	 	 alert("You have not entered a contact Telephone, Fax or E-mail address !");
	 	 return false;
	 	}
		
		if (document.client_contact.email.value.length > 0 &&  !TrueEmail(document.client_contact.email.value))
			{
			alert("You have entered an INVALID e-mail address.\n\n Please correct this and re-submit the form.");
			return false;
			document.client_contact.email.focus();
			}
		if ( document.client_contact.email.value.length <= 1 && document.client_contact.copy_email.checked )
			{
				alert("You have requested for a copy email to be sent\n   but have failed to supply an email address !");
				document.client_contact.email.focus();
				return false;
			}
	if (document.client_contact.forename.value.length <= 1 && document.client_contact.surname.value.length <=1)
		{
		if (confirm("You have left an invalid, or empty 'Name'' field.\n\n If you wish to enter one, please press cancel and return to the form.\n\nOtherwise press OK to proceed."))
		  {
			return true;
		  }
		else
		  {
			document.client_contact.forename.focus();
			return false;
		  }
		 }
	}
	use = 1;
	setTimeout("unuse()", 15000);
	return true;
}
else{
//alert("second submission!");
return false
 }
}

//##########################################################
function preview_check()
{
if ( !document.client_contact.email && document.client_contact.copy_email.checked )
			{
				alert("You have requested for a copy email to be sent\n   but have failed to supply an email address !");
				return false;
			}
}

//############################################################
function unuse()
{
 use = 2;
}

//############################################################
function TrueEmail(text) {
  var supported = 0;
  if (window.RegExp) {
    var testText = "x";
    var Reg = new RegExp(testText);
    if (Reg.test(testText)) supported = 1;
  }
  if (!supported) 
    return (text.indexOf(".") > 2) && (text.indexOf("@") > 0);
  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,7}|[0-9]{1,3})(\\]?)$");
  return (!r1.test(text) && r2.test(text));
}