String.prototype.isvalid = function(){
 return !!this.match(/^([a-zA-Z0-9]{1}([a-zA-Z0-9\.\-\_]*)[a-zA-Z0-9]{1})@([a-zA-Z0-9]{1}([a-zA-Z0-9\.\-\_]*)[a-zA-Z0-9]{1})\.([a-zA-Z]{2,4})$/)
}
function dropdown_validator() {
 if (document.form1.name.value=="") {
  alert("Please Enter Your Name.");
  return false;
 } else if (!document.form1.email.value.isvalid()) {
  alert("Please Enter A Valid Email Address.");
  return false;
 } else {
 return true;
 }
}


function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=410,height=270,left = 376,top = 357');");
}



   function myFocus(element) {
     if (element.value == element.defaultValue) {
       element.value = '';
     }
   }
   function myBlur(element) {
     if (element.value == '') {
       element.value = element.defaultValue;
     }
   }





function contact_form_validator()
{
if (document.contact_form1.Name.value == "")
{
alert("Please enter your Name");
document.contact_form1.Name.focus();
return false;
}

   //FOR CHECKING NULL VALUES IN EMAIL FIELD
  
  if((!document.contact_form1.Email.value) || (document.contact_form1.Email.value==""))
  {
    alert("Your Email needs to be entered");
    document.contact_form1.Email.focus();
    return false;
  }  


  //FOR CHECKING VALIDITY OF E-MAIL ADDRESS

  var email=document.contact_form1.Email.value;
  var email1="";var index2=-1;
  var index1=email.indexOf("@");
  if(index1!=-1)
  email1=email.substring(index1+1);
  if((email1.length)!=0)
  index2=email.indexOf(".");
  if(index1==-1 || index2==-1)
  {
    alert("Enter Valid Email address");
    document.contact_form1.Email.value="";
    document.contact_form1.Email.focus();
    return false;
  }
  email2=email.substring(index2+1)
	if(email2=="")
	  {
	   alert("Enter valid email address");
 	   document.contact_form1.Email.focus()
	   return false;
	  }

	
return (true);
}




function dropdown_validator()
{
if (form1.typehome.value == "")
{
alert("Please Choose Home Type");
form1.typehome.focus();
return (false);
}

if (form1.minprice.value == "")
{
alert("Please Choose Minimum Price");
form1.minprice.focus();
return (false);
}

if (form1.maxprice.value == "")
{
alert("Please Choose Maximum Price");
form1.maxprice.focus();
return (false);
}

if (form1.beds.value == "")
{
alert("Please Choose Bed Type");
form1.beds.focus();
return (false);
}





if (form1.baths.value == "")
{
alert("Please Choose Bath Type");
form1.baths.focus();
return (false);
}

if(form1.name.value=="")
  {
    alert("Please Enter Your Name");
    form1.name.focus();
    return false; 
   }
   
   
   //FOR CHECKING NULL VALUES IN EMAIL FIELD
  
  if((!form1.email.value) || (form1.email.value==""))
  {
    alert("Your email id has to be entered");
    form1.email.focus();
    return false;
  }  

  //FOR CHECKING VALIDITY OF E-MAIL ADDRESS

  var email=form1.email.value;
  var email1="";var index2=-1;
  var index1=email.indexOf("@");
  if(index1!=-1)
  email1=email.substring(index1+1);
  if((email1.length)!=0)
  index2=email.indexOf(".");
  if(index1==-1 || index2==-1)
  {
    alert("Enter Valid Email address");
    form1.email.value="";
    form1.email.focus();
    return false;
  }
  email2=email.substring(index2+1)
	if(email2=="")
	  {
	   alert("Enter valid email address");
 	   form1.email.focus()
	   return false;
	  }

return (true);
}





// What's New functionality 
document.domain='napervilleaurorarealestate.com';

function getObj(name) {
  if (document.getElementById)
  {
     this.obj = document.getElementById(name);
     this.style = document.getElementById(name).style;
  }
}

var whatsnew_off_top = -300;
var whatsnew_on_top = 320;
var whatsnew_step = 8;
var whatsnew_interval = 10;
var whatsObj = new getObj('whatsNewDiv');

function open_shade() {
    if (parseInt(whatsObj.style.top) < whatsnew_on_top) {
        whatsObj.style.top = parseInt(whatsObj.style.top) + whatsnew_step + "px";
        var x = setTimeout("open_shade()", whatsnew_interval);
        document.getElementById('toggle_whats_new').href = "javascript:void(0);";
    } else {
        document.getElementById('toggle_whats_new').href = "javascript:toggle_whats_new();";
    }
}

function close_shade() {
     if (parseInt(whatsObj.style.top) > whatsnew_off_top) {
          whatsObj.style.top = parseInt(whatsObj.style.top) - whatsnew_step + "px";
          var x = setTimeout("close_shade()", whatsnew_interval);
          document.getElementById('toggle_whats_new').href = "javascript:void(0);";
     } else {
          document.getElementById('toggle_whats_new').href = "javascript:toggle_whats_new();";
     }
}

function toggle_whats_new() {
    frames['whatsNewFrame'].location.href = 'popup.htm';
    var currPos = parseInt(document.getElementById('whatsNewDiv').style.top);
    if (currPos <= 0) {
        open_shade();
    } else {
        close_shade();
    }
}

    toggle_whats_new();
    setTimeout("close_shade()", 8000);


