//Put this in the header of the HTML files:
//    <script language="JavaScript" src="countdown.js"></script>

//Function call arguments are:
//    showDaysToGo([target year], [target month - zero based], [target day of month], [target UCT offest]);
//
//The target UCT offset is the number of timezones away from UCT. For example, New York is -5 from UCT.
//
//The month value is the representative element from a zero based list. That is to say, January is zero '0',
//count upwards from there.
//
//The full call in a web page AFTER the above statement in the header would look like this:
//
//          <script langauge="JavaScript1.2"> showDaysToGo(2009,5,26,-5) </script> Days To Go
//
//Yes, you can have multiple calls on one page.

function showDaysToGo(showyear, showmonth, showdom, showoffset) {
  var millisecs_per_day=86400000
  var countdown_time=Date.UTC(showyear,showmonth,showdom,showoffset);
  var now=new Date();
  var now_millisecs=now.valueOf();
  var day_cnt= Math.ceil(( countdown_time - now_millisecs)/86400000 )
  // display the number of days left (or since)
  if ( day_cnt > 1 ) {
    // multiple days to go
    document.write( day_cnt)
  }
  else if ( day_cnt == 1 ) {
    // one day to go
    document.write( day_cnt)
  }
  else if ( day_cnt == 0 ) {
    // it's today
    document.write("0")
  }
  else if ( day_cnt == -1 ) {
    // one day ago
    document.write("0")
  }
  else {
    // multiple days ago
    document.write("0")
  }
}
