Copy code The code is as follows: js calendar <br>/* Copyright Mihai Bazon, 2002-2005 | www.bazon.net/mishoo <br>* ----------------------------------------------------------- <br>* <br>* The DHTML Calendar, version 1.0 "It is happening again" <br>* <br>* Details and latest version at: <br>* www.dynarch.com/projects/calendar <br>* <br>* This script is developed by Dynarch.com. Visit us at www.dynarch.com. <br>* <br>* This script is distributed under the GNU Lesser General Public License. <br>* Read the entire license text here: http://www.gnu.org/licenses/lgpl.html <br>*/ <br>// $Id: calendar.js,v 1.51 2005/03/07 16:44:31 mishoo Exp $ <br>/**The Calendar object constructor.*/ <br>Calendar = function (firstDayOfWeek, dateStr, onSelected, onClose) { <br>// member variables <br>this.activeDiv = null; <br>this.currentDateEl = null; <br>this.getDateStatus = null; <br>this.getDateToolTip = null; <br>this.getDateText = null; <br>this.timeout = null; <br>this.onSelected = onSelected || null; <br>this.onClose = onClose || null; <br>this.dragging = false; <br>this.hidden = false; <br>this.minYear = 1970; <br>this.maxYear = 2050; <br>this.dateFormat = Calendar._TT["DEF_DATE_FORMAT"]; <br>this.ttDateFormat = Calendar._TT["TT_DATE_FORMAT"]; <br>this.isPopup = true; <br>this.weekNumbers = true; <br>this.firstDayOfWeek = typeof firstDayOfWeek == "number" ? firstDayOfWeek : Calendar._FD; // 0 for Sunday, 1 for Monday, etc. <br>this.showsOtherMonths = false; <br>this.dateStr = dateStr; <br>this.ar_days = null; <br>this.showsTime = false; <br>this.time24 = true; <br>this.yearStep = 2; <br>this.hiliteToday = true; <br>this.multiple = null; <br>// HTML elements <br>this.table = null; <br>this.element = null; <br>this.tbody = null; <br>this.firstdayname = null; <br>// Combo boxes <br>this.monthsCombo = null; <br>this.yearsCombo = null; <br>this.hilitedMonth = null; <br>this.activeMonth = null; <br>this.hilitedYear = null; <br>this.activeYear = null; <br>// Information <br>this.dateClicked = false; <br>// one-time initializations <br>if (typeof Calendar._SDN == "undefined") { <br>// table of short day names <br>if (typeof Calendar._SDN_len == "undefined") <br>Calendar._SDN_len = 3; <br>var ar = new Array(); <br>for (var i = 8; i > 0;) { <br>ar[--i] = Calendar._DN[i].substr(0, Calendar._SDN_len); <br>} <br>Calendar._SDN = ar; <br>// table of short month names <br>if (typeof Calendar._SMN_len == "undefined") <br>Calendar._SMN_len = 3; <br>ar = new Array(); <br>for (var i = 12; i > 0;) { <br>ar[--i] = Calendar._MN[i].substr(0, Calendar._SMN_len); <br>} <br>Calendar._SMN = ar; <br>} <br>}; <br>// ** constants <br>/// "static", needed for event handlers. <br>Calendar._C = null; <br>/// detect a special case of "web browser" <br>Calendar.is_ie = ( /msie/i.test(navigator.userAgent) && <br>!/opera/i.test(navigator.userAgent) ); <br>Calendar.is_ie5 = ( Calendar.is_ie && /msie 5.0/i.test(navigator.userAgent) ); <br>/// detect Opera browser <br>Calendar.is_opera = /opera/i.test(navigator.userAgent); <br>/// detect KHTML-based browsers <br>Calendar.is_khtml = /Konqueror|Safari|KHTML/i.test(navigator.userAgent); <br>// BEGIN: UTILITY FUNCTIONS; beware that these might be moved into a separate <br>// library, at some point. <br>Calendar.getAbsolutePos = function(el) { <br>var SL = 0, ST = 0; <br>var is_div = /^div$/i.test(el.tagName); <br>if (is_div && el.scrollLeft) <br>SL = el.scrollLeft; <br>if (is_div && el.scrollTop) <br>ST = el.scrollTop; <br>var r = { x: el.offsetLeft - SL, y: el.offsetTop - ST }; <br>if (el.offsetParent) { <br>var tmp = this.getAbsolutePos(el.offsetParent); <br>r.x += tmp.x; <br>r.y += tmp.y; <br>} <br>return r; <br>}; <br>Calendar.isRelated = function (el, evt) { <br>var related = evt.relatedTarget; <br>if (!related) { <br>var type = evt.type; <br>if (type == "mouseover") { <br>related = evt.fromElement; <br>} else if (type == "mouseout") { <br>related = evt.toElement; <br>} <br>} <br>while (related) { <br>if (related == el) { <br>return true; <br>} <br>related = related.parentNode; <br>} <br>return false; <br>}; <br>Calendar.removeClass = function(el, className) { <br>if (!(el && el.className)) { <br>return; <br>} <br>var cls = el.className.split(" "); <br>var ar = new Array(); <br>for (var i = cls.length; i > 0;) { <br>if (cls[--i] != className) { <br>ar[ar.length] = cls[i]; <br>} <br>} <br>el.className = ar.join(" "); <br>}; <br>Calendar.addClass = function(el, className) { <br>Calendar.removeClass(el, className); <br>el.className += " " + className; <br>}; <br>// FIXME: the following 2 functions totally suck, are useless and should be replaced immediately. <br>Calendar.getElement = function(ev) { <br>var f = Calendar.is_ie ? window.event.srcElement : ev.currentTarget; <br>while (f.nodeType != 1 || /^div$/i.test(f.tagName)) <br>f = f.parentNode; <br>return f; <br>}; <br>Calendar.getTargetElement = function(ev) { <br>var f = Calendar.is_ie ? window.event.srcElement : ev.target; <br>while (f.nodeType != 1) <br>f = f.parentNode; <br>return f; <br>}; <br>Calendar.stopEvent = function(ev) { <br>ev || (ev = window.event); <br>if (Calendar.is_ie) { <br>ev.cancelBubble = true; <br>ev.returnValue = false; <br>} else { <br>ev.preventDefault(); <br>ev.stopPropagation(); <br>} <br>return false; <br>}; <br>Calendar.addEvent = function(el, evname, func) { <br>if (el.attachEvent) { // IE <br>el.attachEvent("on" + evname, func); <br>} else if (el.addEventListener) { // Gecko / W3C <br>el.addEventListener(evname, func, true); <br>} else { <br>el["on" + evname] = func; <br>} <br>}; <br>Calendar.removeEvent = function(el, evname, func) { <br>if (el.detachEvent) { // IE <br>el.detachEvent("on" + evname, func); <br>} else if (el.removeEventListener) { // Gecko / W3C <br>el.removeEventListener(evname, func, true); <br>} else { <br>el["on" + evname] = null; <br>} <br>}; <br>Calendar.createElement = function(type, parent) { <br>var el = null; <br>if (document.createElementNS) { <br>// use the XHTML namespace; IE won't normally get here unless <br>// _they_ "fix" the DOM2 implementation. <br>el = document.createElementNS("http://www.w3.org/1999/xhtml", type); <br>} else { <br>el = document.createElement(type); <br>} <br>if (typeof parent != "undefined") { <br>parent.appendChild(el); <br>} <br>return el; <br>}; <br>// END: UTILITY FUNCTIONS <br>// BEGIN: CALENDAR STATIC FUNCTIONS <br>/**Internal -- adds a set of events to make some element behave like a button.*/ <br>Calendar._add_evs = function(el) { <br>with (Calendar) { <br>addEvent(el, "mouseover", dayMouseOver); <br>addEvent(el, "mousedown", dayMouseDown); <br>addEvent(el, "mouseout", dayMouseOut); <br>if (is_ie) { <br>addEvent(el, "dblclick", dayMouseDblClick); <br>el.setAttribute("unselectable", true); <br>} <br>} <br>}; <br>Calendar.findMonth = function(el) { <br>if (typeof el.month != "undefined") { <br>return el; <br>} else if (typeof el.parentNode.month != "undefined") { <br>return el.parentNode; <br>} <br>return null; <br>}; <br>Calendar.findYear = function(el) { <br>if (typeof el.year != "undefined") { <br>return el; <br>} else if (typeof el.parentNode.year != "undefined") { <br>return el.parentNode; <br>} <br>return null; <br>}; <br>Calendar.showMonthsCombo = function () { <br>var cal = Calendar._C; <br>if (!cal) { <br>return false; <br>} <br>var cal = cal; <br>var cd = cal.activeDiv; <br>var mc = cal.monthsCombo; <br>if (cal.hilitedMonth) { <br>Calendar.removeClass(cal.hilitedMonth, "hilite"); <br>} <br>if (cal.activeMonth) { <br>Calendar.removeClass(cal.activeMonth, "active"); <br>} <br>var mon = cal.monthsCombo.getElementsByTagName("div")[cal.date.getMonth()]; <br>Calendar.addClass(mon, "active"); <br>cal.activeMonth = mon; <br>var s = mc.style; <br>s.display = "block"; <br>if (cd.navtype < 0) <BR>s.left = cd.offsetLeft + "px"; <BR>else { <BR>var mcw = mc.offsetWidth; <BR>if (typeof mcw == "undefined") <BR>// Konqueror brain-dead techniques <BR>mcw = 50; <BR>s.left = (cd.offsetLeft + cd.offsetWidth - mcw) + "px"; <BR>} <BR>s.top = (cd.offsetTop + cd.offsetHeight) + "px"; <BR>}; <BR>Calendar.showYearsCombo = function (fwd) { <BR>var cal = Calendar._C; <BR>if (!cal) { <BR>return false; <BR>} <BR>var cal = cal; <BR>var cd = cal.activeDiv; <BR>var yc = cal.yearsCombo; <BR>if (cal.hilitedYear) { <BR>Calendar.removeClass(cal.hilitedYear, "hilite"); <BR>} <BR>if (cal.activeYear) { <BR>Calendar.removeClass(cal.activeYear, "active"); <BR>} <BR>cal.activeYear = null; <BR>var Y = cal.date.getFullYear() + (fwd ? 1 : -1); <BR>var yr = yc.firstChild; <BR>var show = false; <BR>for (var i = 12; i > 0; --i) { <br>if (Y >= cal.minYear && Y <= cal.maxYear) { <BR>yr.innerHTML = Y; <BR>yr.year = Y; <BR>yr.style.display = "block"; <BR>show = true; <BR>} else { <BR>yr.style.display = "none"; <BR>} <BR>yr = yr.nextSibling; <BR>Y += fwd ? cal.yearStep : -cal.yearStep; <BR>} <BR>if (show) { <BR>var s = yc.style; <BR>s.display = "block"; <BR>if (cd.navtype < 0) <BR>s.left = cd.offsetLeft + "px"; <BR>else { <BR>var ycw = yc.offsetWidth; <BR>if (typeof ycw == "undefined") <BR>// Konqueror brain-dead techniques <BR>ycw = 50; <BR>s.left = (cd.offsetLeft + cd.offsetWidth - ycw) + "px"; <BR>} <BR>s.top = (cd.offsetTop + cd.offsetHeight) + "px"; <BR>} <BR>}; <BR>// event handlers <BR>Calendar.tableMouseUp = function(ev) { <BR>var cal = Calendar._C; <BR>if (!cal) { <BR>return false; <BR>} <BR>if (cal.timeout) { <BR>clearTimeout(cal.timeout); <BR>} <BR>var el = cal.activeDiv; <BR>if (!el) { <BR>return false; <BR>}<BR>var target = Calendar.getTargetElement(ev); <BR>ev || (ev = window.event); <BR>Calendar.removeClass(el, "active"); <BR>if (target == el || target.parentNode == el) { <BR>Calendar.cellClick(el, ev); <BR>} <BR>var mon = Calendar.findMonth(target); <BR>var date = null; <BR>if (mon) { <BR>date = new Date(cal.date); <BR>if (mon.month != date.getMonth()) { <BR>date.setMonth(mon.month); <BR>cal.setDate(date); <BR>cal.dateClicked = false; <BR>cal.callHandler(); <BR>} <BR>} else { <BR>var year = Calendar.findYear(target); <BR>if (year) { <BR>date = new Date(cal.date); <BR>if (year.year != date.getFullYear()) { <BR>date.setFullYear(year.year); <BR>cal.setDate(date); <BR>cal.dateClicked = false; <BR>cal.callHandler(); <BR>} <BR>} <BR>} <BR>with (Calendar) { <BR>removeEvent(document, "mouseup", tableMouseUp); <BR>removeEvent(document, "mouseover", tableMouseOver); <BR>removeEvent(document, "mousemove", tableMouseOver); <BR>cal._hideCombos(); <BR>_C = null; <BR>return stopEvent(ev); <BR>} <BR>}; <BR>Calendar.tableMouseOver = function (ev) { <BR>var cal = Calendar._C; <BR>if (!cal) { <BR>return; <BR>} <BR>var el = cal.activeDiv; <BR>var target = Calendar.getTargetElement(ev); <BR>if (target == el || target.parentNode == el) { <BR>Calendar.addClass(el, "hilite active"); <BR>Calendar.addClass(el.parentNode, "rowhilite"); <BR>} else { <BR>if (typeof el.navtype == "undefined" || (el.navtype != 50 && (el.navtype == 0 || Math.abs(el.navtype) > 2))) <br>Calendar.removeClass(el, "active"); <br>Calendar.removeClass(el, "hilite"); <br>Calendar.removeClass(el.parentNode, "rowhilite"); <br>} <br>ev || (ev = window.event); <br>if (el.navtype == 50 && target != el) { <br>var pos = Calendar.getAbsolutePos(el); <br>var w = el.offsetWidth; <br>var x = ev.clientX; <br>var dx; <br>var decrease = true; <br>if (x > pos.x + w) { <br>dx = x - pos.x - w; <br>decrease = false; <br>} else <br>dx = pos.x - x; <br>if (dx < 0) dx = 0; <BR>var range = el._range; <BR>var current = el._current; <BR>var count = Math.floor(dx / 10) % range.length; <BR>for (var i = range.length; --i >= 0;) <br>if (range[i] == current) <br>break; <br>while (count-- > 0) <br>if (decrease) { <br>if (--i < 0) <BR>i = range.length - 1; <BR>} else if ( ++i >= range.length ) <br>i = 0; <br>var newval = range[i]; <br>el.innerHTML = newval; <br>cal.onUpdateTime(); <br>} <br>var mon = Calendar.findMonth(target); <br>if (mon) { <br>if (mon.month != cal.date.getMonth()) { <br>if (cal.hilitedMonth) { <br>Calendar.removeClass(cal.hilitedMonth, "hilite"); <br>} <br>Calendar.addClass(mon, "hilite"); <br>cal.hilitedMonth = mon; <br>} else if (cal.hilitedMonth) { <br>Calendar.removeClass(cal.hilitedMonth, "hilite"); <br>} <br>} else { <br>if (cal.hilitedMonth) { <br>Calendar.removeClass(cal.hilitedMonth, "hilite"); <br>} <br>var year = Calendar.findYear(target); <br>if (year) { <br>if (year.year != cal.date.getFullYear()) { <br>if (cal.hilitedYear) { <br>Calendar.removeClass(cal.hilitedYear, "hilite"); <br>} <br>Calendar.addClass(year, "hilite"); <br>cal.hilitedYear = year; <br>} else if (cal.hilitedYear) { <br>Calendar.removeClass(cal.hilitedYear, "hilite"); <br>} <br>} else if (cal.hilitedYear) { <br>Calendar.removeClass(cal.hilitedYear, "hilite"); <br>} <br>} <br>return Calendar.stopEvent(ev); <br>}; <br>Calendar.tableMouseDown = function (ev) { <br>if (Calendar.getTargetElement(ev) == Calendar.getElement(ev)) { <br>return Calendar.stopEvent(ev); <br>} <br>}; <br>Calendar.calDragIt = function (ev) { <br>var cal = Calendar._C; <br>if (!(cal && cal.dragging)) { <br>return false; <br>} <br>var posX; <br>var posY; <br>if (Calendar.is_ie) { <br>posY = window.event.clientY + document.body.scrollTop; <br>posX = window.event.clientX + document.body.scrollLeft; <br>} else { <br>posX = ev.pageX; <br>posY = ev.pageY; <br>} <br>cal.hideShowCovered(); <br>var st = cal.element.style; <br>st.left = (posX - cal.xOffs) + "px"; <br>st.top = (posY - cal.yOffs) + "px"; <br>return Calendar.stopEvent(ev); <br>}; <br>Calendar.calDragEnd = function (ev) { <br>var cal = Calendar._C; <br>if (!cal) { <br>return false; <br>} <br>cal.dragging = false; <br>with (Calendar) { <br>removeEvent(document, "mousemove", calDragIt); <br>removeEvent(document, "mouseup", calDragEnd); <br>tableMouseUp(ev); <br>} <br>cal.hideShowCovered(); <br>}; <br>Calendar.dayMouseDown = function(ev) { <br>var el = Calendar.getElement(ev); <br>if (el.disabled) { <br>return false; <br>} <br>var cal = el.calendar; <br>cal.activeDiv = el; <br>Calendar._C = cal; <br>if (el.navtype != 300) with (Calendar) { <br>if (el.navtype == 50) { <br>el._current = el.innerHTML; <br>addEvent(document, "mousemove", tableMouseOver); <br>} else <br>addEvent(document, Calendar.is_ie5 ? "mousemove" : "mouseover", tableMouseOver); <br>addClass(el, "hilite active"); <br>addEvent(document, "mouseup", tableMouseUp); <br>} else if (cal.isPopup) { <br>cal._dragStart(ev); <br>}<br>if (el.navtype == -1 || el.navtype == 1) { <br>if (cal.timeout) clearTimeout(cal.timeout); <br>cal.timeout = setTimeout("Calendar.showMonthsCombo()", 250); <br>} else if (el.navtype == -2 || el.navtype == 2) { <br>if (cal.timeout) clearTimeout(cal.timeout); <br>cal.timeout = setTimeout((el.navtype > 0) ? "Calendar.showYearsCombo(true)" : "Calendar.showYearsCombo(false)", 250); <br>} else { <br>cal.timeout = null; <br>} <br>return Calendar.stopEvent(ev); <br>}; <br>Calendar.dayMouseDblClick = function(ev) { <br>Calendar.cellClick(Calendar.getElement(ev), ev || window.event); <br>if (Calendar.is_ie) { <br>document.selection.empty(); <br>} <br>}; <br>Calendar.dayMouseOver = function(ev) { <br>var el = Calendar.getElement(ev); <br>if (Calendar.isRelated(el, ev) || Calendar._C || el.disabled) { <br>return false; <br>} <br>if (el.ttip) { <br>if (el.ttip.substr(0, 1) == "_") { <br>el.ttip = el.caldate.print(el.calendar.ttDateFormat) + el.ttip.substr(1); <br>} <br>el.calendar.tooltips.innerHTML = el.ttip; <br>} <br>if (el.navtype != 300) { <br>Calendar.addClass(el, "hilite"); <br>if (el.caldate) { <br>Calendar.addClass(el.parentNode, "rowhilite"); <br>} <br>} <br>return Calendar.stopEvent(ev); <br>}; <br>Calendar.dayMouseOut = function(ev) { <br>with (Calendar) { <br>var el = getElement(ev); <br>if (isRelated(el, ev) || _C || el.disabled) <br>return false; <br>removeClass(el, "hilite"); <br>if (el.caldate) <br>removeClass(el.parentNode, "rowhilite"); <br>if (el.calendar) <br>el.calendar.tooltips.innerHTML = _TT["SEL_DATE"]; <br>return stopEvent(ev); <br>} <br>}; <br>/**<br>* A generic "click" handler :) handles all types of buttons defined in this <br>* calendar. <br>*/ <br>Calendar.cellClick = function(el, ev) { <br>var cal = el.calendar; <br>var closing = false; <br>var newdate = false; <br>var date = null; <br>if (typeof el.navtype == "undefined") { <br>if (cal.currentDateEl) { <br>Calendar.removeClass(cal.currentDateEl, "selected"); <br>Calendar.addClass(el, "selected"); <br>closing = (cal.currentDateEl == el); <br>if (!closing) { <br>cal.currentDateEl = el; <br>} <br>} <br>cal.date.setDateOnly(el.caldate); <br>date = cal.date; <br>var other_month = !(cal.dateClicked = !el.otherMonth); <br>if (!other_month && !cal.currentDateEl) <br>cal._toggleMultipleDate(new Date(date)); <br>else <br>newdate = !el.disabled; <br>// a date was clicked <br>if (other_month) <br>cal._init(cal.firstDayOfWeek, date); <br>} else { <br>if (el.navtype == 200) { <br>Calendar.removeClass(el, "hilite"); <br>cal.callCloseHandler(); <br>return; <br>} <br>date = new Date(cal.date); <br>if (el.navtype == 0) <br>date.setDateOnly(new Date()); // TODAY <br>// unless "today" was clicked, we assume no date was clicked so <br>// the selected handler will know not to close the calenar when <br>// in single-click mode. <br>// cal.dateClicked = (el.navtype == 0); <br>cal.dateClicked = false; <br>var year = date.getFullYear(); <br>var mon = date.getMonth(); <br>function setMonth(m) { <br>var day = date.getDate(); <br>var max = date.getMonthDays(m); <br>if (day > max) { <br>date.setDate(max); <br>} <br>date.setMonth(m); <br>}; <br>switch (el.navtype) { <br>case 400: <br>Calendar.removeClass(el, "hilite"); <br>var text = Calendar._TT["ABOUT"]; <br>if (typeof text != "undefined") { <br>text += cal.showsTime ? Calendar._TT["ABOUT_TIME"] : ""; <br>} else { <br>// FIXME: this should be removed as soon as lang files get updated! <br>text = "Help and about box text is not translated into this language.n" + <br>"If you know this language and you feel generous please updaten" + <br>"the corresponding file in "lang" subdir to match calendar-en.jsn" + <br>"and send it back to <mihai_bazon@yahoo.com> to get it into the distribution ;-)nn" + <br>"Thank you!n" + <br>"http://dynarch.com/mishoo/calendar.epln"; <br>} <br>alert(text); <br>return; <br>case -2: <br>if (year > cal.minYear) { <br>date.setFullYear(year - 1); <br>} <br>break; <br>case -1: <br>if (mon > 0) { <br>setMonth(mon - 1); <br>} else if (year-- > cal.minYear) { <br>date.setFullYear(year); <br>setMonth(11); <br>} <br>break; <br>case 1: <br>if (mon < 11) { <BR>setMonth(mon + 1); <BR>} else if (year < cal.maxYear) { <BR>date.setFullYear(year + 1); <BR>setMonth(0); <BR>} <BR>break; <BR>case 2: <BR>if (year < cal.maxYear) { <BR>date.setFullYear(year + 1); <BR>} <BR>break; <BR>case 100: <BR>cal.setFirstDayOfWeek(el.fdow); <BR>return; <BR>case 50: <BR>var range = el._range; <BR>var current = el.innerHTML; <BR>for (var i = range.length; --i >= 0;) <br>if (range[i] == current) <br>break; <br>if (ev && ev.shiftKey) { <br>if (--i < 0) <BR>i = range.length - 1; <BR>} else if ( ++i >= range.length ) <br>i = 0; <br>var newval = range[i]; <br>el.innerHTML = newval; <br>cal.onUpdateTime(); <br>return; <br>case 0: <br>// TODAY will bring us here <br>if ((typeof cal.getDateStatus == "function") && <br>cal.getDateStatus(date, date.getFullYear(), date.getMonth(), date.getDate())) { <br>return false; <br>} <br>break; <br>} <br>if (!date.equalsTo(cal.date)) { <br>cal.setDate(date); <br>newdate = true; <br>} else if (el.navtype == 0) <br>newdate = closing = true; <br>} <br>if (newdate) { <br>ev && cal.callHandler(); <br>} <br>if (closing) { <br>Calendar.removeClass(el, "hilite"); <br>ev && cal.callCloseHandler(); <br>} <br>}; <br>// END: CALENDAR STATIC FUNCTIONS <br>// BEGIN: CALENDAR OBJECT FUNCTIONS <br>/** <br>* This function creates the calendar inside the given parent. If _par is <br>* null than it creates a popup calendar inside the BODY element. If _par is <br>* an element, be it BODY, then it creates a non-popup calendar (still <br>* hidden). Some properties need to be set before calling this function. <br>*/ <br>Calendar.prototype.create = function (_par) { <br>var parent = null; <br>if (! _par) { <br>// default parent is the document body, in which case we create <br>// a popup calendar. <br>parent = document.getElementsByTagName("body")[0]; <br>this.isPopup = true; <br>} else { <br>parent = _par; <br>this.isPopup = false; <br>} <br>this.date = this.dateStr ? new Date(this.dateStr) : new Date(); <br>var table = Calendar.createElement("table"); <br>this.table = table; <br>table.cellSpacing = 0; <br>table.cellPadding = 0; <br>table.calendar = this; <br>Calendar.addEvent(table, "mousedown", Calendar.tableMouseDown); <br>var div = Calendar.createElement("div"); <br>this.element = div; <br>div.className = "calendar"; <br>if (this.isPopup) { <br>div.style.position = "absolute"; <br>div.style.display = "none"; <br>} <br>div.appendChild(table); <br>var thead = Calendar.createElement("thead", table); <br>var cell = null; <br>var row = null; <br>var cal = this; <br>var hh = function (text, cs, navtype) { <br>cell = Calendar.createElement("td", row); <br>cell.colSpan = cs; <br>cell.className = "button"; <br>if (navtype != 0 && Math.abs(navtype) <= 2) <BR>cell.className += " nav"; <BR>Calendar._add_evs(cell); <BR>cell.calendar = cal; <BR>cell.navtype = navtype; <BR>cell.innerHTML = "<div unselectable='on'>" + text + "</div>"; <br>return cell; <br>}; <br>row = Calendar.createElement("tr", thead); <br>var title_length = 6; <br>(this.isPopup) && --title_length; <br>(this.weekNumbers) && ++title_length; <br>hh("?", 1, 400).ttip = Calendar._TT["INFO"]; <br>this.title = hh("", title_length, 300); <br>this.title.className = "title"; <br>if (this.isPopup) { <br>this.title.ttip = Calendar._TT["DRAG_TO_MOVE"]; <br>this.title.style.cursor = "move"; <br>hh("×", 1, 200).ttip = Calendar._TT["CLOSE"]; <br>} <br>row = Calendar.createElement("tr", thead); <br>row.className = "headrow"; <br>this._nav_py = hh("«", 1, -2); <br>this._nav_py.ttip = Calendar._TT["PREV_YEAR"]; <br>this._nav_pm = hh("‹", 1, -1); <br>this._nav_pm.ttip = Calendar._TT["PREV_MONTH"]; <br>this._nav_now = hh(Calendar._TT["TODAY"], this.weekNumbers ? 4 : 3, 0); <br>this._nav_now.ttip = Calendar._TT["GO_TODAY"]; <br>this._nav_nm = hh("›", 1, 1); <br>this._nav_nm.ttip = Calendar._TT["NEXT_MONTH"]; <br>this._nav_ny = hh("»", 1, 2); <br>this._nav_ny.ttip = Calendar._TT["NEXT_YEAR"]; <br>// day names <br>row = Calendar.createElement("tr", thead); <br>row.className = "daynames"; <br>if (this.weekNumbers) { <br>cell = Calendar.createElement("td", row); <br>cell.className = "name wn"; <br>cell.innerHTML = Calendar._TT["WK"]; <br>} <br>for (var i = 7; i > 0; --i) { <br>cell = Calendar.createElement("td", row); <br>if (!i) { <br>cell.navtype = 100; <br>cell.calendar = this; <br>Calendar._add_evs(cell); <br>} <br>} <br>this.firstdayname = (this.weekNumbers) ? row.firstChild.nextSibling : row.firstChild; <br>this._displayWeekdays(); <br>var tbody = Calendar.createElement("tbody", table); <br>this.tbody = tbody; <br>for (i = 6; i > 0; --i) { <br>row = Calendar.createElement("tr", tbody); <br>if (this.weekNumbers) { <br>cell = Calendar.createElement("td", row); <br>} <br>for (var j = 7; j > 0; --j) { <br>cell = Calendar.createElement("td", row); <br>cell.calendar = this; <br>Calendar._add_evs(cell); <br>} <br>} <br>if (this.showsTime) { <br>row = Calendar.createElement("tr", tbody); <br>row.className = "time"; <br>cell = Calendar.createElement("td", row); <br>cell.className = "time"; <br>cell.colSpan = 2; <br>cell.innerHTML = Calendar._TT["TIME"] || " "; <br>cell = Calendar.createElement("td", row); <br>cell.className = "time"; <br>cell.colSpan = this.weekNumbers ? 4 : 3; <br>(function(){ <br>function makeTimePart(className, init, range_start, range_end) { <br>var part = Calendar.createElement("span", cell); <br>part.className = className; <br>part.innerHTML = init; <br>part.calendar = cal; <br>part.ttip = Calendar._TT["TIME_PART"]; <br>part.navtype = 50; <br>part._range = []; <br>if (typeof range_start != "number") <br>part._range = range_start; <br>else { <br>for (var i = range_start; i <= range_end; ++i) { <BR>var txt; <BR>if (i < 10 && range_end >= 10) txt = '0' + i; <br>else txt = '' + i; <br>part._range[part._range.length] = txt; <br>} <br>} <br>Calendar._add_evs(part); <br>return part; <br>}; <br>var hrs = cal.date.getHours(); <br>var mins = cal.date.getMinutes(); <br>var t12 = !cal.time24; <br>var pm = (hrs > 12); <br>if (t12 && pm) hrs -= 12; <br>var H = makeTimePart("hour", hrs, t12 ? 1 : 0, t12 ? 12 : 23); <br>var span = Calendar.createElement("span", cell); <br>span.innerHTML = ":"; <br>span.className = "colon"; <br>var M = makeTimePart("minute", mins, 0, 59); <br>var AP = null; <br>cell = Calendar.createElement("td", row); <br>cell.className = "time"; <br>cell.colSpan = 2; <br>if (t12) <br>AP = makeTimePart("ampm", pm ? "pm" : "am", ["am", "pm"]); <br>else <br>cell.innerHTML = " "; <br>cal.onSetTime = function() { <br>var pm, hrs = this.date.getHours(), <br>mins = this.date.getMinutes(); <br>if (t12) { <br>pm = (hrs >= 12); <br>if (pm) hrs -= 12; <br>if (hrs == 0) hrs = 12; <br>AP.innerHTML = pm ? "pm" : "am"; <br>} <br>H.innerHTML = (hrs < 10) ? ("0" + hrs) : hrs; <BR>M.innerHTML = (mins < 10) ? ("0" + mins) : mins; <BR>}; <BR>cal.onUpdateTime = function() { <BR>var date = this.date; <BR>var h = parseInt(H.innerHTML, 10); <BR>if (t12) { <BR>if (/pm/i.test(AP.innerHTML) && h < 12) <BR>h += 12; <BR>else if (/am/i.test(AP.innerHTML) && h == 12) <BR>h = 0; <BR>} <BR>var d = date.getDate(); <BR>var m = date.getMonth(); <BR>var y = date.getFullYear(); <BR>date.setHours(h); <BR>date.setMinutes(parseInt(M.innerHTML, 10)); <BR>date.setFullYear(y); <BR>date.setMonth(m); <BR>date.setDate(d); <BR>this.dateClicked = false; <BR>this.callHandler(); <BR>}; <BR>})(); <BR>} else { <BR>this.onSetTime = this.onUpdateTime = function() {}; <BR>} <BR>var tfoot = Calendar.createElement("tfoot", table); <BR>row = Calendar.createElement("tr", tfoot); <BR>row.className = "footrow"; <BR>cell = hh(Calendar._TT["SEL_DATE"], this.weekNumbers ? 8 : 7, 300); <BR>cell.className = "ttip"; <BR>if (this.isPopup) { <BR>cell.ttip = Calendar._TT["DRAG_TO_MOVE"]; <BR>cell.style.cursor = "move"; <BR>}<BR>this.tooltips = cell; <BR>div = Calendar.createElement("div", this.element); <BR>this.monthsCombo = div; <BR>div.className = "combo"; <BR>for (i = 0; i < Calendar._MN.length; ++i) { <BR>var mn = Calendar.createElement("div"); <BR>mn.className = Calendar.is_ie ? "label-IEfix" : "label"; <BR>mn.month = i; <BR>mn.innerHTML = Calendar._SMN[i]; <BR>div.appendChild(mn); <BR>} <BR>div = Calendar.createElement("div", this.element); <BR>this.yearsCombo = div; <BR>div.className = "combo"; <BR>for (i = 12; i > 0; --i) { <br>var yr = Calendar.createElement("div"); <br>yr.className = Calendar.is_ie ? "label-IEfix" : "label"; <br>div.appendChild(yr); <br>} <br>this._init(this.firstDayOfWeek, this.date); <br>parent.appendChild(this.element); <br>}; <br>/**keyboard navigation, only for popup calendars*/ <br>Calendar._keyEvent = function(ev) { <br>var cal = window._dynarch_popupCalendar; <br>if (!cal || cal.multiple) <br>return false; <br>(Calendar.is_ie) && (ev = window.event); <br>var act = (Calendar.is_ie || ev.type == "keypress"), <br>K = ev.keyCode; <br>if (ev.ctrlKey) { <br>switch (K) { <br>case 37: // KEY left <br>act && Calendar.cellClick(cal._nav_pm); <br>break; <br>case 38: // KEY up <br>act && Calendar.cellClick(cal._nav_py); <br>break; <br>case 39: // KEY right <br>act && Calendar.cellClick(cal._nav_nm); <br>break; <br>case 40: // KEY down <br>act && Calendar.cellClick(cal._nav_ny); <br>break; <br>default: <br>return false; <br>} <br>} else switch (K) { <br>case 32: // KEY space (now) <br>Calendar.cellClick(cal._nav_now); <br>break; <br>case 27: // KEY esc <br>act && cal.callCloseHandler(); <br>break; <br>case 37: // KEY left <br>case 38: // KEY up <br>case 39: // KEY right <br>case 40: // KEY down <br>if (act) { <br>var prev, x, y, ne, el, step; <br>prev = K == 37 || K == 38; <br>step = (K == 37 || K == 39) ? 1 : 7; <br>function setVars() { <br>el = cal.currentDateEl; <br>var p = el.pos; <br>x = p & 15; <br>y = p >> 4; <br>ne = cal.ar_days[y][x]; <br>};setVars(); <br>function prevMonth() { <br>var date = new Date(cal.date); <br>date.setDate(date.getDate() - step); <br>cal.setDate(date); <br>}; <br>function nextMonth() { <br>var date = new Date(cal.date); <br>date.setDate(date.getDate() + step); <br>cal.setDate(date); <br>}; <br>while (1) { <br>switch (K) { <br>case 37: // KEY left <br>if (--x >= 0) <br>ne = cal.ar_days[y][x]; <br>else { <br>x = 6; <br>K = 38; <br>continue; <br>} <br>break; <br>case 38: // KEY up <br>if (--y >= 0) <br>ne = cal.ar_days[y][x]; <br>else { <br>prevMonth(); <br>setVars(); <br>} <br>break; <br>case 39: // KEY right <br>if (++x < 7) <BR>ne = cal.ar_days[y][x]; <BR>else { <BR>x = 0; <BR>K = 40; <BR>continue; <BR>} <BR>break; <BR>case 40: // KEY down <BR>if (++y < cal.ar_days.length) <BR>ne = cal.ar_days[y][x]; <BR>else { <BR>nextMonth(); <BR>setVars(); <BR>} <BR>break; <BR>} <BR>break; <BR>} <BR>if (ne) { <BR>if (!ne.disabled) <BR>Calendar.cellClick(ne); <BR>else if (prev) <BR>prevMonth(); <BR>else <BR>nextMonth(); <BR>} <BR>} <BR>break; <BR>case 13: // KEY enter <BR>if (act) <BR>Calendar.cellClick(cal.currentDateEl, ev); <BR>break; <BR>default: <BR>return false; <BR>} <BR>return Calendar.stopEvent(ev); <BR>}; <BR>/**<BR>* (RE)Initializes the calendar to the given date and firstDayOfWeek <BR>*/ <BR>Calendar.prototype._init = function (firstDayOfWeek, date) { <BR>var today = new Date(), <BR>TY = today.getFullYear(), <BR>TM = today.getMonth(), <BR>TD = today.getDate(); <BR>this.table.style.visibility = "hidden"; <BR>var year = date.getFullYear(); <BR>if (year < this.minYear) { <BR>year = this.minYear; <BR>date.setFullYear(year); <BR>} else if (year > this.maxYear) { <br>year = this.maxYear; <br>date.setFullYear(year); <br>} <br>this.firstDayOfWeek = firstDayOfWeek; <br>this.date = new Date(date); <br>var month = date.getMonth(); <br>var mday = date.getDate(); <br>var no_days = date.getMonthDays(); <br>// calendar voodoo for computing the first day that would actually be <br>// displayed in the calendar, even if it's from the previous month. <br>// WARNING: this is magic. ;-) <br>date.setDate(1); <br>var day1 = (date.getDay() - this.firstDayOfWeek) % 7; <br>if (day1 < 0) <BR>day1 += 7; <BR>date.setDate(-day1); <BR>date.setDate(date.getDate() + 1); <BR>var row = this.tbody.firstChild; <BR>var MN = Calendar._SMN[month]; <BR>var ar_days = this.ar_days = new Array(); <BR>var weekend = Calendar._TT["WEEKEND"]; <BR>var dates = this.multiple ? (this.datesCells = {}) : null; <BR>for (var i = 0; i < 6; ++i, row = row.nextSibling) { <BR>var cell = row.firstChild; <BR>if (this.weekNumbers) { <BR>cell.className = "day wn"; <BR>cell.innerHTML = date.getWeekNumber(); <BR>cell = cell.nextSibling; <BR>}<BR>row.className = "daysrow"; <BR>var hasdays = false, iday, dpos = ar_days[i] = []; <BR>for (var j = 0; j < 7; ++j, cell = cell.nextSibling, date.setDate(iday + 1)) { <BR>iday = date.getDate(); <BR>var wday = date.getDay(); <BR>cell.className = "day"; <BR>cell.pos = i << 4 | j; <BR>dpos[j] = cell; <BR>var current_month = (date.getMonth() == month); <BR>if (!current_month) { <BR>if (this.showsOtherMonths) { <BR>cell.className += " othermonth"; <BR>cell.otherMonth = true; <BR>} else { <BR>cell.className = "emptycell"; <BR>cell.innerHTML = " "; <BR>cell.disabled = true; <BR>continue; <BR>} <BR>} else { <BR>cell.otherMonth = false; <BR>hasdays = true; <BR>} <BR>cell.disabled = false; <BR>cell.innerHTML = this.getDateText ? this.getDateText(date, iday) : iday; <BR>if (dates) <BR>dates[date.print("%Y%m%d")] = cell; <BR>if (this.getDateStatus) { <BR>var status = this.getDateStatus(date, year, month, iday); <BR>if (this.getDateToolTip) { <BR>var toolTip = this.getDateToolTip(date, year, month, iday); <BR>if (toolTip) <BR>cell.title = toolTip; <BR>} <BR>if (status === true) { <BR>cell.className += " disabled"; <BR>cell.disabled = true; <BR>} else { <BR>if (/disabled/i.test(status)) <BR>cell.disabled = true; <BR>cell.className += " " + status; <BR>} <BR>} <BR>if (!cell.disabled) { <BR>cell.caldate = new Date(date); <BR>cell.ttip = "_"; <BR>if (!this.multiple && current_month <BR>&& iday == mday && this.hiliteToday) { <BR>cell.className += " selected"; <BR>this.currentDateEl = cell; <BR>} <BR>if (date.getFullYear() == TY && <BR>date.getMonth() == TM && <BR>iday == TD) { <BR>cell.className += " today"; <BR>cell.ttip += Calendar._TT["PART_TODAY"]; <BR>} <BR>if (weekend.indexOf(wday.toString()) != -1) <BR>cell.className += cell.otherMonth ? " oweekend" : " weekend"; <BR>} <BR>} <BR>if (!(hasdays || this.showsOtherMonths)) <BR>row.className = "emptyrow"; <BR>} <BR>this.title.innerHTML = Calendar._MN[month] + ", " + year; <BR>this.onSetTime(); <BR>this.table.style.visibility = "visible"; <BR>this._initMultipleDates(); <BR>// PROFILE <BR>// this.tooltips.innerHTML = "Generated in " + ((new Date()) - today) + " ms"; <BR>}; <BR>Calendar.prototype._initMultipleDates = function() { <BR>if (this.multiple) { <BR>for (var i in this.multiple) { <BR>var cell = this.datesCells[i]; <BR>var d = this.multiple[i]; <BR>if (!d) <BR>continue; <BR>if (cell) <BR>cell.className += " selected"; <BR>} <BR>} <BR>}; <BR>Calendar.prototype._toggleMultipleDate = function(date) { <BR>if (this.multiple) { <BR>var ds = date.print("%Y%m%d"); <BR>var cell = this.datesCells[ds]; <BR>if (cell) { <BR>var d = this.multiple[ds]; <BR>if (!d) { <BR>Calendar.addClass(cell, "selected"); <BR>this.multiple[ds] = date; <BR>} else { <BR>Calendar.removeClass(cell, "selected"); <BR>delete this.multiple[ds]; <BR>} <BR>} <BR>} <BR>}; <BR>Calendar.prototype.setDateToolTipHandler = function (unaryFunction) { <BR>this.getDateToolTip = unaryFunction; <BR>}; <BR>/**<BR>* Calls _init function above for going to a certain date (but only if the <BR>* date is different than the currently selected one). <BR>*/ <BR>Calendar.prototype.setDate = function (date) { <BR>if (!date.equalsTo(this.date)) { <BR>this._init(this.firstDayOfWeek, date); <BR>} <BR>}; <BR>/**<BR>* Refreshes the calendar. Useful if the "disabledHandler" function is <BR>* dynamic, meaning that the list of disabled date can change at runtime. <BR>* Just * call this function if you think that the list of disabled dates <BR>* should * change. <BR>*/ <BR>Calendar.prototype.refresh = function () { <BR>this._init(this.firstDayOfWeek, this.date); <BR>}; <BR>/**Modifies the "firstDayOfWeek" parameter (pass 0 for Synday, 1 for Monday, etc.).*/ <BR>Calendar.prototype.setFirstDayOfWeek = function (firstDayOfWeek) { <BR>this._init(firstDayOfWeek, this.date); <BR>this._displayWeekdays(); <BR>}; <BR>/**<BR>* Allows customization of what dates are enabled. The "unaryFunction" <BR>* parameter must be a function object that receives the date (as a JS Date <BR>* object) and returns a boolean value. If the returned value is true then <BR>* the passed date will be marked as disabled. <BR>*/ <BR>Calendar.prototype.setDateStatusHandler = Calendar.prototype.setDisabledHandler = function (unaryFunction) { <BR>this.getDateStatus = unaryFunction; <BR>}; <BR>/**Customization of allowed year range for the calendar.*/ <BR>Calendar.prototype.setRange = function (a, z) { <BR>this.minYear = a; <BR>this.maxYear = z; <BR>}; <BR>/**Calls the first user handler (selectedHandler).*/ <BR>Calendar.prototype.callHandler = function () { <BR>if (this.onSelected) { <BR>this.onSelected(this, this.date.print(this.dateFormat)); <BR>} <BR>}; <BR>/**Calls the second user handler (closeHandler).*/ <BR>Calendar.prototype.callCloseHandler = function () { <BR>if (this.onClose) { <BR>this.onClose(this); <BR>} <BR>this.hideShowCovered(); <BR>}; <BR>/**Removes the calendar object from the DOM tree and destroys it.*/ <BR>Calendar.prototype.destroy = function () { <BR>var el = this.element.parentNode; <BR>el.removeChild(this.element); <BR>Calendar._C = null; <BR>window._dynarch_popupCalendar = null; <BR>}; <BR>/**<BR>* Moves the calendar element to a different section in the DOM tree (changes <BR>* its parent). <BR>*/ <BR>Calendar.prototype.reparent = function (new_parent) { <BR>var el = this.element; <BR>el.parentNode.removeChild(el); <BR>new_parent.appendChild(el); <BR>}; <BR>// This gets called when the user presses a mouse button anywhere in the <BR>// document, if the calendar is shown. If the click was outside the open <BR>// calendar this function closes it. <BR>Calendar._checkCalendar = function(ev) { <BR>var calendar = window._dynarch_popupCalendar; <BR>if (!calendar) { <BR>return false; <BR>} <BR>var el = Calendar.is_ie ? Calendar.getElement(ev) : Calendar.getTargetElement(ev); <BR>for (; el != null && el != calendar.element; el = el.parentNode); <BR>if (el == null) { <BR>// calls closeHandler which should hide the calendar. <BR>window._dynarch_popupCalendar.callCloseHandler(); <BR>return Calendar.stopEvent(ev); <BR>} <BR>}; <BR>/**Shows the calendar.*/ <BR>Calendar.prototype.show = function () { <BR>var rows = this.table.getElementsByTagName("tr"); <BR>for (var i = rows.length; i > 0;) { <br>var row = rows[--i]; <br>Calendar.removeClass(row, "rowhilite"); <br>var cells = row.getElementsByTagName("td"); <br>for (var j = cells.length; j > 0;) { <br>var cell = cells[--j]; <br>Calendar.removeClass(cell, "hilite"); <br>Calendar.removeClass(cell, "active"); <br>} <br>} <br>this.element.style.display = "block"; <br>this.hidden = false; <br>if (this.isPopup) { <br>window._dynarch_popupCalendar = this; <br>Calendar.addEvent(document, "keydown", Calendar._keyEvent); <br>Calendar.addEvent(document, "keypress", Calendar._keyEvent); <br>Calendar.addEvent(document, "mousedown", Calendar._checkCalendar); <br>} <br>this.hideShowCovered(); <br>}; <br>/**<br>* Hides the calendar. Also removes any "hilite" from the class of any TD <br>* element. <br>*/ <br>Calendar.prototype.hide = function () { <br>if (this.isPopup) { <br>Calendar.removeEvent(document, "keydown", Calendar._keyEvent); <br>Calendar.removeEvent(document, "keypress", Calendar._keyEvent); <br>Calendar.removeEvent(document, "mousedown", Calendar._checkCalendar); <br>} <br>this.element.style.display = "none"; <br>this.hidden = true; <br>this.hideShowCovered(); <br>}; <br>/**<br>* Shows the calendar at a given absolute position (beware that, depending on <br>* the calendar element style -- position property -- this might be relative <br>* to the parent's containing rectangle). <br>*/ <br>Calendar.prototype.showAt = function (x, y) { <br>var s = this.element.style; <br>s.left = x + "px"; <br>s.top = y + "px"; <br>this.show(); <br>}; <br>/**Shows the calendar near a given element.*/ <br>Calendar.prototype.showAtElement = function (el, opts) { <br>var self = this; <br>var p = Calendar.getAbsolutePos(el); <br>if (!opts || typeof opts != "string") { <br>this.showAt(p.x, p.y + el.offsetHeight); <br>return true; <br>} <br>function fixPosition(box) { <br>if (box.x < 0) <BR>box.x = 0; <BR>if (box.y < 0) <BR>box.y = 0; <BR>var cp = document.createElement("div"); <BR>var s = cp.style; <BR>s.position = "absolute"; <BR>s.right = s.bottom = s.width = s.height = "0px"; <BR>document.body.appendChild(cp); <BR>var br = Calendar.getAbsolutePos(cp); <BR>document.body.removeChild(cp); <BR>if (Calendar.is_ie) { <BR>br.y += document.body.scrollTop; <BR>br.x += document.body.scrollLeft; <BR>} else { <BR>br.y += window.scrollY; <BR>br.x += window.scrollX; <BR>} <BR>var tmp = box.x + box.width - br.x; <BR>if (tmp > 0) box.x -= tmp; <br>tmp = box.y + box.height - br.y; <br>if (tmp > 0) box.y -= tmp; <br>}; <br>this.element.style.display = "block"; <br>Calendar.continuation_for_the_fucking_khtml_browser = function() { <br>var w = self.element.offsetWidth; <br>var h = self.element.offsetHeight; <br>self.element.style.display = "none"; <br>var valign = opts.substr(0, 1); <br>var halign = "l"; <br>if (opts.length > 1) { <br>halign = opts.substr(1, 1); <br>} <br>// vertical alignment <br>switch (valign) { <br>case "T": p.y -= h; break; <br>case "B": p.y += el.offsetHeight; break; <br>case "C": p.y += (el.offsetHeight - h) / 2; break; <br>case "t": p.y += el.offsetHeight - h; break; <br>case "b": break; // already there <br>} <br>// horizontal alignment <br>switch (halign) { <br>case "L": p.x -= w; break; <br>case "R": p.x += el.offsetWidth; break; <br>case "C": p.x += (el.offsetWidth - w) / 2; break; <br>case "l": p.x += el.offsetWidth - w; break; <br>case "r": break; // already there <br>} <br>p.width = w; <br>p.height = h + 40; <br>self.monthsCombo.style.display = "none"; <br>fixPosition(p); <br>self.showAt(p.x, p.y); <br>}; <br>if (Calendar.is_khtml) <br>setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()", 10); <br>else <br>Calendar.continuation_for_the_fucking_khtml_browser(); <br>}; <br>/**Customizes the date format.*/ <br>Calendar.prototype.setDateFormat = function (str) { <br>this.dateFormat = str; <br>}; <br>/**Customizes the tooltip date format.*/ <br>Calendar.prototype.setTtDateFormat = function (str) { <br>this.ttDateFormat = str; <br>}; <br>/**<br>* Tries to identify the date represented in a string. If successful it also <br>* calls this.setDate which moves the calendar to the given date. <br>*/ <br>Calendar.prototype.parseDate = function(str, fmt) { <br>if (!fmt) <br>fmt = this.dateFormat; <br>this.setDate(Date.parseDate(str, fmt)); <br>}; <br>Calendar.prototype.hideShowCovered = function () { <br>if (!Calendar.is_ie && !Calendar.is_opera) <br>return; <br>function getVisib(obj){ <br>var value = obj.style.visibility; <br>if (!value) { <br>if (document.defaultView && typeof (document.defaultView.getComputedStyle) == "function") { // Gecko, W3C <br>if (!Calendar.is_khtml) <br>value = document.defaultView. <br>getComputedStyle(obj, "").getPropertyValue("visibility"); <br>else <br>value = ''; <br>} else if (obj.currentStyle) { // IE <br>value = obj.currentStyle.visibility; <br>} else <br>value = ''; <br>} <br>return value; <br>}; <br>var tags = new Array("applet", "iframe", "select"); <br>var el = this.element; <br>var p = Calendar.getAbsolutePos(el); <br>var EX1 = p.x; <br>var EX2 = el.offsetWidth + EX1; <br>var EY1 = p.y; <br>var EY2 = el.offsetHeight + EY1; <br>for (var k = tags.length; k > 0; ) { <br>var ar = document.getElementsByTagName(tags[--k]); <br>var cc = null; <br>for (var i = ar.length; i > 0;) { <br>cc = ar[--i]; <br>p = Calendar.getAbsolutePos(cc); <br>var CX1 = p.x; <br>var CX2 = cc.offsetWidth + CX1; <br>var CY1 = p.y; <br>var CY2 = cc.offsetHeight + CY1; <br>if (this.hidden || (CX1 > EX2) || (CX2 < EX1) || (CY1 > EY2) || (CY2 < EY1)) { <BR>if (!cc.__msh_save_visibility) { <BR>cc.__msh_save_visibility = getVisib(cc); <BR>} <BR>cc.style.visibility = cc.__msh_save_visibility; <BR>} else { <BR>if (!cc.__msh_save_visibility) { <BR>cc.__msh_save_visibility = getVisib(cc); <BR>} <BR>cc.style.visibility = "hidden"; <BR>} <BR>} <BR>} <BR>}; <BR>/**Internal function; it displays the bar with the names of the weekday.*/ <BR>Calendar.prototype._displayWeekdays = function () { <BR>var fdow = this.firstDayOfWeek; <BR>var cell = this.firstdayname; <BR>var weekend = Calendar._TT["WEEKEND"]; <BR>for (var i = 0; i < 7; ++i) { <BR>cell.className = "day name"; <BR>var realday = (i + fdow) % 7; <BR>if (i) { <BR>cell.ttip = Calendar._TT["DAY_FIRST"].replace("%s", Calendar._DN[realday]); <BR>cell.navtype = 100; <BR>cell.calendar = this; <BR>cell.fdow = realday; <BR>Calendar._add_evs(cell); <BR>} <BR>if (weekend.indexOf(realday.toString()) != -1) { <BR>Calendar.addClass(cell, "weekend"); <BR>} <BR>cell.innerHTML = Calendar._SDN[(i + fdow) % 7]; <BR>cell = cell.nextSibling; <BR>} <BR>}; <BR>/**Internal function. Hides all combo boxes that might be displayed.*/ <BR>Calendar.prototype._hideCombos = function () { <BR>this.monthsCombo.style.display = "none"; <BR>this.yearsCombo.style.display = "none"; <BR>}; <BR>/**Internal function. Starts dragging the element.*/ <BR>Calendar.prototype._dragStart = function (ev) { <BR>if (this.dragging) { <BR>return; <BR>} <BR>this.dragging = true; <BR>var posX; <BR>var posY; <BR>if (Calendar.is_ie) { <BR>posY = window.event.clientY + document.body.scrollTop; <BR>posX = window.event.clientX + document.body.scrollLeft; <BR>} else { <BR>posY = ev.clientY + window.scrollY; <BR>posX = ev.clientX + window.scrollX; <BR>} <BR>var st = this.element.style; <BR>this.xOffs = posX - parseInt(st.left); <BR>this.yOffs = posY - parseInt(st.top); <BR>with (Calendar) { <BR>addEvent(document, "mousemove", calDragIt); <BR>addEvent(document, "mouseup", calDragEnd); <BR>} <BR>}; <BR>// BEGIN: DATE OBJECT PATCHES <BR>/**Adds the number of days array to the Date object.*/ <BR>Date._MD = new Array(31,28,31,30,31,30,31,31,30,31,30,31); <BR>/**Constants used for time computations*/ <BR>Date.SECOND = 1000 /* milliseconds */; <BR>Date.MINUTE = 60 * Date.SECOND; <BR>Date.HOUR = 60 * Date.MINUTE; <BR>Date.DAY = 24 * Date.HOUR; <BR>Date.WEEK = 7 * Date.DAY; <BR>Date.parseDate = function(str, fmt) { <BR>var today = new Date(); <BR>var y = 0; <BR>var m = -1; <BR>var d = 0; <BR>var a = str.split(/W+/); <BR>var b = fmt.match(/%./g); <BR>var i = 0, j = 0; <BR>var hr = 0; <BR>var min = 0; <BR>for (i = 0; i < a.length; ++i) { <BR>if (!a[i]) <BR>continue; <BR>switch (b[i]) { <BR>case "%d": <BR>case "%e": <BR>d = parseInt(a[i], 10); <BR>break; <BR>case "%m": <BR>m = parseInt(a[i], 10) - 1; <BR>break; <BR>case "%Y": <BR>case "%y": <BR>y = parseInt(a[i], 10); <BR>(y < 100) && (y += (y > 29) ? 1900 : 2000); <br>break; <br>case "%b": <br>case "%B": <br>for (j = 0; j < 12; ++j) { <BR>if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { m = j; break; } <BR>} <BR>break; <BR>case "%H": <BR>case "%I": <BR>case "%k": <BR>case "%l": <BR>hr = parseInt(a[i], 10); <BR>break; <BR>case "%P": <BR>case "%p": <BR>if (/pm/i.test(a[i]) && hr < 12) <BR>hr += 12; <BR>else if (/am/i.test(a[i]) && hr >= 12) <br>hr -= 12; <br>break; <br>case "%M": <br>min = parseInt(a[i], 10); <br>break; <br>} <br>} <br>if (isNaN(y)) y = today.getFullYear(); <br>if (isNaN(m)) m = today.getMonth(); <br>if (isNaN(d)) d = today.getDate(); <br>if (isNaN(hr)) hr = today.getHours(); <br>if (isNaN(min)) min = today.getMinutes(); <br>if (y != 0 && m != -1 && d != 0) <br>return new Date(y, m, d, hr, min, 0); <br>y = 0; m = -1; d = 0; <br>for (i = 0; i < a.length; ++i) { <BR>if (a[i].search(/[a-zA-Z]+/) != -1) { <BR>var t = -1; <BR>for (j = 0; j < 12; ++j) { <BR>if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { t = j; break; } <BR>} <BR>if (t != -1) { <BR>if (m != -1) { <BR>d = m+1; <BR>} <BR>m = t; <BR>} <BR>} else if (parseInt(a[i], 10) <= 12 && m == -1) { <BR>m = a[i]-1; <BR>} else if (parseInt(a[i], 10) > 31 && y == 0) { <br>y = parseInt(a[i], 10); <br>(y < 100) && (y += (y > 29) ? 1900 : 2000); <br>} else if (d == 0) { <br>d = a[i]; <br>} <br>} <br>if (y == 0) <br>y = today.getFullYear(); <br>if (m != -1 && d != 0) <br>return new Date(y, m, d, hr, min, 0); <br>return today; <br>}; <br>/**Returns the number of days in the current month*/ <br>Date.prototype.getMonthDays = function(month) { <br>var year = this.getFullYear(); <br>if (typeof month == "undefined") { <br>month = this.getMonth(); <br>} <br>if (((0 == (year%4)) && ( (0 != (year%100)) || (0 == (year%400)))) && month == 1) { <br>return 29; <br>} else { <br>return Date._MD[month]; <br>} <br>}; <br>/**Returns the number of day in the year.*/ <br>Date.prototype.getDayOfYear = function() { <br>var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); <br>var then = new Date(this.getFullYear(), 0, 0, 0, 0, 0); <br>var time = now - then; <br>return Math.floor(time / Date.DAY); <br>}; <br>/**Returns the number of the week in year, as defined in ISO 8601.*/ <br>Date.prototype.getWeekNumber = function() { <br>var d = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); <br>var DoW = d.getDay(); <br>d.setDate(d.getDate() - (DoW + 6) % 7 + 3); // Nearest Thu <br>var ms = d.valueOf(); // GMT <br>d.setMonth(0); <br>d.setDate(4); // Thu in Week 1 <br>return Math.round((ms - d.valueOf()) / (7 * 864e5)) + 1; <br>}; <br>/**Checks date and time equality*/ <br>Date.prototype.equalsTo = function(date) { <br>return ((this.getFullYear() == date.getFullYear()) && <br>(this.getMonth() == date.getMonth()) && <br>(this.getDate() == date.getDate()) && <br>(this.getHours() == date.getHours()) && <br>(this.getMinutes() == date.getMinutes())); <br>}; <br>/**Set only the year, month, date parts (keep existing time)*/ <br>Date.prototype.setDateOnly = function(date) { <br>var tmp = new Date(date); <br>this.setDate(1); <br>this.setFullYear(tmp.getFullYear()); <br>this.setMonth(tmp.getMonth()); <br>this.setDate(tmp.getDate()); <br>}; <br>/**Prints the date in a string according to the given format.*/ <br>Date.prototype.print = function (str) { <br>var m = this.getMonth(); <br>var d = this.getDate(); <br>var y = this.getFullYear(); <br>var wn = this.getWeekNumber(); <br>var w = this.getDay(); <br>var s = {}; <br>var hr = this.getHours(); <br>var pm = (hr >= 12); <br>var ir = (pm) ? (hr - 12) : hr; <br>var dy = this.getDayOfYear(); <br>if (ir == 0) <br>ir = 12; <br>var min = this.getMinutes(); <br>var sec = this.getSeconds(); <br>s["%a"] = Calendar._SDN[w]; // abbreviated weekday name [FIXME: I18N] <br>s["%A"] = Calendar._DN[w]; // full weekday name <br>s["%b"] = Calendar._SMN[m]; // abbreviated month name [FIXME: I18N] <br>s["%B"] = Calendar._MN[m]; // full month name <br>// FIXME: %c : preferred date and time representation for the current locale <br>s["%C"] = 1 + Math.floor(y / 100); // the century number <br>s["%d"] = (d < 10) ? ("0" + d) : d; // the day of the month (range 01 to 31) <BR>s["%e"] = d; // the day of the month (range 1 to 31) <BR>// FIXME: %D : american date style: %m/%d/%y <BR>// FIXME: %E, %F, %G, %g, %h (man strftime) <BR>s["%H"] = (hr < 10) ? ("0" + hr) : hr; // hour, range 00 to 23 (24h format) <BR>s["%I"] = (ir < 10) ? ("0" + ir) : ir; // hour, range 01 to 12 (12h format) <BR>s["%j"] = (dy < 100) ? ((dy < 10) ? ("00" + dy) : ("0" + dy)) : dy; // day of the year (range 001 to 366) <BR>s["%k"] = hr; // hour, range 0 to 23 (24h format) <BR>s["%l"] = ir; // hour, range 1 to 12 (12h format) <BR>s["%m"] = (m < 9) ? ("0" + (1+m)) : (1+m); // month, range 01 to 12 <BR>s["%M"] = (min < 10) ? ("0" + min) : min; // minute, range 00 to 59 <BR>s["%n"] = "n"; // a newline character <BR>s["%p"] = pm ? "PM" : "AM"; <BR>s["%P"] = pm ? "pm" : "am"; <BR>// FIXME: %r : the time in am/pm notation %I:%M:%S %p <BR>// FIXME: %R : the time in 24-hour notation %H:%M <BR>s["%s"] = Math.floor(this.getTime() / 1000); <BR>s["%S"] = (sec < 10) ? ("0" + sec) : sec; // seconds, range 00 to 59 <BR>s["%t"] = "t"; // a tab character <BR>// FIXME: %T : the time in 24-hour notation (%H:%M:%S) <BR>s["%U"] = s["%W"] = s["%V"] = (wn < 10) ? ("0" + wn) : wn; <BR>s["%u"] = w + 1; // the day of the week (range 1 to 7, 1 = MON) <BR>s["%w"] = w; // the day of the week (range 0 to 6, 0 = SUN) <BR>// FIXME: %x : preferred date representation for the current locale without the time <BR>// FIXME: %X : preferred time representation for the current locale without the date <BR>s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99) <BR>s["%Y"] = y; // year with the century <BR>s["%%"] = "%"; // a literal '%' character <BR>var re = /%./g; <BR>if (!Calendar.is_ie5 && !Calendar.is_khtml) <BR>return str.replace(re, function (par) { return s[par] || par; }); <BR>var a = str.match(re); <BR>for (var i = 0; i < a.length; i++) { <BR>var tmp = s[a[i]]; <BR>if (tmp) { <BR>re = new RegExp(a[i], 'g'); <BR>str = str.replace(re, tmp); <BR>} <BR>} <BR>return str; <BR>}; <BR>Date.prototype.__msh_oldSetFullYear = Date.prototype.setFullYear; <BR>Date.prototype.setFullYear = function(y) { <BR>var d = new Date(this); <BR>d.__msh_oldSetFullYear(y); <BR>if (d.getMonth() != this.getMonth()) <BR>this.setDate(28); <BR>this.__msh_oldSetFullYear(y); <BR>}; <BR>// END: DATE OBJECT PATCHES <BR>// global object that remembers the calendar <BR>window._dynarch_popupCalendar = null; <BR>//********* calendar.js END ******************** <BR>/* Copyright Mihai Bazon, 2002, 2003 | http://dynarch.com/mishoo/ <BR>* --------------------------------------------------------------------------- <BR>* <BR>* The DHTML Calendar <BR>* <BR>* Details and latest version at: <BR>* http://dynarch.com/mishoo/calendar.epl <BR>* <BR>* This script is distributed under the GNU Lesser General Public License. <BR>* Read the entire license text here: http://www.gnu.org/licenses/lgpl.html <BR>* <BR>* This file defines helper functions for setting up the calendar. They are <BR>* intended to help non-programmers get a working calendar on their site <BR>* quickly. This script should not be seen as part of the calendar. It just <BR>* shows you what one can do with the calendar, while in the same time <BR>* providing a quick and simple method for setting it up. If you need <BR>* exhaustive customization of the calendar creation process feel free to <BR>* modify this code to suit your needs (this is recommended and much better <BR>* than modifying calendar.js itself). <BR>*/ <BR>// $Id: calendar-setup.js,v 1.25 2005/03/07 09:51:33 mishoo Exp $ <BR>/**<BR>* This function "patches" an input field (or other element) to use a calendar <BR>* widget for date selection. <BR>* <BR>* The "params" is a single object that can have the following properties: <BR>* <BR>* prop. name | description <BR>* ------------------------------------------------------------------------------------------------- <BR>* inputField | the ID of an input field to store the date <BR>* displayArea | the ID of a DIV or other element to show the date <BR>* button | ID of a button or other element that will trigger the calendar <BR>* eventName | event that will trigger the calendar, without the "on" prefix (default: "click") <BR>* ifFormat | date format that will be stored in the input field <BR>* daFormat | the date format that will be used to display the date in displayArea <BR>* singleClick | (true/false) wether the calendar is in single click mode or not (default: true) <BR>* firstDay | numeric: 0 to 6. "0" means display Sunday first, "1" means display Monday first, etc. <BR>* align | alignment (default: "Br"); if you don't know what's this see the calendar documentation <BR>* range | array with 2 elements. Default: [1900, 2999] -- the range of years available <BR>* weekNumbers | (true/false) if it's true (default) the calendar will display week numbers <BR>* flat | null or element ID; if not null the calendar will be a flat calendar having the parent with the given ID <BR>* flatCallback | function that receives a JS Date object and returns an URL to point the browser to (for flat calendar) <BR>* disableFunc | function that receives a JS Date object and should return true if that date has to be disabled in the calendar <BR>* onSelect | function that gets called when a date is selected. You don't _have_ to supply this (the default is generally okay) <BR>* onClose | function that gets called when the calendar is closed. [default] <BR>* onUpdate | function that gets called after the date is updated in the input field. Receives a reference to the calendar. <BR>* date | the date that the calendar will be initially displayed to <BR>* showsTime | default: false; if true the calendar will include a time selector <BR>* timeFormat | the time format; can be "12" or "24", default is "12" <BR>* electric | if true (default) then given fields/date areas are updated for each move; otherwise they're updated only on close <BR>* step | configures the step of the years in drop-down boxes; default: 2 <BR>* position | configures the calendar absolute position; default: null <BR>* cache | if "true" (but default: "false") it will reuse the same calendar object, where possible <BR>* showOthers | if "true" (but default: "false") it will show days from other months too <BR>* <BR>* None of them is required, they all have default values. However, if you <BR>* pass none of "inputField", "displayArea" or "button" you'll get a warning <BR>* saying "nothing to setup". <BR>*/ <BR>Calendar.setup = function (params) { <BR>function param_default(pname, def) { if (typeof params[pname] == "undefined") { params[pname] = def; } }; <BR>param_default("inputField", null); <BR>param_default("displayArea", null); <BR>param_default("button", null); <BR>param_default("eventName", "click"); <BR>param_default("ifFormat", "%Y/%m/%d"); <BR>param_default("daFormat", "%Y/%m/%d"); <BR>param_default("singleClick", true); <BR>param_default("disableFunc", null); <BR>param_default("dateStatusFunc", params["disableFunc"]); // takes precedence if both are defined <BR>param_default("dateText", null); <BR>param_default("firstDay", null); <BR>param_default("align", "Br"); <BR>param_default("range", [1900, 2999]); <BR>param_default("weekNumbers", true); <BR>param_default("flat", null); <BR>param_default("flatCallback", null); <BR>param_default("onSelect", null); <BR>param_default("onClose", null); <BR>param_default("onUpdate", null); <BR>param_default("date", null); <BR>param_default("showsTime", false); <BR>param_default("timeFormat", "24"); <BR>param_default("electric", true); <BR>param_default("step", 2); <BR>param_default("position", null); <BR>param_default("cache", false); <BR>param_default("showOthers", false); <BR>param_default("multiple", null); <BR>var tmp = ["inputField", "displayArea", "button"]; <BR>for (var i in tmp) { <BR>if (typeof params[tmp[i]] == "string") { <BR>params[tmp[i]] = document.getElementById(params[tmp[i]]); <BR>} <BR>} <BR>if (!(params.flat || params.multiple || params.inputField || params.displayArea || params.button)) { <BR>alert("Calendar.setup:n Nothing to setup (no fields found). Please check your code"); <BR>return false; <BR>} <BR>function onSelect(cal) { <BR>var p = cal.params; <BR>var update = (cal.dateClicked || p.electric); <BR>if (update && p.inputField) { <BR>p.inputField.value = cal.date.print(p.ifFormat); <BR>if (typeof p.inputField.onchange == "function") <BR>p.inputField.onchange(); <BR>} <BR>if (update && p.displayArea) <BR>p.displayArea.innerHTML = cal.date.print(p.daFormat); <BR>if (update && typeof p.onUpdate == "function") <BR>p.onUpdate(cal); <BR>if (update && p.flat) { <BR>if (typeof p.flatCallback == "function") <BR>p.flatCallback(cal); <BR>} <BR>if (update && p.singleClick && cal.dateClicked) <BR>cal.callCloseHandler(); <BR>}; <BR>if (params.flat != null) { <BR>if (typeof params.flat == "string") <BR>params.flat = document.getElementById(params.flat); <BR>if (!params.flat) { <BR>alert("Calendar.setup:n Flat specified but can't find parent."); <BR>return false; <BR>} <BR>var cal = new Calendar(params.firstDay, params.date, params.onSelect || onSelect); <BR>cal.showsOtherMonths = params.showOthers; <BR>cal.showsTime = params.showsTime; <BR>cal.time24 = (params.timeFormat == "24"); <BR>cal.params = params; <BR>cal.weekNumbers = params.weekNumbers; <BR>cal.setRange(params.range[0], params.range[1]); <BR>cal.setDateStatusHandler(params.dateStatusFunc); <BR>cal.getDateText = params.dateText; <BR>if (params.ifFormat) { <BR>cal.setDateFormat(params.ifFormat); <BR>} <BR>if (params.inputField && typeof params.inputField.value == "string") { <BR>cal.parseDate(params.inputField.value); <BR>} <BR>cal.create(params.flat); <BR>cal.show(); <BR>return false; <BR>} <BR>var triggerEl = params.button || params.displayArea || params.inputField; <BR>triggerEl["on" + params.eventName] = function() { <BR>var dateEl = params.inputField || params.displayArea; <BR>var dateFmt = params.inputField ? params.ifFormat : params.daFormat; <BR>var mustCreate = false; <BR>var cal = window.calendar; <BR>if (dateEl) <BR>params.date = Date.parseDate(dateEl.value || dateEl.innerHTML, dateFmt); <BR>if (!(cal && params.cache)) { <BR>window.calendar = cal = new Calendar(params.firstDay, <BR>params.date, <BR>params.onSelect || onSelect, <BR>params.onClose || function(cal) { cal.hide(); }); <BR>cal.showsTime = params.showsTime; <BR>cal.time24 = (params.timeFormat == "24"); <BR>cal.weekNumbers = params.weekNumbers; <BR>mustCreate = true; <BR>} else { <BR>if (params.date) <BR>cal.setDate(params.date); <BR>cal.hide(); <BR>} <BR>if (params.multiple) { <BR>cal.multiple = {}; <BR>for (var i = params.multiple.length; --i >= 0;) { <br>var d = params.multiple[i]; <br>var ds = d.print("%Y%m%d"); <br>cal.multiple[ds] = d; <br>} <br>} <br>cal.showsOtherMonths = params.showOthers; <br>cal.yearStep = params.step; <br>cal.setRange(params.range[0], params.range[1]); <br>cal.params = params; <br>cal.setDateStatusHandler(params.dateStatusFunc); <br>cal.getDateText = params.dateText; <br>cal.setDateFormat(dateFmt); <br>if (mustCreate) <br>cal.create(); <br>cal.refresh(); <br>if (!params.position) <br>cal.showAtElement(params.button || params.displayArea || params.inputField, params.align); <br>else <br>cal.showAt(params.position[0], params.position[1]); <br>return false; <br>}; <br>return cal; <br>}; <br>//************ calendar-setup.js END ********************* <br><br>// ** I18N <br>// Calendar big5-utf8 language <br>// Author: Gary Fu, <gary@garyfu.idv.tw> <br>// Encoding: utf8 <br>// Distributed under the same terms as the calendar itself. <br>// For translators: please use UTF-8 if possible. We strongly believe that <br>// Unicode is the answer to a real internationalized world. Also please <br>// include your contact information in the header, as can be seen above. <br>// full day names <br>Calendar._DN = new Array <br>("星期日", <br>"星期一", <br>"星期二", <br>"星期三", <br>"星期四", <br>"星期五", <br>"星期六", <br>"星期日"); <br>// Please note that the following array of short day names (and the same goes <br>// for short month names, _SMN) isn't absolutely necessary. We give it here <br>// for exemplification on how one can customize the short day names, but if <br>// they are simply the first N letters of the full name you can simply say: <br>// <br>// Calendar._SDN_len = N; // short day name length <br>// Calendar._SMN_len = N; // short month name length <br>// <br>// If N = 3 then this is not needed either since we assume a value of 3 if not <br>// present, to be compatible with translation files that were written before <br>// this feature. <br>// short day names <br>Calendar._SDN = new Array <br>("日", <br>"一", <br>"二", <br>"三", <br>"四", <br>"五", <br>"六", <br>"日"); <br>// First day of the week. "0" means display Sunday first, "1" means display <br>// Monday first, etc. <br>Calendar._FD = 0; <br>// full month names <br>Calendar._MN = new Array <br>("一月", <br>"二月", <br>"三月", <br>"四月", <br>"五月", <br>"六月", <br>"七月", <br>"八月", <br>"九月", <br>"十月", <br>"十一月", <br>"十二月"); <br>// short month names <br>Calendar._SMN = new Array <br>("一月", <br>"二月", <br>"三月", <br>"四月", <br>"五月", <br>"六月", <br>"七月", <br>"八月", <br>"九月", <br>"十月", <br>"十一月", <br>"十二月"); <br>// tooltips <br>Calendar._TT = {}; <br>Calendar._TT["INFO"] = "關於"; <br>Calendar._TT["ABOUT"] = <br>"DHTML Date/Time Selectorn" + <br>"(c) dynarch.com 2002-2005 / Author: Mihai Bazonn" + // don't translate this this ;-) <br>"For latest version visit: http://www.dynarch.com/projects/calendar/n" + <br>"Distributed under GNU LGPL. See http://gnu.org/licenses/lgpl.html for details." + <br>"nn" + <br>"日期選擇方法:n" + <br>"- 使用 xab, xbb 按鈕可選擇年份n" + <br>"- 使用 " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " 按鈕可選擇月份n" + <br>"- 按住上面的按鈕可以加快選取"; <br>Calendar._TT["ABOUT_TIME"] = "nn" + <br>"時間選擇方法:n" + <br>"- 點擊任何的時間部份可增加其值n" + <br>"- 同時按Shift鍵再點擊可減少其值n" + <br>"- 點擊並拖曳可加快改變的值"; <br>Calendar._TT["PREV_YEAR"] = "上一年 (按住選單)"; <br>Calendar._TT["PREV_MONTH"] = "上一月 (按住選單)"; <br>Calendar._TT["GO_TODAY"] = "到今日"; <br>Calendar._TT["NEXT_MONTH"] = " 下一月(按住選單)"; <br>Calendar._TT["NEXT_YEAR"] = "下一年 (按住選單)"; <br>Calendar._TT["SEL_DATE"] = "選擇日期"; <br>Calendar._TT["DRAG_TO_MOVE"] = "拖曳"; <br>Calendar._TT["PART_TODAY"] = " (今日)"; <br>// the following is to inform that "%s" is to be the first day of week <br>// %s will be replaced with the day name. <br>Calendar._TT["DAY_FIRST"] = "將 %s 顯示在前"; <br>// This may be locale-dependent. It specifies the week-end days, as an array <br>// of co</div>