// JavaScript Document

<!--

function DoOpen( url )
{
	alert( 'Doing oidaf' );
	document.open( url );
}

//
// Function: Redirect( in url : string )
//
// Description: Redirects the page to a different url.
//
function Redirect( url )
{
	window.location.href = url;
}

/////////////////////////////////////////////////////////////////////////////////
//
//	Date-based functions.
//
/////////////////////////////////////////////////////////////////////////////////

//
// +Today()
//
// DESCRIPTION:	Returns todays date in the 'unfriendly' format of yyyy-mm-dd
// 
// e.g. 2006-11-19
// e.g. 2006-09-03 
// 
// PRECONDITIONS
//		INPUTS:
//		None.
//		1. The javascript functions: getFullYear(), getMonth(), getDate(), LZ(...).
// POSTONDITIONS
//		OUTPUTS:
//		<Return Value>	: String		- Todays date in the unfriendly format of yyyy-mm-dd
//
function Today()
{
	with( new Date() )
	{
		var y1 = getFullYear(), m1 = getMonth()+1, d1 = getDate();
		var ReturnString = y1 + '-' + LZ(m1) + '-' + LZ(d1);
		
		return ReturnString;
	}
}

function Caption1() {
  //     JAVASCRIPT INCLUDE FILE - (c) J R Stockton  >= 2006-09-03
  //             http://www.merlyn.demon.co.uk/include1.js
  //       Routines may be copied, but URL must not be linked to.
  }

var Inc1T=0

var Site = "Merlyn", Owner = "J R Stockton"

function VSF() { document.writeln( // After Michael Donn
  '<a href="view-source:'+this.location+'">View Source File<\/a>') }


// DynWrite(target, text) (Jim Ley) works on controls, after page load :
// it is a computed function :

// Classify browser :

function GetDocVars() { // set 4 Globals; called in include1.js
  nCheck = 0
  if (DocDom = (document.getElementById?true:false))
                                           nCheck++ // NS6 also IE5
  if (DocLay = (document.layers?true:false))
                                           nCheck++ // NS4
  if (DocAll = (document.all?true:false))
                                           nCheck++ // IE4
  }  GetDocVars() // call *here*

// if (nCheck!=1) alert('Browser classification problem!  nCheck = ' +
//  String(nCheck) + '\nPlease let me know how the page works and what' +
//  ' the\nbrowser is; and, if possible, what needs to be done about it.')

function ReportDocVars() {
  if (nCheck==0)
    document.write(' None of DocDom, DocLay, DocAll is set;',
      ' Dynamic Write will fail.'.italics(), '<p>')
  if (DocDom) document.write(' DocDom is set. ')
  if (DocLay) document.write(' DocLay is set. ')
  if (DocAll) document.write(' DocAll is set. ') }

function TableDocVars() {
  document.writeln('<br><br><table summary="Browser class info"',
    ' bgcolor=blue align=center cellpadding=10 border=4>',
    '<tr><th bgcolor=wheat>For the displaying computer :</th>',
    '</tr><tr><td bgcolor=gainsboro align=center>',
    'Your browser gives<br>',
    '<b>DocAll = ', DocAll, ' ; DocDom = ', DocDom,
    ' ; DocLay = ', DocLay, '.</b><br>',
    'Check : ', nCheck, ' browser classification(s) set.',
    '</td></tr></table>') }

function ShowDocVars() { ReportDocVars() ; TableDocVars() }


// Define Function DynWrite(Where, What) to suit browser :
DocStr=''
if (DocLay) DocStr="return document.layers['NS_'+id]"
if (DocAll) DocStr="return document.all[id]"
if (DocDom) DocStr="return document.getElementById(id)"
GetRef=new Function("id", DocStr)

// DocLay = true ; DocAll = DocDom = false // Simulate NS4.7
DynWarn = 0

