 ch=0;
	function change()
	{
		data = cha.innerHTML;
		ch=1;
		cha.innerHTML="";
	}

	function change1(){
		if (ch)
		{
			cha.innerHTML=data;
		}
	}
	

function search()
{
document.form1.method="POST"
document.form1.action="/cgi-bin/sitesearch.cgi"
document.form1.submit()
}

function Validate1(x)
 {
 

 var retValue=false;
 var invalidChars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$%^&*(){}|\':;?/<>,.@-+=[]~`_ ";
 var i;
  
for(i=0;i<invalidChars.length;i++)
 {
  if(x.indexOf(invalidChars.charAt(i))>-1)
  {
     retValue=true;
     break;
   }
 }
 
return retValue;
 }


function Validate2(x)
 {
 

 var retValue=false;
 var invalidChars="0123456789!#$%^&*(){}|\':;?/<>";
 var i;
  
for(i=0;i<invalidChars.length;i++)
 {
  if(x.indexOf(invalidChars.charAt(i))>-1)
  {
     retValue=true;
     break;
   }
 }
 
return retValue;
 }


function Validate3(x)
 {
 

 var retValue=false;
 var invalidChars=".@";
 var i;
  
for(i=0;i<invalidChars.length;i++)
 {
  if(x.indexOf(invalidChars.charAt(i))>-1)
  {
     retValue=true;
     break;
   }
 }
 
return retValue;
}

function validate()
{
if(document.form1.fname.value=="First Name")
	{
		alert("Please Enter Your First Name. ");
		document.form1.fname.focus();
		document.form1.fname.select();
		return false;
	}
	if(!(document.form1.fname.value =="First Name"))
	{
	if(!(isNaN(document.form1.fname.value)))
		{
		alert("Please Enter a Valid First Name");
		document.form1.fname.focus();
		document.form1.fname.select();
		return false;
		}
	}
	if(document.form1.lname.value=="Last Name")
	{
		alert("Please Enter Your Last Name. ");
		document.form1.lname.focus();
		document.form1.lname.select();
		return false;
	}
	if(!(document.form1.lname.value =="Last Name"))
	{
	if(!(isNaN(document.form1.lname.value)))
		{
		alert("Please Enter a Valid Last Name");
		document.form1.lname.focus();
		document.form1.lname.select();
		return false;
		}
	}
	if (document.form1.email.value == "Email")
{
	alert("Please Enter Your Email");
    document.form1.email.focus();
    document.form1.email.select();
    return false;
}
else
	{
	  var evalue=document.form1.email.value;
     // var emailPat = /^[a-zA-Z][\w\.-]*[a-zA-Z0-9_]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/;
	   var emailPat=/^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9])+(\.[a-zA-Z0-9_-]+)+$/;
	  var matchArray = evalue.match(emailPat);

		if(!emailPat.test(evalue))
		{
			alert("Your email address is invalid.  Please try again !!");
			//SetErrorImage("Email", true);
			document.form1.email.select();
			document.form1.email.focus();
  			return false;
		}
		else
       {
    	//SetErrorImage("Email", false);
	   }
	}
	/*if( document.form1.h_phone.value == '' &&  document.form1.h_phone_1.value == '' && document.form1.h_phone_2.value == '' )
{
alert("Please Enter Your Phone Number");
document.form1.h_phone.select();
return false;
}
if ( Validate1(document.form1.h_phone.value) || document.form1.h_phone.value.length < 3)
		{
	alert("Please Enter Valid Phone Number");
        document.form1.h_phone.select();
		return false;
		}
	
if ( Validate1(document.form1.h_phone_1.value) || document.form1.h_phone_1.value.length < 3)
		{
	alert("Please Enter Valid Phone Number");
        document.form1.h_phone_1.select();
		return false;
		}
		
if ( Validate1(document.form1.h_phone_2.value) || document.form1.h_phone_2.value.length < 4)
		{
	alert("Please Enter Valid Phone Number");
        document.form1.h_phone_2.select();
		return false;
		}*/
if(document.form1.zip_code.value == 'Zip Code' )
{
	alert(" Please include your Zip Code. ");
    document.form1.zip_code.select();
	document.form1.zip_code.focus();
	return false;
	}
	if(isNaN(document.form1.zip_code.value))
	{
		alert(" Please enter a valid Zip Code.");
		document.form1.zip_code.select();
		document.form1.zip_code.focus();
		return false;
	}
var pattern2 = /^\d{5}$/ ;
if(!pattern2.test(document.form1.zip_code.value))
{
if(!pattern2.test(document.form1.zip_code.value) ==true)
{
alert(' Please enter a valid Zip Code.');
document.form1.zip_code.select();
document.form1.zip_code.focus();
return false;
}
}
if(!(document.form1.zip_code.value== ""))
	{
	if(document.form1.zip_code.value == "00000")
	{	{
	alert("Please Enter Valid Zip");
	document.form1.zip_code.select();
	document.form1.zip_code.focus();
	return false;
	}
	}
}		

		
document.form1.method="POST";
document.form1.submit();
}



function PhoneMove(nLength, sMoveFrom, sMoveTo) {
	if (sMoveTo != '') {
		if (document.form1[sMoveFrom].value.length >= nLength) {
			document.form1[sMoveTo].focus();
		}

	}
}


