///////// Trim Function/////////



function trim(str) {



  return str.replace(/^\s+|\s+$/g, '');



}



///////////////////////////////////////////







// START OF MESSAGE SCRIPT //







var MSGTIMER = 60;



var MSGSPEED = 5;



var MSGOFFSET = 3;



var MSGHIDE = 3;







// build out the divs, set attributes and call the fade function //



function inlineMsg(target,string,autohide,lpad) {


  var msg;



  var msgcontent;

  var targetdiv = document.getElementById(target);





  if(!document.getElementById('msg')) {



    msg = document.createElement('div');



    msg.id = 'msg';

    msgcontent = document.createElement('div');

    msgcontent.id = 'msgcontent';


    document.body.appendChild(msg);


    msg.appendChild(msgcontent);

    msg.style.filter = 'alpha(opacity=0)';


    msg.style.opacity = 0;



    msg.alpha = 0;



  } else {



    msg = document.getElementById('msg');



    msgcontent = document.getElementById('msgcontent');



  }



  msgcontent.innerHTML = string;



  msg.style.display = 'block';

  var msgheight = msg.offsetHeight;

  targetdiv.focus();

  var targetheight = targetdiv.offsetHeight;

  var targetwidth = targetdiv.offsetWidth;

  var topposition = topPosition(targetdiv) + ((msgheight - targetheight) / 2);


  if (!lpad)
  {
      lpad = 0;
  }
  var leftposition = leftPosition(targetdiv) + targetdiv.offsetWidth + MSGOFFSET + lpad;


  msg.style.top = topposition + 'px';

  msg.style.left = leftposition + 'px';

  msg.style.position = "absolute";

  clearInterval(msg.timer);

  msg.timer = setInterval("fadeMsg(1)", MSGTIMER);

  if(!autohide)
  {
    autohide = MSGHIDE;
  }



//  window.setTimeout("hideMsg()", (autohide * 2000));



}







// hide the form alert //



function hideMsg(msg) {



  var msg = document.getElementById('msg');
  if (msg)
  {
    msg.style.display = "none";
//  if(!msg.timer) {

//    msg.timer = setInterval("fadeMsg(0)", MSGTIMER);
//  }


  }


}







// face the message box //



function fadeMsg(flag) {



  if(flag == null) {



    flag = 1;



  }


  var msg = document.getElementById('msg');



  var value;



  if(flag == 1) {



    value = msg.alpha + MSGSPEED;



  } else {



    value = msg.alpha - MSGSPEED;



  }



  msg.alpha = value;



  msg.style.opacity = (value / 100);



  msg.style.filter = 'alpha(opacity=' + value + ')';



  if(value >= 99) {



    clearInterval(msg.timer);



    msg.timer = null;



  } else if(value <= 1) {



    msg.style.display = "none";



    clearInterval(msg.timer);



  }



}







// calculate the position of the element in relation to the left of the browser //



function leftPosition(target) {



  var left = 0;



  if(target.offsetParent) {



    while(1) {



      left += target.offsetLeft;



      if(!target.offsetParent) {



        break;



      }



      target = target.offsetParent;



    }



  } else if(target.x) {



    left += target.x;



  }



  return left;



}







// calculate the position of the element in relation to the top of the browser window //



function topPosition(target) {



  var top = 0;



  if(target.offsetParent) {



    while(1) {



      top += target.offsetTop;



      if(!target.offsetParent) {



        break;



      }



      target = target.offsetParent;



    }



  } else if(target.y) {



    top += target.y;



  }



  return top;



}







// preload the arrow //



if(document.images) {



  arrow = new Image(7,80); 



  arrow.src = "msg_arrow.gif"; 



}



///////// Trim Function/////////



function trim(str) {



  return str.replace(/^\s+|\s+$/g, '');



}



///////////////////////////////////////////



 //validate a sell a home form



