 function toggleDisplay(elem) {
	elem = document.getElementById(elem)
	if (elem.style.display == "none"){
		elem.style.display="block";
	}
	else {
		elem.style.display="none";
	}
}
 
function togglepass() {
	var password = document.getElementById("password");
	if(password.type == "password") {
	  password.type = "text";
	} else {
	  password.type = "password";
	}
}

/*	I think this version is for also including a slide show ?
	function changeImageText(txt,filename,linkname)
	{
              document.mainimage.src = filename;
              var elem = document.getElementById("mainimglink");
              elem.href = linkname;
	}
*/

 	function changeImageText(txt, filename)
	{
		var elem = document.getElementById("mainimage");
              elem.src = filename;
              elem.alt = txt;
	}


 function doClear(theText) 
 {
     if (theText.value == theText.defaultValue)
     {
         theText.value = ""
         theText.style.fontStyle='normal'
     }
 }

 
function print_page() {
	window.print();
}
  

function checkFields (theForm)
{
	if (theForm.name.value == "" || theForm.name.value == " required ")
	{
		alert('Please enter a name in the Name field.');
		theForm.name.focus();
		return false;
	}
	else if (theForm.email.value == "" || theForm.email.value == " required ")
	{
		alert('Please enter a valid email address in the Email field.');
		theForm.email.focus();
		return false;
	}
	else if (emailCheck(theForm.email.value) == false) {
		theForm.email.focus();
		return false;
	}
	else if (emailCheck(theForm.email.value) == false) {
		theForm.email.focus();
		return false;
	}
	else
	{
		return true;
	}
}


function checkSendLink (theForm)
{
	if (theForm.email_to.value == "")
	{
		alert('Please enter a valid email address in the Email To field.');
		theForm.email_to.focus();
		return false;
	}
	else if (theForm.email.value == "" || theForm.email.value == " required ")
	{
		alert('Please enter a valid email address in the Your Email field.');
		theForm.email.focus();
		return false;
	}
	else if (emailCheck(theForm.email_to.value) == false) {
		theForm.email_to.focus();
		return false;
	}
	else if (emailCheck(theForm.email.value) == false) {
		theForm.email.focus();
		return false;
	}
	else
	{
		return true;
	}
}


 // from http://www.codetoad.com/javascript/isnumeric.asp
function IsNumeric(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }

 
function stripCreditCard(sText)
{
   var stripped = sText.replace(/[\.\-\s]/g,"");
   if(IsNumeric(stripped))
   {
		return stripped;
   } else {
		return false;
   }
}

function checkVacate (theForm)
{
	if (theForm.email.value == "" || theForm.email.value == " required ")
	{
		alert('Please enter a valid email address in the Email field.');
		theForm.email.focus();
		return false;
	}
	else if (emailCheck(theForm.email.value) == false) {
		theForm.email.focus();
		return false;
	}
	else if (theForm.tenant.value == "" || theForm.tenant.value == " required ")
	{
		alert('Please enter a name in the Tenants field.');
		theForm.tenant.focus();
		return false;
	}
	else if (theForm.rental_address.value == "" || theForm.rental_address.value == " required ")
	{
		alert('Please enter an address in the Rental Address field.');
		theForm.rental_address.focus();
		return false;
	}
	else if (theForm.forwarding_address.value == "" || theForm.forwarding_address.value == " required ")
	{
		alert('Please enter an address in the Forwarding Address field.');
		theForm.forwarding_address.focus();
		return false;
	}
	else if (theForm.vacate_date.value == "" || theForm.vacate_date.value == " mm/dd/yyyy ")
	{
		alert('Please enter the date you intend to vacate.');
		theForm.vacate_date.focus();
		return false;
	}
	else if (theForm.expire_date.value == "" || theForm.expire_date.value == " mm/dd/yyyy ")
	{
		alert('Please enter the date your lease expires.');
		theForm.expire_date.focus();
		return false;
	}
	else if (theForm.days_notice.value == "")
	{
		alert('Please enter a value for Days Notice.');
		theForm.days_notice.focus();
		return false;
	}
	else if (theForm.tenant1.value == "" )
	{
		alert('Please enter at least one tenant signature and date.');
		theForm.tenant1.focus();
		return false;
	}
	else if (theForm.tenant1_date.value == "" )
	{
		alert('Please enter at least one tenant signature and date.');
		theForm.tenant1_date.focus();
		return false;
	}
	else
	{
		return true;
	}
}


