// JavaScript to generate a compact date representation

//
// format date as dd-mmm-yyyyy
// example: 12-Jan-1999
//
function date_ddmmmyyyy(date)
{
  var d = date.getDate() -1;
  var m = date.getMonth() + 1;
  var y = date.getFullYear();

  // could use splitString() here 
  // but the following method is 
  // more compatible
  var mmm = 
    ( 1==m)?'Gennaio':( 2==m)?'Febbraio':(3==m)?'Marzo':
    ( 4==m)?'Aprile':( 5==m)?'Maggio':(6==m)?'Giugno':
    ( 7==m)?'Luglio':( 8==m)?'Agosto':(9==m)?'Settembre':
    (10==m)?'Ottubre':(11==m)?'Novembre':'Dicembre';

  return "" +
    (d<10?"0"+d:d) + " " + mmm + " " + y;
}


//
// get last modified date of the 
// current document.
//
function date_lastmodified()
{
  var lmd = document.lastModified;
  var s   = "Unknown";
  var d1;

  // check if we have a valid date
  // before proceeding
  if(0 != (d1=Date.parse(lmd)))
  {
    s = "" + date_ddmmmyyyy(new Date(d1));
  }

  return s;
}

//
// finally display the last modified date
// as DD-MMM-YYYY
//
document.writeln( 
  "" + date_lastmodified() );

// End