function sellingHomeForm(form)



 {



  var fname 		= form.first_name.value;



  var lname 		= form.last_name.value;



  var email 		= form.email.value;



  var address 		= form.address.value;



  var country 		= form.lcountry0.value;



  var state 		= form.lstate0.value;



  var city 			= form.lcity0.value;



  var phone 		= form.phone.value;



  var zip 			= form.zip.value;



  var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;



  var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;



  var messageRegex = new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);







if(fname == "") {



    inlineMsg('first_name','Please Enter  First Name.',2);



    return false;



  }



if(lname == "") {



    inlineMsg('last_name','Please Enter  Last Name.',2);



    return false;



  }







if(email == "") {



    inlineMsg('email','Please Fill Your Email.',2);



    return false;



  }



if(!email.match(emailRegex)) {



    inlineMsg('email','<strong>Error</strong><br />You Have Entered An Invalid Email.',2);



    return false;



  }



if(address == "") {



    inlineMsg('address','Please Enter Address.');



    return false;



  }



if(country == "") {



    inlineMsg('lcountry0','Please Select country.');



    return false;



  }



if(state == "") {



    inlineMsg('lstate0','Please Select State.');



    return false;



  }



if(city == "") {



    inlineMsg('lcity0','Please Enter City.');



    return false;



  }



 



if(zip == "") {



    inlineMsg('zip','Please Enter Zip code.');



    return false;



  }



 if(phone == "") {



    inlineMsg('phone','Please Enter Phone No.');



    return false;



  }



if(!document.getElementById("property_type").selectedIndex) {



    inlineMsg('property_type','Please Select Property Type.');



    return false;



  }



   if(!document.getElementById("price_range").selectedIndex) {



    inlineMsg('price_range','Please Select price range.');



    return false;



  }







   if(!document.getElementById("source").selectedIndex) {



    inlineMsg('source','Please Select heard about us.');



    return false;



  }



return true;







 }



//end of



// validation for buy a home form



 function validateBuyHomeForm(form)



 {



  var first_name 		= form.first_name.value;



  var last_name 		= form.last_name.value;



  var address_line_1 	= form.address_line_1.value;



  var country 			= form.lcountry0.value;



  var state 			= form.lstate0.value;



  var city 				= form.lcity0.value;



  var zip 				= form.zip.value;



  var phone 			= form.phone.value;



  var email 			= form.email.value;



  var source 			= form.source.value;



  var specify_source 	= form.specify_source.value;


  var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;



  var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;



  var messageRegex = new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);



if(!document.getElementById("price_range").selectedIndex) {



    inlineMsg('price_range','Please Select price range.');



    return false;



  }

mortgage = 0;
for (i=0;i<form.Mortgage.length;i++)
{
  if (form.Mortgage[i].checked==true)
  {
     mortgage = 1;
  }
}

if (!mortgage) {



    inlineMsg('Mortgage','Please Enter Whether or not you have a Mortgage Professional.',2, 40);



    return false;



  }


if(first_name == "") {



    inlineMsg('first_name','Please Enter First Name.',2);



    return false;



  }







if(!first_name.match(nameRegex)) {



    inlineMsg('first_name','You Have Entered An Invalid First Name.',2);



    return false;



  }



if(last_name == "") {



    inlineMsg('last_name','Please Enter Last Name.',2);



    return false;



  }



  



if(address_line_1 == "") {



    inlineMsg('address_line_1','Please Enter Address.');



    return false;



  }







if(country == "") {



    inlineMsg('lcountry0','Please Select Country.',2);



    return false;



  }



if(state == "") {



    inlineMsg('lstate0','Please Select State.');



    return false;



  }



if(city == "") {



    inlineMsg('lcity0','Please Select City.');



    return false;



  }







if(zip == "") {



    inlineMsg('zip','Please Enter Zip code.');



    return false;



  }







if(phone == "") {



    inlineMsg('phone','Please Enter Phone No.');



    return false;



  }



