
/* Function To Validate Contact Us Form  */
function contact()
{ 
	if(!(isEmail(document.contactus.email.value)))
	{
		alert("Please enter your correct email address.");
		document.contactus.email.focus();
		return false;
	}
	if(document.contactus.telephone.value == "")
	{
		alert("Please enter your Phone number.");
		document.contactus.telephone.focus();
		return false;
	}
	if(document.contactus.name.value == "" )
	{
		alert("Please your Enter Name.")
		document.contactus.name.focus();
		return false;
	}	
	if(document.contactus.CWC.value == "")
	{
		alert("Please Select Area ");
		document.contactus.CWC.focus();
		return false;
	}

	if(document.contactus.help.value == "")
	{
		alert("Please Enter How can we help?.");
		document.contactus.help.focus();
		return false;
	}
	if(document.contactus.security_code.value == "")
	{
		alert("Please enter security code Number.");
		document.contactus.security_code.focus();
		return false;
	}
	else
	{
		return true; 
	}
}
function isEmail (theStr) 
{
	var atIndex = theStr.indexOf('@');
 	var dotIndex = theStr.indexOf('.', atIndex);
 	var flag = true;
 	theSub = theStr.substring(0, dotIndex+1)
 	if ((atIndex < 1)||(atIndex != theStr.lastIndexOf('@'))||(dotIndex < atIndex + 2)||(theStr.length <= theSub.length)) 
 	{	 
 		flag = false; 
 	}
 	else 
	{ 
 		flag = true; 
 	}
 	return(flag);
}