function call(str)
{
	if(str=='apply'){
		document.getElementById("change").innerHTML="<table width='650' align='center'><tr><td width='235' valign='top'><img src=\"images/main_img.gif\" /></td><td width='403' valign='top'><table width='400' border='0' cellspacing='2' cellpadding='2'><tr><td height='5'></td></tr><tr><td colspan='2'><span class='h3'>Lower Your Monthly Payments</span></td></tr><tr><td width='18'><img src=\"images/dot_img.gif\" width='10' height='12' /></td><td width='382' class='points_txt'>Get started with low mortgage rates.</td></tr><tr><td><img src=\"images/dot_img.gif\" width='10' height='12' /></td><td class='points_txt'>No Hidden cost.</td></tr><tr><td><img src=\"images/dot_img.gif\" width='10' height='12' /></td><td class='points_txt'>Great Rates, Fast and easy approval.</td></tr></table></td></tr></table>"	
				}
		if(str=='fha'){
			document.getElementById("change").innerHTML="<table width='650' align='center'><tr><td width='235' valign='top'><img src=\"images/fhaloan.gif\" /></td><td width='403' valign='top'><table width='400' border='0' cellspacing='2' cellpadding='2'><tr><td height='5'></td></tr><tr><td colspan='2'><span class='h3'>Advantage of FHA Loans</span></td></tr><tr><td width='18'><img src=\"images/dot_img.gif\" width='10' height='12' /></td><td width='382' class='points_txt'>Easier to Qualify</td></tr><tr><td><img src=\"images/dot_img.gif\" width='10' height='12' /></td><td class='points_txt'>Less than Perfect Credit </td></tr><tr><td><img src=\"images/dot_img.gif\" width='10' height='12' /></td><td class='points_txt'>Low Downpayment </td></tr></table></td></tr></table>";
			}
			if(str=="home"){
				document.getElementById("change").innerHTML="<table width=\"650\" align=\"center\"><tr><td width=\"235\" valign=\"top\"><img src=\"images/homequity_img.gif\" /></td><td width=\"403\" valign=\"top\"><table width=\"400\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\">	  <tr><td height=\"5\"></td></tr><tr><td colspan=\"2\"><span class=\"h3\">Home Equity Loan Benefits </span></td></tr><tr><td width=\"18\"><img src=\"images/dot_img.gif\" width=\"10\" height=\"12\" /></td><td width=\"382\" class=\"points_txt\">Lock in A Lower Rate</td></tr><tr><td><img src=\"images/dot_img.gif\" width=\"10\" height=\"12\" /></td><td class=\"points_txt\">Cut Monthly Payments</td></tr><tr><td><img src=\"images/dot_img.gif\" width=\"10\" height=\"12\" /></td><td class=\"points_txt\">Get Cash Fast</td></tr></table></td></tr></table>";
			}
			if(str=="debt"){
                document.getElementById("change").innerHTML="<table width=\"650\" align=\"center\"><tr><td width=\"235\" valign=\"top\"><img src=\"images/debtconsolidation_img.gif\" /></td><td width=\"403\" valign=\"top\"><table width=\"400\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\">	  <tr><td height=\"5\"></td></tr><tr><td colspan=\"2\"><span class=\"h3\">Debt Consolidation Loan</span></td></tr><tr><td width=\"18\"><img src=\"images/dot_img.gif\" width=\"10\" height=\"12\" /></td><td width=\"382\" class=\"points_txt\">Pay Off Your Debt Faster </td></tr><tr><td><img src=\"images/dot_img.gif\" width=\"10\" height=\"12\" /></td><td class=\"points_txt\">One Payment Each Month </td></tr><tr><td><img src=\"images/dot_img.gif\" width=\"10\" height=\"12\" /></td><td class=\"points_txt\">Improve Credit Score </td></tr></table></td></tr></table>";
			}
			if(str=="pur"){
               document.getElementById("change").innerHTML="<table width=\"650\" align=\"center\"><tr><td width=\"235\" valign=\"top\"><img src=\"images/purchase_imgg.gif\" /></td><td width=\"403\" valign=\"top\"><table width=\"400\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\">	  <tr><td height=\"5\"></td></tr><tr><td colspan=\"2\"><span class=\"h3\">Purchase a Home with Confidence</span></td></tr><tr><td width=\"18\"><img src=\"images/dot_img.gif\" width=\"10\" height=\"12\" /></td><td width=\"382\" class=\"points_txt\">Low Monthly Payment Options</td></tr><tr><td><img src=\"images/dot_img.gif\" width=\"10\" height=\"12\" /></td><td class=\"points_txt\">Great Rates and Flexible Terms</td></tr><tr><td><img src=\"images/dot_img.gif\" width=\"10\" height=\"12\" /></td><td class=\"points_txt\">Stress-Free Loan Process</td></tr></table></td></tr></table>";
			   }
			   if(str=='ref'){
                    document.getElementById("change").innerHTML="<table width=\"650\" align=\"center\"><tr><td width=\"235\" valign=\"top\"><img src=\"images/main_img.gif\" /></td><td width=\"403\" valign=\"top\"><table width=\"400\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\">	  <tr><td height=\"5\"></td></tr><tr><td colspan=\"2\"><span class=\"h3\">Time to Refinance Your Mortgage</span></td></tr><tr><td width=\"18\"><img src=\"images/dot_img.gif\" width=\"10\" height=\"12\" /></td><td width=\"382\" class=\"points_txt\">Lower Your Monthly Payment.</td></tr><tr><td><img src=\"images/dot_img.gif\" width=\"10\" height=\"12\" /></td><td class=\"points_txt\">Change Your Loan Program</td></tr><tr><td><img src=\"images/dot_img.gif\" width=\"10\" height=\"12\" /></td><td class=\"points_txt\">Tap Into the Equity </td></tr></table></td></tr></table>";
			   }
}