if (DocStr=='') { DynWrite=new Function("return false") } else {
  if (DocAll || DocDom) {
    DynWrite=new Function("id", "S", "GetRef(id).innerHTML=S; return true")
    }
// if (DocLay) DynWrite=new Function("id", "S", "var x=GetRef(id).document;"+
//  "x.open('text/html'); x.write(S); x.close(); return true")
if (DocLay) DynWrite=new Function(
    "if (0==DynWarn++)"+
    " alert('DynWrite not supported in \".layers\" browsers');"+
    "return false")
 }


function NoDynLay() {
  if (DocLay) document.writeln(
    '<p><i>Dynamic Writing in a ".layers" browser such as yours ',
    'is difficult and I cannot now test it.  Therefore, ',
    'I don\'t now attempt it. An alert will be given in the ',
    'first use in each load/reload of a page.<\/i>') }

// DynWrite() end.

// Alternative :

function SetgEBI() {
  if (document.all && !document.getElementById) { // e.g. IE4
    document.getElementById = function(id) {
      return document.all[id] } } }

function Wryt(ID, S) { document.getElementById(ID).innerHTML = S }

// General Utilities :

function LS(x) { return String(x).replace(/\b(\d)\b/g, '0$1') }

function LZ(x) { return (x>=10||x<0?"":"0") + x }
function Lz(x) { return (x<10&&x>=0?"0":"") + x } // better ?

function LZZ(x) { return x<0||x>=100?""+x:"0"+LZ(x) }

function lz(x) { var t = String(x)
  return t.length==1 ? "0"+t : t } // slower?

function LdgZero(x) { return "0".substring(x>=10) + x } // ???


if (String.prototype && !String.prototype.substr) {
  String.prototype.substr =
    new Function("J", "K", "return this.substring(J, J+K)") }

function TrimS() { // used for String.prototype.trim  \u00A0?
  return (this.toString() ?
    this.toString().replace(/\s+$|^\s+/g, "") : "") }
String.prototype.trim = TrimS

function Space(N) { var S = "" ; while (N--) S += " " ; return S }

function T8(Str) { // Expands Tab to spaces up to Column 8N (Ej)
  var Lines = Str.split("\n"), L, Parts, Row, P, S8 = "        "
  for (L=0 ; L < Lines.length ; L++) { Parts = Lines[L].split("\t")
    Row = "" ; P = 0 ; while (1) { Row += Parts[P]
      if (++P==Parts.length) break
      Row += S8.substring(Row.length%8) /* 1..8 spaces */ }
    Lines[L] = Row }
  return Lines.join("\n") }


function Sign(X) { return X>0 ? "+" : X<0 ? "-" : " " }

function Sgnd(X) { return Sign(X) + Math.abs(X) }

//function PrfxTo(S, L, C) { var R = S + ""
//  if (C.length>0) while (R.length<L) R = C + R ; return R }

function PrfxTo(S, L, C) { S += ""
  if (C.length>0) while (S.length<L) S = C + S ; return S }

//function SpcsTo(S, L) { var R = S + "" // reduction of PrfxTo
//  while (R.length<L) R = " " + R ; return R }

function SpcsTo(S, L) { S += "" // SpcsTo is a reduction of PrfxTo
  while (S.length<L) S = " " + S ; return S }

function StrU(X, M, N) { // X > -0.5e-N ; to M digits point N digits
  var S = String(Math.round(X*Math.pow(10, N)))
  if (/\D/.test(S)) return SpcsTo(X, M+N+1) // cannot cope
  S = PrfxTo(S, M+N, '0') ; var T = S.length - N
  return S.substring(0, T) + '.' + S.substring(T) }

function StrS(X, M, N) { return Sign(X) + StrU(Math.abs(X), M, N) }

function StrT(X, M, N) { return SpcsTo(StrU(X, 1, N), M+N+2) }

function StrW(X, M, N) { return SpcsTo(StrS(X, 1, N), M+N+2) }

if (!Number.toFixed) { // 20030313
  Number.prototype.toFixed = // JL
    new Function("X",
      "  /* toFixed */ if (!X) X=0\n  return StrS(this, 1, X)") }


