function countDown(futureDate) {
  sClockTag = "<span id=\"countdown\"></span>"

  document.write(sClockTag);

  updateClock(futureDate)
}

function updateClock(futureDate) {
  var dDay = new Date(futureDate);
  var tDay = new Date();

  if (tDay < dDay) {
    dYear  = dDay.getFullYear();
    dMonth = dDay.getMonth();
    dDate  = dDay.getDate();

    tYear  = tDay.getFullYear();
    tMonth = tDay.getMonth();
    tDate  = tDay.getDate();

    // Count years between today and target date.
    nYears  = dYear - tYear;

    // Count months between today and taget date independent of year.
    nMonths = dMonth - tMonth - 1;

    // Can we count another month?
    if (dDate > tDate) { nMonths++; }

    // Adjust count of months, if necessary.
    if (nMonths < 0) { nMonths = nMonths + 12; } else if (nMonths == 12) { nMonths = 0; }

    //Adjust count of years, if necessary.
    if ((dMonth < tMonth) || ((dMonth == tMonth) && (dDate <= tDate))) { nYears--; }

    // Simplest case.
    if (dDate > tDate) {
      // Count days between today and taget date independent of year.
      nDays = dDate - tDate - 1;

    // More complex.
    } else {
      // Compute today's date in previous month.
      var pDay = new Date(dYear, dMonth - 1, tDate);

      // Adjust today's date in previous month if necessary.
      if (pDay.getMonth() != (dMonth - 1)) { pDay = new Date(dYear, dMonth, 0); }

      // get last day of previous month.
      qDay = new Date(dYear, dMonth, 0);

      // Extract dates portions.
      pDate  = pDay.getDate(); qDate  = qDay.getDate();

      // Count days between today and taget date independent of year.
        nDays = qDate - pDate + dDate - 1;
    }

    // Compute hours, minutes, and seconds.
    mSec = dDay.getTime() - tDay.getTime();

    //nDays  = Math.floor(mSec/(60*60*1000*24)*1);
    nHours = Math.floor((mSec%(60*60*1000*24))/(60*60*1000)*1);
    nMins  = Math.floor(((mSec%(60*60*1000*24))%(60*60*1000))/(60*1000)*1);
    nSecs  = Math.floor((((mSec%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1);

    // Format countdown for display.
    sYears   = nYears  + " year";
    sMonths  = nMonths + " month";
    sDays    = nDays   + " day";
    sHours   = nHours  + " hour";
    sMinutes = nMins   + " minute";
    sSecs    = nSecs   + " second";

    if (nYears != 1)  { sYears += "s"; }
    if (nMonths != 1) { sMonths += "s"; }
    if (nDays != 1)   { sDays += "s"; }
    if (nHours != 1)  { sHours += "s"; }
    if (nMins != 1)   { sMinutes += "s"; }
    if (nSecs != 1)   { sSecs += "s"; }

    // Count down timer.
    sClock = sYears + ", " + sMonths  + ", " + sDays    + ", " + sHours   + ", " + sMinutes + ", and " + sSecs;

    // Update clock once every second.
    window.setTimeout("updateClock('" + futureDate + "')", 1000);

  } else {
    // Too late message.
    sClock = "Game Over";
  }

  // Update timer in browser independent way.
  var clocklayer;

  // Internet Explorer.
  if(window.document.all) {
    //thisbrowser="ie"
    clocklayer = window.document.all["countdown"];
    clocklayer.innerHTML = sClock;
  }

  // Netscape 6.
  else if(!document.all && document.getElementById) {
    //thisbrowser="NN6";
    clocklayer = document.getElementById("countdown");
    clocklayer.innerHTML  = sClock;
  }

  // Netscape Navigator 4:
  else if(document.layers) {
   //thisbrowser="NN4";
   clocklayer = document.layers["countdown"];
   clocklayer.document.open();
   clocklayer.document.write(sClock);
   clocklayer.document.close();
  }
}

