////////////////////////////////////////////////////////////
//                                                        //
// timer.js - JavaScript Support File                     //
//                                                        //
// Version:  1.1 - SC 14/09/99 = standardise format       //
//                                                        //
// Copyright : (c) 1998-99 all rights reserved by :-      //
//                 Technical System Services Limited      //
// Author:     Simon Cleverley                            //
// History:                                               //
// Version:  1.0 - SC 20/04/99 + process_timer(delay)     //
// Version:  1.0 - SC 20/04/99 + stop_timer()             //
// Version:  1.1 - SC 14/09/99 = standardise format       //
//                                                        //
////////////////////////////////////////////////////////////

var TimerID;
var TimerRunning = false;

////////////////////////////////////////////////////////////
//                                                        //
// Version:  1.0 - SC 20/04/99 + process_timer(delay)     //
//                                                        //
// process_timer(delay)                                   //
//                                                        //
//    process the 'timer' event - delay in 1000s          //
//                                                        //
// Version:  1.0 - SC 20/04/99 + process_timer(delay)     //
//                                                        //
////////////////////////////////////////////////////////////

function process_timer(delay) {

   // user service routine exit below

   service_timer();

   TimerId = setTimeout("process_timer("+delay+")",delay);
   TimerRunning = true;

}

////////////////////////////////////////////////////////////
//                                                        //
// Version:  1.0 - SC 20/04/99 + stop_timer()             //
//                                                        //
// stop_timer()                                           //
//                                                        //
//    stop the 'timer' event                              //
//                                                        //
// Version:  1.0 - SC 20/04/99 + stop_timer()             //
//                                                        //
////////////////////////////////////////////////////////////

function stop_timer() {

   if (TimerRunning) clearTimeout(TimerID);

   TimerRunning = false;

}

////////////////////////////////////////////////////////////
//                                                        //
// Version:  1.0 - SC 20/04/99 + start_timer(delay)       //
//                                                        //
// start_timer(delay)                                     //
//                                                        //
//    start the 'timer' event - delay in 1000s            //
//                                                        //
// Notice:                                                //
//    in the main HTML include the following :-           //
//                                                        //
//       <BODY ... onLoad="start_timer(5000)">            //
//                                                        //
//    AND a JS service routine :-                         //
//                                                        //
//       function service_timer() {};                     //
//                                                        //
// Version:  1.0 - SC 20/04/99 + start_timer(delay)       //
//                                                        //
////////////////////////////////////////////////////////////

function start_timer(delay) {

   stop_timer();

   process_timer(delay);

}