function OldSigFigNum(X, N) { // returns a Number
  var p = Math.pow(10, N-Math.ceil(Math.log(Math.abs(X))/Math.LN10))
  return isFinite(p) ? Math.round(X*p)/p : X }


function OldSigFigExp(X, N) { // N<22 , returns a String
  if (X==0) return OldSigFigExp(1, N).replace(/\+1/, ' 0')
  var p = Math.floor(Math.log(Math.abs(X))/Math.LN10)
  if (!isFinite(p)) return X
  return (X>0?'+':"") + String(
    Math.round(X*Math.pow(10, N-p-1))).replace(/(\d)/, "$1.") +
    (p>=0?"e+":"e-") + LZ(Math.abs(p)) } // All OK?



function Expo(E) { return "e" + (E<0?'-':'+') + LZ(Math.abs(E)) }

function GetSEM(X) { // returns Sign Mantissa Exponent (base 10)
  var U, Obj = { S : Sign(X), E : 0, M : X==U?U:Math.abs(X) }
  with (Obj) { if (M==0 || !isFinite(M)) return Obj
    while (M >= 10) { E++ ; M /= 10 }
    while (M < 1.0) { E-- ; M *= 10 } }
  return Obj }

function NumDecSigFig(X, N) { var U // returns a Number
  if (X==0||X==U) return X
  with (GetSEM(X)) var P = Math.pow(10, N-E-1)
  return Math.round(X*P)/P }

function StrSigFigFxd(X, N) { var U // ?? for 2 <= N <= 16 ??
  if (X==U) return " " + U
  with (GetSEM(X)) { var P, Q
    P = Math.pow(10, N-E-1) ; Q = Math.round(Math.abs(X)*P)/P
    return S + StrU(Q, 1, Math.max(1, N-E-1)) } }

function StrSigFigExp(X, N) { // ?? for 2 <= N <= 16 ??
  with (GetSEM(X))
    return S + StrU(M, 1, N-1) + (isFinite(M) ? Expo(E) : " ") }


SigFigNum = NumDecSigFig // OldSigFigNum
SigFigFxd = StrSigFigFxd 
SigFigExp = StrSigFigExp // OldSigFigExp


function SigFigAre() { var IzN = " is now"
  document.write("Across this site,",
    "\nSigFigNum", IzN, FuncName(SigFigNum),
    "\nSigFigFxd", IzN, FuncName(SigFigFxd),
    "\nSigFigExp", IzN, FuncName(SigFigExp)) }



function Div(X, Y) { return Math.floor(X/Y) /* full range */ }

function Mod(X, Y) { return X - Math.floor(X/Y)*Y }


function FuncName(Fn) { // Fn is a function; return space name
  return Fn.toString().match(/( \w+)/)[0] }


function UserIn(Ctrl) { return +eval(Ctrl.value) /* for exprns */ }

function GetNum(X) { return +eval(X.value.replace(/[ ]/g, '')) }

function RadBtns(Rbtn, Arr) { var Q, J=0
  while (Q=Rbtn[J]) { if (Q.checked) return Arr[J] ; J++ } }




// After LRN, altered ( old ones moved to js-boxes 20050527) : 

var BoxW=69

function xSafeHTML(S) { return S.replace(/&/g, "&amp;"). 
    replace(/</g, "&lt;").replace(/>/g, "&gt;") }

function SafeHTML(S) {
  return S.split("&").join("&amp;").split("<").join("&lt;").
    split(">").join("&gt;") } // IAS

function Depikt(X, Y, S, Hue) { // String S is shown in a box
  document.writeln(
    "<p align=center>\n<textarea readonly wrap=virtual",
    " style=\"border: double thick ", Hue || "black", " ;\"",
    " cols=", X, " rows=", Y, ">\n", SafeHTML(S),
    "<\/textarea><\/p>") }

