//checking for the value of the Email

function checkEmail(emailAdd)
{
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(emailAdd.value))
	{
		return (true)
	}
	else
		alert("Invalid E-mail! Please re-enter.")
	return (false)
}

function load()
{
	document.frmenquiry.Name.focus();
}

function Validate()
{
	
	var expname = /[^\w|\s|\-]+/;
	var expphonefax=/[^0-9|\s|\+|\-]+/;
	var exppostcode=/[^\w|\s|\+|\-]+/;
	
	
	//checking for the value of the Name	
	var nam = document.frmenquiry.Name.value.replace(/ /g,"");
	
	if (nam == "")
	{
		alert(" Name can not be blank");
		document.frmenquiry.Name.focus();
		return false;
	}
	
	var emailAdd = document.frmenquiry.Email.value.replace(/ /g,"");
	
	
	//checking for blank email
	if (emailAdd == "")
	{
		alert("Email can not be blank");
		document.frmenquiry.Email.focus();
		return false;
	}
	if (!checkEmail(document.frmenquiry.Email))
	{
		document.frmenquiry.Email.focus();
		return false;
	}
	
	//checking for the value of the Phone	
	var phone=document.frmenquiry.Telephone.value.replace(/ /g,"");		
	if (phone == "")
	{
		alert(" Phone can not be blank");
		document.frmenquiry.Telephone.focus();
		return false;
	}
	else
	{
		if(expphonefax.test(document.frmenquiry.Telephone.value)==true)
		{
		alert(" Invalid Phone entered\n The allowed characters are 0 to 9,+,- and spaces")
		document.frmenquiry.Telephone.focus();
		return false;	
		}
	}
	
	
	//checking for the value of the query
	var query = document.frmenquiry.txtQuery.value.replace(/ /g,"");;
	
	/*if (query == "")
	{
		alert(" Query cannot be blank");
		document.frmenquiry.txtQuery.focus();
		return false;
	}*/
	if (query!== "")
	{
	  if (document.frmenquiry.txtQuery.value.length > 200)
			{
				alert("Enquiry can be only 200 characters long");
				document.frmenquiry.txtQuery.focus();
				return false;
			}
	} 
	
		if (document.frmenquiry.code.value == "")
	{
		alert("Security code can not be blank");
		document.frmenquiry.code.focus();
		return false;
	}
}

//-->
