/* +-------------------------------------------------------------------+ | J S - C A L E N D A R (v2.1) | | | | Copyright Gerd Tentler www.gerd-tentler.de/tools | | Created: May 27, 2003 Last modified: Dec. 29, 2005 | +-------------------------------------------------------------------+ | This program may be used and hosted free of charge by anyone for | | personal purpose as long as this copyright notice remains intact. | | | | Obtain permission before selling the code for this program or | | hosting this software on a commercial website or redistributing | | this software over the Internet or in any other medium. In all | | cases copyright must remain intact. | +-------------------------------------------------------------------+ EXAMPLE #1: myCal = new CALENDAR(); document.write(myCal.create()); EXAMPLE #2: myCal = new CALENDAR("2004-12"); document.write(myCal.create()); EXAMPLE #3: myCal = new CALENDAR(); myCal.year = 2004; myCal.month = 12; document.write(myCal.create()); ========================================================================================================== */ var cal_ID = 0; myCal = new CALENDAR(); document.write(myCal.create()); function CALENDAR(date) { //======================================================================================================== // Configuration //======================================================================================================== this.tFontFace = 'Arial, Helvetica'; // title: font family (CSS-spec, e.g. "Arial, Helvetica") this.tFontSize = 15; // title: font size (pixels) this.tFontColor = '#000000'; // title: font color this.tBGColor = '#d3e6ff'; // title: background color this.HolFontFace = 'Arial, Helvetica'; // title: font family (CSS-spec, e.g. "Arial, Helvetica") this.HolFontSize = 10; // title: font size (pixels) this.HolFontColor = '#024b95'; // title: font color this.HolBGColor = '#bcd8ff'; // title: background color this.hFontFace = 'Arial, Helvetica'; // heading: font family (CSS-spec, e.g. "Arial, Helvetica") this.hFontSize = 10; // heading: font size (pixels) this.hFontColor = '#000000'; // heading: font color this.hBGColor = '#bcd8ff'; // heading: background color this.dFontFace = 'Arial, Helvetica'; // days: font family (CSS-spec, e.g. "Arial, Helvetica") this.dFontSize = 10; // days: font size (pixels) this.dFontColor = '#000000'; // days: font color this.dBGColor = '#bcd8ff'; // days: background color this.wFontFace = 'Arial, Helvetica'; // weeks: font family (CSS-spec, e.g. "Arial, Helvetica") this.wFontSize = 10; // weeks: font size (pixels) this.wFontColor = '#000000'; // weeks: font color this.wBGColor = '#bcd8ff'; // weeks: background color this.saFontColor = '#D00000'; // Saturdays: font color this.saBGColor = '#bcd8ff'; // Saturdays: background color this.suFontColor = '#000000'; // Sundays: font color this.suBGColor = '#bcd8ff'; // Sundays: background color this.tdFontColor = '#024b95'; // today: font color this.tdBGColor = '#ffffff'; // today: background color this.borderColor = '#bcd8ff'; // border color this.hilightColor = '#ffffff'; // hilight color (works only in combination with link) this.link = "#"; // page to link to when day is clicked this.offset = 2; // week start: 0 - 6 (0 = Saturday, 1 = Sunday, 2 = Monday ...) // weekdays: must start with Saturday because January 1st of year 1 was a Saturday this.weekdays = new Array('Ñá', 'Âñ', 'Ïí', 'Âò', 'Ñð', '×ò', 'Ïò'); // months: must start with January this.months = new Array('ßíâàðü', 'Ôåâðàëü', 'Ìàðò', 'Àïåëü', 'Ìàé', 'Èþíü', 'Èþëü', 'Àâãóñò', 'Ñåíòÿáðü', 'Îêòÿáðü', 'Íîÿáðü', 'Äåêàáðü'); // don't change from here this.year = 0; this.month = 0; this.size = 0; this.mDays = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); this.Hol = new Array([9,13],[9,14],[9,16],[9,22],[9,27],[9,28],[9,29]); //this.HolMonth = new Array (2,7,7,7); if(!date) { var obj = new Date(); this.year = obj.getYear(); if(this.year < 1900) this.year += 1900; this.month = obj.getMonth() + 1; } else { var d = date.split('-'); this.year = d[0]; this.month = d[1]; } //======================================================================================================== // Functions //======================================================================================================== this.set_styles = function() { cal_ID++; var html = ''; return html; } this.leap_year = function(year) { return (!(year % 4) && (year < 1582 || year % 100 || !(year % 400))) ? true : false; } this.get_weekday = function(year, days) { var a = days; if(year) a += (year - 1) * 365; for(var i = 1; i < year; i++) if(this.leap_year(i)) a++; if(year > 1582 || (year == 1582 && days >= 277)) a -= 10; if(a) a = (a - this.offset) % 7; else if(this.offset) a += 7 - this.offset; return a; } this.get_week = function(year, days) { var firstWDay = this.get_weekday(year, 0); return Math.floor((days + firstWDay) / 7) + (firstWDay <= 3); } this.table_cell = function(content, cls, date) { var size = Math.round(this.size * 1.5); var html = '
';
html += ' |