function ShoTrim(St) {
  var match = /\S([\s\S]*\S)*/.exec(St)
  return match ? match[0] : " eh? " }

function ShoLinCnt(St, Mx) { // counts lines when wrapped at     lineLength Mx
  var Ch, j = xj = CR = NL = 0, Len = St.length, X = 1
  while (j<Len) { Ch = St.charCodeAt(j++)
    if (Ch!=10 && Ch!=13) continue
    if (Ch==10) NL++
    if (Ch==13) CR++
    X += Math.max(Math.floor((j-xj-2)/Mx), 0) ; xj = j }
  // In principle, not quite right, as MSIE wraps at whitespace
  return X + Math.max(NL, CR) }

function ShoGen(A) { // see ShoFFF
  var St = "", Len = A.length, j = 0, Vis = 1, Arg, LC = 0
  while (Len>0) {
    Arg = A[j++]
    if (!Arg) { Vis = 0 ; continue }
    Arg = ShoTrim(Arg.toString())
    St += Arg ; if (Vis) LC += ShoLinCnt(Arg, BoxW)
    if (j==Len) break
    St += "\n\n" ; LC += Vis } 
  return {Str:St, Cnt:LC} }

function ShoFFF() { // Args may be functions, but 0 ends visibles
  with (ShoGen(arguments)) Depikt(BoxW, Cnt, Str, "lightgreen") }

function ShoCod(Fn) { // N.B. Fn() should be called externally
  var St = ShoTrim(Fn.toString())
  Depikt(BoxW, ShoLinCnt(St, BoxW), St, "red") }

function ShoOut(Fn) { // N.B. this calls  Fn()
  document.writeln("<pre class=OUT>")
  Fn()
  document.writeln("<\/pre>") }

function ShoDoo(Fn) { // N.B. this calls  Fn() - ADD show others ?
  ShoCod(Fn) ; Fn() }

function ShoDuu(Fn) { // N.B. this calls  Fn() - ADD show others ?
  ShoCod(Fn) ; ShoOut(Fn) }

// .


function eIVSF() {
  Depikt(47, 2, "  For the code, view the source of this page,\n" +
                "     and any include files which it calls.") }


var BID = 0, BoxX = 70


function PopThis(btn) { var Obj = ShoGen(btn.btnargs)
  // Height and Width values need improving
  var Wndw = window.open("", "X"+ +new Date(),
    "height=" + (16*Obj.Cnt+30) + ",width=" + (8*BoxX+20) +
    ",resizable,scrollbars")
  Wndw.document.write("<pre>\n", SafeHTML(Obj.Str), "\n<\/pre>")
  Wndw.document.close() /* DU */ }

function PopBtn() { var I = 'JJ' + BID++ // var BID = 0 precedes
  document.write("<form name=", I, ">",
    "<input type=button name=N value='Pop Code Up'",
    " onClick='PopThis(this)'><\/form>")
  document.close() // DU // ??
  document.forms[I].elements["N"].btnargs = arguments }




function NewPage(Title, Body) { // Same window. Passes TIDY check.
  document.writeln('<!DOCTYPE HTML PUBLIC' +
    ' "-//W3C//DTD HTML 4.01 Transitional//EN"\n' +
    ' "http://www.w3.org/TR/html4/strict.dtd">\n' +
    '<HTML lang="en">\n<HEAD>\n' +
    '<META HTTP-EQUIV="Content-Type"' +
    ' CONTENT="text/html; charset=ISO-8859-1">\n' +
    '<TITLE>' + Site + ' -\n ' +
    Title + '\n  - ' + Owner + '<\/TITLE>\n<\/HEAD>\n<BODY>\n\n' +
    Body + "\n\n<hr>\n<\/BODY>\n</\HTML>\n") }




var Inc1B=0 // end.


function Caption3() {
  //     JAVASCRIPT INCLUDE FILE - (c) J R Stockton  >= 2006-02-08
  //             http://www.merlyn.demon.co.uk/include3.js
  //       Routines may be copied, but URL must not be linked to.
  //               Needs, for LZ at least, include1.js
  }

