// JavaScript Document

function isEmail(string)  // VALIDATE THE EMAIL
{
if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
	return true;
else
	return false;
}
function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }

function validate1()
{
 if(document.contactform.name.value=="")
 {
 	 alert("Please fill your name");
	 document.contactform.name.focus();
	 return false;
 }

if(document.contactform.telephone.value=="")
 {
 	 alert("Please fill Telephone Number");
	 document.contactform.telephone.focus();
	 return false;
 }
 else if (IsNumeric(document.contactform.telephone.value) == false) 
      {
      alert("Please fill numeric value in Telephone !");
	  document.contactform.telephone.focus();
		  return false;
      }

 if(!isEmail(document.contactform.email.value))
	  {
	  	alert("Please fill a valid Email ");
		document.contactform.email.focus();
		  return false;
	  }

 if(document.contactform.enquiry.value=="")
 {
 	 alert("Please fill your queries");
	 document.contactform.enquiry.focus();
	 return false;
 }

}


// VALIDATION JAVASCRIPT FOR APPLY NOW PAGE STARTS //

function validate2()
{ 
 if(document.loanapplicationform.firstname.value=="")
 {
 	 alert("Please fill your First Name");
	 document.loanapplicationform.firstname.focus();
	 return false;
 }

 if(document.loanapplicationform.lastname.value=="")
 {
 	 alert("Please fill your Last Name");
	 document.loanapplicationform.lastname.focus();
	 return false;
 }

 if(document.loanapplicationform.day.value=="")
 {
 	 alert("Please fill your day of birth");
	 document.loanapplicationform.day.focus();
	 return false;
 }

 if(document.loanapplicationform.month.value=="")
 {
 	 alert("Please fill your month of birth");
	 document.loanapplicationform.month.focus();
	 return false;
 }

 if(document.loanapplicationform.year.value=="")
 {
 	 alert("Please fill your year of birth");
	 document.loanapplicationform.year.focus();
	 return false;
 }

if(document.loanapplicationform.homephone.value=="")
 {
 	 alert("Please fill Home Phone Number");
	 document.loanapplicationform.homephone.focus();
	 return false;
 }
 else if (IsNumeric(document.loanapplicationform.homephone.value) == false) 
      {
      alert("Please fill numeric value in Home Phone !");
	  document.loanapplicationform.homephone.focus();
		  return false;
      }

if(document.loanapplicationform.mobilephone.value=="")
 {
 	 alert("Please fill Mobile Number");
	 document.loanapplicationform.mobilephone.focus();
	 return false;
 }
 else if (IsNumeric(document.loanapplicationform.mobilephone.value) == false) 
      {
      alert("Please fill numeric value in Mobile Phone !");
	  document.loanapplicationform.mobilephone.focus();
		  return false;
      }

 if(!isEmail(document.loanapplicationform.email.value))
	  {
	  	alert("Please fill a valid Email ");
		document.loanapplicationform.email.focus();
		  return false;
	  }

 if(document.loanapplicationform.address.value=="")
 {
 	 alert("Please fill your address");
	 document.loanapplicationform.address.focus();
	 return false;
 }
 
 if(document.loanapplicationform.postalcode.value=="")
 {
 	 alert("Please fill your Postal Code");
	 document.loanapplicationform.postalcode.focus();
	 return false;
 } 

 if(document.loanapplicationform.employmentstatus.value=="Please Select")
 {
 	 alert("Please mention your employment status");
	 document.loanapplicationform.employmentstatus.focus();
	 return false;
 }

 if(document.loanapplicationform.employersname.value=="")
 {
 	 alert("Please mention your employers name");
	 document.loanapplicationform.employersname.focus();
	 return false;
 }

if(document.loanapplicationform.workphone.value=="")
 {
 	 alert("Please fill Work Phone Number");
	 document.loanapplicationform.workphone.focus();
	 return false;
 }
 else if (IsNumeric(document.loanapplicationform.workphone.value) == false) 
      {
      alert("Please fill numeric value in your Work Phone Number!");
	  document.loanapplicationform.workphone.focus();
		  return false;
      }

if(document.loanapplicationform.monthlyincome.value=="")
 {
 	 alert("Please mention your Monthly Income");
	 document.loanapplicationform.monthlyincome.focus();
	 return false;
 }

if(document.loanapplicationform.loanpurpose.value=="")
 {
 	 alert("Please mention your Loan Purpose");
	 document.loanapplicationform.loanpurpose.focus();
	 return false;
 }

if(document.loanapplicationform.loanamount.value=="")
 {
 	 alert("Please mention your Loan Amount");
	 document.loanapplicationform.loanamount.focus();
	 return false;
 }
 
 if (document.loanapplicationform.agreed.checked==false)
 {
 	 alert("Please check for agreed");
	 document.loanapplicationform.agreed.focus();
	 return false;
 }

}

