// WEB PAGE GREETING, then IT'S DAY, MONTH DATE, YEAR 
// FILENAME:  web_page_greeting_day_date_year.js
 
// Copyright (C) 1999-2006 by Gregg L. DesElms (gregg@greggdeselms.com) (1-877-383-5148)
// All rights reserved.  Use by permission only.  (You can use it, but just ask first!)
// 



// BEGIN


// SET FONT CHARACTERISICS
document.write('<SPAN STYLE="Font-Size : 8pt"><FONT COLOR="gray" FACE="Verdana, Arial, Helvetica, Geneva, sans serif">')


// BEGIN TIME-OF-DAY-APPROPRIATE GREETING COMPONENT

var Digital=new Date()
var hours=Digital.getHours()

if (hours >= 4 && hours < 12) // MORNING MESSAGE (display from 4:00 am to 11:59 am)
document.write('Good morning. It\'s ')

// else if (hours == 12) // NOON MESSAGE (display at 12:00 noon exactly)
// document.write('Good day. It\'s ')

else if (hours >= 12 && hours < 18) // AFTERNOON MESSAGE (display from 12:00 pm to 5:59 pm)
document.write('Good afternoon. It\'s ')

else if (hours >= 18 && hours < 21) // EVENING MESSAGE (display from 6:00 pm to 8:59 pm)
document.write('Good evening. It\'s ')

else if (hours >= 21 && hours <= 23) // NIGHT MESSAGE (display from 9:00 pm to 11:59 pm)
document.write('Good evening. It\'s ')

else // LATE NIGHT or WEE HOURS MESSAGE (display from 12:00 am to 4:59 am)
document.write('You\'re up late! It\'s ')

// END TIME-OF-DAY-APPROPRIATE GREETING COMPONENT


// GET MONTH/DAY/DATE/YEAR PARTS FROM SITE-VISITOR'S OWN COMPUTER
 calendar = new Date();
 day = calendar.getDay();
 month = calendar.getMonth();
 date = calendar.getDate();
 year = calendar.getYear();


// BUILD MONTH/DAY DISPLAY VARIABLE ARRAYS
 var dayname = new Array ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
 var monthname = new Array ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");


// DISPLAY MONTH/DAY/DATE/YEAR
 document.write(dayname[day] + ", ");
 document.write(monthname[month] + " ");
// if (date < 10) document.write("0" + date + ", "); // if a leading zero on the date is desired (not recommended, best if commented-out)
 if (date < 10) document.write("" + date + ", "); // if NO leading zero on the date is desired (recommended)
         else document.write(date + ", ");
document.write(year + ". "); // use if you want a period and a space to appear after the year (recommended)
// document.write(year + " "); // use if no period, but a space, is to appear after the year, else comment-out (not recommended, best if commented-out)


// UN-SET/RESET FONT CHARACTERISTICS
document.write('</FONT></SPAN>')


// END
