var now = new Date;
nhr=now.getHours(); wk=now.getDay();
gr0=""; // link
gr2=""; // text after link
gr3=""; // second line, if any
apos="&#8217;"; ell="&#8230;"

if (nhr<4) {gr1="The king"+apos+"s loyal subjects are all fast asleep"+ell;
gr3="Except for YOU! What are you doing up at this hour?";}

else if (nhr<8) {

if (wk==2 || wk==4) {
gr1="Hmmm"+ell+" shall I stay up or slither back into bed?";}
else if (wk==3 || wk==6) {
gr1="The early bird gets the worm"+ell;
gr3=" but who wants a worm, anyway?";}
else {
gr1="Good morning! What would you like to drink:";
gr3="Coffee, tea, hot cocoa or Mountain Dew&reg;?";}

}

else if (nhr<12) {

if (wk==1 || wk==3 || wk==4) {
gr1="Hope your morning is a good one so far."}
else {
gr0="faith/beautiful";
gr1="God made this day beautiful"+ell+" really!";}

}

else if (nhr<15) {gr1="Have a great afternoon!"}
else if (nhr<18) {gr0="food/"; gr1="What"+apos+"s for dinner?"}
else if (nhr<21) {gr1="Enjoy your evening!"}
else if (wk==1 || wk==3 || wk==5) {gr1="Good night! Pleasant dreams."}
else {gr1="Have a good night and a bright tomorrow!"}



// Prepare and write the timestamp (first line)

var now = new Date;
wk=now.getDay();
nmo=now.getMonth();
nd=now.getDate();
ny=now.getYear();
var dayNames = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var monthNames = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
if (ny<1900) {ny=1900+ny} // y2k fix
nh=now.getHours();
nm=now.getMinutes();
if (nh<12) {period=" a.m.";} else {period=" p.m.";}
if (nh==0) {nh_new=12;} else if (nh>12) {nh_new=nh-12;} else {nh_new=nh;}
if (nm<10) {nm="0"+nm;}

document.write('<p id="random">It&#8217;s '+nh_new+':'+nm+period+' on '+
dayNames[wk]+', '+monthNames[nmo]+' '+nd+', '+ny+'.');



// Write the greeting (second line)

document.write('<br>');
if(gr0=="") {document.write(gr1);}
else {document.write('<a href="'+gr0+'">'+gr1+'</a>'+gr2);}
if(gr3!="") {document.write('<br>'+gr3);}
document.write('</p>');