function checkCoSign (theForm)
{
	if (theForm.name.value == "" || theForm.name.value == " required ")
	{
		alert('Please enter your name in the Name field.');
		theForm.name.focus();
		return false;
	}
	else if (theForm.email.value == "" || theForm.email.value == " required ")
	{
		alert('Please enter a valid email address in the Email field.');
		theForm.email.focus();
		return false;
	}
	else if (emailCheck(theForm.email.value) == false) {
		theForm.email.focus();
		return false;
	}
	else if (theForm.birthdate.value == "" || theForm.birthdate.value == " required ")
	{
		alert('Please enter your birth date.');
		theForm.birthdate.focus();
		return false;
	}
	else if (theForm.phone.value == "")
	{
		alert('Please enter your phone number.');
		theForm.phone.focus();
		return false;
	}
	else if (theForm.ssn.value == "")
	{
		alert('Please enter your social security number.');
		theForm.ssn.focus();
		return false;
	}
	else if (theForm.address.value == "")
	{
		alert('Please enter your current address.');
		theForm.address.focus();
		return false;
	}
	else if (theForm.city.value == "")
	{
		alert('Please enter the city for your current address.');
		theForm.city.focus();
		return false;
	}
	else if (theForm.state.value == "")
	{
		alert('Please select the state for your current address.');
		theForm.state.focus();
		return false;
	}
	else if (theForm.zip.value == "")
	{
		alert('Please enter the zipcode for your current address.');
		theForm.zip.focus();
		return false;
	}
	
	
	else if (theForm.employervalue == "")
	{
		alert('Please enter your employer.');
		theForm.employer.focus();
		return false;
	}
	else if (theForm.employer_phone.value == "")
	{
		alert('Please enter your employer phone number.');
		theForm.employer_phone.focus();
		return false;
	}
	else if (theForm.employer_address.value == "")
	{
		alert('Please enter your employer address.');
		theForm.employer_address.focus();
		return false;
	}
	else if (theForm.employer_city.value == "")
	{
		alert('Please enter the city for your employer address.');
		theForm.employer_city.focus();
		return false;
	}
	else if (theForm.employer_state.value == "")
	{
		alert('Please select the state for your employer address.');
		theForm.employer_state.focus();
		return false;
	}
	else if (theForm.employer_zip.value == "")
	{
		alert('Please enter the zipcode for your employer address.');
		theForm.employer_zip.focus();
		return false;
	}
	else if (theForm.income.value == "")
	{
		alert('Please enter your annual income.');
		theForm.income.focus();
		return false;
	}
	else if (theForm.signature.value == "")
	{
		alert('Please enter your (typed in) signature.');
		theForm.signature.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function checkMaintenance (theForm)
{
	if (theForm.name.value == "" || theForm.name.value == " required ")
	{
		alert('Please enter your name in the Name field.');
		theForm.name.focus();
		return false;
	}
	else if (theForm.email.value == "" || theForm.email.value == " required ")
	{
		alert('Please enter a valid email address in the Email field.');
		theForm.email.focus();
		return false;
	}
	else if (emailCheck(theForm.email.value) == false) {
		theForm.email.focus();
		return false;
	}
	else if (theForm.rental_address.value == "" || theForm.rental_address.value == " required ")
	{
		alert('Please enter your address in the Address field.');
		theForm.rental_address.focus();
		return false;
	}
	else if (theForm.phone.value == "")
	{
		alert('Please enter your phone number.');
		theForm.phone.focus();
		return false;
	}
	else if (!theForm.method[0].checked && !theForm.method[1].checked)
	{
		alert('Please check either Permission or Appointment Only.');
		theForm.method[0].focus();
		return false;
	}
	else if (theForm.signature.value == "")
	{
		alert('Please enter your (typed in) signature.');
		theForm.signature.focus();
		return false;
	}
	else if (theForm.issues.value == "" )
	{
		alert('Please indicate what the Maintenance Issue is.');
		theForm.issues.focus();
		return false;
	}
	else
	{
		return true;
	}
}




function checkComplaint (theForm)
{
	if (theForm.name.value == "" || theForm.name.value == " required ")
	{
		alert('Please enter your name in the Name field.');
		theForm.name.focus();
		return false;
	}
	else if (theForm.email.value == "" || theForm.email.value == " required ")
	{
		alert('Please enter a valid email address in the Email field.');
		theForm.email.focus();
		return false;
	}
	else if (emailCheck(theForm.email.value) == false) {
		theForm.email.focus();
		return false;
	}
	else if (theForm.rental_address.value == "" || theForm.rental_address.value == " required ")
	{
		alert('Please enter your address in the Address field.');
		theForm.rental_address.focus();
		return false;
	}
	else if (theForm.forwarding_address.value == "" || theForm.forwarding_address.value == " required ")
	{
		alert('Please enter an address in the Forwarding Address field.');
		theForm.forwarding_address.focus();
		return false;
	}
	else if (theForm.phone.value == "")
	{
		alert('Please enter your phone number.');
		theForm.phone.focus();
		return false;
	}
	else if (theForm.complaint_who.value == "" )
	{
		alert('Please enter who you are complaining about.');
		theForm.complaint_who.focus();
		return false;
	}
	else if (theForm.problem_when.value == "")
	{
		alert('Please enter when the problem occurred.');
		theForm.problem_when.focus();
		return false;
	}
	else if (theForm.problem.value == "" )
	{
		alert('Please enter what the problem is.');
		theForm.problem.focus();
		return false;
	}
	else
	{
		return true;
	}
}




function checkApplication(theForm) {
	if (theForm.agreed[0].checked != true)
	{
		alert('You must agree to the Residential Acceptance Policy in order to continue.');
		theForm.agreed[0].focus();
		return false;
	}
	else if (theForm.rental_address.value == "")
	{
		alert('Please enter the Rental Address.');
		theForm.rental_address.focus();
		return false;
	}
	else if (theForm.first_name.value == "")
	{
		alert('Please enter your first name.');
		theForm.first_name.focus();
		return false;
	}
	else if (theForm.last_name.value == "")
	{
		alert('Please enter your last name.');
		theForm.last_name.focus();
		return false;
	}
	else if (theForm.email.value == "" || theForm.email.value == " required ")
	{
		alert('Please enter a valid email address in the Email field.');
		theForm.email.focus();
		return false;
	}
	else if (emailCheck(theForm.email.value) == false) {
		theForm.email.focus();
		return false;
	}
	else if (theForm.dob.value == "")
	{
		alert('Please enter your date of birth.');
		theForm.dob.focus();
		return false;
	}
	
	else if (document.getElementById("residence_address-0").value == "")
	{
		alert('Please enter your previous address.');
		document.getElementById("residence_address-0").focus();
		return false;
	}
	else if (document.getElementById("residence_city-0").value == "")
	{
		alert('Please enter your previous address city.');
		document.getElementById("residence_city-0").focus();
		return false;
	}
	else if (document.getElementById("residence_zip-0").value == "")
	{
		alert('Please enter your previous address zip code.');
		document.getElementById("residence_zip-0").focus();
		return false;
	}
	else if (document.getElementById("residence_start-0").value == "")
	{
		alert('Please enter month/year when your previous tenancy began.');
		document.getElementById("residence_start-0").focus();
		return false;
	}
	else if (document.getElementById("residence_end-0").value == "")
	{
		alert('Please enter month/year when your previous tenancy ends or ended.');
		document.getElementById("residence_end-0").focus();
		return false;
	}
	else if (document.getElementById("residence_rent-0").value == "")
	{
		alert('Please enter the rent at your previous address.');
		document.getElementById("residence_rent-0").focus();
		return false;
	}
	else if (document.getElementById("reason_for_leaving-0").value == "")
	{
		alert('Please enter the reason you are leaving your previous address.');
		document.getElementById("reason_for_leaving-0").focus();
		return false;
	}
	else if (document.getElementById("landlord-0").value == "")
	{
		alert('Please enter your previous landlord.');
		document.getElementById("landlord-0").focus();
		return false;
	}
	else if (document.getElementById("landlord_phone-0").value == "")
	{
		alert('Please enter your previous landlord\'s phone number.');
		document.getElementById("landlord_phone-0").focus();
		return false;
	}

	else if (document.getElementById("employer-0").value == "")
	{
		alert('Please enter your current employer.');
		document.getElementById("employer-0").focus();
		return false;
	}
	else if (document.getElementById("employer_phone-0").value == "")
	{
		alert('Please enter your employer\'s phone.');
		document.getElementById("employer_phone-0").focus();
		return false;
	}
	else if (document.getElementById("employer_address-0").value == "")
	{
		alert('Please enter your employer\'s address.');
		document.getElementById("employer_address-0").focus();
		return false;
	}
	else if (document.getElementById("employer_city-0").value == "")
	{
		alert('Please enter your employer\'s city.');
		document.getElementById("employer_city-0").focus();
		return false;
	}
	else if (document.getElementById("employer_zip-0").value == "")
	{
		alert('Please enter your employer\'s zip code.');
		document.getElementById("employer_zip-0").focus();
		return false;
	}
	else if (document.getElementById("employer_start-0").value == "")
	{
		alert('Please enter month/year when you started your current employment.');
		document.getElementById("employer_start-0").focus();
		return false;
	}
	else if (document.getElementById("employer_end-0").value == "")
	{
		alert('Please enter when you ended your current employment.');
		document.getElementById("employer_end-0").focus();
		return false;
	}
	else if (document.getElementById("salary-0").value == "")
	{
		alert('Please enter your salary.');
		document.getElementById("salary-0").focus();
		return false;
	}
	else if (document.getElementById("position-0").value == "")
	{
		alert('Please enter your employment title.');
		document.getElementById("position-0").focus();
		return false;
	}

	if (!document.getElementById("fte-0-1").checked  && !document.getElementById("fte-0-2").checked )
	 //if(!checkRadio(document.getElementById("fte-0")))
	{
		alert('Please indicate whether you are working full-time or part-time.');
		//document.getElementById("fte-0").focus();
		return false;
	}
	else if (theForm.checking_bank.value == "")
	{
		alert('Please enter the name of your checking account bank.');
		theForm.checking_bank.focus();
		return false;
	}
	else if (theForm.checking_phone.value == "")
	{
		alert('Please enter the name of your checking account phone.');
		theForm.checking_phone.focus();
		return false;
	}
	else if (theForm.checking_address.value == "")
	{
		alert('Please enter the name of your checking account address.');
		theForm.checking_address.focus();
		return false;
	}
	else if (theForm.checking_city.value == "")
	{
		alert('Please enter the name of your checking account city.');
		theForm.checking_city.focus();
		return false;
	}
	else if (theForm.checking_state.value == "")
	{
		alert('Please enter the name of your checking account state.');
		theForm.checking_state.focus();
		return false;
	}
	else if (theForm.savings_bank.value == "")
	{
		alert('Please enter the name of your savings account bank.');
		theForm.savings_bank.focus();
		return false;
	}
	else if (theForm.savings_phone.value == "")
	{
		alert('Please enter the name of your savings account phone.');
		theForm.savings_phone.focus();
		return false;
	}
	else if (theForm.savings_address.value == "")
	{
		alert('Please enter the name of your savings account address.');
		theForm.savings_address.focus();
		return false;
	}
	else if (theForm.savings_city.value == "")
	{
		alert('Please enter the name of your savings account city.');
		theForm.savings_city.focus();
		return false;
	}
	else if (theForm.checking_state.value == "")
	{
		alert('Please enter the name of your savings account state.');
		theForm.checking_state.focus();
		return false;
	}
	else if (theForm.emerg_first_name.value == "")
	{
		alert('Please enter the first name of your emergency contact.');
		theForm.emerg_first_name.focus();
		return false;
	}
	else if (theForm.emerg_last_name.value == "")
	{
		alert('Please enter the last name of your emergency contact.');
		theForm.emerg_last_name.focus();
		return false;
	}
	else if (theForm.emerg_day_phone.value == "")
	{
		alert('Please enter the day phone for your emergency contact.');
		theForm.emerg_day_phone.focus();
		return false;
	}
	else if (theForm.emerg_eve_phone.value == "")
	{
		alert('Please enter the evening phone for your emergency contact.');
		theForm.emerg_eve_phone.focus();
		return false;
	}
	else if (theForm.emerg_relationship.value == "")
	{
		alert('Please enter your relationship to your emergency contact.');
		theForm.emerg_relationship.focus();
		return false;
	}
	else if (theForm.emerg_address.value == "")
	{
		alert('Please enter the address of your emergency contact.');
		theForm.emerg_address.focus();
		return false;
	}
	else if (theForm.emerg_city.value == "")
	{
		alert('Please enter the city for your emergency contact.');
		theForm.emerg_city.focus();
		return false;
	}
	else if (theForm.emerg_state.value == "")
	{
		alert('Please enter the state for your emergency contact.');
		theForm.emerg_state.focus();
		return false;
	}
	else if (theForm.emerg_zip.value == "")
	{
		alert('Please enter the zip code for your emergency contact.');
		theForm.emerg_zip.focus();
		return false;
	}
	else if (!checkRadio(theForm.delinquent))
	{
		alert('Please indicate if you\'ve ever been financially delinquent.');
		theForm.delinquent_explain.focus();
		return false;
	}
	else if (theForm.delinquent[0].checked && theForm.delinquent_explain.value == "")
	{
		alert('Please explain about when you were financially delinquent.');
		theForm.delinquent_explain.focus();
		return false;
	}
	else if (!checkRadio(theForm.defendant))
	{
		alert('Please indicate if you\'ve ever been a defendant in an eviction case.');
		theForm.defendant_explain.focus();
		return false;
	}
	else if (theForm.defendant[0].checked && theForm.defendant_explain.value == "")
	{
		alert('Please explain about when you were a defendant.');
		theForm.defendant_explain.focus();
		return false;
	}
	else if (!checkRadio(theForm.convicted))
	{
		alert('Please indicate if you\'ve ever been convicted of a crime.');
		theForm.convicted_explain.focus();
		return false;
	}
	else if (theForm.convicted[0].checked && theForm.convicted_explain.value == "")
	{
		alert('Please explain about when you were convicted.');
		theForm.convicted_explain.focus();
		return false;
	}
	else if (!checkRadio(theForm.pets))
	{
		alert('Please indicate if you have any pets.');
		theForm.pets_details.focus();
		return false;
	}
	else if (theForm.pets[0].checked && theForm.pets_details.value == "")
	{
		alert('Please let us know about your pet\'s Type / Breed / Weight.');
		theForm.pets_details.focus();
		return false;
	}
	
		return true;
}



function checkRadio (fieldName) {
 var radios = fieldName;
 for (var i=0; i <radios.length; i++) {
  if (radios[i].checked) {
   return true;
  }
 }
 return false;
} 

/*
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- V1.1.3: Sandeep V. Tamhankar (stamhankar@hotmail.com) -->
<!-- Original:  Sandeep V. Tamhankar (stamhankar@hotmail.com) -->
<!-- Changes: */
/* 1.1.4: Fixed a bug where upper ASCII characters (i.e. accented letters
international characters) were allowed.

1.1.3: Added the restriction to only accept addresses ending in two
letters (interpreted to be a country code) or one of the known
TLDs (com, net, org, edu, int, mil, gov, arpa), including the
new ones (biz, aero, name, coop, info, pro, museum).  One can
easily update the list (if ICANN adds even more TLDs in the
future) by updating the knownDomsPat variable near the
top of the function.  Also, I added a variable at the top
of the function that determines whether or not TLDs should be
checked at all.  This is good if you are using this function
internally (i.e. intranet site) where hostnames don't have to 
conform to W3C standards and thus internal organization e-mail
addresses don't have to either.
Changed some of the logic so that the function will work properly
with Netscape 6.

1.1.2: Fixed a bug where trailing . in e-mail address was passing
(the bug is actually in the weak regexp engine of the browser; I
simplified the regexps to make it work).

1.1.1: Removed restriction that countries must be preceded by a domain,
so abc@host.uk is now legal.  However, there's still the 
restriction that an address must end in a two or three letter
word.

1.1: Rewrote most of the function to conform more closely to RFC 822.

1.0: Original

*/



function emailCheck (emailStr) {

/* The following variable tells the rest of the function whether or not
to verify that the address ends in a two-letter country or well-known
TLD.  1 means check it, 0 means don't. */

var checkTLD=1;

/* The following is the list of known TLDs that an e-mail address must end with. */

var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;

/* The following pattern is used to check if the entered e-mail address
fits the user@domain format.  It also is used to separate the username
from the domain. */

var emailPat=/^(.+)@(.+)$/;

/* The following string represents the pattern for matching all special
characters.  We don't want to allow special characters in the address. 
These characters include ( ) < > @ , ; : \ " . [ ] */

var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";

/* The following string represents the range of characters allowed in a 
username or domainname.  It really states which chars aren't allowed.*/

var validChars="\[^\\s" + specialChars + "\]";

/* The following pattern applies if the "user" is a quoted string (in
which case, there are no rules about which characters are allowed
and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
is a legal e-mail address. */

var quotedUser="(\"[^\"]*\")";

/* The following pattern applies for domains that are IP addresses,
rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
e-mail address. NOTE: The square brackets are required. */

var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;

/* The following string represents an atom (basically a series of non-special characters.) */

var atom=validChars + '+';

/* The following string represents one word in the typical username.
For example, in john.doe@somewhere.com, john and doe are words.
Basically, a word is either an atom or quoted string. */

var word="(" + atom + "|" + quotedUser + ")";

// The following pattern describes the structure of the user

var userPat=new RegExp("^" + word + "(\\." + word + ")*$");

/* The following pattern describes the structure of a normal symbolic
domain, as opposed to ipDomainPat, shown above. */

var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

/* Finally, let's start trying to figure out if the supplied address is valid. */

/* Begin with the coarse pattern to simply break up user@domain into
different pieces that are easy to analyze. */

var matchArray=emailStr.match(emailPat);

if (matchArray==null) {

/* Too many/few @'s or something; basically, this address doesn't
even fit the general mould of a valid e-mail address. */

alert("Email address seems incorrect (check @ and .'s)");
return false;
}
var user=matchArray[1];
var domain=matchArray[2];

// Start by checking that only basic ASCII characters are in the strings (0-127).

for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {
alert("Your email/username contains invalid characters.");
return false;
   }
}
for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {
alert("Ths domain name contains invalid characters.");
return false;
   }
}

// See if "user" is valid 

if (user.match(userPat)==null) {

// user is not valid

alert("Your email/username doesn't seem to be valid.");
return false;
}

/* if the e-mail address is at an IP address (as opposed to a symbolic
host name) make sure the IP address is valid. */

var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {

// this is an IP address

for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
alert("Destination IP address is invalid!");
return false;
   }
}
return true;
}

