// ************* Current Day and Hour *********
function makeArray()    {
    this[0] = makeArray.arguments.length;
    for (i = 0; i<makeArray.arguments.length; i++)
        this[i+1] = makeArray.arguments[i];
}

var daysofmonth   = new makeArray( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
var daysofmonthLY = new makeArray( 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);

function LeapYear(year) {
    if ((year/4)   != Math.floor(year/4))   return false;
    if ((year/100) != Math.floor(year/100)) return true;
    if ((year/400) != Math.floor(year/400)) return false;
    return true;
}

function NthDay(nth,weekday,month,year) {
    if (nth > 0) return (nth-1)*7 + 1 + (7 + weekday -
DayOfWeek((nth-1)*7 + 1,month,year))%7;
    if (LeapYear(year)) var days = daysofmonthLY[month];
    else                var days = daysofmonth[month];
    return days - (DayOfWeek(days,month,year) - weekday + 7)%7;
}

function DayOfWeek(day,month,year) {
    var a = Math.floor((14 - month)/12);
    var y = year - a;
    var m = month + 12*a - 2;
    var d = (day + y + Math.floor(y/4) - Math.floor(y/100) +
Math.floor(y/400) + Math.floor((31*m)/12)) % 7;
    return d+1;
}

localtime = new Date();
loctime_ms = localtime.getTime();
gmttime_ms = (localtime.getTimezoneOffset()*60000)+loctime_ms;
esttime_ms = (gmttime_ms - 18000000);

LOC = new Date(loctime_ms);
EST = new Date(esttime_ms);
GMT = new Date(gmttime_ms);

today = new Date(esttime_ms);
year = today.getFullYear();
date = today.getDate();
day = today.getDay();
hour = today.getHours();
minutes = today.getMinutes();
DSTstart = new Date(year,4-1,NthDay(1,1,4,year),2,0,0);
DSTend   = new Date(year,10-1,NthDay(-1,1,10,year),2,0,0);
if ((esttime_ms > DSTstart.getTime()) && (esttime_ms < DSTend.getTime())) {
	hour = hour + 1;
}

//************** IEMac Time Fix ***************

var OSName="Unknown OS";
if (navigator.appVersion.indexOf("Mac")!=-1) OSName="MacOS";
iemac = ((navigator.appName == "Microsoft Internet Explorer") && (OSName == "MacOS" ));
if (iemac) { hour = hour + 1 ;}

// ******************* Schedules **************

Monday = new Array(
/*12AM - 05PM*/"<A href=\"http://www.northcountrypublicradio.org/programs/local/monday.html\"><IMG align=right border=0 height=30 src=\"http://www.northcountrypublicradio.org/features/monmus.gif\" width=30>Music for a Monday Afternoon</A> world music with Jackie Sauter, <font color=\"#99000\">Mon 3 pm</font>", 
/*05PM - 09PM*/"<A href=\"http://www.northcountrypublicradio.org/programs/local/folk.html\"><IMG align=right border=0 height=35 src=\"http://www.northcountrypublicradio.org/features/folkshow.jpg\" width=60>The Folk Show</A> folk and new acoustic music with Mike Alzo, <font color=\"#99000\">Fri 7 pm</font>",
/*09PM - 12AM*/"<A href=\"http://www.northcountrypublicradio.org/programs/local/bluenote.html\"><IMG align=right border=0 height=32 src=\"http://www.northcountrypublicradio.org/features/bluesm.gif\" width=60>The Blue Note</A> best blues with Ellen Rocco, <font color=\"#99000\">Tue 3 pm</font>"
);

Tuesday = new Array(
/*12AM - 05PM*/"<A href=\"http://www.northcountrypublicradio.org/programs/local/bluenote.html\"><IMG align=right border=0 height=32 src=\"http://www.northcountrypublicradio.org/features/bluesm.gif\" width=60>The Blue Note</A> best blues with Ellen Rocco, <font color=\"#99000\">Tue 3 pm</font>", 
/*05PM - 12AM*/"<A href=\"http://www.northcountrypublicradio.org/programs/local/radiobob.html\"><IMG align=right border=0 height=28 src=\"http://www.northcountrypublicradio.org/features/rbob.gif\" width=60>The Radio Bob Show</A> worry-free rhythm and blues with Radio Bob Sauter, <font color=\"#99000\">Wed 3 pm</font>"
);

Wednesday = new Array(
/*12AM - 05PM*/"<A href=\"http://www.northcountrypublicradio.org/programs/local/radiobob.html\"><IMG align=right border=0 height=28 src=\"http://www.northcountrypublicradio.org/features/rbob.gif\" width=60>The Radio Bob Show</A> worry-free rhythm and blues with Radio Bob Sauter, <font color=\"#99000\">Wed 3 pm</font>", 
/*05PM - 12AM*/"<A href=\"http://www.northcountrypublicradio.org/programs/local/string.html\"><IMG align=right border=0 height=30 src=\"http://www.northcountrypublicradio.org/features/stringsm.gif\" width=60>String Fever</A> the best in bluegrass with Barb Heller, <font color=\"#99000\">Thu 3 pm</font>"
);

Thursday = new Array(
/*12AM - 05PM*/"<A href=\"http://www.northcountrypublicradio.org/programs/local/string.html\"><IMG align=right border=0 height=30 src=\"http://www.northcountrypublicradio.org/features/stringsm.gif\" width=60>String Fever</A> the best in bluegrass with Barb Heller, <font color=\"#99000\">Thu 3 pm</font>", 
/*05PM - 12AM*/"<A href=\"http://www.northcountrypublicradio.org/programs/local/beat.html\"><IMG align=right border=0 height=35 src=\"http://www.northcountrypublicradio.org/features/beatlogosm.jpg\" width=60>The Beat Authority</A> world dance and groove music with David Sommerstein, <font color=\"#99000\">Fri 3 pm</font>"
);

Friday = new Array(
/*12AM - 05PM*/"<A href=\"http://www.northcountrypublicradio.org/programs/local/beat.html\"><IMG align=right border=0 height=35 src=\"http://www.northcountrypublicradio.org/features/beatlogosm.jpg\" width=60>The Beat Authority</A> world dance and groove music with David Sommerstein, <font color=\"#99000\">Fri 3 pm</font>", 
/*05PM - 08PM*/"<A href=\"http://www.northcountrypublicradio.org/programs/local/cutaway.html\"><IMG align=right border=0 height=35 src=\"http://www.northcountrypublicradio.org/features/cutaway.jpg\" width=60>Cutaway</A> folk, blues, acoustic and roots sounds with Jonathan Brown, <font color=\"#99000\">Fri 7 pm</font>",
/*08PM - 12AM*/"<A href=\"http://www.northcountrypublicradio.org/programs/local/thebridge.html\"><IMG align=right border=0 height=60 src=\"http://www.northcountrypublicradio.org/programs/images/thebridge75.jpg\" width=60>The Bridge</A> classic and contemporary jazz with Joel Hurd, <font color=\"#99000\">Sat 9 pm</font>"
);

Saturday = new Array(
/*12AM - 10PM*/"<A href=\"http://www.northcountrypublicradio.org/programs/local/thebridge.html\"><IMG align=right border=0 height=60 src=\"http://www.northcountrypublicradio.org/programs/images/thebridge75.jpg\" width=60>The Bridge</A> classic and contemporary jazz with Joel Hurd, <font color=\"#99000\">Sat 9 pm</font>", 
/*10PM - 12AM*/"<A href=\"http://www.northcountrypublicradio.org/programs/local/jazz.html\"><IMG align=right border=0 height=36 src=\"http://www.northcountrypublicradio.org/features/10spot90.jpg\" width=60>Jazz @ The Ten Spot</A> classic and contemporary jazz with Guy Berard, <font color=\"#99000\">Sat 10 pm</font>"
);

Sunday = new Array(
/*12AM - 09AM*/"<A href=\"http://www.northcountrypublicradio.org/programs/local/fminmorning.html\"><IMG align=right border=0 height=50 src=\"http://www.northcountrypublicradio.org/features/fminmorning.jpg\" width=50>FM in the Morning</A> classical music and features with Barb Heller, <font color=#99000>Sun 7 am</font>", 
/*09AM - 12AM*/"<A href=\"http://www.northcountrypublicradio.org/programs/local/monday.html\"><IMG align=right border=0 height=30 src=\"http://www.northcountrypublicradio.org/features/monmus.gif\" width=30>Music for a Monday Afternoon</A> world music with Jackie Sauter, <font color=#99000>Mon 3 pm</font>"
);

// *******************

if (hour < 17) {
	prognum = 0;
}
else {
	prognum = 1;
}

if (day == 6) {
	 if (hour < 9) {
	 	  prognum = 0;
   }
	 else {
	 		prognum = 1;
	 }
}

if (day == 0) {
	 if (hour < 9) {
	 	  prognum = 0;
   }
	 else {
	 		prognum = 1;
	 }
}

if (day == 1) {
	mod = Monday[prognum];
}
if (day == 2) {
	mod = Tuesday[prognum];
}
if (day == 3) {
	mod = Wednesday[prognum];
}
if (day == 4) {
	mod = Thursday[prognum];
}
if (day == 5) {
	mod = Friday[prognum];
}
if (day == 6) {
	mod = Saturday[prognum];
}
if (day == 0) {
	mod = Sunday[prognum];
}

/*
if (day == 4 && hour == 19 && (date >= 1 && date <= 7 )) {
		mod = "Readers and Writers on the Air"
		};
if (day == 4 && hour == 19 && ((date >= 8 && date <= 21 ))) {
		mod = "Documentaries and Call-ins"
		};
if (day == 4 && hour == 19 && (date >= 22 && date <= 28 )) {
		mod = "Documentaries and Call-ins"
		};
*/

		
// **************** Output results

document.write("<font face=\"Verdana, Arial, Helvetica, sans-serif\">"+mod+"</div>");