// JavaScript Document
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


//used to check email field validation.
function is_email(email)
{
	if(!email.match(/^[A-Za-z0-9\._\-+]+@[A-Za-z0-9_\-+]+(\.[A-Za-z0-9_\-+]+)+$/))
		return false;
	return true;
}

function purePhoneValid(checkStr)
{
	var checkOK = "0123456789";
	if(checkStr.value.length!=10) return false;
	for (i = 0;  i < checkStr.value.length;  i++)
	{
	  ch = checkStr.value.charAt(i);
	  for (j = 0;  j < checkOK.length;  j++)
	  {
	      if (ch == checkOK.charAt(j))
		    break;
	  }
	  if (j == checkOK.length)
	  {
	   //alert("Enter numbers 0 - 9");
	   //checkStr.focus();
	   //checkStr.select();
	   return false;
	  }
	}
	return true;
}

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 ismobile(string) {
  if (string.length !=10)
      return false;
   return true;
}
function validate(){
	if(document.appl_frm.Mortgage_Balance.selectedIndex == 0){
	alert('Please select your mortgage balance.');
	document.appl_frm.Mortgage_Balance.focus();
	return false;
	}
	if(document.appl_frm.Property_Value.selectedIndex == 0){
	alert('Please select your property value.');
	document.appl_frm.Property_Value.focus();
	return false;
	}
	if(document.appl_frm.Employment_Status.selectedIndex == 0){
	alert('Please select your employment status.');
	document.appl_frm.Employment_Status.focus();
	return false;
	}
	if(document.appl_frm.Employment_Status.value == 'Unemployed'){
	alert('Sorry. At this time, present employment is a requirement for these services. Please do not submit this form if you can not provide documentation verifying your current employment.  Please try again later if your employment status changes. Thank you.');
	
	document.appl_frm.Mortgage_Balance.selectedIndex = 0;
	document.appl_frm.Property_Value.selectedIndex = 0;
	document.appl_frm.Employment_Status.selectedIndex = 0;
	document.appl_frm.Mortgage_Status.selectedIndex = 0;
	document.appl_frm.First_Name.value="";
	document.appl_frm.Last_Name.value="";
	document.appl_frm.State.selectedIndex = 0;
	document.appl_frm.Email.value="";
	document.appl_frm.Home_Phone.value="";
	document.appl_frm.Cell_Phone.value="";
	
	document.appl_frm.Employment_Status.focus();
	return false;
	}
	if(document.appl_frm.Mortgage_Status.selectedIndex == 0){
	alert('Please select your mortgage status.');
	document.appl_frm.Mortgage_Status.focus();
	return false;
	}
	
	if(document.appl_frm.First_Name.value==''){
	alert('Please enter your first name.');
	document.appl_frm.First_Name.focus();
	return false;
	}
	if(document.appl_frm.Last_Name.value==''){
	alert('Please enter your last name.');
	document.appl_frm.Last_Name.focus();
	return false;
	}
	if(document.appl_frm.State.selectedIndex==0){
	alert('Please select your state.');
	document.appl_frm.State.focus();
	return false;
	}	
	if(document.appl_frm.Email.value==''){
	alert('Please enter your email address.');
	document.appl_frm.Email.focus();
	return false;
	}
	else if(!is_email(document.appl_frm.Email.value))
	{
	alert("Invalid email-id.");		
	document.appl_frm.Email.focus();
	return false;
	}
	if(document.appl_frm.Home_Phone.value==''){
	alert('Please enter your home phone.');
	document.appl_frm.Home_Phone.focus();
	document.appl_frm.Home_Phone.select();
	return false;
	}
	if (purePhoneValid(document.appl_frm.Home_Phone) == false) 
	{
	alert("Please enter valid home phone."+ '\n' +" (numbers only: no dashes, spaces, or brackets)");
	document.appl_frm.Home_Phone.focus();
	document.appl_frm.Home_Phone.select();
	return false;
    }
	if (ismobile(document.appl_frm.Home_Phone.value) == false) {
	alert("Please enter valid home phone."+ '\n' +"Numbers only. No dashes, spaces, or brackets.");
	document.appl_frm.Home_Phone.focus();
	document.appl_frm.Home_Phone.select();
	return false;
    }
	if(document.appl_frm.Cell_Phone.value==''){
	alert('Please enter your cell phone.');
	document.appl_frm.Cell_Phone.focus();
	document.appl_frm.Cell_Phone.select();
	return false;
	}
	if (purePhoneValid(document.appl_frm.Cell_Phone) == false) 
	{
	alert("Please enter valid cell phone."+ '\n' +"Numbers only. No dashes, spaces, or brackets.");
	document.appl_frm.Cell_Phone.focus();
	document.appl_frm.Cell_Phone.select();
	return false;
    }
	if (ismobile(document.appl_frm.Cell_Phone.value) == false) {
	alert("Please enter valid cell phone."+ '\n' +"Numbers only. No dashes, spaces, or brackets.");
	document.appl_frm.Cell_Phone.focus();
	document.appl_frm.Cell_Phone.select();
	return false;
    }	
	if(document.appl_frm.security_code.value==''){
	alert('Please enter your security code.');
	document.appl_frm.security_code.focus();
	return false;
	}

}


//Code for Google Adwords
var google_conversion_id = 1063423424;
var google_conversion_language = "en_US";
var google_conversion_format = "1";
var google_conversion_color = "ffffff";
var google_conversion_label = "X409CKSphQEQwJuK-wM";