// Domain is symbolic name.  Check if it's valid.
 
var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i<len;i++) {
if (domArr[i].search(atomPat)==-1) {
alert("The domain name does not seem to be valid.");
return false;
   }
}

/* domain name seems valid, but now make sure that it ends in a
known top-level domain (like com, edu, gov) or a two-letter word,
representing country (uk, nl), and that there's a hostname preceding 
the domain or country. */
/*	to lowercase mkes it fail
if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].toLowerCase().search(knownDomsPat).toLowerCase() ==-1) {
alert("The address must end in a well-known domain or two letter " + "country.");
return false;
}
*/

// Make sure there's a host name preceding the domain.

if (len<2) {
alert("This address is missing a hostname!");
return false;
}

// If we've gotten this far, everything's valid!
return true;
}


function ValidateUserEdit(emailStr) {
	if (emailCheck(emailStr)) {
		return true;
	}
	else {
		return false;
	}
}

function ValidateUserRegistration(emailStr, PhoneNo) {
	if (emailCheck(emailStr)) {
		// check phone no
		
		if ( PhoneNo.value.length == 0)	
		{
			alert("Your phone number cannot be blank.");				
			return (false);	
		}
	
		if (PhoneNo.value.length<10)	
		{		
			alert("Incorrect number of characters.");	
			return(false);	
		}
	
		if (PhoneNo.value.lentgh>10)	
		{	
			alert("Entry consists of more that 10 Chars.")	
			return(false);	
		}

		if (CheckPhoneNumber(PhoneNo, '')) {
			return true;
		}
		else {
			return false;
		}
	}
	else {
		return false;
	}
}