if(email == "") {



    inlineMsg('email','Please Fill Your Email.',2);



    return false;



  }



if(!email.match(emailRegex)) {



    inlineMsg('email','<strong>Error</strong><br />You Have Entered An Invalid Email.',2);



    return false;



  }



   if(!document.getElementById("price_range").selectedIndex) {



    inlineMsg('price_range','Please Select price range.');



    return false;



  }



if(source == "") {



    inlineMsg('source','Please Select Source.');



    return false;



  }



else if(source == "Other") {



	if(specify_source == "") {



		inlineMsg('specify_source','Please Select Specify Source.');



		return false;



	  }



}



return true;



 }







 // Contact Free Location Kit validation function //



function validateFreeRelocationGuide(form) {



  var first_name 		= trim(form.first_name.value);



  var last_name 		= trim(form.last_name.value);



  var email 			= trim(form.email.value);



  var address_line_1 	= trim(form.address_line_1.value);



  var country 			= trim(form.lcountry0.value);



  var state 			= trim(form.lstate0.value);



  var city 				= trim(form.lcity0.value);



  var zip 				= trim(form.zip.value);



  var phone 			= trim(form.phone.value);



  var city_moving_to 	= trim(form.lcity1.value);


  var state_moving_to 	= trim(form.lstate1.value);


  //var info_request 		= trim(form.info_request.value);





  var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;



  var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;







if(first_name == "") {



    inlineMsg('first_name','Please Enter First Name.',2);



    return false;



  }







if(!first_name.match(nameRegex)) {



    inlineMsg('first_name','You Have Entered An Invalid First Name.',2);



    return false;



  }



if(last_name == "") {



    inlineMsg('last_name','Please Enter Last Name.',2);



    return false;



  }







if(email == "") {



    inlineMsg('email','Please Fill Your Email.',2);



    return false;



  }



if(!email.match(emailRegex)) {



    inlineMsg('email','<strong>Error</strong><br />You Have Entered An Invalid Email.',2);



    return false;



  }







if(address_line_1 == "") {



    inlineMsg('address_line_1','Please Enter Address.');



    return false;



  }



if(country == "") {



    inlineMsg('lcountry0','Please Select State.');



    return false;



  }



if(state == "") {



    inlineMsg('lstate0','Please Select State.');



    return false;



  }



if(city == "") {



    inlineMsg('lcity0','Please Enter City.');



    return false;



  }







if(zip == "") {



    inlineMsg('zip','Please Enter Zip code.');



    return false;



  }







if(phone == "") {



    inlineMsg('phone','Please Enter Phone No.');



    return false;



  }



if(city_moving_to == "") {



    inlineMsg('lcity1','Please Enter City that you are moving to');



    return false;



  }



if (state_moving_to == ""){



    inlineMsg('lstate1','Please Select the state you are moving to');



    return false;



  }



if (!document.getElementById("distance").selectedIndex){



    inlineMsg('distance','Please Select the time frame in whcih you will need a home');



    return false;



  }



/*if(info_request == "") {



    inlineMsg('info_request','Please Enter Information requesting');



    return false;



  }*/



  if((form.info_request_1.checked == false && form.info_request_2.checked == false && form.info_request_3.checked == false && form.info_request_4.checked == false && form.info_request_5.checked == false && form.info_request_6.checked == false)){



			inlineMsg('info_request_1','Please Select Type of home you will need.');



			return false;



		}





if (!document.getElementById("price_range_home").selectedIndex){



    inlineMsg('price_range_home','Please Select Price Range of Homes');



    return false;



  }



if (!document.getElementById("market_analysis").selectedIndex) {



    inlineMsg('market_analysis','Please Select you want a comparative market analysis of your current home?');



    return false;



}





if (!document.getElementById("source").selectedIndex) {



    inlineMsg('source','Please Select Source.');



    return false;



  }



return true;



}











// Function To Validating Agent profile Add Form added by anil