var Inc3T=0

// Gregorian Date/Time Utilities :


// Date.prototype.getTimezoneOffset = new Function("with (this) return 0 ")


if (String.prototype && !String.prototype.substr) {
  String.prototype.substr =
    new Function("J", "K", "return this.substring(J, J+K)") }


function DoWstr(DoWk) { // Javascript & ISO indexing
  return "SunMonTueWedThuFriSatSun".substr(3*DoWk, 3) }

var Mon3 =
  ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']


Date.prototype.ISOlocaltimeStr =
  new Function("  /* Date.ISOlocaltimeStr hh:mm:ss */\n" +
    "  with (this)\n    return" +
    " LZ(getHours())+':'+LZ(getMinutes())+':'+LZ(getSeconds())")


Date.prototype.USlocaltimeStr =
  new Function("  /* Date.USlocaltimeStr hh:mm:ss xM */\n" +
    "  var H\n" +
    "  with (this) return" +
    " LZ(  1+((H=getHours())+11)%12  )+':'+\n      LZ(getMinutes())+':'+" +
    " LZ(getSeconds())+[' AM',' PM'][+(H>11)]")


Date.prototype.ISOlocaldateStr =
  new Function("  /* Date.ISOlocaldateStr YYYY-MM-DD */\n" +
    "  with (this)\n    return " +
    "getFullYear()+'-'+LZ(getMonth()+1)+'-'+LZ(getDate())")


Date.prototype.ISOlocalDTstr =
  new Function("  /* Date.ISOlocalDTstr YYYY-MM-DD hh:mm:ss */\n" +
    "   with (this)\n    return " +
    "ISOlocaldateStr()+' '+ISOlocaltimeStr()")


Date.prototype.UTCstr =
  new Function("  /* Date.UTCstr YYYY-MM-DD hh:mm:ss */\n" +
    "  with (this)\n    return " +
    "getUTCFullYear() + '-' + LZ(getUTCMonth()+1) + '-' +\n" +
    "      LZ(getUTCDate()) + ' ' + LZ(getUTCHours()) + ':' +\n" +
    "      LZ(getUTCMinutes()) + ':' + LZ(getUTCSeconds()) ")


Date.prototype.UTCDstr =
  new Function("  /* Date.UTCDstr Xxx YYYY-MM-DD hh:mm:ss */\n" +
    "  with (this)\n    return " +
    "DoWstr(getUTCDay())+', '+UTCstr()")


Date.prototype.YMDDstr =
  new Function("  /* Date.YMDDstr YYYY-MM-DD Xxx */\n" +
    "  with (this)\n    return " +
    "ISOlocaldateStr() + ' ' + DoWstr(getDay())")


Date.prototype.TZstr = // SIGN SHOULD BE RIGHT
  new Function("  /* Date.TZstr +-hh:mm */\n" +
    "  var X, Y, Z ;\n" +
    "  with (this) {\n" +
    "    X = getTimezoneOffset() ; Y = Math.abs(X) ;\n" +
    "    Z = Y % 60 ; Y = (Y-Z)/60 ;\n" +
    "    return (X>0?'-':'+') + LZ(Y) + ':' + LZ(Z) }")



function ValidDate(y, m, d) { // m = 0..11 ; y m d integers, y!=0
  with (new Date(y, m, d))
    return (getMonth()==m && getDate()==d) /* was y, m */ }


function DateGood(y, m, d) { var D // m = 1..12 ; y m d ints, y!=0
  with (D=new Date(y, --m, d))
    return (getMonth()==m && getDate()==d) ? D : NaN }


function ReadISO8601date(Q) { var T // adaptable for other layouts
  if ((T = /^(\d+)([-\/])(\d\d)(\2)(\d\d)$/.exec(Q)) == null)
    { return -2 } // bad format
  for (var j=1; j<=5; j+=2) T[j] = +T[j] // some use needs numbers
  if (!ValidDate(T[1], T[3]-1, T[5])) { return -1 } // bad value
  return [ T[1], T[3], T[5] ] }



