//<LINK name="author" HREF="http://www.holderness.eu">
//<LINK name="license" TYPE="free to nonprofit organisations; others make an offer - see:" HREF="http://www.holderness.eu/js.htm">
//<META name="warning" content="I am actively looking for test cases to prosecute!">

var updated="26/12/2006";

function lpcd_init() {
	in_dat = new Array("UK","IE","DE","FR");
	pe_dat = new Array("UK","IE","DE","FR","other");

	in_dat["UK"] = new Array();
/*** in_dat *must* have a dat in entry 1 dated before the rules kicked in,
     with the prevailing rate, and a final entry for date of the next change
***/
in_dat["UK"][ 0] = new idet("Bank of England rate","simple",0);
in_dat["UK"][ 1] = new idat("rate change",	"08/10/1998",	7.25,	15.25);
in_dat["UK"][ 2] = new idat("LPCD(I) Act",	"01/11/1998",	7.25,	15.25);
in_dat["UK"][ 3] = new idat("rate change",	"05/11/1998",	6.75,	14.75);
in_dat["UK"][ 4] = new idat("rate change",	"10/12/1998",	6.25,	14.25);
in_dat["UK"][ 5] = new idat("Year end   ",	"31/12/1998",	6.25,	14.25);
in_dat["UK"][ 6] = new idat("rate change",	"07/01/1999",	6,	14);
in_dat["UK"][ 7] = new idat("rate change",	"04/02/1999",	5.5,	13.5);
in_dat["UK"][ 8] = new idat("rate change",	"08/04/1999",	5.25,	13.25);
in_dat["UK"][ 9] = new idat("rate change",	"10/06/1999",	5,	13);
in_dat["UK"][10] = new idat("rate change",	"08/09/1999",	5.25,	13.25);
in_dat["UK"][11] = new idat("rate change",	"04/11/1999",	5.5,	13.5);
in_dat["UK"][12] = new idat("Year end   ",	"31/12/1999",	5.5,	13.5);
in_dat["UK"][13] = new idat("rate change",	"13/01/2000",	5.75,	13.75);
in_dat["UK"][14] = new idat("rate change",	"10/02/2000",	6,	14);
in_dat["UK"][15] = new idat("<B>Small business exemption ends</B>",	"01/11/2000",	6,	14);
in_dat["UK"][16] = new idat("Year end  ",	"31/12/2000",	6,	14);
in_dat["UK"][17] = new idat("rate change",	"08/02/2001",	5.75,	13.75);
in_dat["UK"][18] = new idat("rate change",	"05/04/2001",	5.5,	13.5);
in_dat["UK"][19] = new idat("rate change",	"10/05/2001",	5.25,	13.25);
in_dat["UK"][20] = new idat("rate change",	"02/08/2001",	5,	13);
in_dat["UK"][21] = new idat("rate change",	"18/09/2001",	4.75,	12.75);
in_dat["UK"][22] = new idat("rate change",	"04/10/2001",	4.5,	12.5);
in_dat["UK"][23] = new idat("rate change",	"08/11/2001",	4,	12);
in_dat["UK"][24] = new idat("Year end  ",	"31/12/2001",	4,	12);
in_dat["UK"][25] = new idat("EU Directive",	"07/08/2002",	4,	12);
in_dat["UK"][26] = new idat("Year end   ",	"31/12/2002",	4,	12);
in_dat["UK"][27] = new idat("Half-year  ",	"30/06/2003",	3.75,	11.75);
in_dat["UK"][28] = new idat("Year end   ",	"31/12/2003",	3.75,	11.75);
in_dat["UK"][29] = new idat("Half-year  ",	"30/06/2004",	4.5,	12.5);
in_dat["UK"][30] = new idat("Year end   ",	"31/12/2004",	4.75,	12.75);
in_dat["UK"][31] = new idat("Half-year  ",	"30/06/2005",	4.75,	12.75);
in_dat["UK"][32] = new idat("Year end   ",	"31/12/2005",	4.5,	12.5);
in_dat["UK"][33] = new idat("Half-year  ",	"30/06/2006",	4.5,	12.5);
in_dat["UK"][34] = new idat("Year end   ",	"31/12/2006",	5,	13);	
in_dat["UK"][35] = new idat("Half-year  ",	"30/06/2007",	5.5,	13.5);	
in_dat["UK"][36] = new idat("Year end   ",	"31/12/2007",	5.5,	13.5);	
in_dat["UK"][37] = new idat("Half-year  ",	"30/06/2008",	5,	13);	
in_dat["UK"][38] = new idat("Year end   ",	"31/12/2008",	2,	10);	
in_dat["UK"][39] = new idat("Half-year  ",	"30/06/2009",	0.5,	8.5);	
in_dat["UK"][40] = new idat("Year end   ",	"31/12/2009",	0,	0);	

	pe_dat["UK"] = new Array();

pe_dat["UK"][ 0] = new pdet("the United Kingdom","GBP","Late Payment of Commercial Debts Act 1998, as amended by Statutory Instrument 2002 No. 1674");
pe_dat["UK"][ 1] = new pdat("07/08/2002",  	0,   40);
pe_dat["UK"][ 2] = new pdat("07/08/2002", 1000,	 70);
pe_dat["UK"][ 3] = new pdat("07/08/2002",10000, 100);

	in_dat["IE"] = new Array();

in_dat["IE"][ 0] = new idet("European Central Bank rate","simple",5);
in_dat["IE"][ 1] = new idat("rate change",	"09/11/2001",	3.25,	10.25);
in_dat["IE"][ 2] = new idat("EU Directive",	"08/08/2002",	3.25,	10.25);
in_dat["IE"][ 3] = new idat("Year end   ",	"31/12/2002",	2.75,	9.75);
in_dat["IE"][ 4] = new idat("Half-year  ",	"30/06/2003",	2,	9);
in_dat["IE"][ 5] = new idat("Year end   ",	"31/12/2003",	2,	9);
in_dat["IE"][ 6] = new idat("Half-year  ",	"30/06/2004",	2,	9);
in_dat["IE"][ 7] = new idat("Year end   ", 	"31/12/2004",	2,	9);
in_dat["IE"][ 8] = new idat("Half-year  ",	"30/06/2005",	3,	10);
in_dat["IE"][ 9] = new idat("Year end   ",	"31/12/2005",	3.25,	10.25);
in_dat["IE"][10] = new idat("Half-year  ",	"30/06/2006",	3.75,	10.75);
in_dat["IE"][11] = new idat("Year end   ",	"31/12/2006",	4.5,	11.5);
in_dat["IE"][12] = new idat("Half-year  ",	"30/06/2007",	5,	12);
in_dat["IE"][13] = new idat("Year end   ",	"31/12/2006",	5,	12);
in_dat["IE"][14] = new idat("Half-year  ",	"30/06/2008",	5.25,	12.25);
in_dat["IE"][15] = new idat("Year end   ",	"31/12/2008",	2,	9);
in_dat["IE"][16] = new idat("Half-year  ",	"30/06/2009",	0.25,	7.25);
in_dat["IE"][17] = new idat("Year end   ",	"31/12/2009",	0,	0);

	pe_dat["IE"] = new Array();

pe_dat["IE"][ 0] = new pdet("the Republic of Ireland","EUR","European Communities (Late Payment in Commercial Transactions) Regulations 2002 [S.I. No. 388]");
pe_dat["IE"][ 1] = new pdat("08/08/2002",  	0,   40);
pe_dat["IE"][ 2] = new pdat("08/08/2002", 1000,	 70);
pe_dat["IE"][ 3] = new pdat("08/08/2002",10000, 100);

	in_dat["DE"] = new Array();

in_dat["DE"][ 0] = new idet("European Central Bank rate","compound",0);
in_dat["DE"][ 1] = new idat("initial rate",	"25/11/2001",	3.62,	11.62);
in_dat["DE"][ 2] = new idat("Law takes effect",	"26/11/2001",	3.62,	11.62); // Checking effective date
in_dat["DE"][ 3] = new idat("Year end   ",	"31/12/2001",	3.25,	11.25); 
in_dat["DE"][ 4] = new idat("Half-year  ",	"30/06/2002",	3.25,	11.25);
in_dat["DE"][ 5] = new idat("Year end   ",	"01/01/2003",	2.75,	10.75); 
in_dat["DE"][ 6] = new idat("Half-year  ",	"30/06/2003",	2,	10);
in_dat["DE"][ 7] = new idat("Year end   ",	"01/01/2004",	2,	10);
in_dat["DE"][ 8] = new idat("Half-year  ",	"30/06/2003",	2,	10);
in_dat["DE"][ 9] = new idat("Year end   ", 	"01/01/2005",	2,	10);
in_dat["DE"][10] = new idat("Half-year  ",	"30/06/2005",	3,	11);
in_dat["DE"][11] = new idat("Year end   ",	"31/12/2005",	3.25,	11.25);
in_dat["DE"][12] = new idat("Half-year  ",	"30/06/2006",	3.75,	11.75);
in_dat["DE"][13] = new idat("Year end   ",	"31/12/2006",	4.5,	12.5);
in_dat["DE"][14] = new idat("Half-year  ",	"30/06/2007",	5,	13);
in_dat["DE"][15] = new idat("Year end   ",	"31/12/2006",	5,	13);
in_dat["DE"][16] = new idat("Half-year  ",	"30/06/2008",	5.25,	13.25);
in_dat["DE"][17] = new idat("Year end   ",	"31/12/2008",	2,	10);
in_dat["DE"][18] = new idat("Half-year  ",	"30/06/2009",	0.25,	8.25);
in_dat["DE"][19] = new idat("Year end   ",	"31/12/2009",	0,	0);

	pe_dat["DE"] = new Array();

pe_dat["DE"][ 0] = new pdet("Germany","EUR","Gesetz zur Modernisierung des Schuldrechts, vom 26. November 2001");
pe_dat["DE"][ 1] = new pdat("08/08/2002",    0,  NaN); // Don't know!
pe_dat["DE"][ 2] = new pdat("08/08/2002", 1000,	 NaN);
pe_dat["DE"][ 3] = new pdat("08/08/2002",10000,  NaN);

	in_dat["FR"] = new Array();

in_dat["FR"][ 0] = new idet("European Central Bank rate","compound",0);
in_dat["FR"][ 1] = new idat("rate change",	"31/08/2001",	4.25,	11.25);
in_dat["FR"][ 2] = new idat("Law takes effect",	"08/09/2001",	4.25,	11.25);
in_dat["FR"][ 3] = new idat("Year end  ",	"31/12/2001",	3.25,	10.25); 
in_dat["FR"][ 4] = new idat("Half-year ",	"30/06/2002",	3.25,	10.25);
in_dat["FR"][ 5] = new idat("Year end  ",	"31/12/2002",	2.75,	 9.75); 
in_dat["FR"][ 6] = new idat("Half-year ",	"30/06/2003",	2,	 9);
in_dat["FR"][ 7] = new idat("Year end  ",	"31/12/2003",	2,	 9);
in_dat["FR"][ 8] = new idat("Half-year ",	"30/06/2004",	2,	 9);
in_dat["FR"][ 9] = new idat("Year end  ", 	"31/12/2004",	2,	 9);
in_dat["FR"][10] = new idat("Half-year ",	"30/06/2005",	3,	 10);
in_dat["FR"][11] = new idat("Year end  ",	"31/12/2005",	3.25,	10.25);
in_dat["FR"][12] = new idat("Half-year ",	"30/06/2006",	3.75,	10.75);
in_dat["FR"][13] = new idat("Year end  ",	"31/12/2006",	4.5,	11.5);
in_dat["FR"][14] = new idat("Half-year ",	"30/06/2007",	5,	12);
in_dat["FR"][15] = new idat("Year end  ",	"31/12/2006",	5,	12);
in_dat["FR"][16] = new idat("Half-year ",	"30/06/2008",	5.25,	12.25);
in_dat["FR"][17] = new idat("Year end  ",	"31/12/2008",	2,	9);
in_dat["FR"][18] = new idat("Half-year ",	"30/06/2009",	0.25,	7.25);
in_dat["FR"][19] = new idat("Year end ",	"31/12/2009",	0,	0);

	pe_dat["FR"] = new Array();

pe_dat["FR"][ 0] = new pdet("France","EUR","Loi 2001-420 du 15 Mai 2001 et D&eacute;cret N&ordm; 2001/210 du 07 Mars 2001");
pe_dat["FR"][ 1] = new pdat("08/08/2002",    0, NaN); // Don't know!
pe_dat["FR"][ 2] = new pdat("08/08/2002", 1000,	NaN);
pe_dat["FR"][ 3] = new pdat("08/08/2002",10000, NaN);

	pe_dat["other"] = new Array();

pe_dat["other"][ 0] = new pdet("Other countries","EUR","(legislation not yet coded)");
pe_dat["other"][ 1] = new pdat("01/01/1970",    0, NaN); // Don't know!
pe_dat["other"][ 2] = new pdat("01/01/1970", 1000, NaN);
pe_dat["other"][ 3] = new pdat("01/01/1970",10000, NaN);
}; /* lpcd_init */