function agentSignUpForm(form) {
  var companyName = trim(form.companyName.value);
  var firstName = trim(form.firstName.value);
  var lastName = trim(form.lastName.value);
  var country 		= form.lcountry0.value;
  var state 		= form.lstate0.value;
  var city 			= form.lcity0.value;
  var zip = trim(form.zip.value);
  var address1 = trim(form.address1.value);
  var mobile1 = form.mobile1.value;
  var mobile1length = form.mobile1.value.length;
  var mobile2 = form.mobile2.value;
  var mobile2length = form.mobile2.value.length;
  var mobile3 = form.mobile3.value;
  var mobile3length = form.mobile3.value.length;
  var phone = trim(form.phone.value);
  var fax = trim(form.fax.value);
  var listingFullDesc = trim(form.listingFullDesc.value);

 if (document.getElementById("joinFree").value != 'yes')
 {
  var billing_fname = trim(form.billing_fname.value);
  var billing_lname = trim(form.billing_lname.value);
  var country_billing = trim(form.country_billing.value);
  var state_billing = trim(form.state_billing.value);
  var city_billing = trim(form.city_billing.value);
  var billing_zip = trim(form.billing_zip.value);
  var billing_address1 = trim(form.billing_address1.value);
  var billing_mobile1 = form.billing_mobile1.value;
  var billing_mobile1length = form.billing_mobile1.value.length;
  var billing_mobile2 = form.billing_mobile2.value;
  var billing_mobile2length = form.billing_mobile2.value.length;
  var billing_mobile3 = form.billing_mobile3.value;
  var billing_mobile3length = form.billing_mobile3.value.length;
  var nameOnCard = trim(form.nameOnCard.value);
  var cardNo = trim(form.cardNo.value);
  var cvvNo = trim(form.cvvNo.value);
 }


  var email = trim(form.email.value);



  var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;



  var verifyEmail = trim(form.verifyEmail.value);

  var billingTerms=form.billingTerms.checked;


  var pass = trim(form.pass.value);



  var confirmPass = trim(form.confirmPass.value);



//  var termsAndCondition=form.termsAndCondition.checked;







  //account info


	  if(email == "") {
        inlineMsg('email','You must enter your email.',2);
        return false;
	    }



	  if(!email.match(emailRegex)) {
		inlineMsg('email','<strong>Error</strong><br />You have entered an invalid email.',2);



		return false;



	  }



	 if(verifyEmail == "") {



        inlineMsg('verifyEmail','You must enter verify email.',2);



        return false;



	    }



	 if(verifyEmail != email) {



		inlineMsg('verifyEmail','Email and verify Email are different.');



		return false;



      }



	  if(pass == "") {



		inlineMsg('pass','You must enter password.',2);



		return false;



	  }



	  if(confirmPass == "") {



		inlineMsg('confirmPass','You must enter verify password.');



		return false;



	  }



	 if(confirmPass != pass) {



		inlineMsg('confirmPass','Password and verify Password are different.');



		return false;



   }



   //listing deail


  if(companyName == "") {



    inlineMsg('companyName','Please Fill The Company Name.',2);



    return false;



  }

  if(firstName == "") {



    inlineMsg('firstName','Please Fill The First Name.',2);



    return false;



  }



   if(lastName == "") {



    inlineMsg('lastName','Please Fill The Last Name.',2);



    return false;



  }







  if(country == "") {



    inlineMsg('lcountry0','Please Fill The Country Name.',2);



    return false;



  }



 if(state == "") {



    inlineMsg('lstate0','Please Fill The State.',2);



    return false;



  }







  if(city == "") {



    inlineMsg('lcity0','Please Fill The City.',2);



    return false;



  }



 if(zip == "") {



    inlineMsg('zip','Please Fill The Zip Code.',2);



    return false;



  }



 if(address1 == "") {



    inlineMsg('address1','Please Fill The Zip Code.',2);



    return false;



  }

 if(phone == "") {



    inlineMsg('phone','Please Enter Phone No.');



    return false;



  }

 if(fax == "") {



    inlineMsg('fax','Please Enter Fax No.');



    return false;



  }

if(mobile1 == "") {



    inlineMsg('mobile3','Please Fill The Mobile Number.',2);



    return false;



  }







  if(mobile1length < 3) {



    inlineMsg('mobile3','Please Fill Right Mobile Number.',2);



    return false;



  }



  if(mobile2 == "") {



    inlineMsg('mobile3','Please Fill The Mobile Number.',2);



    return false;



  }



   if(mobile2length < 3) {



    inlineMsg('mobile3','Please Fill Right Mobile Number.',2);



    return false;



  }



 if(mobile3 == "") {



    inlineMsg('mobile3','Please Fill The Mobile Number.',2);



    return false;



  }



   if(mobile3length < 4) {



    inlineMsg('mobile3','Please Fill Right Mobile Number.',2);



    return false;



  }

 if(listingFullDesc == "") {

    inlineMsg('listingFullDesc','Please Fill Listing Full Description.',2);

    return false;

  }


member = 0;
for (i=0;i<form.Member.length;i++)
{
  if (form.Member[i].checked==true)
  {
     member = 1;
  }
}

if (!member) {
    inlineMsg('Member','Please Enter Whether or not you have a Mortgage Professional.',2, 40);
    return false;
  }

/*
if(!document.getElementById("serviceProvider").selectedIndex) {



    inlineMsg('serviceProvider','Please Select Property Type.');



    return false;



  }

*/
 if (document.getElementById("joinFree").value != 'yes')
 {
 if(billing_fname == "") {



    inlineMsg('billing_fname','Please Fill The First Name.',2);



    return false;



  }



   if(billing_lname == "") {



    inlineMsg('billing_lname','Please Fill The Last NAme.',2);



    return false;



  }







  if(country_billing == "") {



    inlineMsg('country_billing','Please Fill The Country Name.',2);



    return false;



  }



 if(state_billing == "") {



    inlineMsg('state_billing','Please Fill The State.',2);



    return false;



  }







  if (city_billing == "") {



    inlineMsg('city_billing','Please Fill The City.',2);



    return false;



  }



 if(billing_zip == "") {



    inlineMsg('billing_zip','Please Fill The Zip Code.',2);



    return false;



  }



 if(billing_address1 == "") {



    inlineMsg('billing_address1','Please Fill The Zip Code.',2);



    return false;



  }



if(billing_mobile1 == "") {



    inlineMsg('billing_mobile3','Please Fill The Mobile Number.',2);



    return false;



  }







  if(billing_mobile1length < 3) {



    inlineMsg('billing_mobile3','Please Fill Right Mobile Number.',2);



    return false;



  }



  if(billing_mobile2 == "") {



    inlineMsg('billing_mobile3','Please Fill The Mobile Number.',2);



    return false;



  }



   if(billing_mobile2length < 3) {



    inlineMsg('billing_mobile3','Please Fill Right Mobile Number.',2);



    return false;



  }



 if(billing_mobile3 == "") {



    inlineMsg('billing_mobile3','Please Fill The Mobile Number.',2);



    return false;



  }



   if(billing_mobile3length < 4) {



    inlineMsg('billing_mobile3','Please Fill Right Mobile Number.',2);



    return false;



  }



if(nameOnCard == "") {



    inlineMsg('nameOnCard','Please Fill The Name On Card.',2);



    return false;



  }











 if(cardNo == "") {



    inlineMsg('cardNo','Please Fill The Card Number.',2);



    return false;



  }











 if(cvvNo == "") {



    inlineMsg('cvvNo','Please Fill The CVV Number.',2);



    return false;



  }


}




	if(!billingTerms) {



        inlineMsg('billingTerms','Please accept billing Terms and condition.',2);



        return false;



	    }

/*
  if(!termsAndCondition) {



        inlineMsg('termsAndCondition','Please accept terms and condition.',2);



        return false;



	    }
*/



   return true;



}







