<!-- Used in Rentex Contact Us page -->

function NewWindow(mypage, myname, w, h, scroll) {
        var winl = (screen.width - w) / 2;
        var wint = (screen.height - h) / 2;
        winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
        win = window.open(mypage, myname, winprops)
        if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
    }


function OpenPopupWin(theURL)
{
	var w = 550;
	var h = 440;
	var winl = (screen.width-w)/2;
	var wint = (screen.height - h)/2;
	var feature = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=yes,menubar=no,location=no,toolbar=no,resizable'
	
	window.name = "mainWin";
	window.open(theURL, "winSpec", feature);
}
   
function ValidateEmail(email) {
    txt=email;
    if (txt.indexOf("@")<3 || txt.indexOf(".")<=0)
    {
        return false;
    }
    return true;
}

function ValidateEmailKeep(email) {
txt=email;
if (txt.indexOf("@")<3){
return false;
}

if ((txt.indexOf(".com")<5)&&(txt.indexOf(".org")<5)
&&(txt.indexOf(".gov")<5)&&(txt.indexOf(".net")<5)
&&(txt.indexOf(".mil")<5)&&(txt.indexOf(".edu")<5)){

return false;
   }
return true;
}

function emailCheck() {
txt=document.isn.email.value;
if (txt.indexOf("@")<3){
alert("Sorry, the e-mail address seems wrong."
+" Please check for accuracy.");
return false;
}

if ((txt.indexOf(".com")<5)&&(txt.indexOf(".org")<5)
&&(txt.indexOf(".gov")<5)&&(txt.indexOf(".net")<5)
&&(txt.indexOf(".mil")<5)&&(txt.indexOf(".edu")<5)){
alert("Sorry, the e-mail address seems wrong."
+" Please check for accuracy.");
return false;
   }
return true;
}



<!-- Paste this code into an external JavaScript file named: validEmail.js  -->

/* This script and many more are available free online at
The JavaScript Source :: http://javascript.internet.com
Created by: Francis Cocharrua :: http://scripts.franciscocharrua.com/ */

function Validate_String(string, return_invalid_chars) {
  valid_chars = '1234567890-_.^~abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
  invalid_chars = '';
  if(string == null || string == '')
     return(true);

  //For every character on the string.   
  for(index = 0; index < string.length; index++) {
    char = string.substr(index, 1);                        
     
    //Is it a valid character?
    if(valid_chars.indexOf(char) == -1) {
      //If not, is it already on the list of invalid characters?
      if(invalid_chars.indexOf(char) == -1) {
        //If it's not, add it.
        if(invalid_chars == '')
          invalid_chars += char;
        else
          invalid_chars += ', ' + char;
      }
    }
  }
            
  //If the string does not contain invalid characters, the function will return true.
  //If it does, it will either return false or a list of the invalid characters used
  //in the string, depending on the value of the second parameter.
  if(return_invalid_chars == true && invalid_chars != '') {
    last_comma = invalid_chars.lastIndexOf(',');
    if(last_comma != -1)
      invalid_chars = invalid_chars.substr(0, $last_comma) + 
      ' and ' + invalid_chars.substr(last_comma + 1, invalid_chars.length);
    return(invalid_chars);
    }
  else
    return(invalid_chars == ''); 
}


function Validate_Email_Address(email_address) {
  //Assumes that valid email addresses consist of user_name@domain.tld
  at = email_address.indexOf('@');
  dot = email_address.indexOf('.');

  if(at == -1 || 
    dot == -1 || 
    dot <= at + 1 ||
    dot == 0 || 
    dot == email_address.length - 1)
    return(false);
     
  user_name = email_address.substr(0, at);
  domain_name = email_address.substr(at + 1, email_address.length);                  

  if(Validate_String(user_name) === false || 
    Validate_String(domain_name) === false)
    return(false);                     

  return(true);
}


function isValidDate(dateStr) {
    // Checks for the following valid date formats:
    // MM/DD/YY   MM/DD/YYYY   MM-DD-YY   MM-DD-YYYY
    // Also separates date into month, day, and year variables

    var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{2}|\d{4})$/;

    // To require a 4 digit year entry, use this line instead:
    // var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/;

    var matchArray = dateStr.match(datePat); // is the format ok?
    if (matchArray == null) {
        //alert("Date is not in a valid format.")
        return false;
    }
    month = matchArray[1]; // parse date into variables
    day = matchArray[3];
    year = matchArray[4];
    if (month < 1 || month > 12) { // check month range
    //alert("Month must be between 1 and 12.");
    return false;
    }
    if (day < 1 || day > 31) {
    //alert("Day must be between 1 and 31.");
    return false;
    }
    if ((month==4 || month==6 || month==9 || month==11) && day==31) {
    //alert("Month "+month+" doesn't have 31 days!")
    return false
    }
    if (month == 2) { // check for february 29th
    var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
    if (day>29 || (day==29 && !isleap)) {
    //alert("February " + year + " doesn't have " + day + " days!");
    return false;
       }
    }
    return true;  // date is valid
}



