
var clicked;

function returnToNormal(){

var theText;
theText =  "<FONT "
theText = theText + "size=4><STRONG>I</STRONG> </FONT><FONT size=1>am now offering free online "
theText = theText + "home appraisal.&nbsp; Are you curious as to your home's value?&nbsp;&nbsp; "
theText = theText + "I can answer this important question in just under ten seconds!&nbsp; Simply " 
theText = theText + "put</FONT><BR><FONT size=1>in your home's address and in</FONT><BR><FONT "
theText = theText + "size=1>a matter of seconds you'll have</FONT><BR><FONT size=1>your "
theText = theText + "estimate, complete with all</FONT><BR><FONT size=1>the home values in the "
theText = theText + "area!<BR><BR><FONT size=4><STRONG>B</STRONG></FONT>efore&nbsp;I list your "
theText = theText + "home, you'll<BR>be confident that your home is <BR>sold for the right "
theText = theText + "price. A home <BR> priced too high will not sell,<br>while a home priced "
theText = theText + "too low will <BR>leave you with less than satisfactory results on your "
theText = theText + "investment. So please feel free to use my instant online <u>{City} home analysis</u> "
theText = theText + "system.&nbsp;</FONT> "
display('freeappraisal',theText);

}


function checkMail(email)
{
	var x = email;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(x)){return true;}else{return false;}
	
}





function validate(){

var isGood=true;
if (document.estimateFrm.name.value =='' || document.estimateFrm.name.value ==null ){
if(isGood==true){alert('You MUST enter a valid name!');return false;}
isGood=false;
}

if (document.estimateFrm.email.value =='' || document.estimateFrm.email.value ==null ){
alert('You  MUST enter a valid email address!');return false;
}

if (document.estimateFrm.email.value =='' || document.estimateFrm.email.value ==null ){
if(checkEmail(document.estimateFrm.email.value)){
if(isGood==true){alert('You  MUST enter a valid email address!');return false;}
}
isGood=false;
}


if (document.estimateFrm.phone.value =='' || document.estimateFrm.phone.value ==null ){
if(isGood==true){alert('You  MUST enter a valid phone number!');return false;}
isGood=false;
}

if (document.estimateFrm.address.value =='' || document.estimateFrm.address.value ==null ){
if(isGood==true){alert('You  MUST  enter a valid street address!');return false;}
isGood=false;
}
if (document.estimateFrm.city.value =='' || document.estimateFrm.city.value ==null ){
if(isGood==true){alert('You MUST enter a valid city!');return false;}
isGood=false;
}
if (document.estimateFrm.zip.value =='' || document.estimateFrm.zip.value ==null ){
if(isGood==true){alert('You must enter a valid zip!');return false;}
isGood=false;
}

if(isGood==true){
	//street,city,state,zip,email,name,phone,sqft
	//location.href = 'sendemail.asp?type=Homepage_CMA_Request&redirect=getcma2.asp&email=' + document.estimateFrm.email.value + '&name=' + document.estimateFrm.name.value + '&address=' + document.estimateFrm.address.value + '&zip=' + document.estimateFrm.zip.value + '&phone=' + document.estimateFrm.phone.value ;
	location.href = 'getcma2.asp?city=' + document.estimateFrm.city.value + '&state=&email=' + document.estimateFrm.email.value + '&name=' + document.estimateFrm.name.value + '&street=' + document.estimateFrm.address.value + '&zip=' + document.estimateFrm.zip.value + '&phone=' + document.estimateFrm.phone.value + '&sqft=' + document.estimateFrm.sqft.value ;
	
}
}
      
function checkEmailSubmission(){
  	if(document.emailValid.emailTestForm.theValue.value=='false')
  	{return false}else{loadAppraisal();}
  	}
  	
  	


function loadAppraisal(){
submitIt();

var theText;
theText="<span style='position:relative;top:90;left:70'><B>PREPARING YOUR ESTIMATE</b><Br><span style='position:relative;top:0;left:-7'><small>This will take just under ten seconds..</small></span><Br><Br><span style='position:relative;top:0;left:55'><img src='images/loading.gif' alt='loading real estate data'></span></span>"

xx=setTimeout('returnToNormal()',7000)
}
function noEstimate(){
alert('Try another appraisal later!  (15-20 minutes)')
}

function appraisal(){
if (clicked==1){
validate();}
else
{

clicked=1;

freeappraisal.style.height=270;
textbutton1.style.top = 584 + 24;
button1.style.top = 575 + 24;
textbutton1.style.left = 440;
button1.style.left = 550;
homefade.style.top = 305 + 54;

display('textbutton1','<font color=green><b>GET ANALYSIS!!</b></font>');

var theText;

theText = "<font size=4><B>A</b></font><font size=1> copy of your estimate will be sent to your email address within a few seconds.  Pleae email me with any comments or questions you may have about this free service.<br>"
theText = theText + "<form method=get action=estimator.asp name=estimateFrm target=estimate>" 

theText = theText + "<table><tr><Td><img src='images/homefade.jpg' align=right style=position:relative;top:4><font face=arial size=-1>FULL NAME:<br><input name=name size=20 value = ''><br>"
theText = theText + "<font face=arial size=-1>EMAIL:<br><input name=email size=20 value = ''><br>"
theText = theText + "<font face=arial size=-1>PHONE:<br><input name=phone size=20 value = ''><br></font>"
theText = theText + "<font face=arial size=-1>TARGET STREET ADDRESS:<br><input name=address size=57 value = ''><br></font>"

theText = theText + "</td></tr><tr><td><font face=arial size=-1>CITY:</font><br><input name=city value='' size=57><br></td></tr></table>"
theText = theText + "<table><tr><td><font face=arial size=-1>ZIP CODE:</font><Br>"
theText = theText + "<input name=zip value='' size=26 maxlength=5 ></td><td>"
theText = theText + "<font face=arial size=-1>TARGET HOME SQFT: </font>"
theText = theText + "<input name=sqft value='' size=26 maxlength=5 ><input type=hidden name=appF value='0'>"
theText = theText + "</td></tr></table>"

theText = theText + "<br><input type=button value='Get Analysis' onClick='validate()' id=button2 name=button2></form>"


display('freeappraisal',theText);

}
}


function submitIt(){

document.CMALog.form1.street.value = estimateFrm.address.value
document.CMALog.form1.name.value = estimateFrm.name.value
document.CMALog.form1.email.value = estimateFrm.email.value
document.CMALog.form1.city.value = estimateFrm.city.value
document.CMALog.form1.phone.value = estimateFrm.phone.value


document.CMALog.captureinfo.street.value = estimateFrm.address.value
document.CMALog.captureinfo.name.value = estimateFrm.name.value
document.CMALog.captureinfo.email.value = estimateFrm.email.value
document.CMALog.captureinfo.phone.value = estimateFrm.phone.value
document.CMALog.captureinfo.zip.value = estimateFrm.zip.value

estimateFrm.submit();

document.CMALogCnt.src=CMALogCnt.asp;

document.CMALog.captureinfo.submit();
document.CMALog.form1.submit();

}