//ŠLoan Runner, LLC
function OnLoad()
{
	LoadLoanValues();
	PS_LienCngd(1)
	findObj("resultsIframe").style.borderWidth=0;
	
	LoadIncVer(document.Form1.lbIncVer);
	StripIncVer(document.Form1.ddlIncomeType.options[document.Form1.ddlIncomeType.selectedIndex].value,document.Form1.lbIncVer);
	var btn=findObj('btnSearch');
	if(btn) btn.disabled=false;
	
	try
	{
		var w=window.parent.self.opener;
		if(w.RSL_SetOnSrchPage && w.g_val!=null)
			w.RSL_SetOnSrchPage(w.g_val,true);
	}catch(e){}
}
function PSROnLoad(srchEnd,DTIErr,minWidth)
{
	if(parent)
	{
		if(srchEnd)
		{
			LAOnEndSearch();
			HighlightDTIFields(DTIErr);
		}

		if(window.name!="resultsIframe")
			resizeSelf();
		else
		{
			resizeIframe(minWidth);
			if(srchEnd)
			{
				var p;
				if(window.name=="resultsIframe")
				{
					if(typeof(scrollParentToObj)!='undefined') scrollParentToObj("resultsIframe",false);
				}
			}
		}
	}
}
function LAOnSubmit(btn)
{
	if(typeof(Page_Validators)!='undefined')
	{
		Page_ClientValidate();
		if(Page_IsValid==false) return;
	}
	btn.disabled=true;
	//clear results in iframe
	var i=findObj('resultsIframe');
	var iframeDoc;
	if(i)
	{
		if(i.contentDocument) {
		iframeDoc = i.contentDocument;
		}
		else if(i.contentWindow) {
		iframeDoc = i.contentWindow.document;
		}
		else if(window.frames[i.name]) {
		iframeDoc = window.frames[i.name].document;
		}
		iframeDoc.body.innerHTML='';
		i.style.height = "50px";
		i.style.width = "100%";
	}
	var oDiv=findObj('dSearch');
	oDiv.style.display='block';
	oDiv.style.visibility='visible';
	if(document.Form1.nw)
	{
		document.Form1.target=document.Form1.nw.checked?"_blank":"resultsIframe";
	//alert(document.Form1.resultsIframe.location);
		FormatFields();
	}
}
function FormatFields()
{
	if(document.Form1.tGDI.value == "")
		document.Form1.tGDI.value = "0";
	document.Form1.txtMIncome.value=ToNumeric(document.Form1.txtMIncome.value,0);
	document.Form1.txtMDebt.value=ToNumeric(document.Form1.txtMDebt.value,0);
	document.Form1.tGDI.value=ToNumeric(document.Form1.tGDI.value,0);
	document.Form1.txtMaxCO.value=ToNumeric(document.Form1.txtMaxCO.value,0);
	document.Form1.txtLoanVal.value=ToNumeric(document.Form1.txtLoanVal.value,0);
	document.Form1.txtPropVal.value=ToNumeric(document.Form1.txtPropVal.value,0);
}
function LAOnEndSearch()
{
	var btn=findObjInParent('btnSearch')
	if(btn)
		btn.disabled=false;	
	var oDiv=findObjInParent('dSearch');
	if(oDiv){
		oDiv.style.display='block';
		oDiv.style.visibility='hidden';
	}
}
function HighlightDTIFields(b)
{
	Highlight("txtMDebt",b);
	Highlight("txtLoanVal",b);
	//Highlight("txtDTI",b);
	Highlight("txtMIncome",b);
}
//Calculate DTI
var g_DTI = 0;
var g_bDTIChngd = false;
var g_debtClrsSet = false;
function PS_ResetDebtClrs()
{
	document.Form1.txtDTI.style.backgroundColor=
	document.Form1.txtMIncome.style.backgroundColor=
	document.Form1.txtMDebt.style.backgroundColor="";
}
function PS_HandleNewVal(o,val)
{
	if(o.value!=val)
	{
		PS_Hl(o);
		g_debtClrsSet=true;
	}
	
	o.value=val;
}
function MIncomeChngd(i)
{
return;
	PS_ResetDebtClrs();
	i=ParseFloat(i);
	if(isNaN(i)) return;
	oDti=document.Form1.txtDTI;
	oD=document.Form1.txtMDebt;
	dti=ParseFloat(oDti.value);
	d=ParseFloat(oD.value);
	if(!isNaN(d))
		PS_HandleNewVal(oDti,(i!=0?(ToFixedNum(d/i*100,4)  ):""))
	else
	if(!isNaN(dti))
		PS_HandleNewVal(oD,ToFixedNum(i*dti/100,2,true))
	g_debtClrsSet=false;
}
function MDebtChngd(d)
{
return;
	PS_ResetDebtClrs();
	d=ParseFloat(d);
	if(isNaN(d)) return;
	var oDti=document.Form1.txtDTI;
	var oI=document.Form1.txtMIncome;
	var dti=ParseFloat(oDti.value);
	var i=ParseFloat(oI.value);
	if(!isNaN(i))
		PS_HandleNewVal(oDti,(i!=0?(ToFixedNum(d/i*100,4)):""))
	else
	if(!isNaN(dti))
		PS_HandleNewVal(oI,(dti!=0?(ToFixedNum(d/dti*100,2,true)):""))
	g_debtClrsSet=false;
}
function DTIChngd(dti)
{
return;
	PS_ResetDebtClrs();
	dti=ParseFloat(dti);
	if(isNaN(dti)) return;
	oD=document.Form1.txtMDebt;
	oI=document.Form1.txtMIncome;
	d=ParseFloat(oD.value);
	i=ParseFloat(oI.value);
	if(!isNaN(i))
		PS_HandleNewVal(oD,ToFixedNum(i*dti/100,2,true))
	else
	if(!isNaN(d))
		PS_HandleNewVal(oI,(dti!=0?(ToFixedNum(d/dti*100,2,true)):""))
}
function DTIBlur()
{
return;
	if(!g_debtClrsSet)
		PS_ResetDebtClrs();
	g_debtClrsSet=false;
}
function PS_ResetLoanColors()
{
	document.Form1.txtLoanVal.style.backgroundColor=
	document.Form1.txt1LoanVal.style.backgroundColor=
	document.Form1.txt2LoanVal.style.backgroundColor=
	document.Form1.txtPropVal.style.backgroundColor=
	document.Form1.dlLTV.style.backgroundColor=
	document.Form1.dl2LTV.style.backgroundColor=
	document.Form1.txtCLTV.style.backgroundColor="";
}
function GetDdlVal(ddl) {return ddl.options[ddl.selectedIndex].value}
var g_loan,g_loan1,g_loan2,g_v,g_ltv1,g_ltv2,g_cltv;
var g_oL,g_oL1,g_oL2,g_oV,g_oLTV1,g_oLTV2,g_oCLTV;
function LoadLoanValues()
{
	g_oL=document.Form1.txtLoanVal;
	g_oL1=document.Form1.txt1LoanVal;
	g_oL2=document.Form1.txt2LoanVal;
	g_oV=document.Form1.txtPropVal;
	g_oLTV1=document.Form1.dlLTV
	g_oLTV2=document.Form1.dl2LTV
	g_oCLTV=document.Form1.txtCLTV;
	g_loan=ParseFloat(g_oL.value);
	g_loan1=ParseFloat(g_oL1.value);
	g_loan2=ParseFloat(g_oL2.value);
	g_v=ParseFloat(g_oV.value);
	g_ltv1=ParseFloat(GetDdlVal(g_oLTV1));
	g_ltv2=ParseFloat(GetDdlVal(g_oLTV2));
	g_cltv=ParseFloat(g_oCLTV.value);
}
function PS_ClearLI()
{
	PS_ResetLoanColors();
	g_loan=g_loan1=g_loan2=g_v=g_ltv1=g_ltv2=g_cltv=NaN;
	g_oL.value=g_oL1.value=g_oL2.value=g_oV.value=g_oCLTV.value="";
	g_oLTV1.selectedIndex=g_oLTV2.selectedIndex=0;
	PS_Hl(g_oL); PS_Hl(g_oL1); PS_Hl(g_oL2); PS_Hl(g_oV); PS_Hl(g_oLTV1); PS_Hl(g_oLTV2); PS_Hl(g_oCLTV);
}
function CmpFixed(val1, val2)
{
	return ToFixedNum(val1,10)==ToFixedNum(val2,10)
}
//Calculate LTV
function PS_Hl(o)
{
	if(!o.disabled)
		o.style.backgroundColor="#FEFEDB";
}
function CalcLoan(bL, bL1, bL2, bLTV1, bLTV2, bCLTV, bV)
{
	var bOldL, bOldL1, bOldL2, bOldLTV1, bOldLTV2, bOldCLTV, bOldV;
	bOldL=bL; bOldL1=bL1; bOldL2=bL2; bOldLTV1=bLTV1; bOldLTV2=bLTV2; bOldCLTV=bCLTV; bOldV=bV;
	var oldLoan, oldCltv, oldLtv1, oldLtv2, oldV, oldLoan1, oldLoan2;
	
	//calculate CLTV
	if(!document.Form1.rbS.checked && !bCLTV)
	{
		if(bLTV1&&bLTV2)
		{
			if(!isNaN(g_ltv1)&&!isNaN(g_ltv2))
			{
				oldCltv=g_cltv;
				g_cltv=g_ltv1+g_ltv2;
				g_oCLTV.value=ToFixedNum(g_cltv,4);
				bCLTV=bLTV1=bLTV2=true;
				if(!CmpFixed(oldCltv,g_cltv))
					PS_Hl(g_oCLTV);
			}
		}
	}
	//calculate CLTV
	if(!bCLTV)
	{
		if(bL||bV)
		{
			if(!isNaN(g_loan)&&!isNaN(g_v))
			{
				if(g_v!=0)
				{
					oldCltv=g_cltv;
					g_cltv=g_loan/g_v*100;
					g_oCLTV.value=ToFixedNum(g_cltv,4);
					bCLTV=bL=bV=true;
					if(!CmpFixed(oldCltv,g_cltv))
						PS_Hl(g_oCLTV);
				}
				else
				{
					oldCltv=g_cltv; oldLtv1=g_ltv1; oldLtv2=g_ltv2;
					g_cltv=g_ltv1=g_ltv2=NaN;
					g_oCLTV.value=GetDdlVal(g_oLTV1)=GetDdlVal(g_oLTV2)="";
					if(!CmpFixed(oldCltv,g_cltv))
						PS_Hl(g_oCLTV);
					if(!CmpFixed(oldLtv1,g_ltv1))
						PS_Hl(g_oLTV1);
					if(!CmpFixed(oldLtv2,g_ltv2))
						PS_Hl(g_oLTV2);
				}
			}
		}
	}
	//calculate Total Loan
	if(document.Form1.rbS.checked && !bL)
	{
		if(bV||bCLTV)
		{
			if(!isNaN(g_cltv)&&!isNaN(g_v))
			{
				oldLoan=g_loan;
				g_loan=g_cltv*g_v/100;
				g_oL.value=ToFixedNum(g_loan,2,true);
				bL=bV=bCLTV=true;
				if(!CmpFixed(oldLoan,g_loan))
					PS_Hl(g_oL);
			}
		}
	}
	//calculate Property Value
	if(!bV)
	{
		if(bLTV1&&bL1)
		{
			if(!isNaN(g_ltv1)&&!isNaN(g_loan1))
			{
				oldV=g_v;
				if(g_ltv1!=0)
				{
					g_v=g_loan1/g_ltv1*100;
					g_oV.value=ToFixedNum(g_v,2,true);
					bV=bLTV1=bL1=true;
				}
				else
				{
					g_v=NaN;
					g_oV.value="";
				}
				if(!CmpFixed(oldV,g_v))
					PS_Hl(g_oV);
			}
		}
	}
	if(!bV)
	{
		if(bLTV2&&bL2)
		{
			if(!isNaN(g_ltv2)&&!isNaN(g_loan2))
			{
				oldV=g_v;
				if(g_ltv2!=0)
				{
					g_v=g_loan2/g_ltv2*100;
					g_oV.value=ToFixedNum(g_v,2,true);
					bV=bLTV2=bL2=true;
				}
				else
				{
					g_v=NaN;
					g_oV.value="";
				}
				if(!CmpFixed(oldV,g_v))
					PS_Hl(g_oV);
			}
		}
	}
	//calculate Property Value
	if(!bV)
	{
		//if(document.Form1.rbS.checked && (bCLTV||bL)
		//	|| !document.Form1.rbS.checked && bCLTV && bL)
		if(bCLTV||bL)
		{
			if(!isNaN(g_cltv)&&!isNaN(g_loan))
			{
				oldV=g_v;
				if(g_cltv!=0)
				{
					g_v=g_loan/g_cltv*100;
					g_oV.value=ToFixedNum(g_v,2,true);
					bV=bCLTV=bL=true;
				}
				else
				{
					g_v=NaN;
					g_oV.value="";
				}
				if(!CmpFixed(oldV,g_v))
					PS_Hl(g_oV);
			}
		}
	}
	
	//calculate 2nd Loan
	if(!bL2)
	{
		if(bV&&bLTV2)
		{
			if(!isNaN(g_v)&&!isNaN(g_ltv2))
			{
				oldLoan2=g_loan2;
				g_loan2=g_ltv2*g_v/100;
				g_oL2.value=ToFixedNum(g_loan2,2,true);
				bL2=bV=bLTV2=true;
				if(!CmpFixed(oldLoan2,g_loan2))
					PS_Hl(g_oL2);
			}
		}
	}
	//calculate 1st Loan
	if(!bL1)
	{
		if(bV&&bLTV1)
		{
			if(!isNaN(g_ltv1)&&!isNaN(g_v))
			{
				oldLoan1=g_loan1;
				g_loan1=g_ltv1*g_v/100;
				g_oL1.value=ToFixedNum(g_loan1,2,true);
				bL1=bV=bLTV1=true;
				if(!CmpFixed(oldLoan1,g_loan1))
					PS_Hl(g_oL1);
			}
		}
	}
	
	//calculate 2nd Loan
	if(!bL2)
	{
		if(bL&&bL1)
		{
			if(!isNaN(g_loan)&&!isNaN(g_loan1))
			{
				oldLoan2=g_loan2;
				g_loan2=g_loan-g_loan1;
				if(g_loan2<0)
					g_loan2=oldLoan2;
				else
				{
					g_oL2.value=ToFixedNum(g_loan2,2,true);
					bL2=bL=bL1=true;
					if(!CmpFixed(oldLoan2,g_loan2))
						PS_Hl(g_oL2);
				}
			}
		}
	}
	
	//calculate 1st Loan
	if(!bL1)
	{
		if(bL&&bL2)
		{
			if(!isNaN(g_loan)&&!isNaN(g_loan2))
			{
				oldLoan1=g_loan1;
				g_loan1=g_loan-g_loan2;
				if(g_loan1<0)
					g_loan1=oldLoan1;
				else
				{
					g_oL1.value=ToFixedNum(g_loan1,2,true);
					bL1=bL=bL2=true;
					if(!CmpFixed(oldLoan1,g_loan1))
						PS_Hl(g_oL1);
				}
			}
		}
	}
	
	//calculate CLTV
	if(document.Form1.rbS.checked && !bCLTV)
	{
		if(bLTV1&&bLTV2)
		{
			if(!isNaN(g_ltv1)&&!isNaN(g_ltv2))
			{
				oldCltv=g_cltv;
				g_cltv=g_ltv1+g_ltv2;
				g_oCLTV.value=ToFixedNum(g_cltv,4);
				bCLTV=bLTV1=bLTV2=true;
				if(!CmpFixed(oldCltv,g_cltv))
					PS_Hl(g_oCLTV);
			}
		}
	}
	
	
	//calculate Total Loan
	if(!document.Form1.rbS.checked && !bL)
	{
		if(bV||bCLTV)
		{
			if(!isNaN(g_cltv)&&!isNaN(g_v))
			{
				oldLoan=g_loan;
				g_loan=g_cltv*g_v/100;
				g_oL.value=ToFixedNum(g_loan,2,true);
				bL=bV=bCLTV=true;
				if(!CmpFixed(oldLoan,g_loan))
					PS_Hl(g_oL);
			}
		}
	}
	if(!bL)
	{
		if(bL1&&bL2)
		{
			if(!isNaN(g_loan1)&&!isNaN(g_loan2))
			{
				oldLoan=g_loan;
				g_loan=g_loan1+g_loan2;
				g_oL.value=ToFixedNum(g_loan,2,true);
				bL=bL1=bL2=true;
				if(!CmpFixed(oldLoan,g_loan))
					PS_Hl(g_oL);
			}
		}
	}
	
	if(bOldL!=bL||bOldL1!=bL1||bOldL2!=bL2||bOldLTV1!=bLTV1||bOldLTV2!=bLTV2||bOldCLTV!=bCLTV||bOldV!=bV)
		CalcLoan(bL, bL1, bL2, bLTV1, bLTV2, bCLTV, bV);
	
	//calculate 2nd Loan
	if(!bL2)
	{
		if(bLTV1&&bLTV2)
		{
			if(!isNaN(g_ltv1)&&!isNaN(g_ltv2)&&!isNaN(g_loan1))
			{
				oldLoan2=g_loan2;
				g_loan2=g_loan1*g_ltv2/g_ltv1;
				g_oL2.value=ToFixedNum(g_loan2,2,true);
				bL2=bL1=bLTV1=bLTV2=true;
				if(!CmpFixed(oldLoan2,g_loan2))
					PS_Hl(g_oL2);
			}
		}
	}
	//calculate 1st Loan
	if(!bL1)
	{
		if(bLTV1&&bLTV2)
		{
			if(!isNaN(g_ltv1)&&!isNaN(g_ltv2)&&!isNaN(g_loan2))
			{
				oldLoan1=g_loan1;
				g_loan1=g_loan2*g_ltv1/g_ltv2;
				g_oL1.value=ToFixedNum(g_loan1,2,true);
				bL2=bL1=bLTV1=bLTV2=true;
				if(!CmpFixed(oldLoan1,g_loan1))
					PS_Hl(g_oL1);
			}
		}
	}
	/*
	if(!bL1)
	{
		if(!isNaN(g_loan)&&g_oL2.value=="")
		{
			oldLoan1=g_loan1; oldLoan2=g_loan2;
			g_loan1=g_loan;
			g_loan2=0;
			g_oL1.value=g_oL.value;
			g_oL2.value="0";
			if(!CmpFixed(oldLoan1,g_loan1))
				PS_Hl(g_oL1);
			if(!CmpFixed(oldLoan2,g_loan2))
				PS_Hl(g_oL2);
		}
	}
	*/
	if(bOldL!=bL||bOldL1!=bL1||bOldL2!=bL2||bOldLTV1!=bLTV1||bOldLTV2!=bLTV2||bOldCLTV!=bCLTV||bOldV!=bV)
		CalcLoan(bL, bL1, bL2, bLTV1, bLTV2, bCLTV, bV);
	g_colorsSet=false;
}

