// JavaScript Document
	function isValidDate(day,month,year,isDateOfBirth)
	{
		var dteDate;
		var curDate;
		
		//set up a Date object based on the day, month and year arguments
		//javascript months start at 0 (0-11 instead of 1-12)
		dteDate=new Date(year,month,day);
		curDate = new Date();
		
		/*
		Javascript Dates are a little too forgiving and will change the date to a reasonable guess if it's invalid. 
		We'll use this to our advantage by creating the date object and then comparing it to the details we put it. 
		If the Date object is different, then it must have been an invalid date to start with...
		*/

		if (!isDateOfBirth)
		{
			return ((day==dteDate.getDate()) && (month==dteDate.getMonth()) && (year==dteDate.getFullYear()) && (dteDate>curDate));
		}
		else
		{
			return ((day==dteDate.getDate()) && (month==dteDate.getMonth()) && (year==dteDate.getFullYear()) && (curDate>dteDate));
		}
	}

	function checkEmail(emField)
	{
		var fieldValue = emField.value;  // store field's value in variable, "fieldValue"

		if(fieldValue != "")
		{  //if field is not empty
			var atSymbol = 0;
			
			for(var a = 0; a < fieldValue.length; a++)
			{ //loop through field value string
				if(fieldValue.charAt(a) == "@")
				{ //look for @ symbol and for each @ found, increment atSymbol variable by 1
					atSymbol++;
				}
			}
	
			if(atSymbol > 1)
			{ // if more than 1 @ symbol exists
				return false;
			}
				
			if(atSymbol == 1 && fieldValue.charAt(0) != "@")
			{  // if @ symbol was found, and it is not the 1st character in string
				var period = fieldValue.indexOf(".",fieldValue.indexOf("@")+2); //look for period at 2nd character after @ symbol
				var twoPeriods = (fieldValue.charAt((period+1)) == ".") ? true : false; // "."  immediately following 1st "." ? 
						  
			//if period was not found OR 2 periods together OR field contains less than 5 characters OR period is in last position
				if(period == -1 || twoPeriods || fieldValue.length < period + 2 || fieldValue.charAt(fieldValue.length-1)==".")
				{
					return false;
				}
				  		  
			}
			else
			{  // no @ symbol exists or it is in position 0 (the first character of the field)
				return false; // then cancel
			}
		}
		else
		{  // if field is empty
			return false;  // then cancel
		}
			
		return true;
	}

	function toUnicode(elmnt,content){
		//alert(window.event.keyCode);
		
		if (content.length==elmnt.maxLength){
			next=elmnt.tabIndex
			if (next<document.forms[0].elements.length){
			
				if (window.event.keyCode != 9)
				{
					document.forms[0].elements[next].focus();
				}
			}
		}
	}

	function startForm(){
		document.forms[0].elements[0].focus();
	}

	function validate1()
	{
		//FIRSTNAME
		if (document.rentApp.firstname.value == '')
		{
			alert('You must provide your first name.');
			document.rentApp.firstname.focus();
			return false;
		}
		
		//LASTNAME
		if (document.rentApp.lastname.value == '')
		{
			alert('You must provide your last name.');
			document.rentApp.lastname.focus();
			return false;
		}

		//DOBMONTH
		if (document.rentApp.dobmonth.value == '')
		{
			alert('You must provide your complete date of birth.');
			document.rentApp.dobmonth.focus();
			return false;
		}
		else
		{
			if ((isNaN(document.rentApp.dobmonth.value)) || (document.rentApp.dobmonth.value.length<2))
			{
				alert('You must enter a valid number for your birth month (01 - 12).');
				document.rentApp.dobmonth.select();
				return false;
			}
			else
			{
				if ((document.rentApp.dobmonth.value < 1) || (document.rentApp.dobmonth.value > 12))
				{
					alert('You must enter a valid number for your birth month (01 - 12).');
					document.rentApp.dobmonth.select();
					return false;
				}
			}
		}

		//DOBDAY
		if (document.rentApp.dobday.value == '')
		{
			alert('You must provide your complete date of birth.');
			document.rentApp.dobday.focus();
			return false;
		}
		else
		{
			if ((isNaN(document.rentApp.dobday.value)) || (document.rentApp.dobday.value.length<2))
			{
				alert('You must enter a valid number for your birth day (01 - 31).');
				document.rentApp.dobday.select();
				return false;
			}
			else
			{
				if ((document.rentApp.dobday.value < 1) || (document.rentApp.dobday.value > 31))
				{
					alert('You must enter a valid number for your birth day (01 - 31).');
					document.rentApp.dobday.select();
					return false;
				}
			}
		}

		//DOBYEAR
		if (document.rentApp.dobyear.value == '')
		{
			alert('You must provide your complete date of birth.');
			document.rentApp.dobyear.focus();
			return false;
		}
		else
		{
			if ((isNaN(document.rentApp.dobyear.value)) || (document.rentApp.dobyear.value.length<4))
			{
				alert('You must enter a valid number for your birth year.');
				document.rentApp.dobyear.select();
				return false;
			}
		}

		if (!isValidDate(document.rentApp.dobday.value, document.rentApp.dobmonth.value - 1, document.rentApp.dobyear.value, true))
		{
			alert('You must enter a valid date for your date of birth.');
			document.rentApp.dobmonth.select();
			return false;
		}
		
		if ((document.rentApp.ssn1.value == '') || (document.rentApp.ssn1.value.length < 3))
		{
			alert('You must provide your complete social security number.');
			document.rentApp.ssn1.focus();
			return false;
		}
		else
		{
			if (isNaN(document.rentApp.ssn1.value))
			{
				alert('You must enter a valid social security number.');
				document.rentApp.ssn1.select();
				return false;
			}
		}

		if ((document.rentApp.ssn2.value == '') || (document.rentApp.ssn2.value.length < 2))
		{
			alert('You must provide your complete social security number.');
			document.rentApp.ssn2.focus();
			return false;
		}
		else
		{
			if (isNaN(document.rentApp.ssn2.value))
			{
				alert('You must enter a valid social security number.');
				document.rentApp.ssn2.select();
				return false;
			}
		}

		if ((document.rentApp.ssn3.value == '') || (document.rentApp.ssn3.value.length < 4))
		{
			alert('You must provide your complete social security number.');
			document.rentApp.ssn3.focus();
			return false;
		}
		else
		{
			if (isNaN(document.rentApp.ssn3.value))
			{
				alert('You must enter a valid social security number.');
				document.rentApp.ssn3.select();
				return false;
			}
		}

		if (document.rentApp.prstreet.value == '')
		{
			alert('You must enter your present street address.');
			document.rentApp.prstreet.focus();
			return false;
		}

		if (document.rentApp.prcity.value == '')
		{
			alert('You must enter your present city.');
			document.rentApp.prcity.focus();
			return false;
		}

		if (document.rentApp.prstate.selectedIndex == 0)
		{
			alert('You must select your present state.');
			document.rentApp.prstate.focus();
			return false;
		}
		
		if ((document.rentApp.przip.value == '') || (document.rentApp.przip.value.length < 5))
		{
			alert('You must enter your present zip code.');
			document.rentApp.przip.select();
			return false;
		}
		/*
		else
		{
			if (isNaN(document.rentApp.przip.value))
			{
				alert('You must enter a valid zip code.');
				document.rentApp.przip.select();
				return false;
			}
		}
		*/
		
		if ((isNaN(document.rentApp.prphone1.value)) || (document.rentApp.prphone1.value.length < 3))
		{
			alert('You must enter a valid phone number.');
			document.rentApp.prphone1.select();
			return false;
		}
		
		if ((isNaN(document.rentApp.prphone2.value)) || (document.rentApp.prphone2.value.length < 3))
		{
			alert('You must enter a valid phone number.');
			document.rentApp.prphone2.select();
			return false;
		}

		if ((isNaN(document.rentApp.prphone3.value)) || (document.rentApp.prphone3.value.length < 4))
		{
			alert('You must enter a valid phone number.');
			document.rentApp.prphone3.select();
			return false;
		}

		if (document.rentApp.prhowlong.value == '')
		{
			alert('You must enter how long you have lived at your present address.');
			document.rentApp.prhowlong.focus();
			return false;
		}

		if (document.rentApp.prrent.value == '')
		{
			alert('You must enter how much you currently pay for rent.');
			document.rentApp.prrent.focus();
			return false;
		}
		else
		{
			if (isNaN(document.rentApp.prrent.value))
			{
				alert("You must enter how much you currently pay for rent (do NOT include a dollar sign ($) or any commas).");
				document.rentApp.prrent.select();
				return false;
			}
		}

		if (document.rentApp.email.value == '')
		{
			alert('You must enter your email address.');
			document.rentApp.email.focus();
			return false;
		}
		else
		{
			if (!checkEmail(document.rentApp.email))
			{
				alert('You must provide a valid email address.');
				document.rentApp.email.select();
				return false;
			}
		}

		if ((document.rentApp.cell1.value != '') || (document.rentApp.cell2.value != '') || (document.rentApp.cell3.value != ''))
		{
			if ((isNaN(document.rentApp.cell1.value)) || (document.rentApp.cell1.value.length < 3))
			{
				alert('You must enter a valid phone number.');
				document.rentApp.cell1.select();
				return false;
			}
		
			if ((isNaN(document.rentApp.cell2.value)) || (document.rentApp.cell2.value.length < 3))
			{
				alert('You must enter a valid phone number.');
				document.rentApp.cell2.select();
				return false;
			}

			if ((isNaN(document.rentApp.cell3.value)) || (document.rentApp.cell3.value.length < 4))
			{
				alert('You must enter a valid phone number.');
				document.rentApp.cell3.select();
				return false;
			}
		}
		
		if (document.rentApp.laname.value == '')
		{
			alert('You must enter your current landlord\'s name.');
			document.rentApp.laname.focus();
			return false;
		}

		if ((isNaN(document.rentApp.laphone1.value)) || (document.rentApp.laphone1.value.length < 3))
		{
			alert('You must enter a valid phone number.');
			document.rentApp.laphone1.select();
			return false;
		}
		
		if ((isNaN(document.rentApp.laphone2.value)) || (document.rentApp.laphone2.value.length < 3))
		{
			alert('You must enter a valid phone number.');
			document.rentApp.laphone2.select();
			return false;
		}

		if ((isNaN(document.rentApp.laphone3.value)) || (document.rentApp.laphone3.value.length < 4))
		{
			alert('You must enter a valid phone number.');
			document.rentApp.laphone3.select();
			return false;
		}

		if (document.rentApp.pastreet.value == '')
		{
			alert('You must enter your previous street address.');
			document.rentApp.pastreet.focus();
			return false;
		}

		if (document.rentApp.pacity.value == '')
		{
			alert('You must enter your previous city.');
			document.rentApp.pacity.focus();
			return false;
		}

		if (document.rentApp.pastate.selectedIndex == 0)
		{
			alert('You must select your previous state.');
			document.rentApp.pastate.focus();
			return false;
		}
		
		if ((document.rentApp.pazip.value == '') || (document.rentApp.pazip.value.length < 5))
		{
			alert('You must enter your previous zip code.');
			document.rentApp.pazip.select();
			return false;
		}
		/*
		else
		{
			if (isNaN(document.rentApp.pazip.value))
			{
				alert('You must enter a valid zip code.');
				document.rentApp.pazip.select();
				return false;
			}
		}
		*/
		if ((isNaN(document.rentApp.paphone1.value)) || (document.rentApp.paphone1.value.length < 3))
		{
			alert('You must enter a valid phone number.');
			document.rentApp.paphone1.select();
			return false;
		}
		
		if ((isNaN(document.rentApp.paphone2.value)) || (document.rentApp.paphone2.value.length < 3))
		{
			alert('You must enter a valid phone number.');
			document.rentApp.paphone2.select();
			return false;
		}

		if ((isNaN(document.rentApp.paphone3.value)) || (document.rentApp.paphone3.value.length < 4))
		{
			alert('You must enter a valid phone number.');
			document.rentApp.paphone3.select();
			return false;
		}

		if (document.rentApp.pezip.value != '')
		{
			if (document.rentApp.pezip.value.length < 5)
			{
				alert('You must provide a valid zip code.');
				document.rentApp.pezip.select();
				return false;
			}
		}
		/*
		else
		{
			if (isNaN(document.rentApp.pezip.value))
			{
				alert('You must enter a valid zip code.');
				document.rentApp.pezip.select();
				return false;
			}
		}
		*/

		if ((document.rentApp.pephone1.value != '') || (document.rentApp.pephone2.value != '') || (document.rentApp.pephone3.value != ''))
		{
			if ((isNaN(document.rentApp.pephone1.value)) || (document.rentApp.pephone1.value.length < 3))
			{
				alert('You must enter a valid phone number.');
				document.rentApp.pephone1.select();
				return false;
			}
		
			if ((isNaN(document.rentApp.pephone2.value)) || (document.rentApp.pephone2.value.length < 3))
			{
				alert('You must enter a valid phone number.');
				document.rentApp.pephone2.select();
				return false;
			}

			if ((isNaN(document.rentApp.pephone3.value)) || (document.rentApp.pephone3.value.length < 4))
			{
				alert('You must enter a valid phone number.');
				document.rentApp.pephone3.select();
				return false;
			}
		}

		if (document.rentApp.ename.value == '')
		{
			alert('You must enter your employer\'s name.');
			document.rentApp.ename.focus();
			return false;
		}

		if (document.rentApp.ezip.value != '')
		{
			if (document.rentApp.ezip.value.length < 5)
			{
				alert('You must provide a valid zip code.');
				document.rentApp.ezip.select();
				return false;
			}
		}
		
		if ((document.rentApp.ephone1.value != '') || (document.rentApp.ephone2.value != '') || (document.rentApp.ephone3.value != ''))
		{
			if ((isNaN(document.rentApp.ephone1.value)) || (document.rentApp.ephone1.value.length < 3))
			{
				alert('You must enter a valid phone number.');
				document.rentApp.ephone1.select();
				return false;
			}
		
			if ((isNaN(document.rentApp.ephone2.value)) || (document.rentApp.ephone2.value.length < 3))
			{
				alert('You must enter a valid phone number.');
				document.rentApp.ephone2.select();
				return false;
			}

			if ((isNaN(document.rentApp.ephone3.value)) || (document.rentApp.ephone3.value.length < 4))
			{
				alert('You must enter a valid phone number.');
				document.rentApp.ephone3.select();
				return false;
			}
		}
		
		if (document.rentApp.eincome.value == '')
		{
			alert("You must enter a valid amount for monthly income.");
			document.rentApp.eincome.focus();
			return false;
		}
		else
		{
			if (isNaN(document.rentApp.eincome.value))
			{
				alert("You must enter a valid amount for monthly income (do NOT include a dollar sign ($) or any commas).");
				document.rentApp.eincome.select();
				return false;
			}
		}

		if (document.rentApp.ecname.value == '')
		{
			alert('You must enter your emergency contact name.');
			document.rentApp.ecname.focus();
			return false;
		}

		if (document.rentApp.ecstreet.value == '')
		{
			alert('You must enter your emergency contact street address.');
			document.rentApp.ecstreet.focus();
			return false;
		}

		if (document.rentApp.eccity.value == '')
		{
			alert('You must enter your emergency contact city.');
			document.rentApp.eccity.focus();
			return false;
		}

		if (document.rentApp.ecstate.selectedIndex == 0)
		{
			alert('You must select your emergency contact state.');
			document.rentApp.ecstate.focus();
			return false;
		}
		
		if ((document.rentApp.eczip.value == '') || (document.rentApp.eczip.value.length < 5))
		{
			alert('You must enter your emergency contact zip code.');
			document.rentApp.eczip.select();
			return false;
		}
		/*
		else
		{
			if (isNaN(document.rentApp.eczip.value))
			{
				alert('You must enter a valid zip code.');
				document.rentApp.eczip.select();
				return false;
			}
		}
		*/
		if ((isNaN(document.rentApp.ecphone1.value)) || (document.rentApp.ecphone1.value.length < 3))
		{
			alert('You must enter a valid phone number.');
			document.rentApp.ecphone1.select();
			return false;
		}
		
		if ((isNaN(document.rentApp.ecphone2.value)) || (document.rentApp.ecphone2.value.length < 3))
		{
			alert('You must enter a valid phone number.');
			document.rentApp.ecphone2.select();
			return false;
		}

		if ((isNaN(document.rentApp.ecphone3.value)) || (document.rentApp.ecphone3.value.length < 4))
		{
			alert('You must enter a valid phone number.');
			document.rentApp.ecphone3.select();
			return false;
		}

		var choice = false;

		for (i=0; i<document.rentApp.cslease.length; i++)
		{
			if (document.rentApp.cslease[i].checked)
				choice = true; 
		}
		
		if (!choice)
		{
			alert("You must state whether or not you have been convicted of a felony.");
			document.rentApp.cslease[0].focus();
			return false;
		}
		
		choice = false;
		
		for (i=0; i<document.rentApp.evict.length; i++)
		{
			if (document.rentApp.evict[i].checked)
				choice = true; 
		}
		
		if (!choice)
		{
			alert("You must state whether or not you have ever been evicted.");
			document.rentApp.evict[0].focus();
			return false;
		}

		choice = false;
		
		for (i=0; i<document.rentApp.bankrupt.length; i++)
		{
			if (document.rentApp.bankrupt[i].checked)
				choice = true; 
		}
		
		if (!choice)
		{
			alert("You must state whether or not you have ever filed bankruptcy.");
			document.rentApp.bankrupt[0].focus();
			return false;
		}
	
		choice = false;
		
		for (i=0; i<document.rentApp.apt.length; i++)
		{
			if (document.rentApp.apt[i].checked)
				choice = true; 
		}
		
		if (!choice)
		{
			alert("You must select an apartment complex.");
			document.rentApp.apt[0].focus();
			return false;
		}

		choice = false;
		
		for (i=0; i<document.rentApp.pet.length; i++)
		{
			if (document.rentApp.pet[i].checked)
				choice = true; 
		}
		
		if (!choice)
		{
			alert("You must state whether or not you have any pets.");
			document.rentApp.pet[0].focus();
			return false;
		}
		else
		{
			if (document.rentApp.pet[0].checked)
			{
				if (document.rentApp.pettype.value == '')
				{
					alert('You must state what type of pet(s) you have.');
					document.rentApp.pettype.focus();
					return false;
				}
			}
		}

		if (document.rentApp.aname.value == '')
		{
			alert("You must specify a valid name for authorization (it MUST match the first and last name provided on the application).");
			document.rentApp.aname.focus();
			return false;
		}
		else
		{
			if (document.rentApp.aname.value != (document.rentApp.firstname.value + ' ' + document.rentApp.lastname.value))
			{
				alert('You must specify a valid name for authorization (it MUST match the first and last name provided on the application).');
				document.rentApp.aname.select();
				return false;
			}
		}
		
		if (document.rentApp.adate.value == '')
		{
			alert("You must specify a valid date for authorization.");
			document.rentApp.adate.focus();
			return false;
		}

		document.rentApp.adate.disabled = false;
		return true;
	}