PageSourceSearch

https://www.scampparnashop.hu/wa_script/js/javascripts.js?_=2026-09-11-00-00

js scampparnashop.hu collected 2026-10-03 21:37:24 UTC 99,553 bytes, 2,916 lines download raw bytes

1/*  Copyright Mihai Bazon, 2002-2005  |  www.bazon.net/mishoo
2 * -----------------------------------------------------------
3 *
4 * The DHTML Calendar, version 1.0 "It is happening again"
5 *
6 * Details and latest version at:
7 * www.dynarch.com/projects/calendar
8 *
9 * This script is developed by Dynarch.com.  Visit us at www.dynarch.com.
10 *
11 * This script is distributed under the GNU Lesser General Public License.
12 * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html
13 */
14
15// $Id: calendar.js,v 1.51 2005/03/07 16:44:31 mishoo Exp $
16
17/** The Calendar object constructor. */
18
19/* �E�TINA windows 1250 - �������̊�؎���� */
20
21Calendar = function (firstDayOfWeek, dateStr, onSelected, onClose) {
22	// member variables
23	this.activeDiv = null;
24	this.currentDateEl = null;
25	this.getDateStatus = null;
26	this.getDateToolTip = null;
27	this.getDateText = null;
28	this.timeout = null;
29	this.onSelected = onSelected || null;
30	this.onClose = onClose || null;
31	this.dragging = false;
32	this.hidden = false;
33	this.minYear = 1970;
34	this.maxYear = 2050;
35	this.dateFormat = Calendar._TT["DEF_DATE_FORMAT"];
36	this.ttDateFormat = Calendar._TT["TT_DATE_FORMAT"];
37	this.isPopup = true;
38	this.weekNumbers = true;
39	this.firstDayOfWeek = typeof firstDayOfWeek == "number" ? firstDayOfWeek : Calendar._FD; // 0 for Sunday, 1 for Monday, etc.
40	this.showsOtherMonths = false;
41	this.dateStr = dateStr;
42	this.ar_days = null;
43	this.showsTime = false;
44	this.time24 = true;
45	this.yearStep = 2;
46	this.hiliteToday = true;
47	this.multiple = null;
48	// HTML elements
49	this.table = null;
50	this.element = null;
51	this.tbody = null;
52	this.firstdayname = null;
53	// Combo boxes
54	this.monthsCombo = null;
55	this.yearsCombo = null;
56	this.hilitedMonth = null;
57	this.activeMonth = null;
58	this.hilitedYear = null;
59	this.activeYear = null;
60	// Information
61	this.dateClicked = false;
62
63	// one-time initializations
64	if (typeof Calendar._SDN == "undefined") {
65		// table of short day names
66		if (typeof Calendar._SDN_len == "undefined")
67			Calendar._SDN_len = 3;
68		var ar = new Array();
69		for (var i = 8; i > 0;) {
70			ar[--i] = Calendar._DN[i].substr(0, Calendar._SDN_len);
71		}
72		Calendar._SDN = ar;
73		// table of short month names
74		if (typeof Calendar._SMN_len == "undefined")
75			Calendar._SMN_len = 3;
76		ar = new Array();
77		for (var i = 12; i > 0;) {
78			ar[--i] = Calendar._MN[i].substr(0, Calendar._SMN_len);
79		}
80		Calendar._SMN = ar;
81	}
82};
83
84// ** constants
85
86/// "static", needed for event handlers.
87Calendar._C = null;
88
89/// detect a special case of "web browser"
90Calendar.is_ie = ( /msie/i.test(navigator.userAgent) &&
91		   !/opera/i.test(navigator.userAgent) );
92
93Calendar.is_ie5 = ( Calendar.is_ie && /msie 5\.0/i.test(navigator.userAgent) );
94
95/// detect Opera browser
96Calendar.is_opera = /opera/i.test(navigator.userAgent);
97
98/// detect KHTML-based browsers
99Calendar.is_khtml = /Konqueror|Safari|KHTML/i.test(navigator.userAgent);
100
101// BEGIN: UTILITY FUNCTIONS; beware that these might be moved into a separate
102//        library, at some point.
103
104Calendar.getAbsolutePos = function(el) {
105	var SL = 0, ST = 0;
106	var is_div = /^div$/i.test(el.tagName);
107	if (is_div && el.scrollLeft)
108		SL = el.scrollLeft;
109	if (is_div && el.scrollTop)
110		ST = el.scrollTop;
111	var r = { x: el.offsetLeft - SL, y: el.offsetTop - ST };
112	if (el.offsetParent) {
113		var tmp = this.getAbsolutePos(el.offsetParent);
114		r.x += tmp.x;
115		r.y += tmp.y;
116	}
117	return r;
118};
119
120Calendar.isRelated = function (el, evt) {
121	var related = evt.relatedTarget;
122	if (!related) {
123		var type = evt.type;
124		if (type == "mouseover") {
125			related = evt.fromElement;
126		} else if (type == "mouseout") {
127			related = evt.toElement;
128		}
129	}
130	while (related) {
131		if (related == el) {
132			return true;
133		}
134		related = related.parentNode;
135	}
136	return false;
137};
138
139Calendar.removeClass = function(el, className) {
140	if (!(el && el.className)) {
141		return;
142	}
143	var cls = el.className.split(" ");
144	var ar = new Array();
145	for (var i = cls.length; i > 0;) {
146		if (cls[--i] != className) {
147			ar[ar.length] = cls[i];
148		}
149	}
150	el.className = ar.join(" ");
151};
152
153Calendar.addClass = function(el, className) {
154	Calendar.removeClass(el, className);
155	el.className += " " + className;
156};
157
158// FIXME: the following 2 functions totally suck, are useless and should be replaced immediately.
159Calendar.getElement = function(ev) {
160	var f = Calendar.is_ie ? window.event.srcElement : ev.currentTarget;
161	while (f.nodeType != 1 || /^div$/i.test(f.tagName))
162		f = f.parentNode;
163	return f;
164};
165
166Calendar.getTargetElement = function(ev) {
167	var f = Calendar.is_ie ? window.event.srcElement : ev.target;
168	while (f.nodeType != 1)
169		f = f.parentNode;
170	return f;
171};
172
173Calendar.stopEvent = function(ev) {
174	ev || (ev = window.event);
175	if (Calendar.is_ie) {
176		ev.cancelBubble = true;
177		ev.returnValue = false;
178	} else {
179		ev.preventDefault();
180		ev.stopPropagation();
181	}
182	return false;
183};
184
185Calendar.addEvent = function(el, evname, func) {
186	if (el.attachEvent) { // IE
187		el.attachEvent("on" + evname, func);
188	} else if (el.addEventListener) { // Gecko / W3C
189		el.addEventListener(evname, func, true);
190	} else {
191		el["on" + evname] = func;
192	}
193};
194
195Calendar.removeEvent = function(el, evname, func) {
196	if (el.detachEvent) { // IE
197		el.detachEvent("on" + evname, func);
198	} else if (el.removeEventListener) { // Gecko / W3C
199		el.removeEventListener(evname, func, true);
200	} else {
201		el["on" + evname] = null;
202	}
203};
204
205Calendar.createElement = function(type, parent) {
206	var el = null;
207	if (document.createElementNS) {
208		// use the XHTML namespace; IE won't normally get here unless
209		// _they_ "fix" the DOM2 implementation.
210		el = document.createElementNS("http://www.w3.org/1999/xhtml", type);
211	} else {
212		el = document.createElement(type);
213	}
214	if (typeof parent != "undefined") {
215		parent.appendChild(el);
216	}
217	return el;
218};
219
220// END: UTILITY FUNCTIONS
221
222// BEGIN: CALENDAR STATIC FUNCTIONS
223
224/** Internal -- adds a set of events to make some element behave like a button. */
225Calendar._add_evs = function(el) {
226	with (Calendar) {
227		addEvent(el, "mouseover", dayMouseOver);
228		addEvent(el, "mousedown", dayMouseDown);
229		addEvent(el, "mouseout", dayMouseOut);
230		if (is_ie) {
231			addEvent(el, "dblclick", dayMouseDblClick);
232			el.setAttribute("unselectable", true);
233		}
234	}
235};
236
237Calendar.findMonth = function(el) {
238	if (typeof el.month != "undefined") {
239		return el;
240	} else if (typeof el.parentNode.month != "undefined") {
241		return el.parentNode;
242	}
243	return null;
244};
245
246Calendar.findYear = function(el) {
247	if (typeof el.year != "undefined") {
248		return el;
249	} else if (typeof el.parentNode.year != "undefined") {
250		return el.parentNode;
251	}
252	return null;
253};
254
255Calendar.showMonthsCombo = function () {
256	var cal = Calendar._C;
257	if (!cal) {
258		return false;
259	}
260	var cal = cal;
261	var cd = cal.activeDiv;
262	var mc = cal.monthsCombo;
263	if (cal.hilitedMonth) {
264		Calendar.removeClass(cal.hilitedMonth, "hilite");
265	}
266	if (cal.activeMonth) {
267		Calendar.removeClass(cal.activeMonth, "active");
268	}
269	var mon = cal.monthsCombo.getElementsByTagName("div")[cal.date.getMonth()];
270	Calendar.addClass(mon, "active");
271	cal.activeMonth = mon;
272	var s = mc.style;
273	s.display = "block";
274	if (cd.navtype < 0)
275		s.left = cd.offsetLeft + "px";
276	else {
277		var mcw = mc.offsetWidth;
278		if (typeof mcw == "undefined")
279			// Konqueror brain-dead techniques
280			mcw = 50;
281		s.left = (cd.offsetLeft + cd.offsetWidth - mcw) + "px";
282	}
283	s.top = (cd.offsetTop + cd.offsetHeight) + "px";
284};
285
286Calendar.showYearsCombo = function (fwd) {
287	var cal = Calendar._C;
288	if (!cal) {
289		return false;
290	}
291	var cal = cal;
292	var cd = cal.activeDiv;
293	var yc = cal.yearsCombo;
294	if (cal.hilitedYear) {
295		Calendar.removeClass(cal.hilitedYear, "hilite");
296	}
297	if (cal.activeYear) {
298		Calendar.removeClass(cal.activeYear, "active");
299	}
300	cal.activeYear = null;
301	var Y = cal.date.getFullYear() + (fwd ? 1 : -1);
302	var yr = yc.firstChild;
303	var show = false;
304	for (var i = 12; i > 0; --i) {
305		if (Y >= cal.minYear && Y <= cal.maxYear) {
306			yr.innerHTML = Y;
307			yr.year = Y;
308			yr.style.display = "block";
309			show = true;
310		} else {
311			yr.style.display = "none";
312		}
313		yr = yr.nextSibling;
314		Y += fwd ? cal.yearStep : -cal.yearStep;
315	}
316	if (show) {
317		var s = yc.style;
318		s.display = "block";
319		if (cd.navtype < 0)
320			s.left = cd.offsetLeft + "px";
321		else {
322			var ycw = yc.offsetWidth;
323			if (typeof ycw == "undefined")
324				// Konqueror brain-dead techniques
325				ycw = 50;
326			s.left = (cd.offsetLeft + cd.offsetWidth - ycw) + "px";
327		}
328		s.top = (cd.offsetTop + cd.offsetHeight) + "px";
329	}
330};
331
332// event handlers
333
334Calendar.tableMouseUp = function(ev) {
335	var cal = Calendar._C;
336	if (!cal) {
337		return false;
338	}
339	if (cal.timeout) {
340		clearTimeout(cal.timeout);
341	}
342	var el = cal.activeDiv;
343	if (!el) {
344		return false;
345	}
346	var target = Calendar.getTargetElement(ev);
347	ev || (ev = window.event);
348	Calendar.removeClass(el, "active");
349	if (target == el || target.parentNode == el) {
350		Calendar.cellClick(el, ev);
351	}
352	var mon = Calendar.findMonth(target);
353	var date = null;
354	if (mon) {
355		date = new Date(cal.date);
356		if (mon.month != date.getMonth()) {
357			date.setMonth(mon.month);
358			cal.setDate(date);
359			cal.dateClicked = false;
360			cal.callHandler();
361		}
362	} else {
363		var year = Calendar.findYear(target);
364		if (year) {
365			date = new Date(cal.date);
366			if (year.year != date.getFullYear()) {
367				date.setFullYear(year.year);
368				cal.setDate(date);
369				cal.dateClicked = false;
370				cal.callHandler();
371			}
372		}
373	}
374	with (Calendar) {
375		removeEvent(document, "mouseup", tableMouseUp);
376		removeEvent(document, "mouseover", tableMouseOver);
377		removeEvent(document, "mousemove", tableMouseOver);
378		cal._hideCombos();
379		_C = null;
380		return stopEvent(ev);
381	}
382};
383
384Calendar.tableMouseOver = function (ev) {
385	var cal = Calendar._C;
386	if (!cal) {
387		return;
388	}
389	var el = cal.activeDiv;
390	var target = Calendar.getTargetElement(ev);
391	if (target == el || target.parentNode == el) {
392		Calendar.addClass(el, "hilite active");
393		Calendar.addClass(el.parentNode, "rowhilite");
394	} else {
395		if (typeof el.navtype == "undefined" || (el.navtype != 50 && (el.navtype == 0 || Math.abs(el.navtype) > 2)))
396			Calendar.removeClass(el, "active");
397		Calendar.removeClass(el, "hilite");
398		Calendar.removeClass(el.parentNode, "rowhilite");
399	}
400	ev || (ev = window.event);
401	if (el.navtype == 50 && target != el) {
402		var pos = Calendar.getAbsolutePos(el);
403		var w = el.offsetWidth;
404		var x = ev.clientX;
405		var dx;
406		var decrease = true;
407		if (x > pos.x + w) {
408			dx = x - pos.x - w;
409			decrease = false;
410		} else
411			dx = pos.x - x;
412
413		if (dx < 0) dx = 0;
414		var range = el._range;
415		var current = el._current;
416		var count = Math.floor(dx / 10) % range.length;
417		for (var i = range.length; --i >= 0;)
418			if (range[i] == current)
419				break;
420		while (count-- > 0)
421			if (decrease) {
422				if (--i < 0)
423					i = range.length - 1;
424			} else if ( ++i >= range.length )
425				i = 0;
426		var newval = range[i];
427		el.innerHTML = newval;
428
429		cal.onUpdateTime();
430	}
431	var mon = Calendar.findMonth(target);
432	if (mon) {
433		if (mon.month != cal.date.getMonth()) {
434			if (cal.hilitedMonth) {
435				Calendar.removeClass(cal.hilitedMonth, "hilite");
436			}
437			Calendar.addClass(mon, "hilite");
438			cal.hilitedMonth = mon;
439		} else if (cal.hilitedMonth) {
440			Calendar.removeClass(cal.hilitedMonth, "hilite");
441		}
442	} else {
443		if (cal.hilitedMonth) {
444			Calendar.removeClass(cal.hilitedMonth, "hilite");
445		}
446		var year = Calendar.findYear(target);
447		if (year) {
448			if (year.year != cal.date.getFullYear()) {
449				if (cal.hilitedYear) {
450					Calendar.removeClass(cal.hilitedYear, "hilite");
451				}
452				Calendar.addClass(year, "hilite");
453				cal.hilitedYear = year;
454			} else if (cal.hilitedYear) {
455				Calendar.removeClass(cal.hilitedYear, "hilite");
456			}
457		} else if (cal.hilitedYear) {
458			Calendar.removeClass(cal.hilitedYear, "hilite");
459		}
460	}
461	return Calendar.stopEvent(ev);
462};
463
464Calendar.tableMouseDown = function (ev) {
465	if (Calendar.getTargetElement(ev) == Calendar.getElement(ev)) {
466		return Calendar.stopEvent(ev);
467	}
468};
469
470Calendar.calDragIt = function (ev) {
471	var cal = Calendar._C;
472	if (!(cal && cal.dragging)) {
473		return false;
474	}
475	var posX;
476	var posY;
477	if (Calendar.is_ie) {
478		posY = window.event.clientY + document.body.scrollTop;
479		posX = window.event.clientX + document.body.scrollLeft;
480	} else {
481		posX = ev.pageX;
482		posY = ev.pageY;
483	}
484	cal.hideShowCovered();
485	var st = cal.element.style;
486	st.left = (posX - cal.xOffs) + "px";
487	st.top = (posY - cal.yOffs) + "px";
488	return Calendar.stopEvent(ev);
489};
490
491Calendar.calDragEnd = function (ev) {
492	var cal = Calendar._C;
493	if (!cal) {
494		return false;
495	}
496	cal.dragging = false;
497	with (Calendar) {
498		removeEvent(document, "mousemove", calDragIt);
499		removeEvent(document, "mouseup", calDragEnd);
500		tableMouseUp(ev);
501	}
502	cal.hideShowCovered();
503};
504
505Calendar.dayMouseDown = function(ev) {
506	var el = Calendar.getElement(ev);
507	if (el.disabled) {
508		return false;
509	}
510	var cal = el.calendar;
511	cal.activeDiv = el;
512	Calendar._C = cal;
513	if (el.navtype != 300) with (Calendar) {
514		if (el.navtype == 50) {
515			el._current = el.innerHTML;
516			addEvent(document, "mousemove", tableMouseOver);
517		} else
518			addEvent(document, Calendar.is_ie5 ? "mousemove" : "mouseover", tableMouseOver);
519		addClass(el, "hilite active");
520		addEvent(document, "mouseup", tableMouseUp);
521	} else if (cal.isPopup) {
522		cal._dragStart(ev);
523	}
524	if (el.navtype == -1 || el.navtype == 1) {
525		if (cal.timeout) clearTimeout(cal.timeout);
526		cal.timeout = setTimeout("Calendar.showMonthsCombo()", 250);
527	} else if (el.navtype == -2 || el.navtype == 2) {
528		if (cal.timeout) clearTimeout(cal.timeout);
529		cal.timeout = setTimeout((el.navtype > 0) ? "Calendar.showYearsCombo(true)" : "Calendar.showYearsCombo(false)", 250);
530	} else {
531		cal.timeout = null;
532	}
533	return Calendar.stopEvent(ev);
534};
535
536Calendar.dayMouseDblClick = function(ev) {
537	Calendar.cellClick(Calendar.getElement(ev), ev || window.event);
538	if (Calendar.is_ie) {
539		document.selection.empty();
540	}
541};
542
543Calendar.dayMouseOver = function(ev) {
544	var el = Calendar.getElement(ev);
545	if (Calendar.isRelated(el, ev) || Calendar._C || el.disabled) {
546		return false;
547	}
548	if (el.ttip) {
549		if (el.ttip.substr(0, 1) == "_") {
550			el.ttip = el.caldate.print(el.calendar.ttDateFormat) + el.ttip.substr(1);
551		}
552		el.calendar.tooltips.innerHTML = el.ttip;
553	}
554	if (el.navtype != 300) {
555		Calendar.addClass(el, "hilite");
556		if (el.caldate) {
557			Calendar.addClass(el.parentNode, "rowhilite");
558		}
559	}
560	return Calendar.stopEvent(ev);
561};
562
563Calendar.dayMouseOut = function(ev) {
564	with (Calendar) {
565		var el = getElement(ev);
566		if (isRelated(el, ev) || _C || el.disabled)
567			return false;
568		removeClass(el, "hilite");
569		if (el.caldate)
570			removeClass(el.parentNode, "rowhilite");
571		if (el.calendar)
572			el.calendar.tooltips.innerHTML = _TT["SEL_DATE"];
573		return stopEvent(ev);
574	}
575};
576
577/**
578 *  A generic "click" handler :) handles all types of buttons defined in this
579 *  calendar.
580 */
581Calendar.cellClick = function(el, ev) {
582	var cal = el.calendar;
583	var closing = false;
584	var newdate = false;
585	var date = null;
586	if (typeof el.navtype == "undefined") {
587		if (cal.currentDateEl) {
588			Calendar.removeClass(cal.currentDateEl, "selected");
589			Calendar.addClass(el, "selected");
590			closing = (cal.currentDateEl == el);
591			if (!closing) {
592				cal.currentDateEl = el;
593			}
594		}
595		cal.date.setDateOnly(el.caldate);
596		date = cal.date;
597		var other_month = !(cal.dateClicked = !el.otherMonth);
598		if (!other_month && !cal.currentDateEl)
599			cal._toggleMultipleDate(new Date(date));
600		else
601			newdate = !el.disabled;
602		// a date was clicked
603		if (other_month)
604			cal._init(cal.firstDayOfWeek, date);
605	} else {
606		if (el.navtype == 200) {
607			Calendar.removeClass(el, "hilite");
608			cal.callCloseHandler();
609			return;
610		}
611		date = new Date(cal.date);
612		if (el.navtype == 0)
613			date.setDateOnly(new Date()); // TODAY
614		// unless "today" was clicked, we assume no date was clicked so
615		// the selected handler will know not to close the calenar when
616		// in single-click mode.
617		// cal.dateClicked = (el.navtype == 0);
618		cal.dateClicked = false;
619		var year = date.getFullYear();
620		var mon = date.getMonth();
621		function setMonth(m) {
622			var day = date.getDate();
623			var max = date.getMonthDays(m);
624			if (day > max) {
625				date.setDate(max);
626			}
627			date.setMonth(m);
628		};
629		switch (el.navtype) {
630		    case 400:
631			Calendar.removeClass(el, "hilite");
632			var text = Calendar._TT["ABOUT"];
633			if (typeof text != "undefined") {
634				text += cal.showsTime ? Calendar._TT["ABOUT_TIME"] : "";
635			} else {
636				// FIXME: this should be removed as soon as lang files get updated!
637				text = "Help and about box text is not translated into this language.\n" +
638					"If you know this language and you feel generous please update\n" +
639					"the corresponding file in \"lang\" subdir to match calendar-en.js\n" +
640					"and send it back to <[email protected]> to get it into the distribution  ;-)\n\n" +
641					"Thank you!\n" +
642					"http://dynarch.com/mishoo/calendar.epl\n";
643			}
644			alert(text);
645			return;
646		    case -2:
647			if (year > cal.minYear) {
648				date.setFullYear(year - 1);
649			}
650			break;
651		    case -1:
652			if (mon > 0) {
653				setMonth(mon - 1);
654			} else if (year-- > cal.minYear) {
655				date.setFullYear(year);
656				setMonth(11);
657			}
658			break;
659		    case 1:
660			if (mon < 11) {
661				setMonth(mon + 1);
662			} else if (year < cal.maxYear) {
663				date.setFullYear(year + 1);
664				setMonth(0);
665			}
666			break;
667		    case 2:
668			if (year < cal.maxYear) {
669				date.setFullYear(year + 1);
670			}
671			break;
672		    case 100:
673			cal.setFirstDayOfWeek(el.fdow);
674			return;
675		    case 50:
676			var range = el._range;
677			var current = el.innerHTML;
678			for (var i = range.length; --i >= 0;)
679				if (range[i] == current)
680					break;
681			if (ev && ev.shiftKey) {
682				if (--i < 0)
683					i = range.length - 1;
684			} else if ( ++i >= range.length )
685				i = 0;
686			var newval = range[i];
687			el.innerHTML = newval;
688			cal.onUpdateTime();
689			return;
690		    case 0:
691			// TODAY will bring us here
692			if ((typeof cal.getDateStatus == "function") &&
693			    cal.getDateStatus(date, date.getFullYear(), date.getMonth(), date.getDate())) {
694				return false;
695			}
696			break;
697		}
698		if (!date.equalsTo(cal.date)) {
699			cal.setDate(date);
700			newdate = true;
701		} else if (el.navtype == 0)
702			newdate = closing = true;
703	}
704	if (newdate) {
705		ev && cal.callHandler();
706	}
707	if (closing) {
708		Calendar.removeClass(el, "hilite");
709		ev && cal.callCloseHandler();
710	}
711};
712
713// END: CALENDAR STATIC FUNCTIONS
714
715// BEGIN: CALENDAR OBJECT FUNCTIONS
716
717/**
718 *  This function creates the calendar inside the given parent.  If _par is
719 *  null than it creates a popup calendar inside the BODY element.  If _par is
720 *  an element, be it BODY, then it creates a non-popup calendar (still
721 *  hidden).  Some properties need to be set before calling this function.
722 */
723Calendar.prototype.create = function (_par) {
724	var parent = null;
725	if (! _par) {
726		// default parent is the document body, in which case we create
727		// a popup calendar.
728		parent = document.getElementsByTagName("body")[0];
729		this.isPopup = true;
730	} else {
731		parent = _par;
732		this.isPopup = false;
733	}
734	this.date = this.dateStr ? new Date(this.dateStr) : new Date();
735
736	var table = Calendar.createElement("table");
737	this.table = table;
738	table.cellSpacing = 0;
739	table.cellPadding = 0;
740	table.calendar = this;
741	Calendar.addEvent(table, "mousedown", Calendar.tableMouseDown);
742
743	var div = Calendar.createElement("div");
744	this.element = div;
745	div.className = "calendar";
746	if (this.isPopup) {
747		div.style.position = "absolute";
748		div.style.display = "none";
749	}
750	div.appendChild(table);
751
752	var thead = Calendar.createElement("thead", table);
753	var cell = null;
754	var row = null;
755
756	var cal = this;
757	var hh = function (text, cs, navtype) {
758		cell = Calendar.createElement("td", row);
759		cell.colSpan = cs;
760		cell.className = "button";
761		if (navtype != 0 && Math.abs(navtype) <= 2)
762			cell.className += " nav";
763		Calendar._add_evs(cell);
764		cell.calendar = cal;
765		cell.navtype = navtype;
766		cell.innerHTML = "<div unselectable='on'>
766" + text + "</div>";
767		return cell;
768	};
769
770	row = Calendar.createElement("tr", thead);
771	var title_length = 6;
772	(this.isPopup) && --title_length;
773	(this.weekNumbers) && ++title_length;
774
775	hh("?", 1, 400).ttip = Calendar._TT["INFO"];
776	this.title = hh("", title_length, 300);
777	this.title.className = "title";
778	if (this.isPopup) {
779		this.title.ttip = Calendar._TT["DRAG_TO_MOVE"];
780		this.title.style.cursor = "move";
781		hh("&#x00d7;", 1, 200).ttip = Calendar._TT["CLOSE"];
782	}
783
784	row = Calendar.createElement("tr", thead);
785	row.className = "headrow";
786
787	this._nav_py = hh("&#x00ab;", 1, -2);
788	this._nav_py.ttip = Calendar._TT["PREV_YEAR"];
789
790	this._nav_pm = hh("&#x2039;", 1, -1);
791	this._nav_pm.ttip = Calendar._TT["PREV_MONTH"];
792
793	this._nav_now = hh(Calendar._TT["TODAY"], this.weekNumbers ? 4 : 3, 0);
794	this._nav_now.ttip = Calendar._TT["GO_TODAY"];
795
796	this._nav_nm = hh("&#x203a;", 1, 1);
797	this._nav_nm.ttip = Calendar._TT["NEXT_MONTH"];
798
799	this._nav_ny = hh("&#x00bb;", 1, 2);
800	this._nav_ny.ttip = Calendar._TT["NEXT_YEAR"];
801
802	// day names
803	row = Calendar.createElement("tr", thead);
804	row.className = "daynames";
805	if (this.weekNumbers) {
806		cell = Calendar.createElement("td", row);
807		cell.className = "nameCal wn";
808		cell.innerHTML = Calendar._TT["WK"];
809	}
810	for (var i = 7; i > 0; --i) {
811		cell = Calendar.createElement("td", row);
812		if (!i) {
813			cell.navtype = 100;
814			cell.calendar = this;
815			Calendar._add_evs(cell);
816		}
817	}
818	this.firstdayname = (this.weekNumbers) ? row.firstChild.nextSibling : row.firstChild;
819	this._displayWeekdays();
820
821	var tbody = Calendar.createElement("tbody", table);
822	this.tbody = tbody;
823
824	for (i = 6; i > 0; --i) {
825		row = Calendar.createElement("tr", tbody);
826		if (this.weekNumbers) {
827			cell = Calendar.createElement("td", row);
828		}
829		for (var j = 7; j > 0; --j) {
830			cell = Calendar.createElement("td", row);
831			cell.calendar = this;
832			Calendar._add_evs(cell);
833		}
834	}
835
836	if (this.showsTime) {
837		row = Calendar.createElement("tr", tbody);
838		row.className = "time";
839
840		cell = Calendar.createElement("td", row);
841		cell.className = "time";
842		cell.colSpan = 2;
843		cell.innerHTML = Calendar._TT["TIME"] || "&nbsp;";
844
845		cell = Calendar.createElement("td", row);
846		cell.className = "time";
847		cell.colSpan = this.weekNumbers ? 4 : 3;
848
849		(function(){
850			function makeTimePart(className, init, range_start, range_end) {
851				var part = Calendar.createElement("span", cell);
852				part.className = className;
853				part.innerHTML = init;
854				part.calendar = cal;
855				part.ttip = Calendar._TT["TIME_PART"];
856				part.navtype = 50;
857				part._range = [];
858				if (typeof range_start != "number")
859					part._range = range_start;
860				else {
861					for (var i = range_start; i <= range_end; ++i) {
862						var txt;
863						if (i < 10 && range_end >= 10) txt = '0' + i;
864						else txt = '' + i;
865						part._range[part._range.length] = txt;
866					}
867				}
868				Calendar._add_evs(part);
869				return part;
870			};
871			var hrs = cal.date.getHours();
872			var mins = cal.date.getMinutes();
873			var t12 = !cal.time24;
874			var pm = (hrs > 12);
875			if (t12 && pm) hrs -= 12;
876			var H = makeTimePart("hour", hrs, t12 ? 1 : 0, t12 ? 12 : 23);
877			var span = Calendar.createElement("span", cell);
878			span.innerHTML = ":";
879			span.className = "colon";
880			var M = makeTimePart("minute", mins, 0, 59);
881			var AP = null;
882			cell = Calendar.createElement("td", row);
883			cell.className = "time";
884			cell.colSpan = 2;
885			if (t12)
886				AP = makeTimePart("ampm", pm ? "pm" : "am", ["am", "pm"]);
887			else
888				cell.innerHTML = "&nbsp;";
889
890			cal.onSetTime = function() {
891				var pm, hrs = this.date.getHours(),
892					mins = this.date.getMinutes();
893				if (t12) {
894					pm = (hrs >= 12);
895					if (pm) hrs -= 12;
896					if (hrs == 0) hrs = 12;
897					AP.innerHTML = pm ? "pm" : "am";
898				}
899				H.innerHTML = (hrs < 10) ? ("0" + hrs) : hrs;
900				M.innerHTML = (mins < 10) ? ("0" + mins) : mins;
901			};
902
903			cal.onUpdateTime = function() {
904				var date = this.date;
905				var h = parseInt(H.innerHTML, 10);
906				if (t12) {
907					if (/pm/i.test(AP.innerHTML) && h < 12)
908						h += 12;
909					else if (/am/i.test(AP.innerHTML) && h == 12)
910						h = 0;
911				}
912				var d = date.getDate();
913				var m = date.getMonth();
914				var y = date.getFullYear();
915				date.setHours(h);
916				date.setMinutes(parseInt(M.innerHTML, 10));
917				date.setFullYear(y);
918				date.setMonth(m);
919				date.setDate(d);
920				this.dateClicked = false;
921				this.callHandler();
922			};
923		})();
924	} else {
925		this.onSetTime = this.onUpdateTime = function() {};
926	}
927
928	var tfoot = Calendar.createElement("tfoot", table);
929
930	row = Calendar.createElement("tr", tfoot);
931	row.className = "footrow";
932
933	cell = hh(Calendar._TT["SEL_DATE"], this.weekNumbers ? 8 : 7, 300);
934	cell.className = "ttip";
935	if (this.isPopup) {
936		cell.ttip = Calendar._TT["DRAG_TO_MOVE"];
937		cell.style.cursor = "move";
938	}
939	this.tooltips = cell;
940
941	div = Calendar.createElement("div", this.element);
942	this.monthsCombo = div;
943	div.className = "combo";
944	for (i = 0; i < Calendar._MN.length; ++i) {
945		var mn = Calendar.createElement("div");
946		mn.className = Calendar.is_ie ? "label-IEfix" : "label";
947		mn.month = i;
948		mn.innerHTML = Calendar._SMN[i];
949		div.appendChild(mn);
950	}
951
952	div = Calendar.createElement("div", this.element);
953	this.yearsCombo = div;
954	div.className = "combo";
955	for (i = 12; i > 0; --i) {
956		var yr = Calendar.createElement("div");
957		yr.className = Calendar.is_ie ? "label-IEfix" : "label";
958		div.appendChild(yr);
959	}
960
961	this._init(this.firstDayOfWeek, this.date);
962	parent.appendChild(this.element);
963};
964
965/** keyboard navigation, only for popup calendars */
966Calendar._keyEvent = function(ev) {
967	var cal = window._dynarch_popupCalendar;
968	if (!cal || cal.multiple)
969		return false;
970	(Calendar.is_ie) && (ev = window.event);
971	var act = (Calendar.is_ie || ev.type == "keypress"),
972		K = ev.keyCode;
973	if (ev.ctrlKey) {
974		switch (K) {
975		    case 37: // KEY left
976			act && Calendar.cellClick(cal._nav_pm);
977			break;
978		    case 38: // KEY up
979			act && Calendar.cellClick(cal._nav_py);
980			break;
981		    case 39: // KEY right
982			act && Calendar.cellClick(cal._nav_nm);
983			break;
984		    case 40: // KEY down
985			act && Calendar.cellClick(cal._nav_ny);
986			break;
987		    default:
988			return false;
989		}
990	} else switch (K) {
991	    case 32: // KEY space (now)
992		Calendar.cellClick(cal._nav_now);
993		break;
994	    case 27: // KEY esc
995		act && cal.callCloseHandler();
996		break;
997	    case 37: // KEY left
998	    case 38: // KEY up
999	    case 39: // KEY right
1000	    case 40: // KEY down
1001		if (act) {
1002			var prev, x, y, ne, el, step;
1003			prev = K == 37 || K == 38;
1004			step = (K == 37 || K == 39) ? 1 : 7;
1005			function setVars() {
1006				el = cal.currentDateEl;
1007				var p = el.pos;
1008				x = p & 15;
1009				y = p >> 4;
1010				ne = cal.ar_days[y][x];
1011			};setVars();
1012			function prevMonth() {
1013				var date = new Date(cal.date);
1014				date.setDate(date.getDate() - step);
1015				cal.setDate(date);
1016			};
1017			function nextMonth() {
1018				var date = new Date(cal.date);
1019				date.setDate(date.getDate() + step);
1020				cal.setDate(date);
1021			};
1022			while (1) {
1023				switch (K) {
1024				    case 37: // KEY left
1025					if (--x >= 0)
1026						ne = cal.ar_days[y][x];
1027					else {
1028						x = 6;
1029						K = 38;
1030						continue;
1031					}
1032					break;
1033				    case 38: // KEY up
1034					if (--y >= 0)
1035						ne = cal.ar_days[y][x];
1036					else {
1037						prevMonth();
1038						setVars();
1039					}
1040					break;
1041				    case 39: // KEY right
1042					if (++x < 7)
1043						ne = cal.ar_days[y][x];
1044					else {
1045						x = 0;
1046						K = 40;
1047						continue;
1048					}
1049					break;
1050				    case 40: // KEY down
1051					if (++y < cal.ar_days.length)
1052						ne = cal.ar_days[y][x];
1053					else {
1054						nextMonth();
1055						setVars();
1056					}
1057					break;
1058				}
1059				break;
1060			}
1061			if (ne) {
1062				if (!ne.disabled)
1063					Calendar.cellClick(ne);
1064				else if (prev)
1065					prevMonth();
1066				else
1067					nextMonth();
1068			}
1069		}
1070		break;
1071	    case 13: // KEY enter
1072		if (act)
1073			Calendar.cellClick(cal.currentDateEl, ev);
1074		break;
1075	    default:
1076		return false;
1077	}
1078	return Calendar.stopEvent(ev);
1079};
1080
1081/**
1082 *  (RE)Initializes the calendar to the given date and firstDayOfWeek
1083 */
1084Calendar.prototype._init = function (firstDayOfWeek, date) {
1085	var today = new Date(),
1086		TY = today.getFullYear(),
1087		TM = today.getMonth(),
1088		TD = today.getDate();
1089	this.table.style.visibility = "hidden";
1090	var year = date.getFullYear();
1091	if (year < this.minYear) {
1092		year = this.minYear;
1093		date.setFullYear(year);
1094	} else if (year > this.maxYear) {
1095		year = this.maxYear;
1096		date.setFullYear(year);
1097	}
1098	this.firstDayOfWeek = firstDayOfWeek;
1099	this.date = new Date(date);
1100	var month = date.getMonth();
1101	var mday = date.getDate();
1102	var no_days = date.getMonthDays();
1103
1104	// calendar voodoo for computing the first day that would actually be
1105	// displayed in the calendar, even if it's from the previous month.
1106	// WARNING: this is magic. ;-)
1107	date.setDate(1);
1108	var day1 = (date.getDay() - this.firstDayOfWeek) % 7;
1109	if (day1 < 0)
1110		day1 += 7;
1111	date.setDate(-day1);
1112	date.setDate(date.getDate() + 1);
1113
1114	var row = this.tbody.firstChild;
1115	var MN = Calendar._SMN[month];
1116	var ar_days = this.ar_days = new Array();
1117	var weekend = Calendar._TT["WEEKEND"];
1118	var dates = this.multiple ? (this.datesCells = {}) : null;
1119	for (var i = 0; i < 6; ++i, row = row.nextSibling) {
1120		var cell = row.firstChild;
1121		if (this.weekNumbers) {
1122			cell.className = "day wn";
1123			cell.innerHTML = date.getWeekNumber();
1124			cell = cell.nextSibling;
1125		}
1126		row.className = "daysrow";
1127		var hasdays = false, iday, dpos = ar_days[i] = [];
1128		for (var j = 0; j < 7; ++j, cell = cell.nextSibling, date.setDate(iday + 1)) {
1129			iday = date.getDate();
1130			var wday = date.getDay();
1131			cell.className = "day";
1132			cell.pos = i << 4 | j;
1133			dpos[j] = cell;
1134			var current_month = (date.getMonth() == month);
1135			if (!current_month) {
1136				if (this.showsOtherMonths) {
1137					cell.className += " othermonth";
1138					cell.otherMonth = true;
1139				} else {
1140					cell.className = "emptycell";
1141					cell.innerHTML = "&nbsp;";
1142					cell.disabled = true;
1143					continue;
1144				}
1145			} else {
1146				cell.otherMonth = false;
1147				hasdays = true;
1148			}
1149			cell.disabled = false;
1150			cell.innerHTML = this.getDateText ? this.getDateText(date, iday) : iday;
1151			if (dates)
1152				dates[date.print("%Y%m%d")] = cell;
1153			if (this.getDateStatus) {
1154				var status = this.getDateStatus(date, year, month, iday);
1155				if (this.getDateToolTip) {
1156					var toolTip = this.getDateToolTip(date, year, month, iday);
1157					if (toolTip)
1158						cell.title = toolTip;
1159				}
1160				if (status === true) {
1161					cell.className += " disabled";
1162					cell.disabled = true;
1163				} else {
1164					if (/disabled/i.test(status))
1165						cell.disabled = true;
1166					cell.className += " " + status;
1167				}
1168			}
1169			if (!cell.disabled) {
1170				cell.caldate = new Date(date);
1171				cell.ttip = "_";
1172				if (!this.multiple && current_month
1173				    && iday == mday && this.hiliteToday) {
1174					cell.className += " selected";
1175					this.currentDateEl = cell;
1176				}
1177				if (date.getFullYear() == TY &&
1178				    date.getMonth() == TM &&
1179				    iday == TD) {
1180					cell.className += " today";
1181					cell.ttip += Calendar._TT["PART_TODAY"];
1182				}
1183				if (weekend.indexOf(wday.toString()) != -1)
1184					cell.className += cell.otherMonth ? " oweekend" : " weekend";
1185			}
1186		}
1187		if (!(hasdays || this.showsOtherMonths))
1188			row.className = "emptyrow";
1189	}
1190	this.title.innerHTML = Calendar._MN[month] + ", " + year;
1191	this.onSetTime();
1192	this.table.style.visibility = "visible";
1193	this._initMultipleDates();
1194	// PROFILE
1195	// this.tooltips.innerHTML = "Generated in " + ((new Date()) - today) + " ms";
1196};
1197
1198Calendar.prototype._initMultipleDates = function() {
1199	if (this.multiple) {
1200		for (var i in this.multiple) {
1201			var cell = this.datesCells[i];
1202			var d = this.multiple[i];
1203			if (!d)
1204				continue;
1205			if (cell)
1206				cell.className += " selected";
1207		}
1208	}
1209};
1210
1211Calendar.prototype._toggleMultipleDate = function(date) {
1212	if (this.multiple) {
1213		var ds = date.print("%Y%m%d");
1214		var cell = this.datesCells[ds];
1215		if (cell) {
1216			var d = this.multiple[ds];
1217			if (!d) {
1218				Calendar.addClass(cell, "selected");
1219				this.multiple[ds] = date;
1220			} else {
1221				Calendar.removeClass(cell, "selected");
1222				delete this.multiple[ds];
1223			}
1224		}
1225	}
1226};
1227
1228Calendar.prototype.setDateToolTipHandler = function (unaryFunction) {
1229	this.getDateToolTip = unaryFunction;
1230};
1231
1232/**
1233 *  Calls _init function above for going to a certain date (but only if the
1234 *  date is different than the currently selected one).
1235 */
1236Calendar.prototype.setDate = function (date) {
1237	if (!date.equalsTo(this.date)) {
1238		this._init(this.firstDayOfWeek, date);
1239	}
1240};
1241
1242/**
1243 *  Refreshes the calendar.  Useful if the "disabledHandler" function is
1244 *  dynamic, meaning that the list of disabled date can change at runtime.
1245 *  Just * call this function if you think that the list of disabled dates
1246 *  should * change.
1247 */
1248Calendar.prototype.refresh = function () {
1249	this._init(this.firstDayOfWeek, this.date);
1250};
1251
1252/** Modifies the "firstDayOfWeek" parameter (pass 0 for Synday, 1 for Monday, etc.). */
1253Calendar.prototype.setFirstDayOfWeek = function (firstDayOfWeek) {
1254	this._init(firstDayOfWeek, this.date);
1255	this._displayWeekdays();
1256};
1257
1258/**
1259 *  Allows customization of what dates are enabled.  The "unaryFunction"
1260 *  parameter must be a function object that receives the date (as a JS Date
1261 *  object) and returns a boolean value.  If the returned value is true then
1262 *  the passed date will be marked as disabled.
1263 */
1264Calendar.prototype.setDateStatusHandler = Calendar.prototype.setDisabledHandler = function (unaryFunction) {
1265	this.getDateStatus = unaryFunction;
1266};
1267
1268/** Customization of allowed year range for the calendar. */
1269Calendar.prototype.setRange = function (a, z) {
1270	this.minYear = a;
1271	this.maxYear = z;
1272};
1273
1274/** Calls the first user handler (selectedHandler). */
1275Calendar.prototype.callHandler = function () {
1276	if (this.onSelected) {
1277		this.onSelected(this, this.date.print(this.dateFormat));
1278	}
1279};
1280
1281/** Calls the second user handler (closeHandler). */
1282Calendar.prototype.callCloseHandler = function () {
1283	if (this.onClose) {
1284		this.onClose(this);
1285	}
1286	this.hideShowCovered();
1287};
1288
1289/** Removes the calendar object from the DOM tree and destroys it. */
1290Calendar.prototype.destroy = function () {
1291	var el = this.element.parentNode;
1292	el.removeChild(this.element);
1293	Calendar._C = null;
1294	window._dynarch_popupCalendar = null;
1295};
1296
1297/**
1298 *  Moves the calendar element to a different section in the DOM tree (changes
1299 *  its parent).
1300 */
1301Calendar.prototype.reparent = function (new_parent) {
1302	var el = this.element;
1303	el.parentNode.removeChild(el);
1304	new_parent.appendChild(el);
1305};
1306
1307// This gets called when the user presses a mouse button anywhere in the
1308// document, if the calendar is shown.  If the click was outside the open
1309// calendar this function closes it.
1310Calendar._checkCalendar = function(ev) {
1311	var calendar = window._dynarch_popupCalendar;
1312	if (!calendar) {
1313		return false;
1314	}
1315	var el = Calendar.is_ie ? Calendar.getElement(ev) : Calendar.getTargetElement(ev);
1316	for (; el != null && el != calendar.element; el = el.parentNode);
1317	if (el == null) {
1318		// calls closeHandler which should hide the calendar.
1319		window._dynarch_popupCalendar.callCloseHandler();
1320		return Calendar.stopEvent(ev);
1321	}
1322};
1323
1324/** Shows the calendar. */
1325Calendar.prototype.show = function () {
1326	var rows = this.table.getElementsByTagName("tr");
1327	for (var i = rows.length; i > 0;) {
1328		var row = rows[--i];
1329		Calendar.removeClass(row, "rowhilite");
1330		var cells = row.getElementsByTagName("td");
1331		for (var j = cells.length; j > 0;) {
1332			var cell = cells[--j];
1333			Calendar.removeClass(cell, "hilite");
1334			Calendar.removeClass(cell, "active");
1335		}
1336	}
1337	this.element.style.display = "block";
1338	this.hidden = false;
1339	if (this.isPopup) {
1340		window._dynarch_popupCalendar = this;
1341		Calendar.addEvent(document, "keydown", Calendar._keyEvent);
1342		Calendar.addEvent(document, "keypress", Calendar._keyEvent);
1343		Calendar.addEvent(document, "mousedown", Calendar._checkCalendar);
1344	}
1345	this.hideShowCovered();
1346};
1347
1348/**
1349 *  Hides the calendar.  Also removes any "hilite" from the class of any TD
1350 *  element.
1351 */
1352Calendar.prototype.hide = function () {
1353	if (this.isPopup) {
1354		Calendar.removeEvent(document, "keydown", Calendar._keyEvent);
1355		Calendar.removeEvent(document, "keypress", Calendar._keyEvent);
1356		Calendar.removeEvent(document, "mousedown", Calendar._checkCalendar);
1357	}
1358	this.element.style.display = "none";
1359	this.hidden = true;
1360	this.hideShowCovered();
1361};
1362
1363/**
1364 *  Shows the calendar at a given absolute position (beware that, depending on
1365 *  the calendar element style -- position property -- this might be relative
1366 *  to the parent's containing rectangle).
1367 */
1368Calendar.prototype.showAt = function (x, y) {
1369	var s = this.element.style;
1370	s.left = x + "px";
1371	s.top = y + "px";
1372	this.show();
1373};
1374
1375/** Shows the calendar near a given element. */
1376Calendar.prototype.showAtElement = function (el, opts) {
1377	var self = this;
1378	var p = Calendar.getAbsolutePos(el);
1379	if (!opts || typeof opts != "string") {
1380		this.showAt(p.x, p.y + el.offsetHeight);
1381		return true;
1382	}
1383	function fixPosition(box) {
1384		if (box.x < 0)
1385			box.x = 0;
1386		if (box.y < 0)
1387			box.y = 0;
1388		var cp = document.createElement("div");
1389		var s = cp.style;
1390		s.position = "absolute";
1391		s.right = s.bottom = s.width = s.height = "0px";
1392		document.body.appendChild(cp);
1393		var br = Calendar.getAbsolutePos(cp);
1394		document.body.removeChild(cp);
1395		if (Calendar.is_ie) {
1396			//br.y += document.body.scrollTop;
1397			//br.x += document.body.scrollLeft;
1398			if (document.body.scrollLeft){br.x += document.body.scrollLeft;}
1399            br.x += window.scrollX;
1400            if (document.body.scrollTop){br.y += document.body.scrollTop;}
1401            br.y += window.scrollY;
1402		} else {
1403			br.y += window.scrollY;
1404			br.x += window.scrollX;
1405		}
1406		var tmp = box.x + box.width - br.x;
1407		if (tmp > 0) box.x -= tmp;
1408		tmp = box.y + box.height - br.y;
1409		if (tmp > 0) box.y -= tmp;
1410	};
1411	this.element.style.display = "block";
1412	Calendar.continuation_for_the_fucking_khtml_browser = function() {
1413		var w = self.element.offsetWidth;
1414		var h = self.element.offsetHeight;
1415		self.element.style.display = "none";
1416		var valign = opts.substr(0, 1);
1417		var halign = "l";
1418		if (opts.length > 1) {
1419			halign = opts.substr(1, 1);
1420		}
1421		// vertical alignment
1422		switch (valign) {
1423		    case "T": p.y -= h; break;
1424		    case "B": p.y += el.offsetHeight; break;
1425		    case "C": p.y += (el.offsetHeight - h) / 2; break;
1426		    case "t": p.y += el.offsetHeight - h; break;
1427		    case "b": break; // already there
1428		}
1429		// horizontal alignment
1430		switch (halign) {
1431		    case "L": p.x -= w; break;
1432		    case "R": p.x += el.offsetWidth; break;
1433		    case "C": p.x += (el.offsetWidth - w) / 2; break;
1434		    case "l": p.x += el.offsetWidth - w; break;
1435		    case "r": break; // already there
1436		}
1437		p.width = w;
1438		p.height = h + 40;
1439		self.monthsCombo.style.display = "none";
1440		fixPosition(p);
1441		self.showAt(p.x, p.y);
1442	};
1443	if (Calendar.is_khtml)
1444		setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()", 10);
1445	else
1446		Calendar.continuation_for_the_fucking_khtml_browser();
1447};
1448
1449/** Customizes the date format. */
1450Calendar.prototype.setDateFormat = function (str) {
1451	this.dateFormat = str;
1452};
1453
1454/** Customizes the tooltip date format. */
1455Calendar.prototype.setTtDateFormat = function (str) {
1456	this.ttDateFormat = str;
1457};
1458
1459/**
1460 *  Tries to identify the date represented in a string.  If successful it also
1461 *  calls this.setDate which moves the calendar to the given date.
1462 */
1463Calendar.prototype.parseDate = function(str, fmt) {
1464	if (!fmt)
1465		fmt = this.dateFormat;
1466	this.setDate(Date.parseDate(str, fmt));
1467};
1468
1469Calendar.prototype.hideShowCovered = function () {
1470	if (!Calendar.is_ie && !Calendar.is_opera)
1471		return;
1472	function getVisib(obj){
1473		var value = obj.style.visibility;
1474		if (!value) {
1475			if (document.defaultView && typeof (document.defaultView.getComputedStyle) == "function") { // Gecko, W3C
1476				if (!Calendar.is_khtml)
1477					value = document.defaultView.
1478						getComputedStyle(obj, "").getPropertyValue("visibility");
1479				else
1480					value = '';
1481			} else if (obj.currentStyle) { // IE
1482				value = obj.currentStyle.visibility;
1483			} else
1484				value = '';
1485		}
1486		return value;
1487	};
1488
1489	var tags = new Array("applet", "iframe", "select");
1490	var el = this.element;
1491
1492	var p = Calendar.getAbsolutePos(el);
1493	var EX1 = p.x;
1494	var EX2 = el.offsetWidth + EX1;
1495	var EY1 = p.y;
1496	var EY2 = el.offsetHeight + EY1;
1497
1498	for (var k = tags.length; k > 0; ) {
1499		var ar = document.getElementsByTagName(tags[--k]);
1500		var cc = null;
1501
1502		for (var i = ar.length; i > 0;) {
1503			cc = ar[--i];
1504
1505			p = Calendar.getAbsolutePos(cc);
1506			var CX1 = p.x;
1507			var CX2 = cc.offsetWidth + CX1;
1508			var CY1 = p.y;
1509			var CY2 = cc.offsetHeight + CY1;
1510
1511			if (this.hidden || (CX1 > EX2) || (CX2 < EX1) || (CY1 > EY2) || (CY2 < EY1)) {
1512				if (!cc.__msh_save_visibility) {
1513					cc.__msh_save_visibility = getVisib(cc);
1514				}
1515				cc.style.visibility = cc.__msh_save_visibility;
1516			} else {
1517				if (!cc.__msh_save_visibility) {
1518					cc.__msh_save_visibility = getVisib(cc);
1519				}
1520				cc.style.visibility = "hidden";
1521			}
1522		}
1523	}
1524};
1525
1526/** Internal function; it displays the bar with the names of the weekday. */
1527Calendar.prototype._displayWeekdays = function () {
1528	var fdow = this.firstDayOfWeek;
1529	var cell = this.firstdayname;
1530	var weekend = Calendar._TT["WEEKEND"];
1531	for (var i = 0; i < 7; ++i) {
1532		cell.className = "day nameCal";
1533		var realday = (i + fdow) % 7;
1534		if (i) {
1535			cell.ttip = Calendar._TT["DAY_FIRST"].replace("%s", Calendar._DN[realday]);
1536			cell.navtype = 100;
1537			cell.calendar = this;
1538			cell.fdow = realday;
1539			Calendar._add_evs(cell);
1540		}
1541		if (weekend.indexOf(realday.toString()) != -1) {
1542			Calendar.addClass(cell, "weekend");
1543		}
1544		cell.innerHTML = Calendar._SDN[(i + fdow) % 7];
1545		cell = cell.nextSibling;
1546	}
1547};
1548
1549/** Internal function.  Hides all combo boxes that might be displayed. */
1550Calendar.prototype._hideCombos = function () {
1551	this.monthsCombo.style.display = "none";
1552	this.yearsCombo.style.display = "none";
1553};
1554
1555/** Internal function.  Starts dragging the element. */
1556Calendar.prototype._dragStart = function (ev) {
1557	if (this.dragging) {
1558		return;
1559	}
1560	this.dragging = true;
1561	var posX;
1562	var posY;
1563	if (Calendar.is_ie) {
1564		posY = window.event.clientY + document.body.scrollTop;
1565		posX = window.event.clientX + document.body.scrollLeft;
1566	} else {
1567		posY = ev.clientY + window.scrollY;
1568		posX = ev.clientX + window.scrollX;
1569	}
1570	var st = this.element.style;
1571	this.xOffs = posX - parseInt(st.left);
1572	this.yOffs = posY - parseInt(st.top);
1573	with (Calendar) {
1574		addEvent(document, "mousemove", calDragIt);
1575		addEvent(document, "mouseup", calDragEnd);
1576	}
1577};
1578
1579// BEGIN: DATE OBJECT PATCHES
1580
1581/** Adds the number of days array to the Date object. */
1582Date._MD = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
1583
1584/** Constants used for time computations */
1585Date.SECOND = 1000 /* milliseconds */;
1586Date.MINUTE = 60 * Date.SECOND;
1587Date.HOUR   = 60 * Date.MINUTE;
1588Date.DAY    = 24 * Date.HOUR;
1589Date.WEEK   =  7 * Date.DAY;
1590
1591Date.parseDate = function(str, fmt) {
1592	var today = new Date();
1593	var y = 0;
1594	var m = -1;
1595	var d = 0;
1596	var a = str.split(/\W+/);
1597	var b = fmt.match(/%./g);
1598	var i = 0, j = 0;
1599	var hr = 0;
1600	var min = 0;
1601	for (i = 0; i < a.length; ++i) {
1602		if (!a[i])
1603			continue;
1604		switch (b[i]) {
1605		    case "%d":
1606		    case "%e":
1607			d = parseInt(a[i], 10);
1608			break;
1609
1610		    case "%m":
1611			m = parseInt(a[i], 10) - 1;
1612			break;
1613
1614		    case "%Y":
1615		    case "%y":
1616			y = parseInt(a[i], 10);
1617			(y < 100) && (y += (y > 29) ? 1900 : 2000);
1618			break;
1619
1620		    case "%b":
1621		    case "%B":
1622			for (j = 0; j < 12; ++j) {
1623				if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { m = j; break; }
1624			}
1625			break;
1626
1627		    case "%H":
1628		    case "%I":
1629		    case "%k":
1630		    case "%l":
1631			hr = parseInt(a[i], 10);
1632			break;
1633
1634		    case "%P":
1635		    case "%p":
1636			if (/pm/i.test(a[i]) && hr < 12)
1637				hr += 12;
1638			else if (/am/i.test(a[i]) && hr >= 12)
1639				hr -= 12;
1640			break;
1641
1642		    case "%M":
1643			min = parseInt(a[i], 10);
1644			break;
1645		}
1646	}
1647	if (isNaN(y)) y = today.getFullYear();
1648	if (isNaN(m)) m = today.getMonth();
1649	if (isNaN(d)) d = today.getDate();
1650	if (isNaN(hr)) hr = today.getHours();
1651	if (isNaN(min)) min = today.getMinutes();
1652	if (y != 0 && m != -1 && d != 0)
1653		return new Date(y, m, d, hr, min, 0);
1654	y = 0; m = -1; d = 0;
1655	for (i = 0; i < a.length; ++i) {
1656		if (a[i].search(/[a-zA-Z]+/) != -1) {
1657			var t = -1;
1658			for (j = 0; j < 12; ++j) {
1659				if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { t = j; break; }
1660			}
1661			if (t != -1) {
1662				if (m != -1) {
1663					d = m+1;
1664				}
1665				m = t;
1666			}
1667		} else if (parseInt(a[i], 10) <= 12 && m == -1) {
1668			m = a[i]-1;
1669		} else if (parseInt(a[i], 10) > 31 && y == 0) {
1670			y = parseInt(a[i], 10);
1671			(y < 100) && (y += (y > 29) ? 1900 : 2000);
1672		} else if (d == 0) {
1673			d = a[i];
1674		}
1675	}
1676	if (y == 0)
1677		y = today.getFullYear();
1678	if (m != -1 && d != 0)
1679		return new Date(y, m, d, hr, min, 0);
1680	return today;
1681};
1682
1683/** Returns the number of days in the current month */
1684Date.prototype.getMonthDays = function(month) {
1685	var year = this.getFullYear();
1686	if (typeof month == "undefined") {
1687		month = this.getMonth();
1688	}
1689	if (((0 == (year%4)) && ( (0 != (year%100)) || (0 == (year%400)))) && month == 1) {
1690		return 29;
1691	} else {
1692		return Date._MD[month];
1693	}
1694};
1695
1696/** Returns the number of day in the year. */
1697Date.prototype.getDayOfYear = function() {
1698	var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
1699	var then = new Date(this.getFullYear(), 0, 0, 0, 0, 0);
1700	var time = now - then;
1701	return Math.floor(time / Date.DAY);
1702};
1703
1704/** Returns the number of the week in year, as defined in ISO 8601. */
1705Date.prototype.getWeekNumber = function() {
1706	var d = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
1707	var DoW = d.getDay();
1708	d.setDate(d.getDate() - (DoW + 6) % 7 + 3); // Nearest Thu
1709	var ms = d.valueOf(); // GMT
1710	d.setMonth(0);
1711	d.setDate(4); // Thu in Week 1
1712	return Math.round((ms - d.valueOf()) / (7 * 864e5)) + 1;
1713};
1714
1715/** Checks date and time equality */
1716Date.prototype.equalsTo = function(date) {
1717	return ((this.getFullYear() == date.getFullYear()) &&
1718		(this.getMonth() == date.getMonth()) &&
1719		(this.getDate() == date.getDate()) &&
1720		(this.getHours() == date.getHours()) &&
1721		(this.getMinutes() == date.getMinutes()));
1722};
1723
1724/** Set only the year, month, date parts (keep existing time) */
1725Date.prototype.setDateOnly = function(date) {
1726	var tmp = new Date(date);
1727	this.setDate(1);
1728	this.setFullYear(tmp.getFullYear());
1729	this.setMonth(tmp.getMonth());
1730	this.setDate(tmp.getDate());
1731};
1732
1733/** Prints the date in a string according to the given format. */
1734Date.prototype.print = function (str) {
1735	var m = this.getMonth();
1736	var d = this.getDate();
1737	var y = this.getFullYear();
1738	var wn = this.getWeekNumber();
1739	var w = this.getDay();
1740	var s = {};
1741	var hr = this.getHours();
1742	var pm = (hr >= 12);
1743	var ir = (pm) ? (hr - 12) : hr;
1744	var dy = this.getDayOfYear();
1745	if (ir == 0)
1746		ir = 12;
1747	var min = this.getMinutes();
1748	var sec = this.getSeconds();
1749	s["%a"] = Calendar._SDN[w]; // abbreviated weekday name [FIXME: I18N]
1750	s["%A"] = Calendar._DN[w]; // full weekday name
1751	s["%b"] = Calendar._SMN[m]; // abbreviated month name [FIXME: I18N]
1752	s["%B"] = Calendar._MN[m]; // full month name
1753	// FIXME: %c : preferred date and time representation for the current locale
1754	s["%C"] = 1 + Math.floor(y / 100); // the century number
1755	s["%d"] = (d < 10) ? ("0" + d) : d; // the day of the month (range 01 to 31)
1756	s["%e"] = d; // the day of the month (range 1 to 31)
1757	// FIXME: %D : american date style: %m/%d/%y
1758	// FIXME: %E, %F, %G, %g, %h (man strftime)
1759	s["%H"] = (hr < 10) ? ("0" + hr) : hr; // hour, range 00 to 23 (24h format)
1760	s["%I"] = (ir < 10) ? ("0" + ir) : ir; // hour, range 01 to 12 (12h format)
1761	s["%j"] = (dy < 100) ? ((dy < 10) ? ("00" + dy) : ("0" + dy)) : dy; // day of the year (range 001 to 366)
1762	s["%k"] = hr;		// hour, range 0 to 23 (24h format)
1763	s["%l"] = ir;		// hour, range 1 to 12 (12h format)
1764	s["%m"] = (m < 9) ? ("0" + (1+m)) : (1+m); // month, range 01 to 12
1765	s["%M"] = (min < 10) ? ("0" + min) : min; // minute, range 00 to 59
1766	s["%n"] = "\n";		// a newline character
1767	s["%p"] = pm ? "PM" : "AM";
1768	s["%P"] = pm ? "pm" : "am";
1769	// FIXME: %r : the time in am/pm notation %I:%M:%S %p
1770	// FIXME: %R : the time in 24-hour notation %H:%M
1771	s["%s"] = Math.floor(this.getTime() / 1000);
1772	s["%S"] = (sec < 10) ? ("0" + sec) : sec; // seconds, range 00 to 59
1773	s["%t"] = "\t";		// a tab character
1774	// FIXME: %T : the time in 24-hour notation (%H:%M:%S)
1775	s["%U"] = s["%W"] = s["%V"] = (wn < 10) ? ("0" + wn) : wn;
1776	s["%u"] = w + 1;	// the day of the week (range 1 to 7, 1 = MON)
1777	s["%w"] = w;		// the day of the week (range 0 to 6, 0 = SUN)
1778	// FIXME: %x : preferred date representation for the current locale without the time
1779	// FIXME: %X : preferred time representation for the current locale without the date
1780	s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99)
1781	s["%Y"] = y;		// year with the century
1782	s["%%"] = "%";		// a literal '%' character
1783
1784	var re = /%./g;
1785	if (!Calendar.is_ie5 && !Calendar.is_khtml)
1786		return str.replace(re, function (par) { return s[par] || par; });
1787
1788	var a = str.match(re);
1789	for (var i = 0; i < a.length; i++) {
1790		var tmp = s[a[i]];
1791		if (tmp) {
1792			re = new RegExp(a[i], 'g');
1793			str = str.replace(re, tmp);
1794		}
1795	}
1796
1797	return str;
1798};
1799
1800Date.prototype.__msh_oldSetFullYear = Date.prototype.setFullYear;
1801Date.prototype.setFullYear = function(y) {
1802	var d = new Date(this);
1803	d.__msh_oldSetFullYear(y);
1804	if (d.getMonth() != this.getMonth())
1805		this.setDate(28);
1806	this.__msh_oldSetFullYear(y);
1807};
1808
1809// END: DATE OBJECT PATCHES
1810
1811
1812// global object that remembers the calendar
1813window._dynarch_popupCalendar = null;
1814
1815
1816// ** I18N
1817Calendar._DN  = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday');
1818Calendar._SDN = new Array('Su','Mo','Tu','We','Th','Fr','Sa','Su');// First day of the week. "0" means display Sunday first, "1" means display
1819
1820// Monday first, etc.
1821
1822Calendar._FD = 0;
1823Calendar._MN  = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
1824Calendar._SMN = new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
1825
1826// tooltips
1827Calendar._TT = {};
1828Calendar._TT["INFO"] = "About the calendar";
1829Calendar._TT["TOGGLE"] = "Change the first day of the week";
1830Calendar._TT["PREV_YEAR"] = "Prev. year (hold for menu)";
1831Calendar._TT["PREV_MONTH"] = "Prev. month (hold for menu)";
1832Calendar._TT["GO_TODAY"] = "Go Today";
1833Calendar._TT["NEXT_MONTH"] = "Next month (hold for menu)";
1834Calendar._TT["NEXT_YEAR"] = "Next year (hold for menu)";
1835Calendar._TT["SEL_DATE"] = "Select date";
1836Calendar._TT["DRAG_TO_MOVE"] = "Drag to move";
1837Calendar._TT["PART_TODAY"] = " (today)";
1838Calendar._TT["MON_FIRST"] = "Show the first Monday of";
1839//Calendar._TT["SUN_FIRST"] = "Show the first Sunday of";
1840
1841Calendar._TT["ABOUT"] =
1842"DHTML Date/Time Selector\n" +
1843"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
1844"For latest version visit: http://www.dynarch.com/projects/calendar/\n" +
1845"Distributed under GNU LGPL.  See http://gnu.org/licenses/lgpl.html for details." +
1846"\n\n" +
1847"Date selection:\n" +
1848"- Use the \xab, \xbb  buttons to select year\n" +
1849"- Use the " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " buttons to select month\n" +
1850"- Hold mouse button on any of the above buttons for faster selection.";
1851
1852Calendar._TT["ABOUT_TIME"] = "\n\n" +
1853"Time selection:\n" +
1854"- Click on any of the time parts to increase it.\n" +
1855"- or Shift-click to decrease it\n" +
1856"- or click and drag for faster selection.";
1857
1858// the following is to inform that "%s" is to be the first day of week
1859// %s will be replaced with the day name.
1860Calendar._TT["DAY_FIRST"] = "Display %s first";
1861
1862// This may be locale-dependent.  It specifies the week-end days, as an array
1863// of comma-separated numbers.  The numbers are from 0 to 6: 0 means Sunday, 1
1864// means Monday, etc.
1865Calendar._TT["WEEKEND"] = "0,6";
1866
1867Calendar._TT["CLOSE"] = "Close";
1868Calendar._TT["TODAY"] = "Today";
1869Calendar._TT["TIME_PART"] = "(Shift-)Click or drag to change value";
1870
1871// date formats
1872Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d";
1873Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e";
1874
1875Calendar._TT["WK"] = "wk";
1876Calendar._TT["TIME"] = "Time:";
1877
1878/*  Copyright Mihai Bazon, 2002, 2003  |  http://dynarch.com/mishoo/
1879 * ---------------------------------------------------------------------------
1880 *
1881 * The DHTML Calendar
1882 *
1883 * Details and latest version at:
1884 * http://dynarch.com/mishoo/calendar.epl
1885 *
1886 * This script is distributed under the GNU Lesser General Public License.
1887 * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html
1888 *
1889 * This file defines helper functions for setting up the calendar.  They are
1890 * intended to help non-programmers get a working calendar on their site
1891 * quickly.  This script should not be seen as part of the calendar.  It just
1892 * shows you what one can do with the calendar, while in the same time
1893 * providing a quick and simple method for setting it up.  If you need
1894 * exhaustive customization of the calendar creation process feel free to
1895 * modify this code to suit your needs (this is recommended and much better
1896 * than modifying calendar.js itself).
1897 */
1898
1899// $Id: calendar-setup.js,v 1.25 2005/03/07 09:51:33 mishoo Exp $
1900
1901/**
1902 *  This function "patches" an input field (or other element) to use a calendar
1903 *  widget for date selection.
1904 *
1905 *  The "params" is a single object that can have the following properties:
1906 *
1907 *    prop. name   | description
1908 *  -------------------------------------------------------------------------------------------------
1909 *   inputField    | the ID of an input field to store the date
1910 *   displayArea   | the ID of a DIV or other element to show the date
1911 *   button        | ID of a button or other element that will trigger the calendar
1912 *   eventName     | event that will trigger the calendar, without the "on" prefix (default: "click")
1913 *   ifFormat      | date format that will be stored in the input field
1914 *   daFormat      | the date format that will be used to display the date in displayArea
1915 *   singleClick   | (true/false) wether the calendar is in single click mode or not (default: true)
1916 *   firstDay      | numeric: 0 to 6.  "0" means display Sunday first, "1" means display Monday first, etc.
1917 *   align         | alignment (default: "Br"); if you don't know what's this see the calendar documentation
1918 *   range         | array with 2 elements.  Default: [1900, 2999] -- the range of years available
1919 *   weekNumbers   | (true/false) if it's true (default) the calendar will display week numbers
1920 *   flat          | null or element ID; if not null the calendar will be a flat calendar having the parent with the given ID
1921 *   flatCallback  | function that receives a JS Date object and returns an URL to point the browser to (for flat calendar)
1922 *   disableFunc   | function that receives a JS Date object and should return true if that date has to be disabled in the calendar
1923 *   onSelect      | function that gets called when a date is selected.  You don't _have_ to supply this (the default is generally okay)
1924 *   onClose       | function that gets called when the calendar is closed.  [default]
1925 *   onUpdate      | function that gets called after the date is updated in the input field.  Receives a reference to the calendar.
1926 *   date          | the date that the calendar will be initially displayed to
1927 *   showsTime     | default: false; if true the calendar will include a time selector
1928 *   timeFormat    | the time format; can be "12" or "24", default is "12"
1929 *   electric      | if true (default) then given fields/date areas are updated for each move; otherwise they're updated only on close
1930 *   step          | configures the step of the years in drop-down boxes; default: 2
1931 *   position      | configures the calendar absolute position; default: null
1932 *   cache         | if "true" (but default: "false") it will reuse the same calendar object, where possible
1933 *   showOthers    | if "true" (but default: "false") it will show days from other months too
1934 *
1935 *  None of them is required, they all have default values.  However, if you
1936 *  pass none of "inputField", "displayArea" or "button" you'll get a warning
1937 *  saying "nothing to setup".
1938 */
1939
1940 /* �E�TINA windows 1250 - �������̊�؎���� */
1941Calendar.setup = function (params) {
1942	function param_default(pname, def) { if (typeof params[pname] == "undefined") { params[pname] = def; } };
1943
1944	param_default("inputField",     null);
1945	param_default("displayArea",    null);
1946	param_default("button",         null);
1947	param_default("eventName",      "click");
1948	param_default("ifFormat",       "%Y/%m/%d");
1949	param_default("daFormat",       "%Y/%m/%d");
1950	param_default("singleClick",    true);
1951	param_default("disableFunc",    null);
1952	param_default("dateStatusFunc", params["disableFunc"]);	// takes precedence if both are defined
1953	param_default("dateText",       null);
1954	param_default("firstDay",       null);
1955	param_default("align",          "Br");
1956	param_default("range",          [1900, 2999]);
1957	param_default("weekNumbers",    true);
1958	param_default("flat",           null);
1959	param_default("flatCallback",   null);
1960	param_default("onSelect",       null);
1961	param_default("onClose",        null);
1962	param_default("onUpdate",       null);
1963	param_default("date",           null);
1964	param_default("showsTime",      false);
1965	param_default("timeFormat",     "24");
1966	param_default("electric",       true);
1967	param_default("step",           2);
1968	param_default("position",       null);
1969	param_default("cache",          false);
1970	param_default("showOthers",     false);
1971	param_default("multiple",       null);
1972
1973	var tmp = ["inputField", "displayArea", "button"];
1974	for (var i in tmp) {
1975		if (typeof params[tmp[i]] == "string") {
1976			params[tmp[i]] = document.getElementById(params[tmp[i]]);
1977		}
1978	}
1979	if (!(params.flat || params.multiple || params.inputField || params.displayArea || params.button)) {
1980		alert("Calendar.setup:\n  Nothing to setup (no fields found).  Please check your code");
1981		return false;
1982	}
1983
1984	function onSelect(cal) {
1985		var p = cal.params;
1986		var update = (cal.dateClicked || p.electric);
1987		if (update && p.inputField) {
1988			p.inputField.value = cal.date.print(p.ifFormat);
1989			if (typeof p.inputField.onchange == "function")
1990				p.inputField.onchange();
1991		}
1992		if (update && p.displayArea)
1993			p.displayArea.innerHTML = cal.date.print(p.daFormat);
1994		if (update && typeof p.onUpdate == "function")
1995			p.onUpdate(cal);
1996		if (update && p.flat) {
1997			if (typeof p.flatCallback == "function")
1998				p.flatCallback(cal);
1999		}
2000		if (update && p.singleClick && cal.dateClicked)
2001			cal.callCloseHandler();
2002	};
2003
2004	if (params.flat != null) {
2005		if (typeof params.flat == "string")
2006			params.flat = document.getElementById(params.flat);
2007		if (!params.flat) {
2008			alert("Calendar.setup:\n  Flat specified but can't find parent.");
2009			return false;
2010		}
2011		var cal = new Calendar(params.firstDay, params.date, params.onSelect || onSelect);
2012		cal.showsOtherMonths = params.showOthers;
2013		cal.showsTime = params.showsTime;
2014		cal.time24 = (params.timeFormat == "24");
2015		cal.params = params;
2016		cal.weekNumbers = params.weekNumbers;
2017		cal.setRange(params.range[0], params.range[1]);
2018		cal.setDateStatusHandler(params.dateStatusFunc);
2019		cal.getDateText = params.dateText;
2020		if (params.ifFormat) {
2021			cal.setDateFormat(params.ifFormat);
2022		}
2023		if (params.inputField && typeof params.inputField.value == "string") {
2024			cal.parseDate(params.inputField.value);
2025		}
2026		cal.create(params.flat);
2027		cal.show();
2028		return false;
2029	}
2030
2031	var triggerEl = params.button || params.displayArea || params.inputField;
2032	triggerEl["on" + params.eventName] = function() {
2033		var dateEl = params.inputField || params.displayArea;
2034		var dateFmt = params.inputField ? params.ifFormat : params.daFormat;
2035		var mustCreate = false;
2036		var cal = window.calendar;
2037		if (dateEl)
2038			params.date = Date.parseDate(dateEl.value || dateEl.innerHTML, dateFmt);
2039		if (!(cal && params.cache)) {
2040			window.calendar = cal = new Calendar(params.firstDay,
2041							     params.date,
2042							     params.onSelect || onSelect,
2043							     params.onClose || function(cal) { cal.hide(); });
2044			cal.showsTime = params.showsTime;
2045			cal.time24 = (params.timeFormat == "24");
2046			cal.weekNumbers = params.weekNumbers;
2047			mustCreate = true;
2048		} else {
2049			if (params.date)
2050				cal.setDate(params.date);
2051			cal.hide();
2052		}
2053		if (params.multiple) {
2054			cal.multiple = {};
2055			for (var i = params.multiple.length; --i >= 0;) {
2056				var d = params.multiple[i];
2057				var ds = d.print("%Y%m%d");
2058				cal.multiple[ds] = d;
2059			}
2060		}
2061		cal.showsOtherMonths = params.showOthers;
2062		cal.yearStep = params.step;
2063		cal.setRange(params.range[0], params.range[1]);
2064		cal.params = params;
2065		cal.setDateStatusHandler(params.dateStatusFunc);
2066		cal.getDateText = params.dateText;
2067		cal.setDateFormat(dateFmt);
2068		if (mustCreate)
2069			cal.create();
2070		cal.refresh();
2071		if (!params.position)
2072			cal.showAtElement(params.button || params.displayArea || params.inputField, params.align);
2073		else
2074			cal.showAt(params.position[0], params.position[1]);
2075		return false;
2076	};
2077
2078	return cal;
2079};
2080
2081//***********************************************************************************************************************************/
2082//	LyteBox v3.22
2083//
2084//	 Author: Markus F. Hay
2085//  Website: http://www.dolem.com/lytebox
2086//	   Date: October 2, 2007
2087//	License: Creative Commons Attribution 3.0 License (http://creativecommons.org/licenses/by/3.0/)
2088// Browsers: Tested successfully on WinXP with the following browsers (using no DOCTYPE and Strict/Transitional/Loose DOCTYPES):
2089//				* Firefox: 2.0.0.7, 1.5.0.12
2090//				* Internet Explorer: 7.0, 6.0 SP2, 5.5 SP2
2091//				* Opera: 9.23
2092//
2093// Releases: For up-to-date and complete release information, visit http://www.dolem.com/forum/showthread.php?tid=62
2094//				* v3.22 (10/02/07)
2095//				* v3.21 (09/30/07)
2096//				* v3.20 (07/12/07)
2097//				* v3.10 (05/28/07)
2098//				* v3.00 (05/15/07)
2099//				* v2.02 (11/13/06)
2100//
2101//   Credit: LyteBox was originally derived from the Lightbox class (v2.02) that was written by Lokesh Dhakar. For more
2102//			 information please visit http://huddletogether.com/projects/lightbox2/
2103//***********************************************************************************************************************************/
2104Array.prototype.removeDuplicates = function () { for (var i = 1; i < this.length; i++) { if (this[i][0] == this[i-1][0]) { this.splice(i,1); } } }
2105Array.prototype.empty = function () { for (var i = 0; i <= this.length; i++) { this.shift(); } }
2106String.prototype.trim = function () { return this.replace(/^\s+|\s+$/g, ''); }
2107
2108function LyteBox() {
2109	/*** Start Global Configuration ***/
2110		this.theme				= 'grey';	// themes: grey (default), red, green, blue, gold
2111		this.hideFlash			= true;		// controls whether or not Flash objects should be hidden
2112		this.outerBorder		= true;		// controls whether to show the outer grey (or theme) border
2113		this.resizeSpeed		= 8;		// controls the speed of the image resizing (1=slowest and 10=fastest)
2114		this.maxOpacity			= 80;		// higher opacity = darker overlay, lower opacity = lighter overlay
2115		this.navType			= 1;		// 1 = "Prev/Next" buttons on top left and left (default), 2 = "<< prev | next >>
2115" links next to image number
2116		this.autoResize			= true;		// controls whether or not images should be resized if larger than the browser window dimensions
2117		this.doAnimations		= true;		// controls whether or not "animate" Lytebox, i.e. resize transition between images, fade in/out effects, etc.
2118
2119		this.borderSize			= 12;		// if you adjust the padding in the CSS, you will need to update this variable -- otherwise, leave this alone...
2120	/*** End Global Configuration ***/
2121
2122	/*** Configure Slideshow Options ***/
2123		this.slideInterval		= 4000;		// Change value (milliseconds) to increase/decrease the time between "slides" (10000 = 10 seconds)
2124		this.showNavigation		= true;		// true to display Next/Prev buttons/text during slideshow, false to hide
2125		this.showClose			= true;		// true to display the Close button, false to hide
2126		this.showDetails		= true;		// true to display image details (caption, count), false to hide
2127		this.showPlayPause		= true;		// true to display pause/play buttons next to close button, false to hide
2128		this.autoEnd			= true;		// true to automatically close Lytebox after the last image is reached, false to keep open
2129		this.pauseOnNextClick	= false;	// true to pause the slideshow when the "Next" button is clicked
2130        this.pauseOnPrevClick 	= true;		// true to pause the slideshow when the "Prev" button is clicked
2131	/*** End Slideshow Configuration ***/
2132
2133	if(this.resizeSpeed > 10) { this.resizeSpeed = 10; }
2134	if(this.resizeSpeed < 1) { resizeSpeed = 1; }
2135	this.resizeDuration = (11 - this.resizeSpeed) * 0.15;
2136	this.resizeWTimerArray		= new Array();
2137	this.resizeWTimerCount		= 0;
2138	this.resizeHTimerArray		= new Array();
2139	this.resizeHTimerCount		= 0;
2140	this.showContentTimerArray	= new Array();
2141	this.showContentTimerCount	= 0;
2142	this.overlayTimerArray		= new Array();
2143	this.overlayTimerCount		= 0;
2144	this.imageTimerArray		= new Array();
2145	this.imageTimerCount		= 0;
2146	this.timerIDArray			= new Array();
2147	this.timerIDCount			= 0;
2148	this.slideshowIDArray		= new Array();
2149	this.slideshowIDCount		= 0;
2150	this.imageArray	 = new Array();
2151	this.activeImage = null;
2152	this.slideArray	 = new Array();
2153	this.activeSlide = null;
2154	this.frameArray	 = new Array();
2155	this.activeFrame = null;
2156	this.checkFrame();
2157	this.isSlideshow = false;
2158	this.isLyteframe = false;
2159	/*@cc_on
2160		/*@if (@_jscript)
2161			this.ie = (document.all && !window.opera) ? true : false;
2162		/*@else @*/
2163			this.ie = false;
2164		/*@end
2165	@*/
2166	this.ie7 = (this.ie && window.XMLHttpRequest);
2167	this.initialize();
2168}
2169LyteBox.prototype.initialize = function() {
2170	this.updateLyteboxItems();
2171	var objBody = this.doc.getElementsByTagName("body").item(0);
2172	if (this.doc.getElementById('lbOverlay')) {
2173		objBody.removeChild(this.doc.getElementById("lbOverlay"));
2174		objBody.removeChild(this.doc.getElementById("lbMain"));
2175	}
2176	var objOverlay = this.doc.createElement("div");
2177		objOverlay.setAttribute('id','lbOverlay');
2178		objOverlay.setAttribute((this.ie ? 'className' : 'class'), this.theme);
2179		if ((this.ie && !this.ie7) || (this.ie7 && this.doc.compatMode == 'BackCompat')) {
2180			objOverlay.style.position = 'absolute';
2181		}
2182		objOverlay.style.display = 'none';
2183		objBody.appendChild(objOverlay);
2184	var objLytebox = this.doc.createElement("div");
2185		objLytebox.setAttribute('id','lbMain');
2186		objLytebox.style.display = 'none';
2187		objBody.appendChild(objLytebox);
2188	var objOuterContainer = this.doc.createElement("div");
2189		objOuterContainer.setAttribute('id','lbOuterContainer');
2190		objOuterContainer.setAttribute((this.ie ? 'className' : 'class'), this.theme);
2191		objLytebox.appendChild(objOuterContainer);
2192	var objIframeContainer = this.doc.createElement("div");
2193		objIframeContainer.setAttribute('id','lbIframeContainer');
2194		objIframeContainer.style.display = 'none';
2195		objOuterContainer.appendChild(objIframeContainer);
2196	var objIframe = this.doc.createElement("iframe");
2197		objIframe.setAttribute('id','lbIframe');
2198		objIframe.setAttribute('name','lbIframe');
2199		objIframe.style.display = 'none';
2200		objIframeContainer.appendChild(objIframe);
2201	var objImageContainer = this.doc.createElement("div");
2202		objImageContainer.setAttribute('id','lbImageContainer');
2203		objOuterContainer.appendChild(objImageContainer);
2204	var objLyteboxImage = this.doc.createElement("img");
2205		objLyteboxImage.setAttribute('id','lbImage');
2206		objImageContainer.appendChild(objLyteboxImage);
2207	var objLoading = this.doc.createElement("div");
2208		objLoading.setAttribute('id','lbLoading');
2209		objOuterContainer.appendChild(objLoading);
2210	var objDetailsContainer = this.doc.createElement("div");
2211		objDetailsContainer.setAttribute('id','lbDetailsContainer');
2212		objDetailsContainer.setAttribute((this.ie ? 'className' : 'class'), this.theme);
2213		objLytebox.appendChild(objDetailsContainer);
2214	var objDetailsData =this.doc.createElement("div");
2215		objDetailsData.setAttribute('id','lbDetailsData');
2216		objDetailsData.setAttribute((this.ie ? 'className' : 'class'), this.theme);
2217		objDetailsContainer.appendChild(objDetailsData);
2218	var objDetails = this.doc.createElement("div");
2219		objDetails.setAttribute('id','lbDetails');
2220		objDetailsData.appendChild(objDetails);
2221	var objCaption = this.doc.createElement("span");
2222		objCaption.setAttribute('id','lbCaption');
2223		objDetails.appendChild(objCaption);
2224	var objHoverNav = this.doc.createElement("div");
2225		objHoverNav.setAttribute('id','lbHoverNav');
2226		objImageContainer.appendChild(objHoverNav);
2227	var objBottomNav = this.doc.createElement("div");
2228		objBottomNav.setAttribute('id','lbBottomNav');
2229		objDetailsData.appendChild(objBottomNav);
2230	var objPrev = this.doc.createElement("a");
2231		objPrev.setAttribute('id','lbPrev');
2232		objPrev.setAttribute((this.ie ? 'className' : 'class'), this.theme);
2233		objPrev.setAttribute('href','#');
2234		objHoverNav.appendChild(objPrev);
2235	var objNext = this.doc.createElement("a");
2236		objNext.setAttribute('id','lbNext');
2237		objNext.setAttribute((this.ie ? 'className' : 'class'), this.theme);
2238		objNext.setAttribute('href','#');
2239		objHoverNav.appendChild(objNext);
2240	var objNumberDisplay = this.doc.createElement("span");
2241		objNumberDisplay.setAttribute('id','lbNumberDisplay');
2242		objDetails.appendChild(objNumberDisplay);
2243	var objNavDisplay = this.doc.createElement("span");
2244		objNavDisplay.setAttribute('id','lbNavDisplay');
2245		objNavDisplay.style.display = 'none';
2246		objDetails.appendChild(objNavDisplay);
2247	var objClose = this.doc.createElement("a");
2248		objClose.setAttribute('id','lbClose');
2249		objClose.setAttribute((this.ie ? 'className' : 'class'), this.theme);
2250		objClose.setAttribute('href','#');
2251		objBottomNav.appendChild(objClose);
2252	var objPause = this.doc.createElement("a");
2253		objPause.setAttribute('id','lbPause');
2254		objPause.setAttribute((this.ie ? 'className' : 'class'), this.theme);
2255		objPause.setAttribute('href','#');
2256		objPause.style.display = 'none';
2257		objBottomNav.appendChild(objPause);
2258	var objPlay = this.doc.createElement("a");
2259		objPlay.setAttribute('id','lbPlay');
2260		objPlay.setAttribute((this.ie ? 'className' : 'class'), this.theme);
2261		objPlay.setAttribute('href','#');
2262		objPlay.style.display = 'none';
2263		objBottomNav.appendChild(objPlay);
2264};
2265LyteBox.prototype.updateLyteboxItems = function() {
2266	var anchors = (this.isFrame) ? window.parent.frames[window.name].document.getElementsByTagName('a') : document.getElementsByTagName('a');
2267	for (var i = 0; i < anchors.length; i++) {
2268		var anchor = anchors[i];
2269		var relAttribute = String(anchor.getAttribute('rel'));
2270		if (anchor.getAttribute('href')) {
2271			if (relAttribute.toLowerCase().match('lytebox')) {
2272				anchor.onclick = function () { myLytebox.start(this, false, false); return false; }
2273			} else if (relAttribute.toLowerCase().match('lyteshow')) {
2274				anchor.onclick = function () { myLytebox.start(this, true, false); return false; }
2275			} else if (relAttribute.toLowerCase().match('lyteframe')) {
2276				anchor.onclick = function () { myLytebox.start(this, false, true); return false; }
2277			}
2278		}
2279	}
2280};
2281LyteBox.prototype.start = function(imageLink, doSlide, doFrame) {
2282	if (this.ie && !this.ie7) {	this.toggleSelects('hide');	}
2283	if (this.hideFlash) { this.toggleFlash('hide'); }
2284	this.isLyteframe = (doFrame ? true : false);
2285	var pageSize	= this.getPageSize();
2286	var objOverlay	= this.doc.getElementById('lbOverlay');
2287	var objBody		= this.doc.getElementsByTagName("body").item(0);
2288	objOverlay.style.height = pageSize[1] + "px";
2289	objOverlay.style.display = '';
2290	this.appear('lbOverlay', (this.doAnimations ? 0 : this.maxOpacity));
2291	var anchors = (this.isFrame) ? window.parent.frames[window.name].document.getElementsByTagName('a') : document.getElementsByTagName('a');
2292	if (this.isLyteframe) {
2293		this.frameArray = [];
2294		this.frameNum = 0;
2295		if ((imageLink.getAttribute('rel') == 'lyteframe')) {
2296			var rev = imageLink.getAttribute('rev');
2297			this.frameArray.push(new Array(imageLink.getAttribute('href'), imageLink.getAttribute('title'), (rev == null || rev == '' ? 'width: 400px; height: 400px; scrolling: auto;' : rev)));
2298		} else {
2299			if (imageLink.getAttribute('rel').indexOf('lyteframe') != -1) {
2300				for (var i = 0; i < anchors.length; i++) {
2301					var anchor = anchors[i];
2302					if (anchor.getAttribute('href') && (anchor.getAttribute('rel') == imageLink.getAttribute('rel'))) {
2303						var rev = anchor.getAttribute('rev');
2304						this.frameArray.push(new Array(anchor.getAttribute('href'), anchor.getAttribute('title'), (rev == null || rev == '' ? 'width: 400px; height: 400px; scrolling: auto;' : rev)));
2305					}
2306				}
2307				this.frameArray.removeDuplicates();
2308				while(this.frameArray[this.frameNum][0] != imageLink.getAttribute('href')) { this.frameNum++; }
2309			}
2310		}
2311	} else {
2312		this.imageArray = [];
2313		this.imageNum = 0;
2314		this.slideArray = [];
2315		this.slideNum = 0;
2316		if ((imageLink.getAttribute('rel') == 'lytebox')) {
2317			this.imageArray.push(new Array(imageLink.getAttribute('href'), imageLink.getAttribute('title')));
2318		} else {
2319			if (imageLink.getAttribute('rel').indexOf('lytebox') != -1) {
2320				for (var i = 0; i < anchors.length; i++) {
2321					var anchor = anchors[i];
2322					if (anchor.getAttribute('href') && (anchor.getAttribute('rel') == imageLink.getAttribute('rel'))) {
2323						this.imageArray.push(new Array(anchor.getAttribute('href'), anchor.getAttribute('title')));
2324					}
2325				}
2326				this.imageArray.removeDuplicates();
2327				while(this.imageArray[this.imageNum][0] != imageLink.getAttribute('href')) { this.imageNum++; }
2328			}
2329			if (imageLink.getAttribute('rel').indexOf('lyteshow') != -1) {
2330				for (var i = 0; i < anchors.length; i++) {
2331					var anchor = anchors[i];
2332					if (anchor.getAttribute('href') && (anchor.getAttribute('rel') == imageLink.getAttribute('rel'))) {
2333						this.slideArray.push(new Array(anchor.getAttribute('href'), anchor.getAttribute('title')));
2334					}
2335				}
2336				this.slideArray.removeDuplicates();
2337				while(this.slideArray[this.slideNum][0] != imageLink.getAttribute('href')) { this.slideNum++; }
2338			}
2339		}
2340	}
2341	var object = this.doc.getElementById('lbMain');
2342		object.style.top = (this.getPageScroll() + (pageSize[3] / 15)) + "px";
2343		object.style.display = '';
2344	if (!this.outerBorder) {
2345		this.doc.getElementById('lbOuterContainer').style.border = 'none';
2346		this.doc.getElementById('lbDetailsContainer').style.border = 'none';
2347	} else {
2348		this.doc.getElementById('lbOuterContainer').style.borderBottom = '';
2349		this.doc.getElementById('lbOuterContainer').setAttribute((this.ie ? 'className' : 'class'), this.theme);
2350	}
2351	this.doc.getElementById('lbOverlay').onclick = function() { myLytebox.end(); return false; }
2352	this.doc.getElementById('lbMain').onclick = function(e) {
2353		var e = e;
2354		if (!e) {
2355			if (window.parent.frames[window.name] && (parent.document.getElementsByTagName('frameset').length <= 0)) {
2356				e = window.parent.window.event;
2357			} else {
2358				e = window.event;
2359			}
2360		}
2361		var id = (e.target ? e.target.id : e.srcElement.id);
2362		if (id == 'lbMain') { myLytebox.end(); return false; }
2363	}
2364	this.doc.getElementById('lbClose').onclick = function() { myLytebox.end(); return false; }
2365	this.doc.getElementById('lbPause').onclick = function() { myLytebox.togglePlayPause("lbPause", "lbPlay"); return false; }
2366	this.doc.getElementById('lbPlay').onclick = function() { myLytebox.togglePlayPause("lbPlay", "lbPause"); return false; }
2367	this.isSlideshow = doSlide;
2368	this.isPaused = (this.slideNum != 0 ? true : false);
2369	if (this.isSlideshow && this.showPlayPause && this.isPaused) {
2370		this.doc.getElementById('lbPlay').style.display = '';
2371		this.doc.getElementById('lbPause').style.display = 'none';
2372	}
2373	if (this.isLyteframe) {
2374		this.changeContent(this.frameNum);
2375	} else {
2376		if (this.isSlideshow) {
2377			this.changeContent(this.slideNum);
2378		} else {
2379			this.changeContent(this.imageNum);
2380		}
2381	}
2382};
2383LyteBox.prototype.changeContent = function(imageNum) {
2384	if (this.isSlideshow) {
2385		for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); }
2386	}
2387	this.activeImage = this.activeSlide = this.activeFrame = imageNum;
2388	if (!this.outerBorder) {
2389		this.doc.getElementById('lbOuterContainer').style.border = 'none';
2390		this.doc.getElementById('lbDetailsContainer').style.border = 'none';
2391	} else {
2392		this.doc.getElementById('lbOuterContainer').style.borderBottom = '';
2393		this.doc.getElementById('lbOuterContainer').setAttribute((this.ie ? 'className' : 'class'), this.theme);
2394	}
2395	this.doc.getElementById('lbLoading').style.display = '';
2396	this.doc.getElementById('lbImage').style.display = 'none';
2397	this.doc.getElementById('lbIframe').style.display = 'none';
2398	this.doc.getElementById('lbPrev').style.display = 'none';
2399	this.doc.getElementById('lbNext').style.display = 'none';
2400	this.doc.getElementById('lbIframeContainer').style.display = 'none';
2401	this.doc.getElementById('lbDetailsContainer').style.display = 'none';
2402	this.doc.getElementById('lbNumberDisplay').style.display = 'none';
2403	if (this.navType == 2 || this.isLyteframe) {
2404		object = this.doc.getElementById('lbNavDisplay');
2405		object.innerHTML = '&nbsp;&nbsp;&nbsp;<span id="lbPrev2_Off" style="display: none;" class="' + this.theme + '">&laquo; prev</span><a href="#" id="lbPrev2" class="' + this.theme + '" style="display: none;">&laquo; prev</a> <b id="lbSpacer" class="' + this.theme + '">||</b> <span id="lbNext2_Off" style="display: none;" class="' + this.theme + '">next &raquo;</span><a href="#" id="lbNext2" class="' + this.theme + '" style="display: none;">next &raquo;</a>';
2406		object.style.display = 'none';
2407	}
2408	if (this.isLyteframe) {
2409		var iframe = myLytebox.doc.getElementById('lbIframe');
2410		var styles = this.frameArray[this.activeFrame][2];
2411		var aStyles = styles.split(';');
2412		for (var i = 0; i < aStyles.length; i++) {
2413			if (aStyles[i].indexOf('width:') >= 0) {
2414				var w = aStyles[i].replace('width:', '');
2415				iframe.width = w.trim();
2416			} else if (aStyles[i].indexOf('height:') >= 0) {
2417				var h = aStyles[i].replace('height:', '');
2418				iframe.height = h.trim();
2419			} else if (aStyles[i].indexOf('scrolling:') >= 0) {
2420				var s = aStyles[i].replace('scrolling:', '');
2421				iframe.scrolling = s.trim();
2422			} else if (aStyles[i].indexOf('border:') >= 0) {
2423				// Not implemented yet, as there are cross-platform issues with setting the border (from a GUI standpoint)
2424				//var b = aStyles[i].replace('border:', '');
2425				//iframe.style.border = b.trim();
2426			}
2427		}
2428		this.resizeContainer(parseInt(iframe.width), parseInt(iframe.height));
2429	} else {
2430		imgPreloader = new Image();
2431		imgPreloader.onload = function() {
2432			var imageWidth = imgPreloader.width;
2433			var imageHeight = imgPreloader.height;
2434			if (myLytebox.autoResize) {
2435				var pagesize = myLytebox.getPageSize();
2436				var x = pagesize[2] - 150;
2437				var y = pagesize[3] - 150;
2438				if (imageWidth > x) {
2439					imageHeight = Math.round(imageHeight * (x / imageWidth));
2440					imageWidth = x;
2441					if (imageHeight > y) {
2442						imageWidth = Math.round(imageWidth * (y / imageHeight));
2443						imageHeight = y;
2444					}
2445				} else if (imageHeight > y) {
2446					imageWidth = Math.round(imageWidth * (y / imageHeight));
2447					imageHeight = y;
2448					if (imageWidth > x) {
2449						imageHeight = Math.round(imageHeight * (x / imageWidth));
2450						imageWidth = x;
2451					}
2452				}
2453			}
2454			var lbImage = myLytebox.doc.getElementById('lbImage')
2455			lbImage.src = (myLytebox.isSlideshow ? myLytebox.slideArray[myLytebox.activeSlide][0] : myLytebox.imageArray[myLytebox.activeImage][0]);
2456			lbImage.width = imageWidth;
2457			lbImage.height = imageHeight;
2458			myLytebox.resizeContainer(imageWidth, imageHeight);
2459			imgPreloader.onload = function() {};
2460		}
2461		imgPreloader.src = (this.isSlideshow ? this.slideArray[this.activeSlide][0] : this.imageArray[this.activeImage][0]);
2462	}
2463};
2464LyteBox.prototype.resizeContainer = function(imgWidth, imgHeight) {
2465	this.wCur = this.doc.getElementById('lbOuterContainer').offsetWidth;
2466	this.hCur = this.doc.getElementById('lbOuterContainer').offsetHeight;
2467	this.xScale = ((imgWidth  + (this.borderSize * 2)) / this.wCur) * 100;
2468	this.yScale = ((imgHeight  + (this.borderSize * 2)) / this.hCur) * 100;
2469	var wDiff = (this.wCur - this.borderSize * 2) - imgWidth;
2470	var hDiff = (this.hCur - this.borderSize * 2) - imgHeight;
2471	if (!(hDiff == 0)) {
2472		this.hDone = false;
2473		this.resizeH('lbOuterContainer', this.hCur, imgHeight + this.borderSize*2, this.getPixelRate(this.hCur, imgHeight));
2474	} else {
2475		this.hDone = true;
2476	}
2477	if (!(wDiff == 0)) {
2478		this.wDone = false;
2479		this.resizeW('lbOuterContainer', this.wCur, imgWidth + this.borderSize*2, this.getPixelRate(this.wCur, imgWidth));
2480	} else {
2481		this.wDone = true;
2482	}
2483	if ((hDiff == 0) && (wDiff == 0)) {
2484		if (this.ie){ this.pause(250); } else { this.pause(100); }
2485	}
2486	this.doc.getElementById('lbPrev').style.height = imgHeight + "px";
2487	this.doc.getElementById('lbNext').style.height = imgHeight + "px";
2488	this.doc.getElementById('lbDetailsContainer').style.width = (imgWidth + (this.borderSize * 2) + (this.ie && this.doc.compatMode == "BackCompat" && this.outerBorder ? 2 : 0)) + "px";
2489	this.showContent();
2490};
2491LyteBox.prototype.showContent = function() {
2492	if (this.wDone && this.hDone) {
2493		for (var i = 0; i < this.showContentTimerCount; i++) { window.clearTimeout(this.showContentTimerArray[i]); }
2494		if (this.outerBorder) {
2495			this.doc.getElementById('lbOuterContainer').style.borderBottom = 'none';
2496		}
2497		this.doc.getElementById('lbLoading').style.display = 'none';
2498		if (this.isLyteframe) {
2499			this.doc.getElementById('lbIframe').style.display = '';
2500			this.appear('lbIframe', (this.doAnimations ? 0 : 100));
2501		} else {
2502			this.doc.getElementById('lbImage').style.display = '';
2503			this.appear('lbImage', (this.doAnimations ? 0 : 100));
2504			this.preloadNeighborImages();
2505		}
2506		if (this.isSlideshow) {
2507			if(this.activeSlide == (this.slideArray.length - 1)) {
2508				if (this.autoEnd) {
2509					this.slideshowIDArray[this.slideshowIDCount++] = setTimeout("myLytebox.end('slideshow')", this.slideInterval);
2510				}
2511			} else {
2512				if (!this.isPaused) {
2513					this.slideshowIDArray[this.slideshowIDCount++] = setTimeout("myLytebox.changeContent("+(this.activeSlide+1)+")", this.slideInterval);
2514				}
2515			}
2516			this.doc.getElementById('lbHoverNav').style.display = (this.showNavigation && this.navType == 1 ? '' : 'none');
2517			this.doc.getElementById('lbClose').style.display = (this.showClose ? '' : 'none');
2518			this.doc.getElementById('lbDetails').style.display = (this.showDetail
2518s ? '' : 'none');
2519			this.doc.getElementById('lbPause').style.display = (this.showPlayPause && !this.isPaused ? '' : 'none');
2520			this.doc.getElementById('lbPlay').style.display = (this.showPlayPause && !this.isPaused ? 'none' : '');
2521			this.doc.getElementById('lbNavDisplay').style.display = (this.showNavigation && this.navType == 2 ? '' : 'none');
2522		} else {
2523			this.doc.getElementById('lbHoverNav').style.display = (this.navType == 1 && !this.isLyteframe ? '' : 'none');
2524			if ((this.navType == 2 && !this.isLyteframe && this.imageArray.length > 1) || (this.frameArray.length > 1 && this.isLyteframe)) {
2525				this.doc.getElementById('lbNavDisplay').style.display = '';
2526			} else {
2527				this.doc.getElementById('lbNavDisplay').style.display = 'none';
2528			}
2529			this.doc.getElementById('lbClose').style.display = '';
2530			this.doc.getElementById('lbDetails').style.display = '';
2531			this.doc.getElementById('lbPause').style.display = 'none';
2532			this.doc.getElementById('lbPlay').style.display = 'none';
2533		}
2534		this.doc.getElementById('lbImageContainer').style.display = (this.isLyteframe ? 'none' : '');
2535		this.doc.getElementById('lbIframeContainer').style.display = (this.isLyteframe ? '' : 'none');
2536		try {
2537			this.doc.getElementById('lbIframe').src = this.frameArray[this.activeFrame][0];
2538		} catch(e) { }
2539	} else {
2540		this.showContentTimerArray[this.showContentTimerCount++] = setTimeout("myLytebox.showContent()", 200);
2541	}
2542};
2543LyteBox.prototype.updateDetails = function() {
2544	var object = this.doc.getElementById('lbCaption');
2545	var sTitle = (this.isSlideshow ? this.slideArray[this.activeSlide][1] : (this.isLyteframe ? this.frameArray[this.activeFrame][1] : this.imageArray[this.activeImage][1]));
2546	object.style.display = '';
2547	object.innerHTML = (sTitle == null ? '' : sTitle);
2548	this.updateNav();
2549	this.doc.getElementById('lbDetailsContainer').style.display = '';
2550	object = this.doc.getElementById('lbNumberDisplay');
2551	if (this.isSlideshow && this.slideArray.length > 1) {
2552		object.style.display = '';
2553		object.innerHTML = " " + eval(this.activeSlide + 1) + " / " + this.slideArray.length;
2554		this.doc.getElementById('lbNavDisplay').style.display = (this.navType == 2 && this.showNavigation ? '' : 'none');
2555	} else if (this.imageArray.length > 1 && !this.isLyteframe) {
2556		object.style.display = '';
2557		object.innerHTML = " " + eval(this.activeImage + 1) + " / " + this.imageArray.length;
2558		this.doc.getElementById('lbNavDisplay').style.display = (this.navType == 2 ? '' : 'none');
2559	} else if (this.frameArray.length > 1 && this.isLyteframe) {
2560		object.style.display = '';
2561		object.innerHTML = "Strana " + eval(this.activeFrame + 1) + " z " + this.frameArray.length;
2562		this.doc.getElementById('lbNavDisplay').style.display = '';
2563	} else {
2564		this.doc.getElementById('lbNavDisplay').style.display = 'none';
2565	}
2566	this.appear('lbDetailsContainer', (this.doAnimations ? 0 : 100));
2567};
2568LyteBox.prototype.updateNav = function() {
2569	if (this.isSlideshow) {
2570		if (this.activeSlide != 0) {
2571			var object = (this.navType == 2 ? this.doc.getElementById('lbPrev2') : this.doc.getElementById('lbPrev'));
2572				object.style.display = '';
2573				object.onclick = function() {
2574					if (myLytebox.pauseOnPrevClick) { myLytebox.togglePlayPause("lbPause", "lbPlay"); }
2575					myLytebox.changeContent(myLytebox.activeSlide - 1); return false;
2576				}
2577		} else {
2578			if (this.navType == 2) { this.doc.getElementById('lbPrev2_Off').style.display = ''; }
2579		}
2580		if (this.activeSlide != (this.slideArray.length - 1)) {
2581			var object = (this.navType == 2 ? this.doc.getElementById('lbNext2') : this.doc.getElementById('lbNext'));
2582				object.style.display = '';
2583				object.onclick = function() {
2584					if (myLytebox.pauseOnNextClick) { myLytebox.togglePlayPause("lbPause", "lbPlay"); }
2585					myLytebox.changeContent(myLytebox.activeSlide + 1); return false;
2586				}
2587		} else {
2588			if (this.navType == 2) { this.doc.getElementById('lbNext2_Off').style.display = ''; }
2589		}
2590	} else if (this.isLyteframe) {
2591		if(this.activeFrame != 0) {
2592			var object = this.doc.getElementById('lbPrev2');
2593				object.style.display = '';
2594				object.onclick = function() {
2595					myLytebox.changeContent(myLytebox.activeFrame - 1); return false;
2596				}
2597		} else {
2598			this.doc.getElementById('lbPrev2_Off').style.display = '';
2599		}
2600		if(this.activeFrame != (this.frameArray.length - 1)) {
2601			var object = this.doc.getElementById('lbNext2');
2602				object.style.display = '';
2603				object.onclick = function() {
2604					myLytebox.changeContent(myLytebox.activeFrame + 1); return false;
2605				}
2606		} else {
2607			this.doc.getElementById('lbNext2_Off').style.display = '';
2608		}
2609	} else {
2610		if(this.activeImage != 0) {
2611			var object = (this.navType == 2 ? this.doc.getElementById('lbPrev2') : this.doc.getElementById('lbPrev'));
2612				object.style.display = '';
2613				object.onclick = function() {
2614					myLytebox.changeContent(myLytebox.activeImage - 1); return false;
2615				}
2616		} else {
2617			if (this.navType == 2) { this.doc.getElementById('lbPrev2_Off').style.display = ''; }
2618		}
2619		if(this.activeImage != (this.imageArray.length - 1)) {
2620			var object = (this.navType == 2 ? this.doc.getElementById('lbNext2') : this.doc.getElementById('lbNext'));
2621				object.style.display = '';
2622				object.onclick = function() {
2623					myLytebox.changeContent(myLytebox.activeImage + 1); return false;
2624				}
2625		} else {
2626			if (this.navType == 2) { this.doc.getElementById('lbNext2_Off').style.display = ''; }
2627		}
2628	}
2629	this.enableKeyboardNav();
2630};
2631LyteBox.prototype.enableKeyboardNav = function() { document.onkeydown = this.keyboardAction; };
2632LyteBox.prototype.disableKeyboardNav = function() { document.onkeydown = ''; };
2633LyteBox.prototype.keyboardAction = function(e) {
2634	var keycode = key = escape = null;
2635	keycode	= (e == null) ? event.keyCode : e.which;
2636	key		= String.fromCharCode(keycode).toLowerCase();
2637	escape  = (e == null) ? 27 : e.DOM_VK_ESCAPE;
2638	if ((key == 'x') || (key == 'c') || (keycode == escape)) {
2639		myLytebox.end();
2640	} else if ((key == 'p') || (keycode == 37)) {
2641		if (myLytebox.isSlideshow) {
2642			if(myLytebox.activeSlide != 0) {
2643				myLytebox.disableKeyboardNav();
2644				myLytebox.changeContent(myLytebox.activeSlide - 1);
2645			}
2646		} else if (myLytebox.isLyteframe) {
2647			if(myLytebox.activeFrame != 0) {
2648				myLytebox.disableKeyboardNav();
2649				myLytebox.changeContent(myLytebox.activeFrame - 1);
2650			}
2651		} else {
2652			if(myLytebox.activeImage != 0) {
2653				myLytebox.disableKeyboardNav();
2654				myLytebox.changeContent(myLytebox.activeImage - 1);
2655			}
2656		}
2657	} else if ((key == 'n') || (keycode == 39)) {
2658		if (myLytebox.isSlideshow) {
2659			if(myLytebox.activeSlide != (myLytebox.slideArray.length - 1)) {
2660				myLytebox.disableKeyboardNav();
2661				myLytebox.changeContent(myLytebox.activeSlide + 1);
2662			}
2663		} else if (myLytebox.isLyteframe) {
2664			if(myLytebox.activeFrame != (myLytebox.frameArray.length - 1)) {
2665				myLytebox.disableKeyboardNav();
2666				myLytebox.changeContent(myLytebox.activeFrame + 1);
2667			}
2668		} else {
2669			if(myLytebox.activeImage != (myLytebox.imageArray.length - 1)) {
2670				myLytebox.disableKeyboardNav();
2671				myLytebox.changeContent(myLytebox.activeImage + 1);
2672			}
2673		}
2674	}
2675};
2676LyteBox.prototype.preloadNeighborImages = function() {
2677	if (this.isSlideshow) {
2678		if ((this.slideArray.length - 1) > this.activeSlide) {
2679			preloadNextImage = new Image();
2680			preloadNextImage.src = this.slideArray[this.activeSlide + 1][0];
2681		}
2682		if(this.activeSlide > 0) {
2683			preloadPrevImage = new Image();
2684			preloadPrevImage.src = this.slideArray[this.activeSlide - 1][0];
2685		}
2686	} else {
2687		if ((this.imageArray.length - 1) > this.activeImage) {
2688			preloadNextImage = new Image();
2689			preloadNextImage.src = this.imageArray[this.activeImage + 1][0];
2690		}
2691		if(this.activeImage > 0) {
2692			preloadPrevImage = new Image();
2693			preloadPrevImage.src = this.imageArray[this.activeImage - 1][0];
2694		}
2695	}
2696};
2697LyteBox.prototype.togglePlayPause = function(hideID, showID) {
2698	if (this.isSlideshow && hideID == "lbPause") {
2699		for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); }
2700	}
2701	this.doc.getElementById(hideID).style.display = 'none';
2702	this.doc.getElementById(showID).style.display = '';
2703	if (hideID == "lbPlay") {
2704		this.isPaused = false;
2705		if (this.activeSlide == (this.slideArray.length - 1)) {
2706			this.end();
2707		} else {
2708			this.changeContent(this.activeSlide + 1);
2709		}
2710	} else {
2711		this.isPaused = true;
2712	}
2713};
2714LyteBox.prototype.end = function(caller) {
2715	var closeClick = (caller == 'slideshow' ? false : true);
2716	if (this.isSlideshow && this.isPaused && !closeClick) { return; }
2717	this.disableKeyboardNav();
2718	this.doc.getElementById('lbMain').style.display = 'none';
2719	this.fade('lbOverlay', (this.doAnimations ? this.maxOpacity : 0));
2720	this.toggleSelects('visible');
2721	if (this.hideFlash) { this.toggleFlash('visible'); }
2722	if (this.isSlideshow) {
2723		for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); }
2724	}
2725	if (this.isLyteframe) {
2726		 this.initialize();
2727	}
2728};
2729LyteBox.prototype.checkFrame = function() {
2730	if (window.parent.frames[window.name] && (parent.document.getElementsByTagName('frameset').length <= 0)) {
2731		this.isFrame = true;
2732		this.lytebox = "window.parent." + window.name + ".myLytebox";
2733		this.doc = parent.document;
2734	} else {
2735		this.isFrame = false;
2736		this.lytebox = "myLytebox";
2737		this.doc = document;
2738	}
2739};
2740LyteBox.prototype.getPixelRate = function(cur, img) {
2741	var diff = (img > cur) ? img - cur : cur - img;
2742	if (diff >= 0 && diff <= 100) { return 10; }
2743	if (diff > 100 && diff <= 200) { return 15; }
2744	if (diff > 200 && diff <= 300) { return 20; }
2745	if (diff > 300 && diff <= 400) { return 25; }
2746	if (diff > 400 && diff <= 500) { return 30; }
2747	if (diff > 500 && diff <= 600) { return 35; }
2748	if (diff > 600 && diff <= 700) { return 40; }
2749	if (diff > 700) { return 45; }
2750};
2751LyteBox.prototype.appear = function(id, opacity) {
2752	var object = this.doc.getElementById(id).style;
2753	object.opacity = (opacity / 100);
2754	object.MozOpacity = (opacity / 100);
2755	object.KhtmlOpacity = (opacity / 100);
2756	object.filter = "alpha(opacity=" + (opacity + 10) + ")";
2757	if (opacity == 100 && (id == 'lbImage' || id == 'lbIframe')) {
2758		try { object.removeAttribute("filter"); } catch(e) {}	/* Fix added for IE Alpha Opacity Filter bug. */
2759		this.updateDetails();
2760	} else if (opacity >= this.maxOpacity && id == 'lbOverlay') {
2761		for (var i = 0; i < this.overlayTimerCount; i++) { window.clearTimeout(this.overlayTimerArray[i]); }
2762		return;
2763	} else if (opacity >= 100 && id == 'lbDetailsContainer') {
2764		try { object.removeAttribute("filter"); } catch(e) {}	/* Fix added for IE Alpha Opacity Filter bug. */
2765		for (var i = 0; i < this.imageTimerCount; i++) { window.clearTimeout(this.imageTimerArray[i]); }
2766		this.doc.getElementById('lbOverlay').style.height = this.getPageSize()[1] + "px";
2767	} else {
2768		if (id == 'lbOverlay') {
2769			this.overlayTimerArray[this.overlayTimerCount++] = setTimeout("myLytebox.appear('" + id + "', " + (opacity+20) + ")", 1);
2770		} else {
2771			this.imageTimerArray[this.imageTimerCount++] = setTimeout("myLytebox.appear('" + id + "', " + (opacity+10) + ")", 1);
2772		}
2773	}
2774};
2775LyteBox.prototype.fade = function(id, opacity) {
2776	var object = this.doc.getElementById(id).style;
2777	object.opacity = (opacity / 100);
2778	object.MozOpacity = (opacity / 100);
2779	object.KhtmlOpacity = (opacity / 100);
2780	object.filter = "alpha(opacity=" + opacity + ")";
2781	if (opacity <= 0) {
2782		try {
2783			object.display = 'none';
2784		} catch(err) { }
2785	} else if (id == 'lbOverlay') {
2786		this.overlayTimerArray[this.overlayTimerCount++] = setTimeout("myLytebox.fade('" + id + "', " + (opacity-20) + ")", 1);
2787	} else {
2788		this.timerIDArray[this.timerIDCount++] = setTimeout("myLytebox.fade('" + id + "', " + (opacity-10) + ")", 1);
2789	}
2790};
2791LyteBox.prototype.resizeW = function(id, curW, maxW, pixelrate, speed) {
2792	if (!this.hDone) {
2793		this.resizeWTimerArray[this.resizeWTimerCount++] = setTimeout("myLytebox.resizeW('" + id + "', " + curW + ", " + maxW + ", " + pixelrate + ")", 100);
2794		return;
2795	}
2796	var object = this.doc.getElementById(id);
2797	var timer = speed ? speed : (this.resizeDuration/2);
2798	var newW = (this.doAnimations ? curW : maxW);
2799	object.style.width = (newW) + "px";
2800	if (newW < maxW) {
2801		newW += (newW + pixelrate >= maxW) ? (maxW - newW) : pixelrate;
2802	} else if (newW > maxW) {
2803		newW -= (newW - pixelrate <= maxW) ? (newW - maxW) : pixelrate;
2804	}
2805	this.resizeWTimerArray[this.resizeWTimerCount++] = setTimeout("myLytebox.resizeW('" + id + "', " + newW + ", " + maxW + ", " + pixelrate + ", " + (timer+0.02) + ")", timer+0.02);
2806	if (parseInt(object.style.width) == maxW) {
2807		this.wDone = true;
2808		for (var i = 0; i < this.resizeWTimerCount; i++) { window.clearTimeout(this.resizeWTimerArray[i]); }
2809	}
2810};
2811LyteBox.prototype.resizeH = function(id, curH, maxH, pixelrate, speed) {
2812	var timer = speed ? speed : (this.resizeDuration/2);
2813	var object = this.doc.getElementById(id);
2814	var newH = (this.doAnimations ? curH : maxH);
2815	object.style.height = (newH) + "px";
2816	if (newH < maxH) {
2817		newH += (newH + pixelrate >= maxH) ? (maxH - newH) : pixelrate;
2818	} else if (newH > maxH) {
2819		newH -= (newH - pixelrate <= maxH) ? (newH - maxH) : pixelrate;
2820	}
2821	this.resizeHTimerArray[this.resizeHTimerCount++] = setTimeout("myLytebox.resizeH('" + id + "', " + newH + ", " + maxH + ", " + pixelrate + ", " + (timer+.02) + ")", timer+.02);
2822	if (parseInt(object.style.height) == maxH) {
2823		this.hDone = true;
2824		for (var i = 0; i < this.resizeHTimerCount; i++) { window.clearTimeout(this.resizeHTimerArray[i]); }
2825	}
2826};
2827LyteBox.prototype.getPageScroll = function() {
2828	if (self.pageYOffset) {
2829		return this.isFrame ? parent.pageYOffset : self.pageYOffset;
2830	} else if (this.doc.documentElement && this.doc.documentElement.scrollTop){
2831		return this.doc.documentElement.scrollTop;
2832	} else if (document.body) {
2833		return this.doc.body.scrollTop;
2834	}
2835};
2836LyteBox.prototype.getPageSize = function() {
2837	var xScroll, yScroll, windowWidth, windowHeight;
2838	if (window.innerHeight && window.scrollMaxY) {
2839		xScroll = this.doc.scrollWidth;
2840		yScroll = (this.isFrame ? parent.innerHeight : self.innerHeight) + (this.isFrame ? parent.scrollMaxY : self.scrollMaxY);
2841	} else if (this.doc.body.scrollHeight > this.doc.body.offsetHeight){
2842		xScroll = this.doc.body.scrollWidth;
2843		yScroll = this.doc.body.scrollHeight;
2844	} else {
2845		xScroll = this.doc.getElementsByTagName("html").item(0).offsetWidth;
2846		yScroll = this.doc.getElementsByTagName("html").item(0).offsetHeight;
2847		xScroll = (xScroll < this.doc.body.offsetWidth) ? this.doc.body.offsetWidth : xScroll;
2848		yScroll = (yScroll < this.doc.body.offsetHeight) ? this.doc.body.offsetHeight : yScroll;
2849	}
2850	if (self.innerHeight) {
2851		windowWidth = (this.isFrame) ? parent.innerWidth : self.innerWidth;
2852		windowHeight = (this.isFrame) ? parent.innerHeight : self.innerHeight;
2853	} else if (document.documentElement && document.documentElement.clientHeight) {
2854		windowWidth = this.doc.documentElement.clientWidth;
2855		windowHeight = this.doc.documentElement.clientHeight;
2856	} else if (document.body) {
2857		windowWidth = this.doc.getElementsByTagName("html").item(0).clientWidth;
2858		windowHeight = this.doc.getElementsByTagName("html").item(0).clientHeight;
2859		windowWidth = (windowWidth == 0) ? this.doc.body.clientWidth : windowWidth;
2860		windowHeight = (windowHeight == 0) ? this.doc.body.clientHeight : windowHeight;
2861	}
2862	var pageHeight = (yScroll < windowHeight) ? windowHeight : yScroll;
2863	var pageWidth = (xScroll < windowWidth) ? windowWidth : xScroll;
2864	return new Array(pageWidth, pageHeight, windowWidth, windowHeight);
2865};
2866LyteBox.prototype.toggleFlash = function(state) {
2867	var objects = this.doc.getElementsByTagName("object");
2868	for (var i = 0; i < objects.length; i++) {
2869		objects[i].style.visibility = (state == "hide") ? 'hidden' : 'visible';
2870	}
2871	var embeds = this.doc.getElementsByTagName("embed");
2872	for (var i = 0; i < embeds.length; i++) {
2873		embeds[i].style.visibility = (state == "hide") ? 'hidden' : 'visible';
2874	}
2875	if (this.isFrame) {
2876		for (var i = 0; i < parent.frames.length; i++) {
2877			try {
2878				objects = parent.frames[i].window.document.getElementsByTagName("object");
2879				for (var j = 0; j < objects.length; j++) {
2880					objects[j].style.visibility = (state == "hide") ? 'hidden' : 'visible';
2881				}
2882			} catch(e) { }
2883			try {
2884				embeds = parent.frames[i].window.document.getElementsByTagName("embed");
2885				for (var j = 0; j < embeds.length; j++) {
2886					embeds[j].style.visibility = (state == "hide") ? 'hidden' : 'visible';
2887				}
2888			} catch(e) { }
2889		}
2890	}
2891};
2892LyteBox.prototype.toggleSelects = function(state) {
2893	var selects = this.doc.getElementsByTagName("select");
2894	for (var i = 0; i < selects.length; i++ ) {
2895		selects[i].style.visibility = (state == "hide") ? 'hidden' : 'visible';
2896	}
2897	if (this.isFrame) {
2898		for (var i = 0; i < parent.frames.length; i++) {
2899			try {
2900				selects = parent.frames[i].window.document.getElementsByTagName("select");
2901				for (var j = 0; j < selects.length; j++) {
2902					selects[j].style.visibility = (state == "hide") ? 'hidden' : 'visible';
2903				}
2904			} catch(e) { }
2905		}
2906	}
2907};
2908LyteBox.prototype.pause = function(numberMillis) {
2909	var now = new Date();
2910	var exitTime = now.getTime() + numberMillis;
2911	while (true) {
2912		now = new Date();
2913		if (now.getTime() > exitTime) { return; }
2914	}
2915};
2916

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.