// Created by M. Galloway 9/10/2009

// Replacing Perl and Mason scripts in index.html with javascript that does same thing.

// Checks today's date and generates text/link providing about the Poet of the Week based poet's birthday.

// create a date object
var d = new Date();

//uncomment to use for debugging
//d.setDate(14); // change day of month
//d.setMonth(0); // change month number (subtract 1 for current month)

// get today's date
var t_d = d.toDateString();

//get day of month
var d_of_mon = d.getDate();
//get month number
var mon_num = d.getMonth() + 1;

//uncomment to use for debugging
//document.write(d_of_mon+"<br />"); // see day of month
//document.write(mon_num+"<br />"); // see month number

// initialize message strings to show for today
var t_d_code;
var t_d_img;
var t_d_anchor;

// syntax for having a specific event before or on a specific day in a specific month
// Uncomment if useful for debugging
//if (mon_num <= 8 && d_of_mon <= 24) { t_d_img = 'images/CarlSandburgNoPic.jpg'; t_d_anchor=''; }

// if statements for specific events
if (mon_num <= 1 && d_of_mon <= 6) { t_d_img = 'images/CarlSandburgNoPic.jpg'; t_d_anchor='Sandburg'; }
else if (mon_num <= 1 && d_of_mon <= 14) { t_d_img = 'images/DudleyRandallNoPic.jpg'; t_d_anchor='Randall'; }
else if (mon_num <= 1 && d_of_mon <= 19) { t_d_img = 'images/Edgar_Allan_Poe.jpg'; t_d_anchor='Poe'; }
else if (mon_num <= 1 && d_of_mon <= 25) { t_d_img = 'images/Robert_burns.jpg'; t_d_anchor='Burns'; }
else if (mon_num <= 2 && d_of_mon <= 1) { t_d_img = 'images/Hughes.jpg'; t_d_anchor='Hughes'; }
else if (mon_num <= 2 && d_of_mon <= 6) { t_d_img = 'images/Christopher_MarlowePossibly.jpg'; t_d_anchor='Marlowe'; }
else if (mon_num <= 2 && d_of_mon <= 18) { t_d_img = 'images/AudreLordeNoPic.jpg'; t_d_anchor='Lorde'; }
else if (mon_num <= 2 && d_of_mon <= 22) { t_d_img = 'images/EStVincentMillay2.jpg'; t_d_anchor='Millay'; }
else if (mon_num <= 3 && d_of_mon <= 6) { t_d_img = 'images/Elizabeth_Barrett_Browning2.jpg'; t_d_anchor='Browning'; }
else if (mon_num <= 3 && d_of_mon <= 12) { t_d_img = 'images/Jack_Kerouac2.jpg'; t_d_anchor='Kerouac'; }
else if (mon_num <= 3 && d_of_mon <= 18) { t_d_img = 'images/MichaelSHarperNoPic.jpg'; t_d_anchor='Harper'; }
else if (mon_num <= 3 && d_of_mon <= 26) { t_d_img = 'images/Frost2.jpg'; t_d_anchor='Frost'; }
else if (mon_num <= 4 && d_of_mon <= 4) { t_d_img = 'images/MayaAngelou2.jpg'; t_d_anchor='Angelou'; }
else if (mon_num <= 4 && d_of_mon <= 13) { t_d_img = 'images/Heaney2.jpg'; t_d_anchor='Heaney'; }
else if (mon_num <= 4 && d_of_mon <= 23) { t_d_img = 'images/Shakespeare2.jpg'; t_d_anchor='Shakespeare'; }
else if (mon_num <= 4 && d_of_mon <= 28) { t_d_img = 'images/EStVincentMillay2.jpg'; t_d_anchor='Forche'; }
else if (mon_num <= 5 && d_of_mon <= 6) { t_d_img = 'images/Jarrell_Randall2.jpg'; t_d_anchor='Jarrell'; }
else if (mon_num <= 5 && d_of_mon <= 11) { t_d_img = 'images/KamuaBraithwaiteNoPic.jpg'; t_d_anchor='Braithwaite'; }
else if (mon_num <= 5 && d_of_mon <= 16) { t_d_img = 'images/AdrienneRichNoPic.jpg'; t_d_anchor='Rich'; }
else if (mon_num <= 5 && d_of_mon <= 25) { t_d_img = 'images/TheodoreRoethkeNoPic.jpg'; t_d_anchor='Roethke'; }
else if (mon_num <= 6 && d_of_mon <= 7) { t_d_img = 'images/GwendolynBrooksNoPic.jpg'; t_d_anchor='Brooks'; }
else if (mon_num <= 6 && d_of_mon <= 13) { t_d_img = 'images/Yeats2.jpg'; t_d_anchor='Yeats'; }
else if (mon_num <= 6 && d_of_mon <= 20) { t_d_img = 'images/VikramSethNoPic.jpg'; t_d_anchor='Seth'; }
else if (mon_num <= 6 && d_of_mon <= 27) { t_d_img = 'images/FrankOHaraNoPic.jpg'; t_d_anchor='OHara'; }
else if (mon_num <= 7 && d_of_mon <= 7) { t_d_img = 'images/LousieErdrichNoPic.jpg'; t_d_anchor='Erdrich'; }
else if (mon_num <= 7 && d_of_mon <= 12) { t_d_img = 'images/Pablo_Neruda2.jpg'; t_d_anchor='Neruda'; }
else if (mon_num <= 7 && d_of_mon <= 20) { t_d_img = 'images/HenryDumasNoPic.jpg'; t_d_anchor='Dumas'; }
else if (mon_num <= 7 && d_of_mon <= 28) { t_d_img = 'images/GerardManleyHopkins2.jpg'; t_d_anchor='Hopkins'; }
else if (mon_num <= 8 && d_of_mon <= 6) { t_d_img = 'images/Alfred_Tennyson.jpg'; t_d_anchor='Tennyson'; }
else if (mon_num <= 8 && d_of_mon <= 16) { t_d_img = 'images/CharlesBukowskiNoPic.jpg'; t_d_anchor='Bukowski'; }
else if (mon_num <= 8 && d_of_mon <= 22) { t_d_img = 'images/DorothyParker.jpg'; t_d_anchor='Parker'; }
else if (mon_num <= 8 && d_of_mon <= 27) { t_d_img = 'images/Confucius.jpg'; t_d_anchor='Confucius'; }
else if (mon_num <= 9 && d_of_mon <= 1) { t_d_img = 'images/BlaiseCendras.jpg'; t_d_anchor='Cendrars'; }
else if (mon_num <= 9 && d_of_mon <= 10) { t_d_img = 'images/HildaDoolittle.jpg'; t_d_anchor='HD'; }
else if (mon_num <= 9 && d_of_mon <= 17) { t_d_img = 'images/Wcwilliams.jpg'; t_d_anchor='Williams'; }
else if (mon_num <= 9 && d_of_mon <= 26) { t_d_img = 'images/Tseliot.jpg'; t_d_anchor='Eliot'; }
else if (mon_num <= 10 && d_of_mon <= 2) { t_d_img = 'images/Wallace_Stevens2.jpg'; t_d_anchor='Stevens'; }
else if (mon_num <= 10 && d_of_mon <= 7) { t_d_img = 'images/baraka2.jpg'; t_d_anchor='Baraka'; }
else if (mon_num <= 10 && d_of_mon <= 14) { t_d_img = 'images/EECummings.jpg'; t_d_anchor='cummings'; }
else if (mon_num <= 10 && d_of_mon <= 27) { t_d_img = 'images/SylviaPlathNoPic.jpg'; t_d_anchor='Plath'; }
else if (mon_num <= 11 && d_of_mon <= 2) { t_d_img = 'images/OdysseusElytisNoPic.jpg'; t_d_anchor='Elytis'; }
else if (mon_num <= 11 && d_of_mon <= 9) { t_d_img = 'images/AnneSextonNoPic.jpg'; t_d_anchor='Sexton'; }
else if (mon_num <= 11 && d_of_mon <= 16) { t_d_img = 'images/ChinuaAchebe.jpg'; t_d_anchor='Achebe'; }
else if (mon_num <= 11 && d_of_mon <= 28) { t_d_img = 'images/William_Blake_by_Thomas_Phillips.jpg'; t_d_anchor='Blake'; }
else if (mon_num <= 12 && d_of_mon <= 4) { t_d_img = 'images/RilkeByModersohn-Becker.jpg'; t_d_anchor='Rilke'; }
else if (mon_num <= 12 && d_of_mon <= 10) { t_d_img = 'images/Emily_Dickinson2.jpg'; t_d_anchor='Dickinson'; }
else if (mon_num <= 12 && d_of_mon <= 15) { t_d_img = 'images/Rukeyser.gif'; t_d_anchor='Rukeyser'; }
else if (mon_num <= 12 && d_of_mon <= 26) { t_d_img = 'images/JeanToomerNoPic.jpg'; t_d_anchor='Toomer'; }
//if no match for above dates, reset img variable to empty string and show nothing
else { t_d_img = 'NoPOET'; } 

t_d_code = '<h4 class="center"><a href="weekspoet.html#';
t_d_code += t_d_anchor;
t_d_code += '"><img src=\"\n';
t_d_code += t_d_img;
t_d_code += '" class="no_border" width="200" height="247" alt="" /></a><br /><a href="weekspoet.html#';
t_d_code += t_d_anchor;
t_d_code += '" style="visibility: hidden;">Poet of the Week</a></h4>\n'; 

document.write(t_d_code);