// VALIDATION JAVASCRIPT FOR APPLY NOW PAGE STARTS //




// VALIDATION JAVASCRIPT FOR APPLY NOW PAGE STARTS //

function validate3()
{ 
 if(document.freequote.firstname.value=="")
 {
 	 alert("Please fill your First Name");
	 document.freequote.firstname.focus();
	 return false;
 }

 if(document.freequote.lastname.value=="")
 {
 	 alert("Please fill your Last Name");
	 document.freequote.lastname.focus();
	 return false;
 }

 if(document.freequote.day.value=="")
 {
 	 alert("Please fill your day of birth");
	 document.freequote.day.focus();
	 return false;
 }

 if(document.freequote.month.value=="")
 {
 	 alert("Please fill your month of birth");
	 document.freequote.month.focus();
	 return false;
 }

 if(document.freequote.year.value=="")
 {
 	 alert("Please fill your year of birth");
	 document.freequote.year.focus();
	 return false;
 }

if(document.freequote.homephone.value=="")
 {
 	 alert("Please fill Home Phone Number");
	 document.freequote.homephone.focus();
	 return false;
 }
 else if (IsNumeric(document.freequote.homephone.value) == false) 
      {
      alert("Please fill numeric value in Home Phone !");
	  document.freequote.homephone.focus();
		  return false;
      }

if(document.freequote.mobilephone.value=="")
 {
 	 alert("Please fill Mobile Number");
	 document.freequote.mobilephone.focus();
	 return false;
 }
 else if (IsNumeric(document.freequote.mobilephone.value) == false) 
      {
      alert("Please fill numeric value in Mobile Phone !");
	  document.freequote.mobilephone.focus();
		  return false;
      }

 if(!isEmail(document.freequote.email.value))
	  {
	  	alert("Please fill a valid Email ");
		document.freequote.email.focus();
		  return false;
	  }

 if(document.freequote.postalcode.value=="")
 {
 	 alert("Please fill your Postal Code");
	 document.freequote.postalcode.focus();
	 return false;
 } 

 if(document.freequote.address.value=="")
 {
 	 alert("Please fill your address");
	 document.freequote.address.focus();
	 return false;
 }

if(document.freequote.loanamount.value=="")
 {
 	 alert("Please mention your Loan Amount");
	 document.freequote.loanamount.focus();
	 return false;
 }
 
 if(document.freequote.employmentstatus.value=="Please Select")
 {
 	 alert("Please mention your employment status");
	 document.freequote.employmentstatus.focus();
	 return false;
 }

if(document.freequote.monthlyincome.value=="")
 {
 	 alert("Please mention your Monthly Income");
	 document.freequote.monthlyincome.focus();
	 return false;
 }

if(document.freequote.loanpurpose.value=="")
 {
 	 alert("Please mention your Loan Purpose");
	 document.freequote.loanpurpose.focus();
	 return false;
 }
if(document.freequote.employersname.value=="")
 {
 	 alert("Please mention your Employer's Name");
	 document.freequote.employersname.focus();
	 return false;
 }



}

// VALIDATION JAVASCRIPT FOR APPLY NOW PAGE STARTS //