// Convert numerical month to three letter abbreviation in English
function month(n)
{
  var months="JanFebMarAprMayJunJulAugSepOctNovDec"
  return months.charAt(n*3)+months.charAt(1 + n*3)+months.charAt(2 + n*3)
}

// fix for those browsers which think 2000 is 100
function Goodyear(yr)
{
  if (yr<2000) yr = yr+1900
  return yr
}

// Write date this file was last changed
function modified()
{
  var modified = new Date(document.lastModified)
  var year = Goodyear(modified.getYear())

  document.write(modified.getDate()+"-"+month(modified.getMonth())+"-"+year)
}

// Write the source URL
function URL()
{
  document.write(document.location)
}

// Specify is-was-tonight
function NextPigs(dd,mm,yyyy)
{
  var today = new Date()
  var yr = Goodyear(today.getYear())
  var mn = 1 + today.getMonth()
  var dy = today.getDate()
  var now
  var then

  now = yr*366 + mn*31 + dy
  then = yyyy*366 + mm*31 + dd

  if ( now==then )
  {
    // Today
    document.write("Whistling Pigs Tonight!")
  }
  else
  {
    if ( now>then )
    {
      // Last
      document.write("The Last Whistling Pigs was")
    }
    else
    {
      // Next
      document.write("The Next Whistling Pigs is")
    }
  }
}