// MJD 40587 = 1970-01-01 GMT = Javascript day 0.
// CMJD 40587 = 1970-01-01 local.


function CMJDtoDob(CMJD) { // local time; CMJD 0 = 1858-11-17 local
  return new Date(1858, 10, 17 + CMJD) }  // ???


function YMDto8601(A) { var S = "-"
  return A[0] + S + LZ(A[1]) + S + LZ(A[2]) }


function YMDtoCMJD(y, m, d) { // m = 1..12
  return 40587 + (Date.UTC(y, m-1, d)/864e5) }


function YMDzuCMJD(y, m, d) { // Fast.
  if (m<3) { m += 12 ; y-- } // Initial m *must* be in 1..12
  return -678973 + d + (((153*m-2)/5)|0) + // 153 = 13 + 5*28
    (1461*y>>2) - ((y/100)|0) + ((y/400)|0) }


function CMJDtoYMD(CMJD) {
  with (new Date((CMJD-40587)*864e5)) {
    return [getUTCFullYear(), getUTCMonth()+1, getUTCDate()] } }


function CMJDzuYMD(CMJD) {
  var Y=0, M=0, t, d = CMJD + 678881 // 0000-03-01 : Julian, add 2
  t = (( (4*(d+36525))/146097 )|0) - 1 // Gregorian Added Rules
  Y += 100*t ; d -= 36524*t + (t>>2)
  t = (( (4*(d+366))/1461 )|0) - 1 // Julian Rules
  Y += t ; d -= 365*t + (t>>2)
  M = ( (5*d+2)/153 )|0 // 153=5*28+13 months from March, M = 0...
  d -= ((2+M*153)/5)|0 // remove full months, d = 0...
  if (M > 9) { M -= 12 ; Y++ }
  return [Y, M+3, ++d] }



// function CMJDtoISOdow(CMJD) { return ((CMJD-40587+77777773)%7)+1 } // ISO

// function WkNoDtoCMJD(Y, W, D) { // ISO 8601
//   var Jan4 = YMDtoCMJD(Y, 1, 4)
//   var DoWk = (Jan4+777772)%7
//   return Jan4 - DoWk + 7*(W-1) + (D-1) }

// function JDNtoCMJD(YYYY, DDD) {
//   return YMDtoCMJD(YYYY, 1, 1) + (DDD-1) }

// function LastSun(y, m, ult) {
//   return ult - (YMDtoCMJD(y, m, ult)+77777773)%7 }

// end of CMJD use


function ZelDoW(y, m, d) { // Sun = 0
  if (m<3) { m += 12 ; y-- }
  return (2 + d + (((13*m-2)/5)|0) +
//    y + ((y/4)|0) - ((y/100)|0) + ((y/400)|0) ) % 7 } // <20060127
    ((5*y)>>2) - ((y/100)|0) + ((y/400)|0) ) % 7 }



function YMD2YWD(y, m, d) { // ISO 8601 WkNo. m = 1..12  (in i3.js)
  var ms1d = 864e5, ms7d = 7*ms1d
  var DC3 = Date.UTC(y, m-1, d+3)/ms1d, DoW = 1 + (DC3+7777777)%7
  var AWN = Math.floor(DC3/7) // an Absolute Week Number
  var Wyr = new Date(AWN*ms7d).getUTCFullYear()
  return [Wyr, AWN - Math.floor(Date.UTC(Wyr, 0, 0)/ms7d), DoW ] }


