function SwitchTab_(F,B,D,A,C){var E=F.options[F.selectedIndex].value;ShowTab(document.getElementById("d1"),E==B,new Array("c1PropVal","r1PropVal","c1LoanAmt","c1MinLoanAmt","r1LoanAmt","cFTHB"));ShowTab(document.getElementById("d2"),E==D,new Array("c2PropVal","r2PropVal","c2LoanAmt","c2MinLoanAmt","r2LoanAmt","cCO","rCO"));
ShowTab(document.getElementById("d3"),E==A||E==C,new Array("c3PropVal","r3PropVal","c3LoanAmt","c3MinLoanAmt","r3LoanAmt"));o=document.getElementById("rbRL1");if(!o.checked){o=document.getElementById("rbRL0")
}REAgentChng(o)}function REAgentChng(A){document.getElementById("dPP").className=(A.checked&&A.value=="1"?"vis":"hid")}function PVLostFoc(A){document.acForm.t1PropVal.value=document.acForm.t2PropVal.value=document.acForm.t3PropVal.value=A.value
}function LALostFoc(A){document.acForm.t1LoanAmt.value=document.acForm.t2LoanAmt.value=document.acForm.t3LoanAmt.value=A.value}
function PUChng_(sh,ip){var pu=document.acForm.dlPropUsage.value;if(document.acForm.rbFTHB1.checked&&pu==sh)document.acForm.rbFTHB1.checked=document.acForm.rbFTHB0.checked=false;if(document.acForm.rbFHA.checked&&(pu==sh||pu==ip))document.acForm.rbFHA.checked=false;}
function FTHBCng_(A){if(document.acForm.rbFTHB1.checked&&document.acForm.dlPropUsage.value==A){alert("Second home is not available for first time home buyer.");document.acForm.dlPropUsage.selectedIndex=0}};
function FHACng_(sh,ip){var pu = document.acForm.dlPropUsage.value;if(document.acForm.rbFHA.checked && (pu == sh || pu == ip)){alert("Second home and investment property is not enabled for FHA loans.");document.acForm.dlPropUsage.selectedIndex=0;}}
function LCCng_(a){var fha = document.acForm.rbFHA.checked;for(var i=0; i<a.length; i++){var o = gebi("t" + a[i]);if(fha)o.checked = false;Disable(o, fha);Disable(gebi("l" + a[i]), fha);}}
function trim(str)
{
	return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}
var _zip;
function OnZip()
{
	var o = gebi('tZip');
	var val = trim(o.value);
	if(val.length >= 5)
	{
		var zip = val.substring(0, 5);
		if(_zip != zip)
		{
			_zip = zip;
			var dlCounty = gebi('dlCounty');
			dlCounty.length = 0;
			var opt = new Option();
			opt.text = "Loading...";
			dlCounty.options[0] = opt;
			lrm_json.invoke("../../services/county.aspx", [{key:"zip",val:zip}], county);
		}
	}
}
function county(o)
{
	var dlCounty = gebi('dlCounty');
	dlCounty.length = 0;
	var opt = new Option();
	opt.value = "0";
	opt.text = "- County -";
	dlCounty.options[0] = opt;
	if(o == null)
		return;
	for(var i=0; i<o.length;)
	{
		var a = o[i];
		opt = new Option();
		opt.value = a[0];
		opt.text = a[1];
		dlCounty.options[++i] = opt;
		if(a.length > 2)
			dlCounty.selectedIndex = i;
	}
}
function ShowID(id,b){gebi(id).className=(b?"vis":"hid");}
function Disable(o,b){o.disabled=b;}
