﻿// JScript File
var iIntervalId = 0;
var iTimeout = 0;

function GetMonth(intMonth)
{
    var MonthArray = new Array("January", "February", "March",
                               "April", "May", "June",
                               "July", "August", "September",
                               "October", "November", "December") 
    return MonthArray[intMonth] 	  	 
}


function doClock()
{
    var today = new Date();
    var todayStr = today.getDate() + " " + GetMonth(today.getMonth());
    var year = today.getYear();
    var curAMPM = " AM";
    var minutes = today.getMinutes();
    var hours = today.getHours();
    var seconds = today.getSeconds();
    
    if( hours.toString().length == 1 )
    {
        hours = "0" + hours; 
    }        
    
    if( minutes.toString().length == 1 )
    {
        minutes = "0" + minutes; 
    }
   
    if (hours >= 12)
    {
      curAMPM = " PM";
      if(hours > 12)
      {
          hours -= 12
          
          hours = "0" + hours;
      }
    }
    
    longDateTime.innerText = "" 
                           + todayStr + " "
                           + year + " "
                           + hours + ":" 
                           + minutes 
                           + curAMPM;
           
    clearInterval(iIntervalId);
    iIntervalId = setInterval ( 'doClock();', 60000 );
    
    return seconds;                 
}
  