function CMJDtoYWD(CMJD) { // cf. Calendar FAQ 2.7, Stefan Potthast
  var d4, L, d1, WeekNumber, Bodge, DoW // Bodge, DoW added by JRS
  CJD = CMJD + 2400001 ; DoW = CJD % 7
  d4 = (CJD+31741 - DoW) % 146097 % 36524 % 1461 // 0..1460
  L = +(d4==1460) // was L = (d4/1460)|0
  d1 = ((d4-L) % 365) + L
  WeekNumber = ((d1/7)|0) + 1 // ISO 8601
    Bodge = CJD - 7*(WeekNumber-26) // mid-year
    Bodge = ((Bodge/365.2425)|0) - 4712
  return [Bodge, WeekNumber, 1+DoW] }



function YWDtoCMJD(YWD) { var CJD, y // By JRS 2005-02-23+
  y = YWD[0]-1 // for CJD of Jan 4, modified from YMDzuCMJD
  CJD = 1721429 + (1461*y>>2) - ((y/100)|0) + ((y/400)|0)
  CJD -= CJD%7 // Round down to Monday; CJD 0 is Monday.
  CJD += YWD[1]*7 + +YWD[2] - 8 // Contributions of W and D
  return CJD - 2400001  /* ISO 8601 */ }



function UKtaxWNstr(y, m, d) { var dd, fy = y // m = 1..12
  if (m*32+d<134) fy--
  dd = (Date.UTC(y, m-1, d) - Date.UTC(fy, 3, 6))/864e5
  return 'UK Revenue & Customs:' + ' Year ' + fy + ' week ' +
    LZ(Math.floor(dd/7)+1) + ' day ' + (dd%7+1) + ';' }

function UKtaxMNstr(y, m, d) { var yy = y, mm = m // m = 1..12
  if (d<6) mm--
  if (mm<4) { yy-- ; mm += 12 }
  return ' Year ' + yy + ' month ' + LZ(mm-3) + '.' }



function DaysInMonth(Y, M) { // M=1..12
  with (new Date(Y, M, 1, 12)) {
    setDate(0) ; return getDate() /* OK in NS4? */ } }


function LeapYr(y) { if (y%4) return false
  if (y%100) return true ; return !(y%400) }


function Suffix(j) { return "thstndrd".
  substr("01230000000000000000012300000001".
    charAt(j)*2,2) }


function TimeChangeDates(YYYY) { // Detect OS settings
  var Ton, Tof, JanOff, JulOff, TonMin, TonMax, TofMin, TofMax, K
  with(new Date(YYYY, 00, 01)) {
    TonMin = TofMin = getTime() ; JanOff = getTimezoneOffset()
    setMonth(06) ; JulOff = getTimezoneOffset()
    if (JanOff == JulOff) { return [0,0] }
    setMonth(12) ; TonMax = TofMax = getTime()
    var Min = Math.min(JanOff, JulOff),
        Max = Math.max(JanOff, JulOff)
    Ton = Tof = (TonMin + TofMax)/2
    for (K=0; K<22; K++) {
      setTime(Ton) ; if (getTimezoneOffset() != Max)
        { TonMax = Ton ; Ton = (TonMin+Ton)/2 }
        else
        { TonMin = Ton ; Ton = (Ton+TonMax)/2 }
      setTime(Tof) ; if (getTimezoneOffset() != Min)
        { TofMax = Tof ; Tof = (TofMin+Tof)/2 }
        else
        { TofMin = Tof ; Tof = (Tof+TofMax)/2 }
      }
    }
  Ton = Math.round(Ton/6e4)*6e4 ; Tof = Math.round(Tof/6e4)*6e4
  return {Spring:Ton, Autumn:Tof} }


function TimeFunc(Fns, N) { var Fn, J, K, D0, D1, St, T = new Date()
  St = "TimeFunc: " + N + " Loops\n\nms\tTimes"
  for (J in Fns) { St += "\n" ; Fn = Fns[J] ; if (!Fn) continue
    K = N ; D0 = new Date() ; while (K--) Fn(K) ; D1 = new Date()
    St += (D1-D0) + "\t" + FuncName(Fn) }
  alert(St + "\n\nOverall: " + (new Date() - T) + " ms.") }


var Inc3B=0 // end.


//-->