function lpcd(interest,penalty,jurisdiction,currency,cont_date,due_date,stmt_date,amount,detail) {
var intr=0;
var imsg="<TD colspan=3></TD>";
var penl=-1; /* "do not change" flag */
var itot=-1;
var lday=noDate;
var dgap=0;
var cuml=0;
var expl="";
var errx="<TR><TD></TD><TD class=\"x\" colspan=6>";
var penx="<TR><TH class=\"n\"><B>Compensation</B></TD>";
var isdata=false;
var lastd=noDate;
var juri_name="other";
var legislation="question";

function announce(msg) {
	if (detail) {
		expl+=msg;
	}
};

function announce_initial(ix) {
	with (in_dat[juri][ix]) {
		announce("<TR><TD class=\"e\"><B>Amount&nbsp;overdue</B></TD><TD class=\"n\">"+showDate(dued)+"</TD><TD class=\"n\">"+showNum(rate,3)+"</TD><TD class=\"n\">"+showNum(rate2,3)+"</TD><TD class=\"n\">"+showNum(dgap,0)+"</TD><TD class=\"n\">"+showNum(intr,4)+"</TD><TD class=\"a\">"+showNum(cuml,2)+"</TD></TR>")
	}
}

	juri=getValue(jurisdiction);
	curn=whichSelected(currency);
	cond=fetchDate(cont_date);
	dued=fetchDate(due_date);
	stmd=fetchDate(stmt_date);
	amnt=checkAmount(amount,false,2,"_NO_MSG");
	if (!in_dat[juri]) {
		announce(
			errx+"We do not yet have data on the interest due on contracts in <B>"+juri+"</B>.</TD></TR>")
	}
	else if (!pe_dat[juri]) {
		announce(
			errx+"We do not yet have data on the penalties due on contracts in <B>"+juri+"</B>.</TD></TR>")
	}
	else { /* have country data */
		ityp=in_dat[juri][0].type;
	juri_name=pe_dat[juri][0].name;
		legislation=pe_dat[juri][0].legl;
		lastd=(in_dat[juri][in_dat[juri].length-1].date);
		if (cond=="NOT_A_DATE" || dued=="NOT_A_DATE" || stmd=="NOT_A_DATE" || isNaN(amnt)) {
			announce(
				errx+"<P>You haven't entered enough information for us to calculate interest. We need at least:</P>\n<UL>"
				+"<LI>Date work was agreed (contract date);</LI>"
				+"<LI>Date payment was due;</LI>"
				+"<LI>Amount that was due; and</LI>"
				+"<LI>Date of issue of your statement.</LI></UL></TD></TR>")
		}
		else if (dued>stmd) {
			penl=0;
			itot=0;
			announce(
				errx+"The debt was not yet overdue on the statement date of "+showDate(stmd)+"</TD></TR>")
		}
		else { /* OK to try interest, then penalty */
			itot=0; /* do putValue */
			if (cond<in_dat[juri][2].date) {
				announce(
					errx+"No interest is chargeable for (private-sector) contracts made before "+showDate(in_dat[juri][2].date)+" in <B>"+juri+"</B>.</TD></TR>");
				intr=0;
			}
		else if (stmd>=lastd) {
				announce(
					errx+"Sorry, but if we knew what interest rates would apply after "+showDate(lastd)+" we wouldn't be telling.</TD></TR>\n")
			}
			else {
				i=1;
				while (i<in_dat[juri].length && in_dat[juri][i].date<dued) {
					i++
				}
				if (i<=1) { 
					announce(
						errx+"Sorry, there seems to have been an error: is the amount due on <B>"+showDate(dued)+"</B>?</TD>\n")
				}
				else {
					isdata=true;
					cuml=amnt;
					next=in_dat[juri][i].date;
					announce(
						"<TR><TH class=\"e\">Event</TH><TH>Date</TH><TH>"+in_dat[juri][0].name+"</TH><TH>Penalty rate</TH><TH>Days</TH><TH>Interest</TH><TH class=\"a\">Total</TH></TR>\n");
					with(in_dat[juri][i-1]) {
//**
						announce("<TR><TD class=\"e\">Rate set</TD><TD class=\"n\">"+showDate(date)+"</TD><TD class=\"n\">"+showNum(rate,3)+"</TD><TD class=\"n\">"+showNum(rate2,3)+"</TD><TD class=\"n\">-</TD><TD class=\"n\">-</TD><TD class=\"n\"><IMG SRC=\"gif/c_"+curn+".gif\"></TD></TR>")
						if (ityp=="simple")  {
							dgap=((stmd-dued)/daylen);
							intr=amnt*dgap*rate2/36500;
							announce_initial(i-1);
							cuml+=intr;
							itot+=intr;
							cuml=amnt+itot;
/**/
						} 
						else {
							if (next>stmd) { /* single-line special case */
								dgap=((stmd-dued)/daylen);
							}
							else {
								dgap=((next-dued)/daylen);
							}
							intr=amnt*dgap*rate2/36500;
							announce_initial(i-1);
							cuml+=intr;
							itot+=intr;
							while (i<in_dat[juri].length && in_dat[juri][i].date<stmd) {
								next=in_dat[juri][i+1].date;
								with (in_dat[juri][i]) {
									if (next>stmd) {
										dgap=((stmd-date)/daylen)
									}
									else {
										dgap=((next-date)/daylen)
									}
									intr=cuml*dgap*rate2/36500;
									announce(
										"<TR><TD class=\"e\">"+event+"</TD><TD class=\"n\">"+showDate(date)+"</TD><TD class=\"n\">"+showNum(rate,3)+"</TD><TD class=\"n\">"+showNum(rate2,3)+"</TD><TD class=\"n\">"+showNum(dgap,0)+"</TD><TD class=\"n\">"+showNum(intr,4)+"</TD><TD class=\"a\">"+showNum(cuml,2)+"</TD></TR>\n");
									cuml+=intr;
									itot+=intr;
								}
								i++
							} /* if ityp=="simple" else */
						}
					}
					if (itot<in_dat[juri][0].mini) {
						itot=0;
						cuml=amnt;
						imsg="<TD class=\"e\" colspan=3>Minimum interest is <B>"+pe_dat[juri][0].curn+"</B>&nbsp;"+in_dat[juri][0].mini+"</TD>";
					}
					announce(
						"<TR><TD class=\"e\"><B>Statement</B></TD><TD class=\"n\">"+showDate(stmd)+"</TD>"+imsg+"<TD class=\"a\">"+showNum(itot,2)+"</TD><TD class=\"a\">"+showNum(cuml,2)+"</TD></TR>\n")
				}
			}
			/* try penalty: */
			if (dued>=stmd || amnt<=0) {
				penl=0; /* then putValue 0 */
			}
			else {
				i=pe_dat[juri].length-1;
				if (isNaN(pe_dat[juri][i].penl)) {
					announce(penx+"<TD colspan=5>Don't know whether there is compensation in <B>"+juri+"</B></TD><TD class=\"n\"><B>?</B></TD></TR>\n")
				}
				else {
					while (i>0 && (cond<pe_dat[juri][i].date || amnt<pe_dat[juri][i].thrh)) {
						i--
					}
					if (i==0) {
						penl=0; /* then putValue 0 */
						announce(
							penx+"<TD colspan=5>No compensation on <B>"+juri+"</B> contracts before "+showDate(pe_dat[juri][1].date)+"</TD><TD class=\"n\">0.00</TD></TR>\n")
					}
					else {
						if (pe_dat[juri][0].curn==curn) {
							penl=pe_dat[juri][i].penl; /* then putValue penl */
							cuml+=penl;
							announce(
								penx+"<TD colspan=5></TD><TD class=\"n\"><B>"+showNum(penl,2)+"</B></TD></TR>\n")
						}
						else { /* penl==-1; don't putValue - leave anything entered */
							announce(
								penx+"<TD colspan=5>Compensation is <B>"+pe_dat[juri][0].curn+"</B> "+showNum(pe_dat[juri][i].penl,2)+": please convert to "+curn+"</TD><TD class=\"n\"><B>?</B></TD></TR>\n")
						}
					}
				}
			}
		} /* gross errors else */
	} /* no country data else */
		
	if (itot>-1) {
		putValue(interest,showNum(itot,2),true)
	}
	if (penl>-1) {
		putValue(penalty,showNum(penl,2),true);
	}
	if (detail) { /* report results */
		if (isdata) {
			expl+="<TR><TH class=\"n\"><B>Total</B></TD><TD colspan=5></TD><TD class=\"n\"><B>"+showNum(cuml,2)+"</B></TD></TR>\n"
		}
		head="<TITLE>Late payment interest calculation</TITLE>\n"
			+"<LINK rel=\"stylesheet\" type=\"text/css\" href=\"interest.css\" title=styleSums>\n"
			+"<SCRIPT type=\"text/javascript\" language=\"JavaScript1.3\">"
			+"function closeMsg(){self.window.close()}\n"
			+"</SCRIPT></HEAD><BODY><TABLE id=\"sizer\"><TR><TD class=\"h\" colspan=6 rowspan=2 width=400><H1>Interest calculation</H1></TD><TD width=30 class=\"l\"><A HREF=\"javascript:print()\">Print</A></TD></TR><TR><TD class=\"l\"><A HREF=\"javascript:closeMsg()\">Close</A></TD></TR>"
			+"<TR><TD class=\"h\" colspan=7><P>The sum due under contract of "+showDate(cond)+" was <B>"+curn+"</B>&nbsp;"+showNum(amnt,2)+"; the jurisdiction is "+juri_name+" (<B>"+juri+"</B>) and the legislation is the <CITE>"+legislation+"</CITE>. ";
		if (isdata) {
			head+=" Interest is <B>"+ityp+"</B> and rates are valid until "+showDate(lastd)+".</P>\n<TABLE>\n"
		}
		head+="</P></TD></TR><TR><TD></TD><TD></TD><TD></TD><TD></TD><TD></TD><TD></TD><TD></TD></TR>\n";
		expl+="<TR><TD>&nbsp;</TD></TR>";
		if (isdata) {
			expl+="<TR><TD><H4>Notes:<H4></TD>"
				+"<TD colspan=6><B>The ("+ityp+") interest is:</B><BR>";
			if (ityp=="simple") {
				expl+="the original amount due<BR>"
			}
			else {
				expl+="the amount due at the &quot;event&quot; date that starts the period<BR>"
			}
			expl+="&times; the percentage annual interest rate &divide; 100<BR>"
				+"&times; the number of days until the statement &divide; 365</TD></TR>"
				+"<TR><TD>&nbsp;</TD>";
		}
		expl+="<TR><TD></TD><TD class=\"e\" colspan=6><P class=\"furniture\">Design and scripting <A HREF=\"c-strict.html\">&copy;</A> "+updated+" <A class=\"external\" target=\"elsewhere\" HREF=\"http://www.holderness.eu\">Mike Holderness</A>. "
			+"Though every effort has been made to interpret the legislation precisely  this calculation is a guide only and is offered as is without warranty express or implied. "
			+"Note that this version gives you an hour's &quot;extra&quot; interest when the clocks go back and <I>vice versa</I> and that though the amount is small it can affect rounded totals.</P></TD></TR>"
			+"</TABLE></BODY></HTML>";
		window.defaultStatus="*";
		window.status="";
		closeWait(false);
		resultsWin=popUp("results",500,head+expl);
	} /* report */
	return !detail;
};