function CheckPhoneNumber(PhoneNo,TagStr)
{
	// get rid of non-numerics
	var checkOK = new String("0123456789");
	var strNo = new String(PhoneNo.value);
	PhoneNo.value="";

	for ( i = 0; i < strNo.length; i++ )
	{
		ch = strNo.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
			if (ch == checkOK.charAt(j))
				break;

		if (j != checkOK.length)
		{
			PhoneNo.value=String(PhoneNo.value)+String(ch);
		}
	}

	// get rid of leading 1
	if ( ( PhoneNo.value.length == 11 ) && ( PhoneNo.value.charAt(0) == 1 ) )
	{
		PhoneNo.value = PhoneNo.value.substr(1,10);
	}

	if ( (PhoneNo.value.length != 0) && (PhoneNo.value.length < 10) )
	{
		alert("Please enter exactly 10 digits in \"" + TagStr + "\".");
		PhoneNo.focus();
		return (false);
	}

	if (PhoneNo.value.length > 10)
	{
		alert("Please enter exactly 10 digits in \"" + TagStr + "\".");
		PhoneNo.focus();
		return (false);
	}


	var checkStr = PhoneNo.value;
	var allValid = true;
	var decPoints = 0;

	for (i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
			if (ch == checkOK.charAt(j))
			break;

		if (j == checkOK.length)
		{
			allValid = false;
			break;
		}
	}

	if (!allValid)
	{
		alert("Please enter only digits in \"" + TagStr + "\".");
		PhoneNo.focus();
		return (false);
	}

	if ( checkStr.length == 10 )
	{
		if ( checkStr.charAt(0) < '2' )
		{
			alert("The first digit of the area code in \"" + TagStr + "\" cannot be a '1' or '0'");
			PhoneNo.focus();
			return (false);
		}

		if ( checkStr.charAt(3) < '2' )
		{
			alert("The first digit of the prefix in \"" + TagStr + "\" cannot be a '1' or '0'");
			PhoneNo.focus();
			return (false);
		}

		if ( checkStr.substring(0,3) == "900" )
		{
			alert("The area code in \"" + TagStr + "\" cannot be '900'");
			PhoneNo.focus();
			return (false);
		}

	}
	else
		return (true);

	return true;
}


