//*********************************************************************************
// Function for Checking/ Validation of Multiple Quote Enquiry Form at IPM-HOME
// Developer: Avanish Kumar
// Email: Kumar.Avanish@Gmail.com
//*********************************************************************************
function HomeEnq_Validator(theform)
{   
//Moving From City
if(theform.txtMoveFrom.value=="")
		{	
		alert("Please Enter Source Location(Move From).");
		theform.txtMoveFrom.focus();
		return (false);
		}
	
//Moving To City
if(theform.txtMoveTo.value=="")
		{	
		alert("Please Enter Destination Location(Move To).");
		theform.txtMoveTo.focus();
		return (false);
		}
		
//Enquirer Name
if(theform.txtName.value=="")
		{	
		alert("Please Provide Your Name.");
		theform.txtName.focus();
		return (false);
		}

//EMAIL ID VALIDATION
	if(theform.txtEmail.value == "") 
	   {
	   alert("Please Provide Email ID for Better Communication.");
	   theform.txtEmail.focus();
	   return false;
	   }
   
	if (theform.txtEmail.value != "")
	{
	// Test if Valid Email Address, Must have @ and .
	var checkEmail = "@.";
	var checkStr = theform.txtEmail.value;
	var EmailValid = false;
	var EmailAt = false;
	var EmailPeriod = false;
		for (i = 0;  i < checkStr.length;  i++)
		{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkEmail.length;  j++)
			{
			if (ch == checkEmail.charAt(j) && ch == "@")
			EmailAt = true;
			if (ch == checkEmail.charAt(j) && ch == ".")
			EmailPeriod = true;
			  if (EmailAt && EmailPeriod)
			  break;
			  if (j == checkEmail.length)
			  break;
			}
		// if both the @ and . were in the string
			if (EmailAt && EmailPeriod)
			{
			EmailValid = true
			break;
			}
		}
	}

		if (!EmailValid)
		{
		alert("Please Enter Valid Email ID.");
		theform.txtEmail.focus();
		return (false);
		} // EMAIL VALIDATION FINISED

//Customer Phone
		if (theform.txtPhone.value=="")
		{
		alert("Please Enter Phone Number.");
		theform.txtPhone.focus();
		return false;
		}
// Phone NO Validation No##2 : Numeric Values
	var checkOK = "0123456789";
	var checkStr = theform.txtPhone.value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)
	{
	ch = checkStr.charAt(i);
	for (j = 0;  j < checkOK.length;  j++)
	if (ch == checkOK.charAt(j))
	break;
		if (j == checkOK.length)
		{
		allValid = false;
		break;
		}
	}
if (!allValid)
	{
	alert("PLease Enter Only Numbers In Phone No. Field.");
	theform.txtPhone.focus();
	return (false);
	}//Phone No Validation No-2 Final		
		

//Customer Mobile
		if (theform.txtMobile.value=="")
		{
		alert("Please Provide Mobile No. for Better & Quick Communication.");
		theform.txtMobile.focus();
		return false;
		}
//Mobile No Field Only Numbers Validation
	var checkOK = "0123456789";
	var checkStr = theform.txtMobile.value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)
	{
	ch = checkStr.charAt(i);
	for (j = 0;  j < checkOK.length;  j++)
	if (ch == checkOK.charAt(j))
	break;
		if (j == checkOK.length)
		{
		allValid = false;
		break;
		}
	}
	if (!allValid)
	{
	alert("PLease Enter Only Numbers In MOBILE NO. Field.");
	theform.txtMobile.focus();
	return (false);
	}//Mobile No. Validation No-2 Final	
		

//Services Requirements
	if (theform.txtService.value=="")
    {
    alert("Please Select Services You Require.");
	theform.txtService.focus();
    return false;
    }
	
//Moving Date
	if (theform.txtMoveDate.value=="")
    {
    alert("Please Enter Your Expected or Planned Moving Date.");
	theform.txtMoveDate.focus();
    return false;
    }

//Service Details - Brief
	if (theform.txtDetails.value=="")
    {
    alert("Please Enter Your Service Details.");
	theform.txtDetails.focus();
    return false;
    }
}// Function Ended