// Contact Us validation function //



function validateContactUs(form) {



  var first_name 		= trim(form.first_name.value);



  var last_name 		= trim(form.last_name.value);



  var phone 			= trim(form.phone.value);



  var email 			= trim(form.email.value);



  var emailRegex 		= /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;















  var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;



  var messageRegex = new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);







if(first_name == "") {



    inlineMsg('first_name','Please Enter First Name.',2);



    return false;



  }







 if(last_name == "") {



    inlineMsg('last_name','Please Enter Last Name.',2);



    return false;



  }







if(!last_name.match(nameRegex)) {



    inlineMsg('first_name','You Have Entered An Invalid Last Name.',2);



    return false;



  }


if(phone == "") {



    inlineMsg('phone','Please Enter Phone No.', 2);



    return false;



  }






  if(email == "") {



        inlineMsg('email','You must enter your email.',2);



        return false;



	    }



	  if(!email.match(emailRegex)) {



		inlineMsg('email','<strong>Error</strong><br />You have entered an invalid email.',2);



		return false;



	  }








return true;



}







// Function To Validating Banner Ads Form 	//



function validateBannerAdvertise(form) {



  var first_name 	= trim(form.first_name.value);



  var last_name 	= trim(form.last_name.value);



  var email 		= trim(form.email.value);



  var country 		= trim(form.country.value);



  var state 		= trim(form.state.value);



  var city 			= trim(form.city.value);



  var zip 			= trim(form.zip.value);



  var company 		= trim(form.company.value);



  var phone 		= trim(form.phone.value);



  var banner_url 	= trim(form.banner_url.value);



  var bCountry 		= trim(form.bCountry.value);



  var bState 		= trim(form.bState.value);



  var bCity 		= trim(form.bCity.value);



  var banner_image 	= trim(form.banner_image.value);



  var ext 			= banner_image.substring(banner_image.lastIndexOf('.') + 1);



  var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;



  //alert(ext);



	



   if(bCity == "" ) {



    inlineMsg('bCity','Please Enter The Banner City .',2);



    return false;



  }



  if(bState == "" ) {



    inlineMsg('bState','Please Select The Banner State .',2);



    return false;



  }



  if(bCountry == "" ) {



    inlineMsg('bCountry','Please Select The Banner Country .',2);



    return false;



  }



	     if(ext == "gif" || ext == "GIF" || ext == "JPEG" || ext == "jpeg" || ext == "jpg" || ext == "JPG")



      {



                //return true;



      }        



      else



      {



		  		inlineMsg('banner_image','Image must have extension - .jpg or .gif only.',2);



                return false;



       }



   if(banner_url == "") {



    inlineMsg('banner_url','Please Fill The Banner URL.',2);



    return false;



  }



   if(company == "") {



    inlineMsg('company','Please Fill The Company Name.',2);



    return false;



  }



  if(first_name == "") {



    inlineMsg('first_name','Please Fill The First Name.',2);



    return false;



  }



   if(last_name == "") {



    inlineMsg('last_name','Please Fill The Last Name.',2);



    return false;



  }



if(email == "") {



    inlineMsg('email','Please Fill Your Email.',2);



    return false;



  }



if(!email.match(emailRegex)) {



    inlineMsg('email','<strong>Error</strong><br />Please Enter a Valid Email Address.',2);



    return false;



  }



 if(city == "") {



    inlineMsg('city','Please Fill The City.',2);



    return false;



  }



  if(state == "") {



    inlineMsg('state','Please Fill The State.',2);



    return false;



  }



  if(zip == "") {



    inlineMsg('zip','Please Fill The Zip Code.',2);



    return false;



  }



 if(country == "") {



    inlineMsg('country','Please Fill The Country Name.',2);



    return false;



  }



  if(phone == "") {



    inlineMsg('phone','Please Fill The Phone Number.',2);



    return false;



  }







return true;



}



 // Contact Agent validation function //



