/**
 * (c) Date for http://www.houie.com
 * Copyright (c) 2003 Hou-En Han. All rights reserved.
 */

var time = new Date();

var day = time.getDay();
var month = time.getMonth();
var date = time.getDate();
var year = time.getFullYear();

var hours = time.getHours();
var minutes = time.getMinutes();
var seconds = time.getSeconds();

var days = new Array(7);
days[0] = "Sunday";
days[1] = "Monday";
days[2] = "Tuesday";
days[3] = "Wednesday";
days[4] = "Thursday";
days[5] = "Friday";
days[6] = "Saturday";

var months = new Array(12);
months[0] = "January";
months[1] = "February";
months[2] = "March";
months[3] = "April";
months[4] = "May";
months[5] = "June";
months[6] = "July";
months[7] = "August";
months[8] = "September";
months[9] = "October";
months[10] = "November";
months[11] = "December";

function fnDate() {
  date=((date < 10) ? "0" : "") + date;
  return days[day]+", "+date+" "+months[month]+" "+year;
}

function fnTime() {
  var meridian = "AM";

  if (hours >= 12) {
    hours -= 12;
    meridian = "PM";
  }
  if (hours == 0)
    hours = 12;

  minutes=((minutes < 10) ? "0" : "") + minutes;
  seconds=((seconds < 10) ? "0" : "") + seconds;
  return hours+":"+minutes+"."+seconds+" "+meridian;
}

function fnCalcAge(sDate)  {
  var birthday = new Date(sDate);
  var msDiff = time.getTime() - birthday.getTime();
  var age = (msDiff / (365.25 * 24 * 60 * 60 * 1000));
  return Math.floor(age);
}