    if (Drupal.jsEnabled) {
      $(document).ready(countdown_auto_attach);
    }
  
    function jstimer(timer_span) {
      //defaults
      year="2068"; month="1"; day="1"; hour="00"; min="00"; sec="00"; tz_hours = -8; //PST

      this.timer_span = timer_span;
      strdate = timer_span.innerHTML;
      date_and_time = strdate.split(' ');
      if (typeof(date_and_time[0]) != 'undefined' && date_and_time[0] != '') {
        date_only = date_and_time[0].split('-');
        year  = date_only[0] || year;
        month = date_only[1] || month ;
        day   = new String(date_only[2] || day) ;
      } 
      if (typeof(date_and_time[1]) != 'undefined' && date_and_time[1] != '') {
        time_only = date_and_time[1].split(':');
        hour = time_only[0] || hour;
        min  = time_only[1] || min;
        sec  = time_only[2] || sec;
      } 
      if (typeof(date_and_time[2]) != 'undefined' && date_and_time[2] != '') {
        tz_hours = date_and_time[2];
      } 
      
      this.to_date = new Date();
      this.to_date.setFullYear(year,month-1,day);
      this.to_date.setHours(hour);
      this.to_date.setMinutes(min);
      this.to_date.setSeconds(sec);
      
      var tz_offset_client = -(this.to_date.getTimezoneOffset()*60*1000);  //getTimezoneOffset: minutes between the time on the current machine and UTC
      var tz_offset = (tz_hours*60*60*1000);
      var msecs =  this.to_date.getTime();
      this.to_date.setTime(msecs - tz_offset + tz_offset_client);
     
      var myDays=["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun"];
      var myMonths=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
      dow = myDays[this.to_date.getDay()];
      moy = myMonths[this.to_date.getMonth()];
      this.outformat = '<em>(%dow% %moy%%day%)</em><br>%days% days + %hours%:%mins%:%secs%';
      this.outformat = this.outformat.replace(/%day%/,day);
      this.outformat = this.outformat.replace(/%month%/,month);
      this.outformat = this.outformat.replace(/%year%/,year);
      this.outformat = this.outformat.replace(/%moy%/,moy);
      this.outformat = this.outformat.replace(/%dow%/,dow);

      //hook in start method
      this.start = start;
    }
    function start() {
      display_countdown(this.outformat,set_countdown(this.to_date),this.timer_span.id);
    }
    
    function set_countdown(to_date) {
      var from_date = new Date();
      // return initial difference in seconds at start
      return Math.floor((to_date - from_date)/1000);
    }
    
    function display_countdown(outformat,countdn,spanid) {
      if (countdn <= 1) {
        document.getElementById(spanid).innerHTML = ":Countdown Completed";
      }
      else {
        var secs = countdn % 60;
        if (secs < 10) secs = '0'+secs;
        var countdn1 = (countdn - secs) / 60;
        var mins = countdn1 % 60;
        if (mins < 10) mins = '0'+mins;countdn1 = (countdn1 - mins) / 60;
        var hours = (countdn1 % 24);
        var days = (countdn1 - hours) / 24;
        
        var outhtml = new String(outformat);
        outhtml = outhtml.replace(/%days%/,days);
        outhtml = outhtml.replace(/%hours%/,hours);
        outhtml = outhtml.replace(/%mins%/,mins);
        outhtml = outhtml.replace(/%secs%/,secs);
        //kludge, find a better way
        if ( days == 1 ) {
          outhtml = outhtml.replace(/days/,'day');
        }
        document.getElementById(spanid).innerHTML = outhtml;
        setTimeout('display_countdown(\''+ outformat + '\','+(countdn-1)+',\''+spanid+'\');',999);
      }
    }
    
    //need span with class="countdown", innerhtml="somedate somehour (8-5-2006 12)"
    function countdown_auto_attach() {
      $(".countdowntimer").each(
        function(i) {  // arg i is the position in the each fieldset
        this.id = "timer_"+i;  //add unique id's for the timers
      	var timer = new jstimer(this);
        timer.start();
        }
      )
    }
   