/* seminars.js - Auto-updating seminar list for frontpage of entomology department site
 * 
 * VARIABLES
 * 
 * myDay is the numerical day.  1-31 possible.  Obtained from Date() object.
 *
 * myMonth is the numerical month.  0-11, where 0 is January.  Obtained from Date() object.
 *
 * ARRAYS
 * Each index in array corresponds to the same index in all the other arrays.
 * 
 * myDates is the list of seminar dates.  If anyone knows how to make this array data load
 * from a file, be my guest.  It's a pain right now.
 * 
 * mySpeakers is the list of seminar speakers, each wrapped in a link to their homepage.
 * 
 * myTitles is the list of seminar titles.
 *
 */

var myDay;
var myMonth;
var myMonthDay;

var index;

var myDates = new Array(
		   /*0*/   '8/24/2009', 
                   /*1*/   '8/31/2009',
                   /*2*/   '9/7/2009 (Labor Day)',
                   /*3*/   '9/14/2009',
                   /*4*/   '9/21/2009',
		   /*5*/   '9/28/2009',
                   /*6*/   '10/5/2009',
                   /*7*/   '10/12/2009',
                   /*8*/   '10/19/2009',
                   /*9*/   '10/26/2009',
                   /*10*/  '11/2/2009',
                   /*11*/  '11/9/2009',
                   /*12*/  '11/16/2009',
                   /*13*/  '11/23/2009 (Thanksgiving)',
                   /*14*/  '11/30/2009',
                   /*15*/  '12/7/2009',
                   /*16*/  'Winter Break')

var mySpeakers = new Array(
		   /*0*/   '<b>New Student Meet & Greet!</b>', 
                   /*1*/   '<a href="http://www.citypaper.net/articles/2008/12/18/the-green-futures-of-aaron-birk">Aaron Birk</a>',
                   /*2*/   '<b>No seminar.</b>',
                   /*3*/   '<a href="http://www.eeb.uconn.edu/people/wagner/">David Wagner</a>',
                   /*4*/   '<a href="http://fm1.fieldmuseum.org/aa/staff_page.cgi?staff=cmoreau">Corrie Moreau</a>',
		   /*5*/   '<b>No seminar.</b>',
                   /*6*/   '<a href="http://www.inhs.uiuc.edu/staff/index.php?action=list&amp;user_name=lsolter">Lee Solter</a>',
                   /*7*/   '<a href="http://www.bio.umass.edu/mcb/faculty/Clark.html">John Clark</a>',
                   /*8*/   '<a href="http://insects.tamu.edu/people/faculty/zhusalzmank.cfm">Keyan Zhu-Salzman</a>',
                   /*9*/   '<a href="http://www.cals.ncsu.edu/entomology/schal/">Coby Schal</a>',
                   /*10*/  '<a href="http://taes.utk.edu/person/show.asp?which=5225">Juan Luis Jurat-Fuentes</a>',
                   /*11*/  '<a href="http://www.entomology.lsu.edu/faculty/allison_files/allison.html">Jeremy Allison</a>',
                   /*12*/  '<a href="http://www.uky.edu/Ag/Entomology/entdept/faculty/dpotter/dpotter.htm">Dan Potter</a>',
                   /*13*/  '<b>No seminar.</b>',
                   /*14*/  'John Marlin',
                   /*15*/  '<b><font color="red">ESA practice talks!</font></b>',
                   /*16*/  'Seminars resume in 2010!')

var myTitles = new Array(
		   /*0*/   '', 
                   /*1*/   '<i>The Pollinator`s Corridor</i>, a graphic novel',
                   /*2*/   '',
                   /*3*/   'Threats posed to rare or endangered insects by invasions of non-native species',
                   /*4*/   'Unraveling speciation and diversification patterns across the ants',
		   /*5*/   '',
                   /*6*/   'TBA',
                   /*7*/   'Mechanisms and monitoring of permethrin resistance in human head lice',
                   /*8*/   'Gaining molecular insight into insect adaptation to dietary toxins',
                   /*9*/   'Microbial flatulence and bug farts as insect semiochemicals: Lessons from cockroaches and mosquitoes',
                   /*10*/  'Prospecting insects for enzymes to improve lignocellulosic biofuel production',
                   /*11*/  'Evolutionary ecology of moth pheromone communication: Acceptance of a paradigm without empirical support?',
                   /*12*/  'Japanese beetle-plant interactions',
                   /*13*/  '',
                   /*14*/  'TBA',
                   /*15*/  '',
                   /*16*/  '')

function makeDate()
{

 index=0;

 var d = new Date();
 myDay = d.getDate();
 myMonth = d.getMonth() + 1;  /*adjust for 0 being january*/

 myMonthDay = (myMonth*100)+myDay;

 /*Date is described as Month+Day as single number, e.g. Jan 14 = 114*/

 if(myMonthDay > 825) index=1; /*proceed through dates until hit closest upcoming monday*/
 if(myMonthDay > 831) index=2;
 if(myMonthDay > 907) index=3;
 if(myMonthDay > 914) index=4;
 if(myMonthDay > 921) index=5;
 if(myMonthDay > 928) index=6;
 if(myMonthDay > 1005) index=7;
 if(myMonthDay > 1012) index=8;
 if(myMonthDay > 1019) index=9;
 if(myMonthDay > 1026) index=10;
 if(myMonthDay > 1102) index=11;
 if(myMonthDay > 1109) index=12;
 if(myMonthDay > 1116) index=13;
 if(myMonthDay > 1123) index=14;
 if(myMonthDay > 1130) index=15;
 if(myMonthDay > 1207) index=16; /*cover for winter break*/

}

function getSeminarDate()
{

 document.write(myDates[index]);

}

function getSpeaker()
{

 document.write(mySpeakers[index]);

}

function getTitle()
{

 document.write(myTitles[index]);

}