function twoWorkingDaysAfter(thisdate) {
var workday=0;
	if (thisdate!=noDate) {
		while (workday<3) {
			thisdate.setDate(thisdate.getDate()+1);
			day=thisdate.getDay();
			if (day>0 && day <6) {workday++}
		}
	}
	return thisdate;
};

function checkInTime(thisfld,jurifld,msg) {
var fieldOK=true;
	juri=getValue(jurifld);
	limit=pe_dat[juri][0].time;
	errorM.val="if your "+msg+" was <EM>really</EM> more than "+limit+" years ago, sorry, it is probably unenforceable in <B>"+juri+"</B>";
	dat1=fetchDate(thisfld,false,false,"");
	if (dat1!=noDate && today-dat1>(limit*365.25+1)*daylen && today.getUTCFullYear()-dat1.getUTCFullYear()<=methuselah) {
		showDatErr=addNote(showDatErr,errorM,"D");
		addMsg(thisfld,errorM.val);
		fieldOK=false;
	}
	formOK=formOK && fieldOK;
	return fieldOK
};

/* object constructor functions */

function idet(name,type,mini) {
	this.name = name;
	this.type = type;
	this.mini = mini;
};

function idat(event,datest,rate,rate2) {
	this.event = event;
	this.date = makeDate(datest,"z_StatementInterest",true,"<B>Internal error in idat</B>: "+datest);
	this.rate  = rate;
	this.rate2 = rate2;
};

function pdet(name,curn,legl,time) {
	this.name = name;
	this.curn = curn;
	this.legl = legl;
	this.time = time;
};

function pdat(datest,thrh,penl) {
	this.date = makeDate(datest,"z_StatementInterest",true,"<B>Internal error in pdat</B>: "+datest);
	this.thrh = thrh;
	this.penl = penl;
};

/*
function generateError() {
	foo=document.nonexistentproperty;
	bar=document.nonexistentmethod();
};
*/
// end of script 