function validatecontactAgent(form) {



  var first_name 		= trim(form.first_name.value);



  var last_name 		= trim(form.last_name.value);



  var email 			= trim(form.email.value);



  var address_line_1 	= trim(form.address_line_1.value);



  var country 			= trim(form.lcountry0.value);



  var state 			= trim(form.lstate0.value);



  var city 				= trim(form.lcity0.value);



  var zip 				= trim(form.zip.value);



  var phone 			= trim(form.phone.value);







  var nameRegex = /^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;



  var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;







if(first_name == "") {



    inlineMsg('first_name','Please Enter First Name.',2);



    return false;



  }



 



if(!first_name.match(nameRegex)) {



    inlineMsg('first_name','You Have Entered An Invalid First Name.',2);



    return false;



  }



if(last_name == "") {



    inlineMsg('last_name','Please Enter Last Name.',2);



    return false;



  }



  



if(email == "") {



    inlineMsg('email','Please Fill Your Email.',2);



    return false;



  }



if(!email.match(emailRegex)) {



    inlineMsg('email','<strong>Error</strong><br />You Have Entered An Invalid Email.',2);



    return false;



  }







if(address_line_1 == "") {



    inlineMsg('address_line_1','Please Enter Address.');



    return false;



  }



if(country == "") {



    inlineMsg('lcountry0','Please Enter Country.');



    return false;



  }

if(state == "") {



    inlineMsg('lstate0','Please Enter State.');



    return false;



  }





if(city == "") {



    inlineMsg('lcity0','Please Enter City.');



    return false;



  }







if(zip == "") {



    inlineMsg('zip','Please Enter Zip code.');



    return false;



  }







if(phone == "") {



    inlineMsg('phone','Please Enter Phone No.');



    return false;



  }





/*

if(state_moving_to == "") {



    inlineMsg('state_moving_to','Please Select State that you are moving to');



    return false;



  }







if(city_moving_to == "") {



    inlineMsg('city_moving_to','Please Enter City that you are moving to');



    return false;



  }



 



if(info_request == "") {



    inlineMsg('info_request','Please Enter Information requesting');



    return false;



  }



  if((form.info_request_1.checked == false && form.info_request_2.checked == false && form.info_request_3.checked == false && form.info_request_4.checked == false && form.info_request_5.checked == false && form.info_request_6.checked == false)){



			inlineMsg('info_request_1','Please Select Type of home you will need.');



			return false;



		}



  if(distance == "") {



    inlineMsg('distance','Please Select Distance');



    return false;



  }



if(price_range_home == "") {



    inlineMsg('price_range_home','Please Select Price Rane Of Home.');



    return false;



  }



if(market_analysis == "") {



    inlineMsg('market_analysis','Please Select you want a comparative market analysis of your current home?');



    return false;



  }







if(work_with == "") {



    inlineMsg('work_with','Please Select Work With.');



    return false;



  }

*/





   if(!document.getElementById("source").selectedIndex) {



    inlineMsg('source','Please Select heard about us.');



    return false;



  }



return true;



}



// for  only numeric key



function isNumberKey(evt)



      {



         var charCode = (evt.which) ? evt.which : evt.keyCode ;



          if (charCode > 31 && charCode != 40 && charCode != 41 && charCode != 43 && charCode != 46 && (charCode < 48 || charCode > 57))



            return false;







            return true;



      }



  //function for check fax and phone format ( ) , . - 0-9 accept



function checkPhoneMail(evt)



 {



	 var charCode = (evt.which) ? evt.which : evt.keyCode ;



     if (charCode > 31 && charCode != 40 && charCode != 41 && charCode != 43 && charCode != 44 && charCode != 45 && charCode != 46 && (charCode < 48 || charCode > 57))



            return false;



			



	return true;		



 }