var g_colorsSet=false;
function LtvBlur()
{
	if(!g_colorsSet)
		PS_ResetLoanColors();
	g_colorsSet=false;
}
function PropValChngd(v)
{
	g_v=ParseFloat(v);
	if(isNaN(g_v)||v=="") return;
	PS_ResetLoanColors();
	CalcLoan(false, false, false, true, true, false, true);
}
function LoanAmtChngd(loan)
{
	g_loan=ParseFloat(loan);
	if(isNaN(g_loan)||loan=="") return;
	PS_ResetLoanColors();
	CalcLoan(true, false, false, true, true, false, false);
}
function LoanAmt1Chngd(loan)
{
	g_loan1=ParseFloat(loan);
	if(isNaN(g_loan1)||loan=="") return;
	PS_ResetLoanColors();
	CalcLoan(false, true, false, true, true, false, false);
}
function LoanAmt2Chngd(loan)
{
	g_loan2=ParseFloat(loan);
	if(isNaN(g_loan2)||loan=="") return;
	PS_ResetLoanColors();
	CalcLoan(false, false, true, true, true, false, false);
}
function LTV1Chngd(ddl)
{
	var ltv=ddl.options[ddl.selectedIndex].value;
	g_ltv1=ParseFloat(ltv);
	if(isNaN(g_ltv1)||ltv=="") return;
	PS_ResetLoanColors();
	CalcLoan(false, false, false, true, true, false, false);
	g_colorsSet=true;
}
function LTV2Chngd(ddl)
{
	var ltv=ddl.options[ddl.selectedIndex].value;
	g_ltv2=ParseFloat(ltv);
	if(isNaN(g_ltv2)||ltv=="") return;
	PS_ResetLoanColors();
	CalcLoan(false, false, false, true, true, false, false);
	g_colorsSet=true;
}
function CLTVChngd(ltv)
{
	g_cltv=ParseFloat(ltv);
	if(isNaN(g_cltv)||ltv=="") return;
	PS_ResetLoanColors();
	CalcLoan(false, false, false, true, true, true, false);
	g_colorsSet=true;
}
function PS_LienCngd(val)
{
	var b=false;
	if(val==1)
	{
		b=true;
		//g_oL1.value=g_oL2.value=g_oLTV1.value=g_oLTV2.value="";
	}
	Disable(g_oL1,b);Disable(g_oL2,b);Disable(g_oLTV1,b);Disable(g_oLTV2,b);Disable(g_oCLTV,!b);
	Disable(document.Form1.dl2ndLoanType,b);
	document.Form1.txtCLTV.readonly=b;
}
function RecSrch(name)
{
	RecentSrchs_OpenDialog("dialogs/RecentSrchs/",name);
}
function Import()
{
	ImportSrch_OpenDialog("dialogs/ImportSrch/","",window,"");
}
function Export()
{
	var n=document.Form1.p.length;
	if(n==null)
	{
		if(document.Form1.p==null) return false;
		if(!document.Form1.p.checked)
			alert("Please select a g_loan which you want to export to Point.");
		else
		{
			ExportDialog();
			return true;
		}
		return false;
	}
	var c=0;
	for(var i=0;i<n;i++)
		if(document.Form1.p[i].checked) c++;
	if(c==0)
		alert("Please select a g_loan which you want to export to Point.")
	else if(c>1)
		alert("Only one g_loan can be exported to Point.")
	else
	{
		ExportDialog();
		return true;
	}
	return false;
}
function resizeSelf()
{
	if(isPB) return;
	self.window.moveTo(0,0);
	if(!isIE)
		self.window.resizeTo(50,50);
	var h = document.body.scrollHeight;
	if(h>screen.availHeight) h=screen.availHeight;
	else h+=250;
	self.window.resizeTo(screen.availWidth, h);
	return;
}
function resizeIframe(minWidth) {
	if(minWidth==null) minWidth=790;
	var i = findObjInParent(window.name);
	i.style.overflow = "auto";
	i.style.width = minWidth+"px";//"825px";
	//if(!isIE)
	//	i.style.height = "100px";
	var h = document.body.scrollHeight;
	var w = document.body.scrollWidth;
	if(h<=50) h=40;
	i.style.height = (h + 10) + "px";
	var img = findObjInParent("iframePH");
	if(w<minWidth) w=minWidth//if(w<815) w=835;
	img.style.width = (w + 0) + "px";
	i.style.width = "100%";
	i.style.overflow = "hidden";
}
//validation
function VldtCustChap7Y(source, arguments)
{
if(!document.Form1.chbChap7.checked)
	arguments.IsValid=true;
else
	arguments.IsValid=IsValidNum(document.Form1.txtChap7Y.value);
}
function VldtCustChap13Y(source, arguments)
{
if(!document.Form1.chbChap13.checked)
	arguments.IsValid=true;
else
	arguments.IsValid=IsValidNum(document.Form1.txtChap13Y.value);
}
function VldtCustFrclY(source, arguments)
{
if(!document.Form1.chbFrcl.checked)
	arguments.IsValid=true;
else
	arguments.IsValid=IsValidNum(document.Form1.txtFrclY.value);
}/*
function Vldt2ndLoanType(source, arguments)
{
	arguments.IsValid=document.Form1.rbS.checked||document.Form1.dl2ndLoanType.selectedIndex>0;
}*/
function Vldt12LoanVal(source, arguments)
{
	arguments.IsValid=document.Form1.rbS.checked||document.Form1.txt1LoanVal.value.replace(/( )/g, "")!=""&&document.Form1.txt2LoanVal.value.replace(/( )/g, "")!="";
}
function VldtLTV(source, arguments)
{
	arguments.IsValid=document.Form1.rbS.checked||!isNaN(GetDdlVal(document.Form1.dlLTV));
}
function Vldt2LTV(source, arguments)
{
	arguments.IsValid=document.Form1.rbS.checked||!isNaN(GetDdlVal(document.Form1.dl2LTV));
}

function IW(pk)
{
	InWindow('../../admin/program/dialogs/rateAdj.aspx?pk='+pk,'rAdj','width=520,height=520,toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1');
}
function NW(pkt)
{
	InWindow('../../admin/program/dialogs/notes2.aspx?pkt='+pkt,'N','width=600,height=600,toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1');
}
function AE(pk)
{
	InWindow('../../admin/program/dialogs/contactAE.aspx?pk='+pk,'AE','width=600,height=600,toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1');
}
/////
function PS_PurTypeChngd(ddl)
{
	var v=ddl.options[ddl.selectedIndex].value;
	Disable(document.Form1.txtMaxCO,(v=="1"||v=="2"));
}