function RefreshIMG( name) {

	image=document.images[ name ].src;
	tmp = new Date();
	tmp = "?"+tmp.getTime()
	document.images[ name ].src = image+tmp
}

function delHousing(src)
{
    if (confirm('Delete this tenant history record?')) {
      src.form.submit();
    }
}

function delPet(src)
{
    if (confirm('Delete this pet record?')) {
      src.form.submit();
    }
}

function checkAddUserForm()
{
	with (window.document.frmAddUser) {
		if (isEmpty(txtUserName, 'Enter user name')) {
			return false;
		} else if (isEmpty(txtPassword, 'Enter password')) {
			return false;
		} else if (isEmpty(txtFirstName, 'Enter first name')) {
			return false;
		} else if (isEmpty(txtLastName, 'Enter last name')) {
			return false;
		} else if (isEmpty(txtEmail, 'Enter email address')) {
			return false;
		} else if (isEmpty(cboRole, 'Assign a role')) {
			return false;
    } else if (agree.checked == false) {
      alert('Please confirm that you agree with "Terms and conditions"');
      return false;
		} else {
			submit();
		}
	}
}

function LTrim(str)
 {
  var whitespace = new String(" \t\n\r");
  var s1 = new String(str);
  if (whitespace.indexOf(s1.charAt(0)) != -1) {
     var j1=0, i1 = s1.length;
     while (j1 < i1 && whitespace.indexOf(s1.charAt(j1)) != -1)
           j1++;
           s1 = s1.substring(j1, i1);
       }
  return s1;
 }

function checkEditContact(f) {
//' Tenant Information Validation
if (LTrim(document.frmEditContact.txtUserName.value) == "") { 
    document.frmEditContact.txtUserName.focus() 
    document.frmEditContact.txtUserName.select() 
    alert(" You must enter a user name for future access.")
    return false 
} 
if (LTrim(document.frmEditContact.txtPassword.value) == "") { 
    document.frmEditContact.txtPassword.focus() 
    document.frmEditContact.txtPassword.select() 
    alert(" You must enter a password for future access.")
   return false 
} 
if (LTrim(document.frmEditContact.txtPassword2.value) == "") { 
    document.frmEditContact.txtPassword2.focus() 
    document.frmEditContact.txtPassword2.select() 
    alert(" You must enter your password a second time.")
    return false 
} 
if (document.frmEditContact.txtPassword.value != document.frmEditContact.txtPassword2.value) { 
    document.frmEditContact.txtPassword.focus() 
    document.frmEditContact.txtPassword.select() 
    alert(" Your password and verification do not match. Please enter them again.")
    return false 
} 
if (LTrim(document.frmEditContact.txtFName.value) == "") { 
    document.frmEditContact.txtFName.focus() 
    document.frmEditContact.txtFName.select() 
    alert(" You must enter your first name.")
    return false 
    } 
if (LTrim(document.frmEditContact.txtLName.value) == "") { 
    document.frmEditContact.txtLName.focus() 
    document.frmEditContact.txtLName.select() 
    alert(" You must enter your last name.")
    return false 
    } 
if (LTrim(document.frmEditContact.TAddress.value) == "") { 
    document.frmEditContact.TAddress.focus() 
    document.frmEditContact.TAddress.select() 
    alert(" You must enter your current street address.")
    return false 
    } 
if (LTrim(document.frmEditContact.TCity.value) == "") { 
    document.frmEditContact.TCity.focus() 
    document.frmEditContact.TCity.select() 
    alert(" You must enter your current city of residence.")
    return false 
} 
if (LTrim(document.frmEditContact.TProv.value) == "") { 
    document.frmEditContact.TProv.focus() 
    document.frmEditContact.TProv.select() 
    alert(" You must enter your current province of residence.")
    return false 
} 
if (LTrim(document.frmEditContact.TEmail.value) == "") { 
    document.frmEditContact.TEmail.focus() 
    document.frmEditContact.TEmail.select() 
    alert(" You must enter a valid email address.")
    return false 
} 
if (LTrim(document.frmEditContact.TPhone.value) == "") { 
    document.frmEditContact.TPhone.focus() 
    document.frmEditContact.TPhone.select() 
    alert(" You must enter a valid phone.")
    return false 
} 

 return true
}

function checkHousingRecord() {
//' Tenant Information Validation
if (LTrim(document.entryform.TPropName.value) == "") { 
    document.entryform.TPropName.focus();
    document.entryform.TPropName.select(); 
    alert(" You must enter your current residence information.");
    return false 
} 
if (LTrim(document.entryform.TPropAddress.value) == "") { 
    document.entryform.TPropAddress.focus(); 
    document.entryform.TPropAddress.select(); 
    alert(" You must enter your current residence information.");
    return false; 
} 
if (LTrim(document.entryform.TPropCity.value) == "") { 
    document.entryform.TPropCity.focus(); 
    document.entryform.TPropCity.select(); 
    alert(" You must enter your current residence information.");
    return false; 
} 
if (LTrim(document.entryform.TPropMgrName.value) == "") { 
    document.entryform.TPropMgrName.focus(); 
    document.entryform.TPropMgrName.select(); 
    alert(" You must enter your current Property Manager or owners name.");
    return false; 
} 
if (LTrim(document.entryform.HowLongThere.value) == "") { 
    document.entryform.HowLongThere.focus(); 
    document.entryform.HowLongThere.select(); 
    alert(" You must enter how long you've been at this address.");
    return false; 
} 

 return true;
}
