function popupWindow(name){
	window.open('popups/eviction/'+(name),'popupwindow','width=400,height=400,scrollbars=1');
	
	}

function unmaskmoney(which)
{
  rtrn = which.value;
  rtrn = rtrn.replace(/,/g, "");
  rtrn = rtrn.replace(/\$/g, "");
  return parseFloat(rtrn);
}

function unmaskpercent(which)
{
  rtrn = which.value;
  rtrn = rtrn.replace(/\%/g, "");
  return parseFloat(rtrn);
}

function dopercent(which)
{
  var pc = unmaskpercent(which);
  var rt = unmaskmoney(document.MyForm.rent);
  var lt = Math.round(rt * pc) / 100;
  if (!isNaN(lt))
  {
    document.MyForm.laterent.realValue = lt;
    document.MyForm.laterent.refresh();
  }
}

function dolate(which)
{
  var lt = unmaskmoney(which);
  var rt = unmaskmoney(document.MyForm.rent);
  var pc = Math.round((lt/rt) * 10000) / 100;
  if (!isNaN(pc))
  {
    document.MyForm.percent.realValue = pc;
    document.MyForm.percent.refresh();
  }
}

function doLatefee(yorn)
{
  if (yorn == "Yes"){
   latestuff.style.display = "block";
 } else{
    latestuff.style.display = "none";
}
showSubmit();
}

function showSubmit(){
	submitty.style.display = "block";
	}
	
function doError(er,name){
	alert(er.error);
	document.MyForm(name).focus();
	}
	
function checkEm(){
	with(document.MyForm){
		if((lessor.value !== "") && (evicteename.value !== "") && (propertyaddress.value !== "") && (city.value !== "") && (county.value !== "") && (state.value !== "") && (zip.value !== "") && (propertydescription.value !== "") && (rent.value !== "") && (initialdate.value !== "") && (finaldate.value !== "") && (latefee.value !== "") && yesLate()){
		return true;
		}else{
		window.open('popups/eviction/eviction_no_rent_notice_missing.asp','missing','width=400,height=400,scrollbars=1,status=1');
		return false;
		}
		
	}
}

function yesLate(){
	with(document.MyForm){
		if(latefee.value !== "Yes"){
		return true;
		}else{
			if((percent.value !== "") && (laterent.value !== "")){
			return true;
			}else{
			return false;
			}
		}
	}
}

function trySubmit(what){
	with(document.MyForm){
		if((lessor.value !== "") && (evicteename.value !== "") && (propertyaddress.value !== "") && (city.value !== "") && (county.value !== "") && (state.value !== "") && (zip.value !== "") && (propertydescription.value !== "") && lastStuff(what)){
		return true;
		}else{
		window.open('popups/eviction/' + (what),'missing','width=400,height=400,scrollbars=1,status=1');
		return false;
		}
		
	}
}
function lastStuff(what){
	with(document.MyForm){
		if((what == "eviction_notice_to_vacate_missing.asp") || (what == "eviction_notice_to_terminate_tenancy_missing.asp")){
			if (finaldate.value == ""){
			return false;
			}else{
			return true;
			}
		}else if((what == "eviction_notice_to_comply_missing.asp") || (what == "eviction_nuisance_missing.asp")){
			if (reason.value == ""){
			return false;
			}else{
			return true;
			}
		}else{
		return true;
		}
	}
}