/*************************************************************************************** JavaScript Calendar - Digital Christian Design //Script featured on and available at JavaScript Kit: http://www.javascriptkit.com // Functions changedate(): Moves to next or previous month or year, or current month depending on the button clicked. createCalendar(): Renders the calander into the page with links for each to fill the date form filds above. ***************************************************************************************/ var thisDate = 1; // Tracks current date being written in calendar var wordMonth = new Array("January","February","March","April","May","June","July","August","September","October","November","December"); var today = new Date(); // Date object to store the current date var todaysDay = today.getDay() + 1; // Stores the current day number 1-7 var todaysDate = today.getDate(); // Stores the current numeric date within the month var todaysMonth = today.getUTCMonth() + 1; // Stores the current month 1-12 var todaysYear = today.getFullYear(); // Stores the current year var monthNum = todaysMonth; // Tracks the current month being displayed var yearNum = todaysYear; // Tracks the current year being displayed var firstDate = new Date(String(monthNum)+"/1/"+String(yearNum)); // Object Storing the first day of the current month var firstDay = firstDate.getUTCDay(); // Tracks the day number 1-7 of the first day of the current month var lastDate = new Date(String(monthNum+1)+"/0/"+String(yearNum)); // Tracks the last date of the current month var numbDays = 0; var calendarString = ""; var eastermonth = 0; var easterday = 0; function changedate(buttonpressed) { if (buttonpressed == "prevyr") yearNum--; else if (buttonpressed == "nextyr") yearNum++; else if (buttonpressed == "prevmo") monthNum--; else if (buttonpressed == "nextmo") monthNum++; else if (buttonpressed == "return") { monthNum = todaysMonth; yearNum = todaysYear; } if (monthNum == 0) { monthNum = 12; yearNum--; } else if (monthNum == 13) { monthNum = 1; yearNum++ } lastDate = new Date(String(monthNum+1)+"/0/"+String(yearNum)); numbDays = lastDate.getDate(); firstDate = new Date(String(monthNum)+"/1/"+String(yearNum)); firstDay = firstDate.getDay() + 1; createCalendar(); return; } function easter(year) { // feed in the year it returns the month and day of Easter using two GLOBAL variables: eastermonth and easterday var a = year % 19; var b = Math.floor(year/100); var c = year % 100; var d = Math.floor(b/4); var e = b % 4; var f = Math.floor((b+8) / 25); var g = Math.floor((b-f+1) / 3); var h = (19*a + b - d - g + 15) % 30; var i = Math.floor(c/4); var j = c % 4; var k = (32 + 2*e + 2*i - h - j) % 7; var m = Math.floor((a + 11*h + 22*k) / 451); var month = Math.floor((h + k - 7*m + 114) / 31); var day = ((h + k - 7*m +114) % 31) + 1; eastermonth = month; easterday = day; } function createCalendar() { calendarString = ''; var daycounter = 0; calendarString += '