From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Mon, 2 Sep 2019 13:46:59 +0900
Subject: Initial commit

---
 macros/latex/contrib/cntdwn/lngcnt.def | 518 +++++++++++++++++++++++++++++++++
 1 file changed, 518 insertions(+)
 create mode 100644 macros/latex/contrib/cntdwn/lngcnt.def

(limited to 'macros/latex/contrib/cntdwn/lngcnt.def')

diff --git a/macros/latex/contrib/cntdwn/lngcnt.def b/macros/latex/contrib/cntdwn/lngcnt.def
new file mode 100644
index 0000000000..518097c0c5
--- /dev/null
+++ b/macros/latex/contrib/cntdwn/lngcnt.def
@@ -0,0 +1,518 @@
+%%
+%% This is file `lngcnt.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% cntdwn.dtx  (with options: `copyright,lngcnt')
+%% 
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% cntdwn package,            2010-8-2                  %%
+%% Copyright (C) 2010  D. P. Story                      %%
+%%   dpstory@uakron.edu                                 %%
+%%                                                      %%
+%% This program can redistributed and/or modified under %%
+%% the terms of the LaTeX Project Public License        %%
+%% Distributed from CTAN archives in directory          %%
+%% macros/latex/base/lppl.txt; either version 1 of the  %%
+%% License, or (at your option) any later version.      %%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\newcommand{\lcntdwnDisplay}[4][]{%
+    \let\autorun@presets\@empty
+    \expandafter\ifnum\csname#2@autorun\endcsname=1\relax
+        \edef\autorun@presets{%
+        \AAPageOpen{if (\CDO#2.bAutorunEnabled && \CDO#2.timeout==null) lStartTimer(\CDO#2);}}\fi
+    \expandafter\ifnum\csname#2@autopause\endcsname=1\relax
+        \edef\autorun@presets{\autorun@presets
+        \AAPageClose{if (\CDO#2.timeout!=null) lcntdwnPause(\CDO#2);}}\fi
+    \edef\autorun@presets{\noexpand\AA{\autorun@presets}}%
+    \textField[\Ff\FfReadOnly\textSize{0}#1
+        \presets{\autorun@presets}]%
+    {\CDO#2.lcntdwn.timeToFromEvent}{#3}{#4}}
+\newcommand{\lcntdwnToggle}[4][]{%
+    \pushButton[\TU{Toggle Countdown}\A{\JS{lcntdwnToggle(\CDO#2);}}#1
+    ]{\CDO#2.lcntdwn.Toggle}{#3}{#4}}
+\newcommand{\setLongCntDwn}[2]{\begingroup
+    \@ifundefined{#1@timername}{\cntdwn@namegdef{#1@timername}{#1}}%
+    {\PackageError{cntdwn}{The name `#1' is already defined as a timer
+    variable.}{Choose a unique timer variable name,
+    one different from `#1'.}}%
+    \setkeys{lcntdwn}{date,endmsg,#2}%
+    \def\seconds{_oTime.second}\def\minutes{_oTime.minute}%
+    \def\hours{_oTime.hour}\def\days{_oTime.day}%
+    \def\weeks{7*_oTime.day}\def\years{_oTime.year}%
+    \cntdwn@namexdef{#1@autorun}{\lctndwn@autorun}%
+    \cntdwn@namexdef{#1@autopause}{\lctndwn@autopause}%
+    \ifx\lcntdwn@date\@empty\def\lcntdwn@date{1970/01/01}%
+    \PackageWarning{cntdwn}{!!Beware!!
+    The `date' key was not supplied,\MessageBreak
+    using the default date 1970/01/01}\fi
+    \def\r{^^J}\def\t{\space\space\space\space}%
+    \cntdwn@namexdef{#1TimerObject}{%
+        var _o#1 = {\r\t
+            name: "_o#1",\r\t
+            pdfdate:"D:\lcntdwn@date\lcntdwn@time\lcntdwn@tz",\r\t
+            target: null,\r\t
+            refreshrate: 1000,\r\t
+            notify1: \lcntdwn@notifyi,\r\t
+            notify2: \lcntdwn@notifyii,\r\t
+            notify3: \lcntdwn@notifyiii,\r\t
+            notify5: \lcntdwn@notifyv,\r\t
+            notify6: \lcntdwn@notifyvi,\r\t
+            notify7: \lcntdwn@notifyvii,\r\t
+            eventhandler: "\lcntdwn@eventhandler",\r\t
+            refreshrate: \lcntdwn@refreshrate,\r\t
+            timedateFunc: "\lcntdwn@timedateFunc",\r\t
+            displayfunc: "\lcntdwn@displayfunc",\r\t
+            endtimecolor: \cntdwn@endtimecolor,\r\t
+            weStopOnEnd: \lcntdwn@ifstop,\r\t
+            endMsg: "\lcntdwn@endmsg",\r\t
+            bAutorunEnabled:\lcntdwn@autorunenabled,\r\t
+            bNotify1:false,\r\t
+            bNotify2:false,\r\t
+            bNotify3:false,\r\t
+            bNotify4:false,\r\t
+            bNotify5:false,\r\t
+            bNotify6:false,\r\t
+            bNotify7:false,\r\t
+            lastSignDelta:1,\r\t
+            timeout:null\r
+        };
+    }%
+    \ifx\cntdwnlTimers\@empty
+    \else\g@addto@macro\cntdwnlTimers{^^J}\fi
+    \expandafter\g@addto@macro\expandafter\cntdwnlTimers
+    \expandafter{\csname#1TimerObject\endcsname}%
+    \ifx\cntdwnaTimers\@empty\else\g@addto@macro\cntdwnaTimers{^^J}\fi
+    \g@addto@macro\cntdwnaTimers{aTimers["_o#1"]=_o#1;}%
+    \endgroup}
+\def\@lcntdwn@parse@YYYY#1#2#3#4{%
+    {\count0=#1\relax\count0=#2\relax
+     \count0=#3\relax\count0=#4\relax}%
+    \def\lcntdwn@date{#1#2#3#4}%
+    \@ifnextchar\@nil{\@gobbletonil}%
+    {\@ifnextchar/{\expandafter\@lcntdwn@parse@MM\@gobble}%
+    {\def\lcntdwn@date{#1#2#3#4}}}%
+}
+\def\@lcntdwn@parse@MM#1#2{%
+    {\count0=#1\relax\count0=#2\relax}%
+    \edef\lcntdwn@date{\lcntdwn@date#1#2}%
+    \@ifnextchar\@nil{\@gobbletonil}%
+    {\@ifnextchar/{\expandafter\@lcntdwn@parse@DD\@gobble}%
+    {\edef\lcntdwn@date{\lcntdwn@date#1#2}}}%
+}
+\def\@lcntdwn@parse@DD#1#2{%
+    {\count0=#1\relax\count0=#2\relax}%
+    \edef\lcntdwn@date{\lcntdwn@date#1#2}%
+    \@gobbletonil
+}
+\def\@lcntdwn@parse@HH#1#2{%
+    {\count0=#1\relax\count0=#2\relax}%
+    \def\lcntdwn@time{#1#2}
+    \@ifnextchar\@nil{\@gobbletonil}%
+    {\@ifnextchar:{\expandafter\@lcntdwn@parse@mm\@gobble}%
+    {\def\lcntdwn@time{#1#2}}}%
+}
+\def\@lcntdwn@parse@mm#1#2{%
+    {\count0=#1\relax\count0=#2\relax}%
+    \edef\lcntdwn@time{\lcntdwn@time#1#2}%
+    \@ifnextchar\@nil{\@gobbletonil}%
+    {\@ifnextchar:{\expandafter\@lcntdwn@parse@SS\@gobble}%
+    {\edef\lcntdwn@time{\lcntdwn@time#1#2}}}%
+}
+\def\@lcntdwn@parse@SS#1#2{%
+    {\count0=#1\relax\count0=#2\relax}%
+    \edef\lcntdwn@time{\lcntdwn@time#1#2}%
+    \@gobbletonil
+}
+\def\tz@Z{Z}\def\tz@p{+}\def\tz@m{-}
+\def\lcntdwn@parse@tz{\@ifnextchar\@nil
+    {\let\lcntdwn@tz\@empty}{\@lcntdwn@parse@tz}%
+}
+\def\@lcntdwn@parse@tz#1{%
+    \def\argi{#1}\ifx\argi\tz@Z
+    \def\lcntdwn@tz{Z}\def\@next{\@gobbletonil}%
+    \else\ifx\argi\tz@p\def\lcntdwn@tz{+}%
+    \def\@next{\tz@gethrs}\else
+    \ifx\argi\tz@m\def\lcntdwn@tz{-}%
+    \def\@next{\tz@gethrs}\else
+    \let\lcntdwn@tz\@empty\def\@next{\@gobbletonil}%
+    \fi\fi\fi\@next
+}
+\def\@gobbletonil#1\@nil{}
+\def\tz@gethrs#1#2{{\count0=#1\relax\count0=#2\relax}%
+    \edef\lcntdwn@tz{\lcntdwn@tz#1#2'}%
+    \@ifnextchar\@nil{\@gobbletonil}{\tz@getmnts}}
+\def\tz@getmnts#1#2{{\count0=#1\relax\count0=#2\relax}%
+    \edef\lcntdwn@tz{\lcntdwn@tz#1#2'}\@gobbletonil}
+\define@key{lcntdwn}{date}[]{%
+    \edef\argi{#1}\ifx\argi\@empty
+    \def\lcntdwn@date{}\let\@next\relax\else
+    \def\@next{\expandafter\@lcntdwn@parse@YYYY\argi\@nil}\fi
+    \@next
+}
+\define@key{lcntdwn}{time}[]{%
+    \edef\argi{#1}\ifx\argi\@empty
+    \let\lcntdwn@time\@empty\let\@next\relax\else
+    \def\@next{\expandafter\@lcntdwn@parse@HH\argi\@nil}\fi
+    \@next
+}
+\define@key{lcntdwn}{tzoffset}[]{%
+    \def\argi{#1}\ifx\argi\@empty
+    \let\lcntdwn@tz\@empty\let\@next\relax\else
+    \def\@next{\lcntdwn@parse@tz#1\@nil}\fi
+    \@next
+}
+\define@boolkey{lcntdwn}{autorun}[true]{%
+    \edef\lctndwn@autorun{\ifKV@lcntdwn@autorun1\else0\fi}}
+\define@boolkey{lcntdwn}{autopause}[true]{%
+    \edef\lctndwn@autopause{\ifKV@lcntdwn@autopause1\else0\fi}}
+\define@boolkey{lcntdwn}{autorunenabled}[true]{%
+    \edef\lcntdwn@autorunenabled{\ifKV@lcntdwn@autorunenabled
+    true\else false\fi}}
+\define@key{lcntdwn}{notify1}[null]{\def\lcntdwn@notifyi{#1}}
+\define@key{lcntdwn}{notify2}[null]{\def\lcntdwn@notifyii{#1}}
+\define@key{lcntdwn}{notify3}[null]{\def\lcntdwn@notifyiii{#1}}
+\define@key{lcntdwn}{notify5}[null]{\def\lcntdwn@notifyv{#1}}
+\define@key{lcntdwn}{notify6}[null]{\def\lcntdwn@notifyvi{#1}}
+\define@key{lcntdwn}{notify7}[null]{\def\lcntdwn@notifyvii{#1}}
+\define@key{lcntdwn}{eventhandler}[_NoOpt]{%
+    \def\lcntdwn@eventhandler{#1}}
+\define@key{lcntdwn}{refreshrate}[1000]{\def\lcntdwn@refreshrate{#1}}
+\define@key{lcntdwn}{currtimefunc}[_defaultTimeDateFunc]{%
+    \def\lcntdwn@timedateFunc{#1}}
+\define@key{lcntdwn}{displayfunc}[_defaultLDisplayFunc]{%
+    \def\lcntdwn@displayfunc{#1}}
+\define@key{lcntdwn}{endtimecolor}[color.red]{%
+    \def\cntdwn@endtimecolor{#1}}
+\define@choicekey{lcntdwn}{onfinish}[\val\nr]{stop,continue}[stop]{%
+    \ifcase\nr\relax\def\lcntdwn@ifstop{true}\or
+    \def\lcntdwn@ifstop{false}\fi}
+\newcommand{\lcnddwnDefaultEndMsg}{The time has expired}
+\define@key{lcntdwn}{endmsg}[\lcnddwnDefaultEndMsg]{%
+    \def\lcntdwn@endmsg{#1}}
+\setkeys{lcntdwn}{time,tzoffset,refreshrate,autorun,autopause,%
+    autorunenabled,notify1,notify2,notify3,notify5,notify6,notify7,%
+    eventhandler,endtimecolor,displayfunc,currtimefunc,%
+    onfinish=continue,endmsg}
+\newcommand{\setClockTimer}[2]{\begingroup
+    \@ifundefined{#1@timername}{\cntdwn@namegdef{#1@timername}{#1}}%
+    {\PackageError{cntdwn}{The name `#1' is already defined as a timer
+    variable.}{Choose a unique timer variable name,
+    one different from `#1'.}}%
+    \setkeys{lcntdwn}{#2}%
+    \def\seconds{_oTime.second}\def\minutes{_oTime.minute}%
+    \def\hours{_oTime.hour}\def\days{_oTime.day}%
+    \def\weeks{7*_oTime.day}\def\years{_oTime.year}%
+    \cntdwn@namexdef{#1@autorun}{\lctndwn@autorun}%
+    \cntdwn@namexdef{#1@autopause}{\lctndwn@autopause}%
+    \def\r{^^J}\def\t{\space\space\space\space}%
+    \cntdwn@namexdef{#1TimerObject}{%
+        var _o#1 = {\r\t
+            name: "_o#1",\r\t
+            tzoffset:"\lcntdwn@tz",\r\t
+            refreshrate: \lcntdwn@refreshrate,\r\t
+            timedateFunc: "\lcntdwn@timedateFunc",\r\t
+            timeout:null\r
+        };
+    }%
+    \ifx\cntdwnlTimers\@empty
+    \else\g@addto@macro\cntdwnlTimers{^^J}\fi
+    \expandafter\g@addto@macro\expandafter\cntdwnlTimers
+    \expandafter{\csname#1TimerObject\endcsname}%
+    \ifx\cntdwnaTimers\@empty\else\g@addto@macro\cntdwnaTimers{^^J}\fi
+    \g@addto@macro\cntdwnaTimers{aTimers["_o#1"]=_o#1;}%
+    \endgroup}
+\newcommand{\cntdwnclocktime}[4][]{%
+    \let\autorun@presets\@empty
+    \expandafter\ifnum\csname#2@autorun\endcsname=1\relax
+        \edef\autorun@presets{%
+        \AAPageOpen{if (\CDO#2.timeout==null) clStartTimer(\CDO#2);}}\fi
+    \expandafter\ifnum\csname#2@autopause\endcsname=1\relax
+        \edef\autorun@presets{\autorun@presets
+        \AAPageClose{if (\CDO#2.timeout!=null) clcntdwnPause(\CDO#2);}}\fi
+    \edef\autorun@presets{\noexpand\AA{\autorun@presets}}%
+    \textField[\Ff\FfReadOnly\Q{1}\textSize{0}#1
+        \presets{\autorun@presets}]%
+    {\CDO#2.clock.time}{#3}{#4}}
+\newcommand{\cntdwnclockdate}[4][]{\textField[%
+    \Ff\FfReadOnly\Q{1}\textSize{0}#1]{\CDO#2.clock.date}{#3}{#4}}
+\newcommand{\clockToggle}[4][]{%
+    \pushButton[\TU{Toggle Countdown}\A{\JS{clockToggle(\CDO#2);}}#1
+    ]{\CDO#2.lcntdwn.Toggle}{#3}{#4}}
+\begin{insDLJS*}[lngcntdwn]{lngcntdwn}
+\begin{newsegment}{CntDwn: Convert Time Function}
+/*
+   This function converts the PDF Date Format to a JavaScript
+   Date object. The PDF Date Format is specified in section
+   3.8.3 in the PDF Reference.
+*/
+function pdfDate2oDate( pdfDate ) {
+    // if present, remove the "D:" in format
+    if ( pdfDate.indexOf("D:")  != -1 )
+        pdfDate = pdfDate.substring(2);
+    // now see if the O component is there
+    var re = /[\+\-Z]/;
+    var nIndex =  pdfDate.search(re);
+    // separate the time date info from the time zone offset info
+    if ( nIndex != -1 ) {
+        var cTimeZone = pdfDate.substring(nIndex);
+        pdfDate = pdfDate.substring(0, nIndex);
+    } else cTimeZone = "";
+    // seg is an array of arrays. The first element is the field width,
+    // the second entry is the default value.
+    var seg = [[4,1970],[2,1],[2,1],[2,0],[2,0],[2,0]];
+    // an array to hold time arguments for the date constructor.
+    var args = new Array();
+    // as we determine the values of the PDF Date Format, push them onto
+    // the args array, if not present, push the default value on.
+    for ( var i=0; i < seg.length; i++) {
+        if ( pdfDate.length > 0 ) {
+            args.push(Number( pdfDate.substring(0, seg[i][0]) ) );
+            pdfDate = pdfDate.substring( seg[i][0] );
+        } else args.push( seg[i][1] );
+    }
+    // adjust month to base zero
+    args[1] =  args[1] - 1;
+    // see if there is time zone info
+    var pm = "";
+    if ( cTimeZone.length > 0  ) {
+        pm = cTimeZone.charAt(0);
+        var zoneOffsetHr=Number(cTimeZone.substring(1,3));
+        cTimeZone=cTimeZone.substring(3);
+        var zoneOffsetMin=0;
+        if ( cTimeZone.length > 0 && cTimeZone.charAt(0) == "'" )
+            var zoneOffsetMin = Number( cTimeZone.substring(1,3) );
+        var totalOffset=zoneOffsetHr*60+zoneOffsetMin;
+        totalOffset*= 60000;
+        totalOffset=( pm == "-" )?-1*totalOffset:totalOffset;
+        var msTime=Date.UTC.apply(global,args);
+        msTime = msTime - totalOffset;
+        var d = new Date( msTime );
+    } else {
+        var dateArgs = args.toSource().replace(/[\[\]]/g,"");
+        var d = eval("new Date(" + dateArgs + ")" );
+    }
+    return d
+}
+\end{newsegment}
+\begin{newsegment}{CntDwn: Long Countdown JavaScript}
+function lngcntdwn(cTimer){
+    var _delta,nYears,pYears,nDays,pDays,nHours,pHours,nMinutes,
+        pMinutes,nSeconds,pSeconds,f,thisSignDelta,msYear;
+    var oTimer=aTimers[cTimer];
+    var Clock=new Date();
+    this.delay=true;
+    _delta=oTimer.target-Clock;
+    var o=lCalcYears(oTimer,Clock,_delta);
+    nYears=o.nYears;
+    pYears=o.pYears;
+    _delta=o.delta;
+    nDays=Math.floor(pYears/_oTime.day);
+    pDays=pYears\%_oTime.day;
+    nHours=Math.floor(pDays/_oTime.hour);
+    pHours=pDays\%_oTime.hour;
+    nMinutes=Math.floor(pHours/_oTime.minute);
+    pMinutes=pHours\%_oTime.minute;
+    nSeconds=Math.round(pMinutes/_oTime.second);
+    pSeconds=pMinutes\%_oTime.second;
+    f=this.getField(cTimer+".lcntdwn.timeToFromEvent");
+    thisSignDelta=(_delta<0)?-1:1;
+    if (thisSignDelta*oTimer.lastSignDelta<0&&!oTimer.bNotify4) {
+        if (f!=null) f.textColor=oTimer.endtimecolor;
+        oTimer.bNotify4=true;
+        oTimer.lastSignDelta=thisSignDelta;
+        eval(oTimer.eventhandler)(this,cTimer,4);
+        if (oTimer.weStopOnEnd) {
+            try { app.clearInterval(oTimer.timeout);
+            oTimer.timeout=null; } catch(e){};
+            if (f!=null) f.value=oTimer.endMsg;
+            return;
+        }
+    }
+    if (!oTimer.bNotify4&&_delta>0){ // event in future
+        if (!oTimer.bNotify1&&oTimer.notify1!=null%
+&&_delta<oTimer.notify1) {
+            oTimer.bNotify1=true;
+            eval(oTimer.eventhandler)(this,cTimer,1);
+        } else {
+            if (!oTimer.bNotify2&&oTimer.notify2!=null%
+&&_delta<oTimer.notify2) {
+                oTimer.bNotify2=true;
+                skipCheckB=true;
+                eval(oTimer.eventhandler)(this,cTimer,2);
+            } else {
+                if (!oTimer.bNotify3&&oTimer.notify3!=null%
+&&_delta<oTimer.notify3) {
+                    oTimer.bNotify3=true;
+                    eval(oTimer.eventhandler)(this,cTimer,3);
+                }
+            }
+        }
+    }
+    if (oTimer.bNotify4&&_delta<0){// event in past
+        var neg_delta=-1*_delta;
+        if (!oTimer.bNotify5&&oTimer.notify5!=null&&%
+neg_delta>oTimer.notify5) {
+            oTimer.bNotify5=true;
+            eval(oTimer.eventhandler)(this,cTimer,5);
+        } else {
+            if (!oTimer.bNotify6&&oTimer.notify6!=null&&%
+neg_delta>oTimer.notify6) {
+                oTimer.bNotify6=true;
+                eval(oTimer.eventhandler)(this,cTimer,6);
+        } else {
+            if (!oTimer.bNotify7&&oTimer.notify7!=null&&%
+neg_delta>oTimer.notify7) {
+                oTimer.bNotify7=true;
+                eval(oTimer.eventhandler)(this,cTimer,7);
+                }
+            }
+        }
+    }
+    eval(oTimer.displayfunc)(f,nYears,nDays,nHours,nMinutes,nSeconds);
+    this.delay=false;
+    this.dirty=false;
+}
+function _defaultTimeDateFunc(oTime,cTimer) {
+    try{ this.getField(cTimer+".clock.time").value%
+=util.printd("H:MM:ss",oTime); } catch(e) {};
+    try { this.getField(cTimer+".clock.date").value=%
+util.printd("mm/dd/yyyy", oTime); } catch(e) {};
+}
+function _defaultLDisplayFunc(f,nYears,nDays,nHours,nMinutes,nSeconds) {
+    var strYears=(nYears==0)?""%
+:(""+nYears+((nYears == 1)?" \cntdwnYear, ":" \cntdwnYears, "));
+    var strDays=(nDays== 0)?""%
+:(""+nDays+((nDays==1)?" \cntdwnDay, ":" \cntdwnDays, "));
+    var strHours=(nHours==0)?""%
+:(""+nHours+((nHours==1)?" \cntdwnHour, ":" \cntdwnHours, "));
+    var strMinutes=(nMinutes==0)?""%
+:(""+nMinutes+((nMinutes==1)?" \cntdwnMinute, ":" \cntdwnMinutes, "));
+    var strSeconds=""+nSeconds+((nSeconds<2)?" \cntdwnSecond "%
+:" \cntdwnSeconds ");
+    var cCntDwnDisplay=strYears+strDays+strHours+strMinutes+strSeconds;
+    try { f.value=cCntDwnDisplay; } catch(e) {}
+}
+function lCalcYears(oTimer,Clock,_delta) {
+    var nYears,lengthOfYears,targetpdfdate,targetYear,thisYear,
+        otherYear,currAnnivDate,otherAnnivDate,tCurrAnnivDate,
+        tOtherAnnivDate,msYear=0;
+    targetpdfdate=oTimer.pdfdate;
+    targetYear=Number(targetpdfdate.substring(2,6));
+    thisYear=Clock.getFullYear();
+    otherYear=(_delta<0)?thisYear-1:thisYear+1;
+    currAnnivDate=targetpdfdate.substring(0,2)%
++thisYear+targetpdfdate.substring(6);
+    otherAnnivDate=targetpdfdate.substring(0,2)%
++otherYear+targetpdfdate.substring(6);
+    tCurrAnnivDate=pdfDate2oDate( currAnnivDate );
+    tOtherAnnivDate=pdfDate2oDate( otherAnnivDate );
+    if (_delta<0) {
+        if ( Clock < tCurrAnnivDate ){
+            nYears=otherYear-targetYear;
+            lengthOfYears=oTimer.target-tOtherAnnivDate;
+        } else {
+            nYears=thisYear-targetYear;
+            lengthOfYears=oTimer.target-tCurrAnnivDate;
+        }
+    } else {// _delta>=0
+        if ( Clock > tCurrAnnivDate ) {
+            nYears=targetYear-otherYear;
+            lengthOfYears=oTimer.target-tOtherAnnivDate;
+        } else {
+            nYears=targetYear-thisYear;
+            lengthOfYears=oTimer.target-tCurrAnnivDate;
+        }
+    }
+    _delta-=lengthOfYears;
+    pYears=Math.abs(_delta);
+    return {
+        nYears:nYears,
+        pYears:pYears,
+        delta:_delta
+    };
+}
+function lStartTimer(oTimer) {
+    var cTimer=oTimer.name;
+    oTimer.target=pdfDate2oDate(oTimer.pdfdate).getTime();
+    var bWasNotified=oTimer.bNotify4;
+    var _delta=oTimer.target-new Date();
+    oTimer.lastSignDelta=(_delta<0)?-1:1;
+    if ( _delta > 0 ) {
+        oTimer.bNotify1=(_delta<oTimer.notify1);
+        oTimer.bNotify2=(_delta<oTimer.notify2);
+        oTimer.bNotify3=(_delta<oTimer.notify3);
+    } else {
+        oTimer.bNotify4=true;
+        oTimer.bNotify5=(-1*_delta>oTimer.notify5);
+        oTimer.bNotify6=(-1*_delta>oTimer.notify6);
+        oTimer.bNotify7=(-1*_delta>oTimer.notify7);
+    }
+    if (!bWasNotified&&oTimer.bNotify4) {
+        var f=this.getField(cTimer+".lcntdwn.timeToFromEvent");
+        if (f!=null) f.textColor=oTimer.endtimecolor;
+        eval(oTimer.eventhandler)(this,cTimer,4);
+    }
+    if (_delta<0&&oTimer.weStopOnEnd) {
+        f.value=oTimer.endMsg;
+        return;
+    }
+    oTimer.timeout=app.setInterval(%
+"lngcntdwn(\""+cTimer+"\")",oTimer.refreshrate);
+}
+function lcntdwnPause(oTimer) {
+    try { app.clearInterval(oTimer.timeout);
+        oTimer.timeout=null; } catch(e){};
+}
+function lcntdwnToggle(oTimer) {
+    if (oTimer.timeout==null) // stopped or paused
+        lStartTimer(oTimer);
+    else
+        lcntdwnPause(oTimer);
+}
+function _NoOpt(doc,cTimer,nEvent){}
+function lngClockHandler(cTimer) {
+    var oTimer=aTimers[cTimer];
+    var Clock = new Date();
+    if ( oTimer.tzoffset != "" ) {
+        var localTime = Clock.getTime();
+        var localOffset = Clock.getTimezoneOffset()*60000;
+        // obtain UTC time in msec
+        var utc = localTime + localOffset;
+        var tzoffset=(oTimer.tzoffset=="Z")?0:oTimer.tzoffset;
+        var nonlocal=utc+oTimer.tzoffset;
+        Clock = new Date(nonlocal);
+    }
+    this.delay=true;
+    eval(oTimer.timedateFunc)(Clock,cTimer);
+    this.dirty=false;
+    this.delay=false;
+}
+function clStartTimer(oTimer) {
+    var tzoffset=oTimer.tzoffset;
+    if ( tzoffset !="" && tzoffset !="Z" ) {
+        var sign=tzoffset.charAt(0);
+        offset=tzoffset.substring(1);
+        var a=tzoffset.split("'");
+        var hrs=Number(a[0]);
+        var mins=Number(a[1]);
+        tzoffset=hrs*3600000+mins*60000;
+        tzoffset=((sign=="+")?1:-1)*tzoffset;
+        oTimer.tzoffset=tzoffset;
+    }
+    var cTimer=oTimer.name;
+    oTimer.timeout=app.setInterval(%
+"lngClockHandler(\""+cTimer+"\")",oTimer.refreshrate);
+}
+function clockToggle(oTimer) {
+    if (oTimer.timeout==null) // stopped or paused
+        clStartTimer(oTimer);
+    else
+        lcntdwnPause(oTimer);
+}
+\end{newsegment}
+\end{insDLJS*}
+\endinput
+%%
+%% End of file `lngcnt.def'.
-- 
cgit v1.2.3

