/** $Id: domLib.js 1952 2005-07-17 16:24:05Z dallen $ */
// {{{ license
/*
* Copyright 2002-2005 Dan Allen, Mojavelinux.com (dan.allen@mojavelinux.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// }}}
// {{{ intro
/**
* Title: DOM Library Core
* Version: 0.70
*
* Summary:
* A set of commonly used functions that make it easier to create javascript
* applications that rely on the DOM.
*
* Updated: 2005/05/17
*
* Maintainer: Dan Allen <dan.allen@mojavelinux.com>
* Maintainer: Jason Rust <jrust@rustyparts.com>
*
* License: Apache 2.0
*/
// }}}
// {{{ global constants (DO NOT EDIT)
// -- Browser Detection --
var domLib_userAgent = navigator.userAgent.toLowerCase();
var domLib_isMac = navigator.appVersion.indexOf('Mac') != -1;
var domLib_isWin = domLib_userAgent.indexOf('windows') != -1;
// NOTE: could use window.opera for detecting Opera
var domLib_isOpera = domLib_userAgent.indexOf('opera') != -1;
var domLib_isOpera7up = domLib_userAgent.match(/opera.(7|8)/i);
var domLib_isSafari = domLib_userAgent.indexOf('safari') != -1;
var domLib_isKonq = domLib_userAgent.indexOf('konqueror') != -1;
// Both konqueror and safari use the khtml rendering engine
var domLib_isKHTML = (domLib_isKonq || domLib_isSafari || domLib_userAgent.indexOf('khtml') != -1);
var domLib_isIE = (!domLib_isKHTML && !domLib_isOpera && (domLib_userAgent.indexOf('msie 5') != -1 || domLib_userAgent.indexOf('msie 6') != -1 || domLib_userAgent.indexOf('msie 7') != -1));
var domLib_isIE5up = domLib_isIE;
var domLib_isIE50 = (domLib_isIE && domLib_userAgent.indexOf('msie 5.0') != -1);
var domLib_isIE55 = (domLib_isIE && domLib_userAgent.indexOf('msie 5.5') != -1);
var domLib_isIE5 = (domLib_isIE50 || domLib_isIE55);
// safari and konq may use string "khtml, like gecko", so check for destinctive /
var domLib_isGecko = domLib_userAgent.indexOf('gecko/') != -1;
var domLib_isMacIE = (domLib_isIE && domLib_isMac);
var domLib_isIE55up = domLib_isIE5up && !domLib_isIE50 && !domLib_isMacIE;
var domLib_isIE6up = domLib_isIE55up && !domLib_isIE55;
// -- Browser Abilities --
var domLib_standardsMode = (document.compatMode && document.compatMode == 'CSS1Compat');
var domLib_useLibrary = (domLib_isOpera7up || domLib_isKHTML || domLib_isIE5up || domLib_isGecko || domLib_isMacIE || document.defaultView);
// fixed in Konq3.2
var domLib_hasBrokenTimeout = (domLib_isMacIE || (domLib_isKonq && domLib_userAgent.match(/konqueror\/3.([2-9])/) == null));
var domLib_canFade = (domLib_isGecko || domLib_isIE || domLib_isSafari || domLib_isOpera);
var domLib_canDrawOverSelect = (domLib_isMac || domLib_isOpera || domLib_isGecko);
var domLib_canDrawOverFlash = (domLib_isMac || domLib_isWin);
// -- Event Variables --
var domLib_eventTarget = domLib_isIE ? 'srcElement' : 'currentTarget';
var domLib_eventButton = domLib_isIE ? 'button' : 'which';
var domLib_eventTo = domLib_isIE ? 'toElement' : 'relatedTarget';
var domLib_stylePointer = domLib_isIE ? 'hand' : 'pointer';
// NOTE: a bug exists in Opera that prevents maxWidth from being set to 'none', so we make it huge
var domLib_styleNoMaxWidth = domLib_isOpera ? '10000px' : 'none';
var domLib_hidePosition = '-1000px';
var domLib_scrollbarWidth = 14;
var domLib_autoId = 1;
var domLib_zIndex = 100;
// -- Detection --
var domLib_collisionElements;
var domLib_collisionsCached = false;
var domLib_timeoutStateId = 0;
var domLib_timeoutStates = new Hash();
// }}}
// {{{ DOM enhancements
if (!document.ELEMENT_NODE)
{
document.ELEMENT_NODE = 1;
document.ATTRIBUTE_NODE = 2;
document.TEXT_NODE = 3;
document.DOCUMENT_NODE = 9;
document.DOCUMENT_FRAGMENT_NODE = 11;
}
function domLib_clone(obj)
{
var copy = {};
for (var i in obj)
{
var value = obj[i];
try
{
if (value != null && typeof(value) == 'object' && value != window && !value.nodeType)
{
copy[i] = domLib_clone(value);
}
else
{
copy[i] = value;
}
}
catch(e)
{
copy[i] = value;
}
}
return copy;
}
// }}}
// {{{ class Hash()
function Hash()
{
this.length = 0;
this.numericLength = 0;
this.elementData = [];
for (var i = 0; i < arguments.length; i += 2)
{
if (typeof(arguments[i + 1]) != 'undefined')
{
this.elementData[arguments[i]] = arguments[i + 1];
this.length++;
if (arguments[i] == parseInt(arguments[i]))
{
this.numericLength++;
}
}
}
}
// using prototype as opposed to inner functions saves on memory
Hash.prototype.get = function(in_key)
{
return this.elementData[in_key];
}
Hash.prototype.set = function(in_key, in_value)
{
if (typeof(in_value) != 'undefined')
{
if (typeof(this.elementData[in_key]) == 'undefined')
{
this.length++;
if (in_key == parseInt(in_key))
{
this.numericLength++;
}
}
return this.elementData[in_key] = in_value;
}
return false;
}
Hash.prototype.remove = function(in_key)
{
var tmp_value;
if (typeof(this.elementData[in_key]) != 'undefined')
{
this.length--;
if (in_key == parseInt(in_key))
{
this.numericLength--;
}
tmp_value = this.elementData[in_key];
delete this.elementData[in_key];
}
return tmp_value;
}
Hash.prototype.size = function()
{
return this.length;
}
Hash.prototype.has = function(in_key)
{
return typeof(this.elementData[in_key]) != 'undefined';
}
Hash.prototype.find = function(in_obj)
{
for (var tmp_key in this.elementData)
{
if (this.elementData[tmp_key] == in_obj)
{
return tmp_key;
}
}
}
Hash.prototype.merge = function(in_hash)
{
for (var tmp_key in in_hash.elementData)
{
if (typeof(this.elementData[tmp_key]) == 'undefined')
{
this.length++;
if (tmp_key == parseInt(tmp_key))
{
this.numericLength++;
}
}
this.elementData[tmp_key] = in_hash.elementData[tmp_key];
}
}
Hash.prototype.compare = function(in_hash)
{
if (this.length != in_hash.length)
{
return false;
}
for (var tmp_key in this.elementData)
{
if (this.elementData[tmp_key] != in_hash.elementData[tmp_key])
{
return false;
}
}
return true;
}
// }}}
// {{{ domLib_isDescendantOf()
function domLib_isDescendantOf(in_object, in_ancestor)
{
if (in_object == in_ancestor)
{
return true;
}
while (in_object != document.documentElement)
{
try
{
if ((tmp_object = in_object.offsetParent) && tmp_object == in_ancestor)
{
return true;
}
else if ((tmp_object = in_object.parentNode) == in_ancestor)
{
return true;
}
else
{
in_object = tmp_object;
}
}
// in case we get some wierd error, just assume we haven't gone out yet
catch(e)
{
return true;
}
}
return false;
}
// }}}
// {{{ domLib_detectCollisions()
/**
* For any given target element, determine if elements on the page
* are colliding with it that do not obey the rules of z-index.
*/
function domLib_detectCollisions(in_object, in_recover, in_useCache)
{
// the reason for the cache is that if the root menu is built before
// the page is done loading, then it might not find all the elements.
// so really the only time you don't use cache is when building the
// menu as part of the page load
if (!domLib_collisionsCached)
{
var tags = [];
if (!domLib_canDrawOverFlash)
{
tags[tags.length] = 'object';
}
if (!domLib_canDrawOverSelect)
{
tags[tags.length] = 'select';
}
domLib_collisionElements = domLib_getElementsByTagNames(tags, true);
domLib_collisionsCached = in_useCache;
}
// if we don't have a tip, then unhide selects
if (in_recover)
{
for (var cnt = 0; cnt < domLib_collisionElements.length; cnt++)
{
var thisElement = domLib_collisionElements[cnt];
if (!thisElement.hideList)
{
thisElement.hideList = new Hash();
}
thisElement.hideList.remove(in_object.id);
if (!thisElement.hideList.length)
{
domLib_collisionElements[cnt].style.visibility = 'visible';
if (domLib_isKonq)
{
domLib_collisionElements[cnt].style.display = '';
}
}
}
return;
}
else if (domLib_collisionElements.length == 0)
{
return;
}
// okay, we have a tip, so hunt and destroy
var objectOffsets = domLib_getOffsets(in_object);
for (var cnt = 0; cnt < domLib_collisionElements.length; cnt++)
{
var thisElement = domLib_collisionElements[cnt];
// if collision element is in active element, move on
// WARNING: is this too costly?
if (domLib_isDescendantOf(thisElement, in_object))
{
continue;
}
// konqueror only has trouble with multirow selects
if (domLib_isKonq &&
thisElement.tagName == 'SELECT' &&
(thisElement.size <= 1 && !thisElement.multiple))
{
continue;
}
if (!thisElement.hideList)
{
thisElement.hideList = new Hash();
}
var selectOffsets = domLib_getOffsets(thisElement);
var center2centerDistance = Math.sqrt(Math.pow(selectOffsets.get('leftCenter') - objectOffsets.get('leftCenter'), 2) + Math.pow(selectOffsets.get('topCenter') - objectOffsets.get('topCenter'), 2));
var radiusSum = selectOffsets.get('radius') + objectOffsets.get('radius');
// the encompassing circles are overlapping, get in for a closer look
if (center2centerDistance < radiusSum)
{
// tip is left of select
if ((objectOffsets.get('leftCenter') <= selectOffsets.get('leftCenter') && objectOffsets.get('right') < selectOffsets.get('left')) ||
// tip is right of select
(objectOffsets.get('leftCenter') > selectOffsets.get('leftCenter') && objectOffsets.get('left') > selectOffsets.get('right')) ||
// tip is above select
(objectOffsets.get('topCenter') <= selectOffsets.get('topCenter') && objectOffsets.get('bottom') < selectOffsets.get('top')) ||
// tip is below select
(objectOffsets.get('topCenter') > selectOffsets.get('topCenter') && objectOffsets.get('top') > selectOffsets.get('bottom')))
{
thisElement.hideList.remove(in_object.id);
if (!thisElement.hideList.length)
{
thisElement.style.visibility = 'visible';
if (domLib_isKonq)
{
thisElement.style.display = '';
}
}
}
else
{
thisElement.hideList.set(in_object.id, true);
thisElement.style.visibility = 'hidden';
if (domLib_isKonq)
{
thisElement.style.display = 'none';
}
}
}
}
}
// }}}
// {{{ domLib_getOffsets()
function domLib_getOffsets(in_object)
{
var originalObject = in_object;
var originalWidth = in_object.offsetWidth;
var originalHeight = in_object.offsetHeight;
var offsetLeft = 0;
var offsetTop = 0;
while (in_object)
{
offsetLeft += in_object.offsetLeft;
offsetTop += in_object.offsetTop;
in_object = in_object.offsetParent;
}
// MacIE misreports the offsets (even with margin: 0 in body{}), still not perfect
if (domLib_isMacIE) {
offsetLeft += 10;
offsetTop += 10;
}
return new Hash(
'left', offsetLeft,
'top', offsetTop,
'right', offsetLeft + originalWidth,
'bottom', offsetTop + originalHeight,
'leftCenter', offsetLeft + originalWidth/2,
'topCenter', offsetTop + originalHeight/2,
'radius', Math.max(originalWidth, originalHeight)
);
}
// }}}
// {{{ domLib_setTimeout()
function domLib_setTimeout(in_function, in_timeout, in_args)
{
if (typeof(in_args) == 'undefined')
{
in_args = [];
}
if (in_timeout == -1)
{
// timeout event is disabled
return;
}
else if (in_timeout == 0)
{
in_function(in_args);
return 0;
}
// must make a copy of the arguments so that we release the reference
var args = domLib_clone(in_args);
if (!domLib_hasBrokenTimeout)
{
return setTimeout(function() { in_function(args); }, in_timeout);
}
else
{
var id = domLib_timeoutStateId++;
var data = new Hash();
data.set('function', in_function);
data.set('args', args);
domLib_timeoutStates.set(id, data);
data.set('timeoutId', setTimeout('domLib_timeoutStates.get(' + id + ').get(\'function\')(domLib_timeoutStates.get(' + id + ').get(\'args\')); domLib_timeoutStates.remove(' + id + ');', in_timeout));
return id;
}
}
// }}}
// {{{ domLib_clearTimeout()
function domLib_clearTimeout(in_id)
{
if (!domLib_hasBrokenTimeout)
{
clearTimeout(in_id);
}
else
{
if (domLib_timeoutStates.has(in_id))
{
clearTimeout(domLib_timeoutStates.get(in_id).get('timeoutId'))
domLib_timeoutStates.remove(in_id);
}
}
}
// }}}
// {{{ domLib_getEventPosition()
function domLib_getEventPosition(in_eventObj)
{
var eventPosition = new Hash('x', 0, 'y', 0, 'scrollX', 0, 'scrollY', 0);
// IE varies depending on standard compliance mode
if (domLib_isIE)
{
var doc = (domLib_standardsMode ? document.documentElement : document.body);
// NOTE: events may fire before the body has been loaded
if (doc)
{
eventPosition.set('x', in_eventObj.clientX + doc.scrollLeft);
eventPosition.set('y', in_eventObj.clientY + doc.scrollTop);
eventPosition.set('scrollX', doc.scrollLeft);
eventPosition.set('scrollY', doc.scrollTop);
}
}
else
{
eventPosition.set('x', in_eventObj.pageX);
eventPosition.set('y', in_eventObj.pageY);
eventPosition.set('scrollX', in_eventObj.pageX - in_eventObj.clientX);
eventPosition.set('scrollY', in_eventObj.pageY - in_eventObj.clientY);
}
return eventPosition;
}
// }}}
// {{{ domLib_cancelBubble()
function domLib_cancelBubble(in_event)
{
var eventObj = in_event ? in_event : window.event;
eventObj.cancelBubble = true;
}
// }}}
// {{{ domLib_getIFrameReference()
function domLib_getIFrameReference(in_frame)
{
if (domLib_isGecko || domLib_isIE)
{
return in_frame.frameElement;
}
else
{
// we could either do it this way or require an id on the frame
// equivalent to the name
var name = in_frame.name;
if (!name || !in_frame.parent)
{
return;
}
var candidates = in_frame.parent.document.getElementsByTagName('iframe');
for (var i = 0; i < candidates.length; i++)
{
if (candidates[i].name == name)
{
return candidates[i];
}
}
}
}
// }}}
// {{{ domLib_getElementsByClass()
function domLib_getElementsByClass(in_class)
{
var elements = domLib_isIE5 ? document.all : document.getElementsByTagName('*');
var matches = [];
var cnt = 0;
for (var i = 0; i < elements.length; i++)
{
if ((" " + elements[i].className + " ").indexOf(" " + in_class + " ") != -1)
{
matches[cnt++] = elements[i];
}
}
return matches;
}
// }}}
// {{{
function domLib_getElementsByTagNames(in_list, in_excludeHidden)
{
var elements = [];
for (var i = 0; i < in_list.length; i++)
{
var matches = document.getElementsByTagName(in_list[i]);
for (var j = 0; j < matches.length; j++)
{
if (in_excludeHidden && domLib_getComputedStyle(matches[j], 'visibility') == 'hidden')
{
continue;
}
elements[elements.length] = matches[j];
}
}
return elements;
}
// }}}
// {{{
function domLib_getComputedStyle(in_obj, in_property)
{
if (domLib_isIE)
{
var humpBackProp = in_property.replace(/-(.)/, function (a, b) { return b.toUpperCase(); });
return eval('in_obj.currentStyle.' + humpBackProp);
}
// getComputedStyle() is broken in konqueror, so let's go for the style object
else if (domLib_isKonq)
{
var humpBackProp = in_property.replace(/-(.)/, function (a, b) { return b.toUpperCase(); });
return eval('in_obj.style.' + in_property);
}
else
{
return document.defaultView.getComputedStyle(in_obj, null).getPropertyValue(in_property);
}
}
// }}}
// {{{ makeTrue()
function makeTrue()
{
return true;
}
// }}}
// {{{ makeFalse()
function makeFalse()
{
return false;
}
// }}}
/** $Id: domTT.js 1951 2005-07-17 16:22:34Z dallen $ */
// {{{ license
/*
* Copyright 2002-2005 Dan Allen, Mojavelinux.com (dan.allen@mojavelinux.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// }}}
// {{{ intro
/**
* Title: DOM Tooltip Library
* Version: 0.7.1
*
* Summary:
* Allows developers to add custom tooltips to the webpages. Tooltips are
* generated using the domTT_activate() function and customized by setting
* a handful of options.
*
* Maintainer: Dan Allen <dan.allen@mojavelinux.com>
* Contributors:
* Josh Gross <josh@jportalhome.com>
* Jason Rust <jason@rustyparts.com>
*
* License: Apache 2.0
* However, if you use this library, you earn the position of official bug
* reporter :) Please post questions or problem reports to the newsgroup:
*
* http://groups-beta.google.com/group/dom-tooltip
*
* If you are doing this for commercial work, perhaps you could send me a few
* Starbucks Coffee gift dollars or PayPal bucks to encourage future
* developement (NOT REQUIRED). E-mail me for my snail mail address.
*
* Homepage: http://www.mojavelinux.com/projects/domtooltip/
*
* Newsgroup: http://groups-beta.google.com/group/dom-tooltip
*
* Freshmeat Project: http://freshmeat.net/projects/domtt/?topic_id=92
*
* Updated: 2005/07/16
*
* Supported Browsers:
* Mozilla (Gecko), IE 5.5+, IE on Mac, Safari, Konqueror, Opera 7
*
* Usage:
* Please see the HOWTO documentation.
**/
// }}}
// {{{ settings (editable)
// IE mouse events seem to be off by 2 pixels
var domTT_offsetX = (domLib_isIE ? -2 : 0);
var domTT_offsetY = (domLib_isIE ? 4 : 2);
var domTT_direction = 'southeast';
var domTT_mouseHeight = domLib_isIE ? 13 : 19;
var domTT_closeLink = 'X';
var domTT_closeAction = 'hide';
var domTT_activateDelay = 500;
var domTT_maxWidth = false;
var domTT_styleClass = 'domTT';
var domTT_fade = 'neither';
var domTT_lifetime = 0;
var domTT_grid = 0;
var domTT_trailDelay = 200;
var domTT_useGlobalMousePosition = true;
var domTT_screenEdgeDetection = true;
var domTT_screenEdgePadding = 4;
var domTT_oneOnly = true;
var domTT_draggable = false;
if (typeof(domTT_dragEnabled) == 'undefined')
{
domTT_dragEnabled = false;
}
// }}}
// {{{ globals (DO NOT EDIT)
var domTT_predefined = new Hash();
// tooltips are keyed on both the tip id and the owner id,
// since events can originate on either object
var domTT_tooltips = new Hash();
var domTT_lastOpened = 0;
// }}}
// {{{ document.onmousemove
if (domLib_useLibrary && domTT_useGlobalMousePosition)
{
var domTT_mousePosition = new Hash();
document.onmousemove = function(in_event)
{
if (typeof(in_event) == 'undefined')
{
in_event = event;
}
domTT_mousePosition = domLib_getEventPosition(in_event);
if (domTT_dragEnabled && domTT_dragMouseDown)
{
domTT_dragUpdate(in_event);
}
}
}
// }}}
// {{{ domTT_activate()
function domTT_activate(in_this, in_event)
{
if (!domLib_useLibrary) { return false; }
// make sure in_event is set (for IE, some cases we have to use window.event)
if (typeof(in_event) == 'undefined')
{
in_event = window.event;
}
var owner = document.body;
// we have an active event so get the owner
if (in_event.type.match(/key|mouse|click|contextmenu/i))
{
// make sure we have nothing higher than the body element
if (in_this.nodeType && in_this.nodeType != document.DOCUMENT_NODE)
{
var owner = in_this;
}
}
// non active event (make sure we were passed a string id)
else
{
if (typeof(in_this) != 'object' && !(owner = domTT_tooltips.get(in_this)))
{
owner = document.body.appendChild(document.createElement('div'));
owner.style.display = 'none';
owner.id = in_this;
}
}
// make sure the owner has a unique id
if (!owner.id)
{
owner.id = '__autoId' + domLib_autoId++;
}
// see if we should only be openning one tip at a time
// NOTE: this is not "perfect" yet since it really steps on any other
// tip working on fade out or delayed close, but it get's the job done
if (domTT_oneOnly && domTT_lastOpened)
{
domTT_deactivate(domTT_lastOpened);
}
domTT_lastOpened = owner.id;
var tooltip = domTT_tooltips.get(owner.id);
if (tooltip)
{
if (tooltip.get('eventType') != in_event.type)
{
if (tooltip.get('type') == 'greasy')
{
tooltip.set('closeAction', 'destroy');
domTT_deactivate(owner.id);
}
else if (tooltip.get('status') != 'inactive')
{
return owner.id;
}
}
else
{
if (tooltip.get('status') == 'inactive')
{
tooltip.set('status', 'pending');
tooltip.set('activateTimeout', domLib_setTimeout(domTT_runShow, tooltip.get('delay'), [owner.id, in_event]));
return owner.id;
}
// either pending or active, let it be
else
{
return owner.id;
}
}
}
// setup the default options hash
var options = new Hash(
'caption', '',
'content', '',
'clearMouse', true,
'closeAction', domTT_closeAction,
'closeLink', domTT_closeLink,
'delay', domTT_activateDelay,
'direction', domTT_direction,
'draggable', domTT_draggable,
'fade', domTT_fade,
'fadeMax', 100,
'grid', domTT_grid,
'id', '[domTT]' + owner.id,
'inframe', false,
'lifetime', domTT_lifetime,
'offsetX', domTT_offsetX,
'offsetY', domTT_offsetY,
'parent', document.body,
'position', 'absolute',
'styleClass', domTT_styleClass,
'type', 'greasy',
'trail', false,
'lazy', false
);
// load in the options from the function call
for (var i = 2; i < arguments.length; i += 2)
{
// load in predefined
if (arguments[i] == 'predefined')
{
var predefinedOptions = domTT_predefined.get(arguments[i + 1]);
for (var j in predefinedOptions.elementData)
{
options.set(j, predefinedOptions.get(j));
}
}
// set option
else
{
options.set(arguments[i], arguments[i + 1]);
}
}
options.set('eventType', in_event.type);
// immediately set the status text if provided
if (options.has('statusText'))
{
try { window.status = options.get('statusText'); } catch(e) {}
}
// if we didn't give content...assume we just wanted to change the status and return
if (!options.has('content') || options.get('content') == '' || options.get('content') == null)
{
if (typeof(owner.onmouseout) != 'function')
{
owner.onmouseout = function(in_event) { domTT_mouseout(this, in_event); };
}
return owner.id;
}
options.set('owner', owner);
domTT_create(options);
// determine the show delay
options.set('delay', in_event.type.match(/click|mousedown|contextmenu/i) ? 0 : parseInt(options.get('delay')));
domTT_tooltips.set(owner.id, options);
domTT_tooltips.set(options.get('id'), options);
options.set('status', 'pending');
options.set('activateTimeout', domLib_setTimeout(domTT_runShow, options.get('delay'), [owner.id, in_event]));
return owner.id;
}
// }}}
// {{{ domTT_create()
function domTT_create(in_options)
{
var tipOwner = in_options.get('owner');
var parentObj = in_options.get('parent');
var parentDoc = parentObj.ownerDocument || parentObj.document;
// create the tooltip and hide it
var tipObj = parentObj.appendChild(parentDoc.createElement('div'));
tipObj.style.position = 'absolute';
tipObj.style.left = '0px';
tipObj.style.top = '0px';
tipObj.style.visibility = 'hidden';
tipObj.id = in_options.get('id');
tipObj.className = in_options.get('styleClass');
// content of tip as object
var content;
var tableLayout = false;
if (in_options.get('caption') || (in_options.get('type') == 'sticky' && in_options.get('caption') !== false))
{
tableLayout = true;
// layout the tip with a hidden formatting table
var tipLayoutTable = tipObj.appendChild(parentDoc.createElement('table'));
tipLayoutTable.style.borderCollapse = 'collapse';
if (domLib_isKHTML)
{
tipLayoutTable.cellSpacing = 0;
}
var tipLayoutTbody = tipLayoutTable.appendChild(parentDoc.createElement('tbody'));
var numCaptionCells = 0;
var captionRow = tipLayoutTbody.appendChild(parentDoc.createElement('tr'));
var captionCell = captionRow.appendChild(parentDoc.createElement('td'));
captionCell.style.padding = '0px';
var caption = captionCell.appendChild(parentDoc.createElement('div'));
caption.className = 'caption';
if (domLib_isIE50)
{
caption.style.height = '100%';
}
if (in_options.get('caption').nodeType)
{
caption.appendChild(in_options.get('caption').cloneNode(1));
}
else
{
caption.innerHTML = in_options.get('caption');
}
if (in_options.get('type') == 'sticky')
{
var numCaptionCells = 2;
var closeLinkCell = captionRow.appendChild(parentDoc.createElement('td'));
closeLinkCell.style.padding = '0px';
var closeLink = closeLinkCell.appendChild(parentDoc.createElement('div'));
closeLink.className = 'caption';
if (domLib_isIE50)
{
closeLink.style.height = '100%';
}
closeLink.style.textAlign = 'right';
closeLink.style.cursor = domLib_stylePointer;
// merge the styles of the two cells
closeLink.style.borderLeftWidth = caption.style.borderRightWidth = '0px';
closeLink.style.paddingLeft = caption.style.paddingRight = '0px';
closeLink.style.marginLeft = caption.style.marginRight = '0px';
if (in_options.get('closeLink').nodeType)
{
closeLink.appendChild(in_options.get('closeLink').cloneNode(1));
}
else
{
closeLink.innerHTML = in_options.get('closeLink');
}
closeLink.onclick = function() { domTT_deactivate(tipOwner.id); };
closeLink.onmousedown = function(in_event) { if (typeof(in_event) == 'undefined') { in_event = event; } in_event.cancelBubble = true; };
// MacIE has to have a newline at the end and must be made with createTextNode()
if (domLib_isMacIE)
{
closeLinkCell.appendChild(parentDoc.createTextNode("\n"));
}
}
// MacIE has to have a newline at the end and must be made with createTextNode()
if (domLib_isMacIE)
{
captionCell.appendChild(parentDoc.createTextNode("\n"));
}
var contentRow = tipLayoutTbody.appendChild(parentDoc.createElement('tr'));
var contentCell = contentRow.appendChild(parentDoc.createElement('td'));
contentCell.style.padding = '0px';
if (numCaptionCells)
{
if (domLib_isIE || domLib_isOpera)
{
contentCell.colSpan = numCaptionCells;
}
else
{
contentCell.setAttribute('colspan', numCaptionCells);
}
}
content = contentCell.appendChild(parentDoc.createElement('div'));
if (domLib_isIE50)
{
content.style.height = '100%';
}
}
else
{
content = tipObj.appendChild(parentDoc.createElement('div'));
}
content.className = 'contents';
if (in_options.get('content').nodeType)
{
content.appendChild(in_options.get('content').cloneNode(1));
}
else
{
content.innerHTML = in_options.get('content');
}
// adjust the width if specified
if (in_options.has('width'))
{
tipObj.style.width = parseInt(in_options.get('width')) + 'px';
}
// check if we are overridding the maxWidth
// if the browser supports maxWidth, the global setting will be ignored (assume stylesheet)
var maxWidth = domTT_maxWidth;
if (in_options.has('maxWidth'))
{
if ((maxWidth = in_options.get('maxWidth')) === false)
{
tipObj.style.maxWidth = domLib_styleNoMaxWidth;
}
else
{
maxWidth = parseInt(in_options.get('maxWidth'));
tipObj.style.maxWidth = maxWidth + 'px';
}
}
// HACK: fix lack of maxWidth in CSS for KHTML and IE
if (maxWidth !== false && (domLib_isIE || domLib_isKHTML) && tipObj.offsetWidth > maxWidth)
{
tipObj.style.width = maxWidth + 'px';
}
in_options.set('offsetWidth', tipObj.offsetWidth);
in_options.set('offsetHeight', tipObj.offsetHeight);
// konqueror miscalcuates the width of the containing div when using the layout table based on the
// border size of the containing div
if (domLib_isKonq && tableLayout && !tipObj.style.width)
{
var left = document.defaultView.getComputedStyle(tipObj, '').getPropertyValue('border-left-width');
var right = document.defaultView.getComputedStyle(tipObj, '').getPropertyValue('border-right-width');
left = left.substring(left.indexOf(':') + 2, left.indexOf(';'));
right = right.substring(right.indexOf(':') + 2, right.indexOf(';'));
var correction = 2 * ((left ? parseInt(left) : 0) + (right ? parseInt(right) : 0));
tipObj.style.width = (tipObj.offsetWidth - correction) + 'px';
}
// if a width is not set on an absolutely positioned object, both IE and Opera
// will attempt to wrap when it spills outside of body...we cannot have that
if (domLib_isIE || domLib_isOpera)
{
if (!tipObj.style.width)
{
// HACK: the correction here is for a border
tipObj.style.width = (tipObj.offsetWidth - 2) + 'px';
}
// HACK: the correction here is for a border
tipObj.style.height = (tipObj.offsetHeight - 2) + 'px';
}
// store placement offsets from event position
var offsetX, offsetY;
// tooltip floats
if (in_options.get('position') == 'absolute' && !(in_options.has('x') && in_options.has('y')))
{
// determine the offset relative to the pointer
switch (in_options.get('direction'))
{
case 'northeast':
offsetX = in_options.get('offsetX');
offsetY = 0 - tipObj.offsetHeight - in_options.get('offsetY');
break;
case 'northwest':
offsetX = 0 - tipObj.offsetWidth - in_options.get('offsetX');
offsetY = 0 - tipObj.offsetHeight - in_options.get('offsetY');
break;
case 'north':
offsetX = 0 - parseInt(tipObj.offsetWidth/2);
offsetY = 0 - tipObj.offsetHeight - in_options.get('offsetY');
break;
case 'southwest':
offsetX = 0 - tipObj.offsetWidth - in_options.get('offsetX');
offsetY = in_options.get('offsetY');
break;
case 'southeast':
offsetX = in_options.get('offsetX');
offsetY = in_options.get('offsetY');
break;
case 'south':
offsetX = 0 - parseInt(tipObj.offsetWidth/2);
offsetY = in_options.get('offsetY');
break;
}
// if we are in an iframe, get the offsets of the iframe in the parent document
if (in_options.get('inframe'))
{
var iframeObj = domLib_getIFrameReference(window);
if (iframeObj)
{
var frameOffsets = domLib_getOffsets(iframeObj);
offsetX += frameOffsets.get('left');
offsetY += frameOffsets.get('top');
}
}
}
// tooltip is fixed
else
{
offsetX = 0;
offsetY = 0;
in_options.set('trail', false);
}
// set the direction-specific offsetX/Y
in_options.set('offsetX', offsetX);
in_options.set('offsetY', offsetY);
if (in_options.get('clearMouse') && in_options.get('direction').indexOf('south') != -1)
{
in_options.set('mouseOffset', domTT_mouseHeight);
}
else
{
in_options.set('mouseOffset', 0);
}
if (domLib_canFade && typeof(Fadomatic) == 'function')
{
if (in_options.get('fade') != 'neither')
{
var fadeHandler = new Fadomatic(tipObj, 10, 0, 0, in_options.get('fadeMax'));
in_options.set('fadeHandler', fadeHandler);
}
}
else
{
in_options.set('fade', 'neither');
}
// setup mouse events
if (in_options.get('trail') && typeof(tipOwner.onmousemove) != 'function')
{
tipOwner.onmousemove = function(in_event) { domTT_mousemove(this, in_event); };
}
if (typeof(tipOwner.onmouseout) != 'function')
{
tipOwner.onmouseout = function(in_event) { domTT_mouseout(this, in_event); };
}
if (in_options.get('type') == 'sticky')
{
if (in_options.get('position') == 'absolute' && domTT_dragEnabled && in_options.get('draggable'))
{
if (domLib_isIE)
{
captionRow.onselectstart = function() { return false; };
}
// setup drag
captionRow.onmousedown = function(in_event) { domTT_dragStart(tipObj, in_event); };
captionRow.onmousemove = function(in_event) { domTT_dragUpdate(in_event); };
captionRow.onmouseup = function() { domTT_dragStop(); };
}
}
else if (in_options.get('type') == 'velcro')
{
tipObj.onmouseout = function(in_event) { if (typeof(in_event) == 'undefined') { in_event = event; } if (!domLib_isDescendantOf(in_event[domLib_eventTo], tipObj)) { domTT_deactivate(tipOwner.id); }};
}
if (in_options.get('position') == 'relative')
{
tipObj.style.position = 'relative';
}
in_options.set('node', tipObj);
in_options.set('status', 'inactive');
}
// }}}
// {{{ domTT_show()
// in_id is either tip id or the owner id
function domTT_show(in_id, in_event)
{
// should always find one since this call would be cancelled if tip was killed
var tooltip = domTT_tooltips.get(in_id);
var status = tooltip.get('status');
var tipObj = tooltip.get('node');
if (tooltip.get('position') == 'absolute')
{
var mouseX, mouseY;
if (tooltip.has('x') && tooltip.has('y'))
{
mouseX = tooltip.get('x');
mouseY = tooltip.get('y');
}
else if (!domTT_useGlobalMousePosition || status == 'active' || tooltip.get('delay') == 0)
{
var eventPosition = domLib_getEventPosition(in_event);
var eventX = eventPosition.get('x');
var eventY = eventPosition.get('y');
if (tooltip.get('inframe'))
{
eventX -= eventPosition.get('scrollX');
eventY -= eventPosition.get('scrollY');
}
// only move tip along requested trail axis when updating position
if (status == 'active' && tooltip.get('trail') !== true)
{
var trail = tooltip.get('trail');
if (trail == 'x')
{
mouseX = eventX;
mouseY = tooltip.get('mouseY');
}
else if (trail == 'y')
{
mouseX = tooltip.get('mouseX');
mouseY = eventY;
}
}
else
{
mouseX = eventX;
mouseY = eventY;
}
}
else
{
mouseX = domTT_mousePosition.get('x');
mouseY = domTT_mousePosition.get('y');
if (tooltip.get('inframe'))
{
mouseX -= domTT_mousePosition.get('scrollX');
mouseY -= domTT_mousePosition.get('scrollY');
}
}
// we are using a grid for updates
if (tooltip.get('grid'))
{
// if this is not a mousemove event or it is a mousemove event on an active tip and
// the movement is bigger than the grid
if (in_event.type != 'mousemove' || (status == 'active' && (Math.abs(tooltip.get('lastX') - mouseX) > tooltip.get('grid') || Math.abs(tooltip.get('lastY') - mouseY) > tooltip.get('grid'))))
{
tooltip.set('lastX', mouseX);
tooltip.set('lastY', mouseY);
}
// did not satisfy the grid movement requirement
else
{
return false;
}
}
// mouseX and mouseY store the last acknowleged mouse position,
// good for trailing on one axis
tooltip.set('mouseX', mouseX);
tooltip.set('mouseY', mouseY);
var coordinates;
if (domTT_screenEdgeDetection)
{
coordinates = domTT_correctEdgeBleed(
tooltip.get('offsetWidth'),
tooltip.get('offsetHeight'),
mouseX,
mouseY,
tooltip.get('offsetX'),
tooltip.get('offsetY'),
tooltip.get('mouseOffset'),
tooltip.get('inframe') ? window.parent : window
);
}
else
{
coordinates = {
'x' : mouseX + tooltip.get('offsetX'),
'y' : mouseY + tooltip.get('offsetY') + tooltip.get('mouseOffset')
};
}
// update the position
tipObj.style.left = coordinates.x + 'px';
tipObj.style.top = coordinates.y + 'px';
// increase the tip zIndex so it goes over previously shown tips
tipObj.style.zIndex = domLib_zIndex++;
}
// if tip is not active, active it now and check for a fade in
if (status == 'pending')
{
// unhide the tooltip
tooltip.set('status', 'active');
tipObj.style.display = '';
tipObj.style.visibility = 'visible';
var fade = tooltip.get('fade');
if (fade != 'neither')
{
var fadeHandler = tooltip.get('fadeHandler');
if (fade == 'out' || fade == 'both')
{
fadeHandler.haltFade();
if (fade == 'out')
{
fadeHandler.halt();
}
}
if (fade == 'in' || fade == 'both')
{
fadeHandler.fadeIn();
}
}
if (tooltip.get('type') == 'greasy' && tooltip.get('lifetime') != 0)
{
tooltip.set('lifetimeTimeout', domLib_setTimeout(domTT_runDeactivate, tooltip.get('lifetime'), [tipObj.id]));
}
}
if (tooltip.get('position') == 'absolute')
{
domLib_detectCollisions(tipObj);
}
}
// }}}
// {{{ domTT_close()
// in_handle can either be an child object of the tip, the tip id or the owner id
function domTT_close(in_handle)
{
var id;
if (typeof(in_handle) == 'object' && in_handle.nodeType)
{
var obj = in_handle;
while (!obj.id || !domTT_tooltips.get(obj.id))
{
obj = obj.parentNode;
if (obj.nodeType != document.ELEMENT_NODE) { return; }
}
id = obj.id;
}
else
{
id = in_handle;
}
domTT_deactivate(id);
}
// }}}
// {{{ domTT_deactivate()
// in_id is either the tip id or the owner id
function domTT_deactivate(in_id)
{
var tooltip = domTT_tooltips.get(in_id);
if (tooltip)
{
var status = tooltip.get('status');
if (status == 'pending')
{
// cancel the creation of this tip if it is still pending
domLib_clearTimeout(tooltip.get('activateTimeout'));
tooltip.set('status', 'inactive');
}
else if (status == 'active')
{
if (tooltip.get('lifetime'))
{
domLib_clearTimeout(tooltip.get('lifetimeTimeout'));
}
var tipObj = tooltip.get('node');
if (tooltip.get('closeAction') == 'hide')
{
var fade = tooltip.get('fade');
if (fade != 'neither')
{
var fadeHandler = tooltip.get('fadeHandler');
if (fade == 'out' || fade == 'both')
{
fadeHandler.fadeOut();
}
else
{
fadeHandler.hide();
}
}
else
{
tipObj.style.display = 'none';
}
}
else
{
tooltip.get('parent').removeChild(tipObj);
domTT_tooltips.remove(tooltip.get('owner').id);
domTT_tooltips.remove(tooltip.get('id'));
}
tooltip.set('status', 'inactive');
// unhide all of the selects that are owned by this object
domLib_detectCollisions(tipObj, true);
}
}
}
// }}}
// {{{ domTT_mouseout()
function domTT_mouseout(in_owner, in_event)
{
if (!domLib_useLibrary) { return false; }
if (typeof(in_event) == 'undefined')
{
in_event = event;
}
var toChild = domLib_isDescendantOf(in_event[domLib_eventTo], in_owner);
var tooltip = domTT_tooltips.get(in_owner.id);
if (tooltip && (tooltip.get('type') == 'greasy' || tooltip.get('status') != 'active'))
{
// deactivate tip if exists and we moved away from the owner
if (!toChild)
{
domTT_deactivate(in_owner.id);
try { window.status = window.defaultStatus; } catch(e) {}
}
}
else if (!toChild)
{
try { window.status = window.defaultStatus; } catch(e) {}
}
}
// }}}
// {{{ domTT_mousemove()
function domTT_mousemove(in_owner, in_event)
{
if (!domLib_useLibrary) { return false; }
if (typeof(in_event) == 'undefined')
{
in_event = event;
}
var tooltip = domTT_tooltips.get(in_owner.id);
if (tooltip && tooltip.get('trail') && tooltip.get('status') == 'active')
{
// see if we are trailing lazy
if (tooltip.get('lazy'))
{
domLib_setTimeout(domTT_runShow, domTT_trailDelay, [in_owner.id, in_event]);
}
else
{
domTT_show(in_owner.id, in_event);
}
}
}
// }}}
// {{{ domTT_addPredefined()
function domTT_addPredefined(in_id)
{
var options = new Hash();
for (var i = 1; i < arguments.length; i += 2)
{
options.set(arguments[i], arguments[i + 1]);
}
domTT_predefined.set(in_id, options);
}
// }}}
// {{{ domTT_correctEdgeBleed()
function domTT_correctEdgeBleed(in_width, in_height, in_x, in_y, in_offsetX, in_offsetY, in_mouseOffset, in_window)
{
var win, doc;
var bleedRight, bleedBottom;
var pageHeight, pageWidth, pageYOffset, pageXOffset;
var x = in_x + in_offsetX;
var y = in_y + in_offsetY + in_mouseOffset;
win = (typeof(in_window) == 'undefined' ? window : in_window);
// Gecko and IE swaps values of clientHeight, clientWidth properties when
// in standards compliance mode from documentElement to document.body
doc = ((domLib_standardsMode && (domLib_isIE || domLib_isGecko)) ? win.document.documentElement : win.document.body);
// for IE in compliance mode
if (domLib_isIE)
{
pageHeight = doc.clientHeight;
pageWidth = doc.clientWidth;
pageYOffset = doc.scrollTop;
pageXOffset = doc.scrollLeft;
}
else
{
pageHeight = doc.clientHeight;
pageWidth = doc.clientWidth;
if (domLib_isKHTML)
{
pageHeight = win.innerHeight;
}
pageYOffset = win.pageYOffset;
pageXOffset = win.pageXOffset;
}
// we are bleeding off the right, move tip over to stay on page
// logic: take x position, add width and subtract from effective page width
if ((bleedRight = (x - pageXOffset) + in_width - (pageWidth - domTT_screenEdgePadding)) > 0)
{
x -= bleedRight;
}
// we are bleeding to the left, move tip over to stay on page
// if tip doesn't fit, we will go back to bleeding off the right
// logic: take x position and check if less than edge padding
if ((x - pageXOffset) < domTT_screenEdgePadding)
{
x = domTT_screenEdgePadding + pageXOffset;
}
// if we are bleeding off the bottom, flip to north
// logic: take y position, add height and subtract from effective page height
if ((bleedBottom = (y - pageYOffset) + in_height - (pageHeight - domTT_screenEdgePadding)) > 0)
{
y = in_y - in_height - in_offsetY;
}
// if we are bleeding off the top, flip to south
// if tip doesn't fit, we will go back to bleeding off the bottom
// logic: take y position and check if less than edge padding
if ((y - pageYOffset) < domTT_screenEdgePadding)
{
y = in_y + domTT_mouseHeight + in_offsetY;
}
return {'x' : x, 'y' : y};
}
// }}}
// {{{ domTT_isActive()
// in_id is either the tip id or the owner id
function domTT_isActive(in_id)
{
var tooltip = domTT_tooltips.get(in_id);
if (!tooltip || tooltip.get('status') != 'active')
{
return false;
}
else
{
return true;
}
}
// }}}
// {{{ domTT_runXXX()
// All of these domMenu_runXXX() methods are used by the event handling sections to
// avoid the circular memory leaks caused by inner functions
function domTT_runDeactivate(args) { domTT_deactivate(args[0]); }
function domTT_runShow(args) { domTT_show(args[0], args[1]); }
// }}}
// {{{ domTT_replaceTitles()
function domTT_replaceTitles(in_decorator)
{
var elements = domLib_getElementsByClass('tooltip');
for (var i = 0; i < elements.length; i++)
{
if (elements[i].title)
{
var content;
if (typeof(in_decorator) == 'function')
{
content = in_decorator(elements[i]);
}
else
{
content = elements[i].title;
}
content = content.replace(new RegExp('\'', 'g'), '\\\'');
elements[i].onmouseover = new Function('in_event', "domTT_activate(this, in_event, 'content', '" + content + "')");
elements[i].title = '';
}
}
}
// }}}
// {{{ domTT_update()
// Allow authors to update the contents of existing tips using the DOM
function domTT_update(handle, content, type)
{
// type defaults to 'content', can also be 'caption'
if (typeof(type) == 'undefined')
{
type = 'content';
}
var tip = domTT_tooltips.get(handle);
if (!tip)
{
return;
}
var tipObj = tip.get('node');
var updateNode;
if (type == 'content')
{
// <div class="contents">...
updateNode = tipObj.firstChild;
if (updateNode.className != 'contents')
{
// <table><tbody><tr>...</tr><tr><td><div class="contents">...
updateNode = updateNode.firstChild.firstChild.nextSibling.firstChild.firstChild;
}
}
else
{
updateNode = tipObj.firstChild;
if (updateNode.className == 'contents')
{
// missing caption
return;
}
// <table><tbody><tr><td><div class="caption">...
updateNode = updateNode.firstChild.firstChild.firstChild.firstChild;
}
// TODO: allow for a DOM node as content
updateNode.innerHTML = content;
}
// }}}
/*
* jQuery 1.2 - New Wave Javascript
*
* Copyright (c) 2007 John Resig (jquery.com)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* $Date: 2007-09-10 15:45:49 -0400 (Mon, 10 Sep 2007) $
* $Rev: 3219 $
*/
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(G(){9(1n E!="11")H w=E;H E=17.16=G(a,c){9(17==6||!6.4K)I 1q E(a,c);I 6.4K(a,c)};9(1n $!="11")H D=$;17.$=E;H u=/^[^<]*(<(.|\\s)+>)[^>]*$|^#(\\w+)$/;E.1b=E.3x={4K:G(a,c){a=a||U;9(1n a=="1M"){H m=u.2L(a);9(m&&(m[1]||!c)){9(m[1])a=E.4I([m[1]],c);J{H b=U.42(m[3]);9(b)9(b.1T!=m[3])I E().1X(a);J{6[0]=b;6.L=1;I 6}J a=[]}}J I 1q E(c).1X(a)}J 9(E.1p(a))I 1q E(U)[E.1b.2d?"2d":"37"](a);I 6.6u(a.1d==1C&&a||(a.4d||a.L&&a!=17&&!a.1z&&a[0]!=11&&a[0].1z)&&E.2h(a)||[a])},4d:"1.2",82:G(){I 6.L},L:0,28:G(a){I a==11?E.2h(6):6[a]},2v:G(a){H b=E(a);b.4Y=6;I b},6u:G(a){6.L=0;1C.3x.1a.15(6,a);I 6},O:G(a,b){I E.O(6,a,b)},4J:G(a){H b=-1;6.O(G(i){9(6==a)b=i});I b},1y:G(f,d,e){H c=f;9(f.1d==3T)9(d==11)I 6.L&&E[e||"1y"](6[0],f)||11;J{c={};c[f]=d}I 6.O(G(a){M(H b 1j c)E.1y(e?6.R:6,b,E.1c(6,c[b],e,a,b))})},18:G(b,a){I 6.1y(b,a,"3O")},2t:G(e){9(1n e!="5w"&&e!=S)I 6.4o().3e(U.6F(e));H t="";E.O(e||6,G(){E.O(6.2X,G(){9(6.1z!=8)t+=6.1z!=1?6.6x:E.1b.2t([6])})});I t},5l:G(b){9(6[0])E(b,6[0].3N).6t().38(6[0]).1W(G(){H a=6;1Y(a.1t)a=a.1t;I a}).3e(6);I 6},8p:G(a){I 6.O(G(){E(6).6p().5l(a)})},8h:G(a){I 6.O(G(){E(6).5l(a)})},3e:G(){I 6.3s(1k,Q,1,G(a){6.57(a)})},6k:G(){I 6.3s(1k,Q,-1,G(a){6.38(a,6.1t)})},6g:G(){I 6.3s(1k,P,1,G(a){6.14.38(a,6)})},53:G(){I 6.3s(1k,P,-1,G(a){6.14.38(a,6.2i)})},1B:G(){I 6.4Y||E([])},1X:G(t){H b=E.1W(6,G(a){I E.1X(t,a)});I 6.2v(/[^+>] [^+>]/.12(t)||t.1e("..")>-1?E.4V(b):b)},6t:G(e){H f=6.1W(G(){I 6.66?E(6.66)[0]:6.4S(Q)});9(e===Q){H d=f.1X("*").4Q();6.1X("*").4Q().O(G(i){H c=E.K(6,"2A");M(H a 1j c)M(H b 1j c[a])E.1h.1f(d[i],a,c[a][b],c[a][b].K)})}I f},1A:G(t){I 6.2v(E.1p(t)&&E.2T(6,G(b,a){I t.15(b,[a])})||E.3G(t,6))},5T:G(t){I 6.2v(t.1d==3T&&E.3G(t,6,Q)||E.2T(6,G(a){I(t.1d==1C||t.4d)?E.2S(a,t)<0:a!=t}))},1f:G(t){I 6.2v(E.1S(6.28(),t.1d==3T?E(t).28():t.L!=11&&(!t.Y||t.Y=="7t")?t:[t]))},3j:G(a){I a?E.3G(a,6).L>0:P},7g:G(a){I 6.3j("."+a)},2V:G(b){9(b==11){9(6.L){H c=6[0];9(E.Y(c,"24")){H e=c.4z,a=[],W=c.W,2P=c.N=="24-2P";9(e<0)I S;M(H i=2P?e:0,2Y=2P?e+1:W.L;i<2Y;i++){H d=W[i];9(d.29){H b=E.V.1g&&!d.70["1N"].9U?d.2t:d.1N;9(2P)I b;a.1a(b)}}I a}J I 6[0].1N.1o(/\\r/g,"")}}J I 6.O(G(){9(b.1d==1C&&/4s|5u/.12(6.N))6.2K=(E.2S(6.1N,b)>=0||E.2S(6.2J,b)>=0);J 9(E.Y(6,"24")){H a=b.1d==1C?b:[b];E("9m",6).O(G(){6.29=(E.2S(6.1N,a)>=0||E.2S(6.2t,a)>=0)});9(!a.L)6.4z=-1}J 6.1N=b})},4n:G(a){I a==11?(6.L?6[0].3D:S):6.4o().3e(a)},6H:G(a){I 6.53(a).2e()},2s:G(){I 6.2v(1C.3x.2s.15(6,1k))},1W:G(b){I 6.2v(E.1W(6,G(a,i){I b.3c(a,i,a)}))},4Q:G(){I 6.1f(6.4Y)},3s:G(f,d,g,e){H c=6.L>1,a;I 6.O(G(){9(!a){a=E.4I(f,6.3N);9(g<0)a.91()}H b=6;9(d&&E.Y(6,"1F")&&E.Y(a[0],"4k"))b=6.4q("1J")[0]||6.57(U.5r("1J"));E.O(a,G(){9(E.Y(6,"1P")){9(6.3g)E.3w({1u:6.3g,3h:P,1Z:"1P"});J E.5h(6.2t||6.6s||6.3D||"")}J e.15(b,[c?6.4S(Q):6])})})}};E.1i=E.1b.1i=G(){H c=1k[0]||{},a=1,2g=1k.L,5e=P;9(c.1d==8v){5e=c;c=1k[1]||{}}9(2g==1){c=6;a=0}H b;M(;a<2g;a++)9((b=1k[a])!=S)M(H i 1j b){9(c==b[i])6r;9(5e&&1n b[i]==\'5w\'&&c[i])E.1i(c[i],b[i]);J 9(b[i]!=11)c[i]=b[i]}I c};H F="16"+(1q 3v()).3u(),6q=0,5d={};E.1i({8k:G(a){17.$=D;9(a)17.16=w;I E},1p:G(a){I!!a&&1n a!="1M"&&!a.Y&&a.1d!=1C&&/G/i.12(a+"")},4a:G(a){I a.35&&!a.1K||a.34&&a.3N&&!a.3N.1K},5h:G(a){a=E.33(a);9(a){9(17.6o)17.6o(a);J 9(E.V.1H)17.58(a,0);J 3p.3c(17,a)}},Y:G(b,a){I b.Y&&b.Y.26()==a.26()},1I:{},K:G(c,d,b){c=c==17?5d:c;H a=c[F];9(!a)a=c[F]=++6q;9(d&&!E.1I[a])E.1I[a]={};9(b!=11)E.1I[a][d]=b;I d?E.1I[a][d]:a},30:G(c,b){c=c==17?5d:c;H a=c[F];9(b){9(E.1I[a]){2G E.1I[a][b];b="";M(b 1j E.1I[a])22;9(!b)E.30(c)}}J{2c{2G c[F]}27(e){9(c.54)c.54(F)}2G E.1I[a]}},O:G(a,b,c){9(c){9(a.L==11)M(H i 1j a)b.15(a[i],c);J M(H i=0,45=a.L;i<45;i++)9(b.15(a[i],c)===P)22}J{9(a.L==11)M(H i 1j a)b.3c(a[i],i,a[i]);J M(H i=0,45=a.L,2V=a[0];i<45&&b.3c(2V,i,2V)!==P;2V=a[++i]){}}I a},1c:G(c,b,d,e,a){9(E.1p(b))b=b.3c(c,[e]);H f=/z-?4J|7T-?7S|1v|69|7Q-?1G/i;I b&&b.1d==4X&&d=="3O"&&!f.12(a)?b+"2I":b},1m:{1f:G(b,c){E.O((c||"").2p(/\\s+/),G(i,a){9(!E.1m.3t(b.1m,a))b.1m+=(b.1m?" ":"")+a})},2e:G(b,c){b.1m=c!=11?E.2T(b.1m.2p(/\\s+/),G(a){I!E.1m.3t(c,a)}).65(" "):""},3t:G(t,c){I E.2S(c,(t.1m||t).3z().2p(/\\s+/))>-1}},2q:G(e,o,f){M(H i 1j o){e.R["3C"+i]=e.R[i];e.R[i]=o[i]}f.15(e,[]);M(H i 1j o)e.R[i]=e.R["3C"+i]},18:G(e,p){9(p=="1G"||p=="2E"){H b={},3Z,3Y,d=["7L","7K","7J","7G"];E.O(d,G(){b["7F"+6]=0;b["7D"+6+"61"]=0});E.2q(e,b,G(){9(E(e).3j(\':3X\')){3Z=e.7A;3Y=e.7z}J{e=E(e.4S(Q)).1X(":4s").5X("2K").1B().18({4v:"1O",2W:"4D",19:"2U",7w:"0",1R:"0"}).5P(e.14)[0];H a=E.18(e.14,"2W")||"3V";9(a=="3V")e.14.R.2W="7k";3Z=e.7h;3Y=e.7f;9(a=="3V")e.14.R.2W="3V";e.14.3k(e)}});I p=="1G"?3Z:3Y}I E.3O(e,p)},3O:G(h,j,i){H g,2u=[],2q=[];G 3l(a){9(!E.V.1H)I P;H b=U.3M.3P(a,S);I!b||b.4y("3l")==""}9(j=="1v"&&E.V.1g){g=E.1y(h.R,"1v");I g==""?"1":g}9(j.1U(/4r/i))j=y;9(!i&&h.R[j])g=h.R[j];J 9(U.3M&&U.3M.3P){9(j.1U(/4r/i))j="4r";j=j.1o(/([A-Z])/g,"-$1").2F();H d=U.3M.3P(h,S);9(d&&!3l(h))g=d.4y(j);J{M(H a=h;a&&3l(a);a=a.14)2u.4Z(a);M(a=0;a<2u.L;a++)9(3l(2u[a])){2q[a]=2u[a].R.19;2u[a].R.19="2U"}g=j=="19"&&2q[2u.L-1]!=S?"2j":U.3M.3P(h,S).4y(j)||"";M(a=0;a<2q.L;a++)9(2q[a]!=S)2u[a].R.19=2q[a]}9(j=="1v"&&g=="")g="1"}J 9(h.43){H f=j.1o(/\\-(\\w)/g,G(m,c){I c.26()});g=h.43[j]||h.43[f];9(!/^\\d+(2I)?$/i.12(g)&&/^\\d/.12(g)){H k=h.R.1R;H e=h.4t.1R;h.4t.1R=h.43.1R;h.R.1R=g||0;g=h.R.74+"2I";h.R.1R=k;h.4t.1R=e}}I g},4I:G(a,e){H r=[];e=e||U;E.O(a,G(i,d){9(!d)I;9(d.1d==4X)d=d.3z();9(1n d=="1M"){d=d.1o(/(<(\\w+)[^>]*?)\\/>/g,G(m,a,b){I b.1U(/^(71|6Z|5D|6Y|49|9S|9P|3f|9K|9I)$/i)?m:a+"></"+b+">"});H s=E.33(d).2F(),1r=e.5r("1r"),2x=[];H c=!s.1e("<9D")&&[1,"<24>","</24>"]||!s.1e("<9A")&&[1,"<6S>","</6S>"]||s.1U(/^<(9x|1J|9u|9t|9s)/)&&[1,"<1F>","</1F>"]||!s.1e("<4k")&&[2,"<1F><1J>","</1J></1F>"]||(!s.1e("<9r")||!s.1e("<9q"))&&[3,"<1F><1J><4k>","</4k></1J></1F>"]||!s.1e("<5D")&&[2,"<1F><1J></1J><6L>","</6L></1F>"]||E.V.1g&&[1,"1r<1r>","</1r>"]||[0,"",""];1r.3D=c[1]+d+c[2];1Y(c[0]--)1r=1r.5k;9(E.V.1g){9(!s.1e("<1F")&&s.1e("<1J")<0)2x=1r.1t&&1r.1t.2X;J 9(c[1]=="<1F>"&&s.1e("<1J")<0)2x=1r.2X;M(H n=2x.L-1;n>=0;--n)9(E.Y(2x[n],"1J")&&!2x[n].2X.L)2x[n].14.3k(2x[n]);9(/^\\s/.12(d))1r.38(e.6F(d.1U(/^\\s*/)[0]),1r.1t)}d=E.2h(1r.2X)}9(0===d.L&&(!E.Y(d,"3B")&&!E.Y(d,"24")))I;9(d[0]==11||E.Y(d,"3B")||d.W)r.1a(d);J r=E.1S(r,d)});I r},1y:G(c,d,a){H e=E.4a(c)?{}:E.5o;9(d=="29"&&E.V.1H)c.14.4z;9(e[d]){9(a!=11)c[e[d]]=a;I c[e[d]]}J 9(E.V.1g&&d=="R")I E.1y(c.R,"9g",a);J 9(a==11&&E.V.1g&&E.Y(c,"3B")&&(d=="9e"||d=="9d"))I c.9b(d).6x;J 9(c.34){9(a!=11){9(d=="N"&&E.Y(c,"49")&&c.14)6E"N 96 94\'t 93 92";c.90(d,a)}9(E.V.1g&&/6B|3g/.12(d)&&!E.4a(c))I c.4l(d,2);I c.4l(d)}J{9(d=="1v"&&E.V.1g){9(a!=11){c.69=1;c.1A=(c.1A||"").1o(/6A\\([^)]*\\)/,"")+(3K(a).3z()=="8V"?"":"6A(1v="+a*6z+")")}I c.1A?(3K(c.1A.1U(/1v=([^)]*)/)[1])/6z).3z():""}d=d.1o(/-([a-z])/8T,G(z,b){I b.26()});9(a!=11)c[d]=a;I c[d]}},33:G(t){I(t||"").1o(/^\\s+|\\s+$/g,"")},2h:G(a){H r=[];9(1n a!="8Q")M(H i=0,2g=a.L;i<2g;i++)r.1a(a[i]);J r=a.2s(0);I r},2S:G(b,a){M(H i=0,2g=a.L;i<2g;i++)9(a[i]==b)I i;I-1},1S:G(a,b){9(E.V.1g){M(H i=0;b[i];i++)9(b[i].1z!=8)a.1a(b[i])}J M(H i=0;b[i];i++)a.1a(b[i]);I a},4V:G(b){H r=[],2f={};2c{M(H i=0,6P=b.L;i<6P;i++){H a=E.K(b[i]);9(!2f[a]){2f[a]=Q;r.1a(b[i])}}}27(e){r=b}I r},2T:G(b,a,c){9(1n a=="1M")a=3p("P||G(a,i){I "+a+"}");H d=[];M(H i=0,4m=b.L;i<4m;i++)9(!c&&a(b[i],i)||c&&!a(b[i],i))d.1a(b[i]);I d},1W:G(c,b){9(1n b=="1M")b=3p("P||G(a){I "+b+"}");H d=[];M(H i=0,4m=c.L;i<4m;i++){H a=b(c[i],i);9(a!==S&&a!=11){9(a.1d!=1C)a=[a];d=d.8O(a)}}I d}});H v=8M.8K.2F();E.V={4f:(v.1U(/.+(?:8I|8H|8F|8E)[\\/: ]([\\d.]+)/)||[])[1],1H:/6T/.12(v),3a:/3a/.12(v),1g:/1g/.12(v)&&!/3a/.12(v),39:/39/.12(v)&&!/(8B|6T)/.12(v)};H y=E.V.1g?"4h":"5g";E.1i({5f:!E.V.1g||U.8A=="8z",4h:E.V.1g?"4h":"5g",5o:{"M":"8y","8x":"1m","4r":y,5g:y,4h:y,3D:"3D",1m:"1m",1N:"1N",36:"36",2K:"2K",8w:"8u",29:"29",8t:"8s"}});E.O({1D:"a.14",8r:"16.4e(a,\'14\')",8q:"16.2R(a,2,\'2i\')",8o:"16.2R(a,2,\'4c\')",8n:"16.4e(a,\'2i\')",8m:"16.4e(a,\'4c\')",8l:"16.5c(a.14.1t,a)",8j:"16.5c(a.1t)",6p:"16.Y(a,\'8i\')?a.8f||a.8e.U:16.2h(a.2X)"},G(i,n){E.1b[i]=G(a){H b=E.1W(6,n);9(a&&1n a=="1M")b=E.3G(a,b);I 6.2v(E.4V(b))}});E.O({5P:"3e",8d:"6k",38:"6g",8c:"53",8b:"6H"},G(i,n){E.1b[i]=G(){H a=1k;I 6.O(G(){M(H j=0,2g=a.L;j<2g;j++)E(a[j])[n](6)})}});E.O({5X:G(a){E.1y(6,a,"");6.54(a)},8a:G(c){E.1m.1f(6,c)},89:G(c){E.1m.2e(6,c)},88:G(c){E.1m[E.1m.3t(6,c)?"2e":"1f"](6,c)},2e:G(a){9(!a||E.1A(a,[6]).r.L){E.30(6);6.14.3k(6)}},4o:G(){E("*",6).O(G(){E.30(6)});1Y(6.1t)6.3k(6.1t)}},G(i,n){E.1b[i]=G(){I 6.O(n,1k)}});E.O(["87","61"],G(i,a){H n=a.2F();E.1b[n]=G(h){I 6[0]==17?E.V.1H&&3r["86"+a]||E.5f&&32.2Y(U.35["59"+a],U.1K["59"+a])||U.1K["59"+a]:6[0]==U?32.2Y(U.1K["6n"+a],U.1K["6m"+a]):h==11?(6.L?E.18(6[0],n):S):6.18(n,h.1d==3T?h:h+"2I")}});H C=E.V.1H&&3q(E.V.4f)<85?"(?:[\\\\w*56-]|\\\\\\\\.)":"(?:[\\\\w\\84-\\83*56-]|\\\\\\\\.)",6j=1q 47("^>\\\\s*("+C+"+)"),6i=1q 47("^("+C+"+)(#)("+C+"+)"),6h=1q 47("^([#.]?)("+C+"*)");E.1i({55:{"":"m[2]==\'*\'||16.Y(a,m[2])","#":"a.4l(\'1T\')==m[2]",":":{81:"i<m[3]-0",7Z:"i>m[3]-0",2R:"m[3]-0==i",7Y:"m[3]-0==i",3o:"i==0",3n:"i==r.L-1",6f:"i%2==0",6d:"i%2","3o-46":"a.14.4q(\'*\')[0]==a","3n-46":"16.2R(a.14.5k,1,\'4c\')==a","7X-46":"!16.2R(a.14.5k,2,\'4c\')",1D:"a.1t",4o:"!a.1t",7W:"(a.6s||a.7V||\'\').1e(m[3])>=0",3X:\'"1O"!=a.N&&16.18(a,"19")!="2j"&&16.18(a,"4v")!="1O"\',1O:\'"1O"==a.N||16.18(a,"19")=="2j"||16.18(a,"4v")=="1O"\',7U:"!a.36",36:"a.36",2K:"a.2K",29:"a.29||16.1y(a,\'29\')",2t:"\'2t\'==a.N",4s:"\'4s\'==a.N",5u:"\'5u\'==a.N",52:"\'52\'==a.N",51:"\'51\'==a.N",50:"\'50\'==a.N",6c:"\'6c\'==a.N",6b:"\'6b\'==a.N",2y:\'"2y"==a.N||16.Y(a,"2y")\',49:"/49|24|6a|2y/i.12(a.Y)",3t:"16.1X(m[3],a).L",7R:"/h\\\\d/i.12(a.Y)",7P:"16.2T(16.2Z,G(1b){I a==1b.T;}).L"}},68:[/^(\\[) *@?([\\w-]+) *([!*$^~=]*) *(\'?"?)(.*?)\\4 *\\]/,/^(:)([\\w-]+)\\("?\'?(.*?(\\(.*?\\))?[^(]*?)"?\'?\\)/,1q 47("^([:.#]*)("+C+"+)")],3G:G(a,c,b){H d,2b=[];1Y(a&&a!=d){d=a;H f=E.1A(a,c,b);a=f.t.1o(/^\\s*,\\s*/,"");2b=b?c=f.r:E.1S(2b,f.r)}I 2b},1X:G(t,o){9(1n t!="1M")I[t];9(o&&!o.1z)o=S;o=o||U;H d=[o],2f=[],3n;1Y(t&&3n!=t){H r=[];3n=t;t=E.33(t);H l=P;H g=6j;H m=g.2L(t);9(m){H p=m[1].26();M(H i=0;d[i];i++)M(H c=d[i].1t;c;c=c.2i)9(c.1z==1&&(p=="*"||c.Y.26()==p.26()))r.1a(c);d=r;t=t.1o(g,"");9(t.1e(" ")==0)6r;l=Q}J{g=/^([>+~])\\s*(\\w*)/i;9((m=g.2L(t))!=S){r=[];H p=m[2],1S={};m=m[1];M(H j=0,31=d.L;j<31;j++){H n=m=="~"||m=="+"?d[j].2i:d[j].1t;M(;n;n=n.2i)9(n.1z==1){H h=E.K(n);9(m=="~"&&1S[h])22;9(!p||n.Y.26()==p.26()){9(m=="~")1S[h]=Q;r.1a(n)}9(m=="+")22}}d=r;t=E.33(t.1o(g,""));l=Q}}9(t&&!l){9(!t.1e(",")){9(o==d[0])d.44();2f=E.1S(2f,d);r=d=[o];t=" "+t.67(1,t.L)}J{H k=6i;H m=k.2L(t);9(m){m=[0,m[2],m[3],m[1]]}J{k=6h;m=k.2L(t)}m[2]=m[2].1o(/\\\\/g,"");H f=d[d.L-1];9(m[1]=="#"&&f&&f.42&&!E.4a(f)){H q=f.42(m[2]);9((E.V.1g||E.V.3a)&&q&&1n q.1T=="1M"&&q.1T!=m[2])q=E(\'[@1T="\'+m[2]+\'"]\',f)[0];d=r=q&&(!m[3]||E.Y(q,m[3]))?[q]:[]}J{M(H i=0;d[i];i++){H a=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];9(a=="*"&&d[i].Y.2F()=="5w")a="3f";r=E.1S(r,d[i].4q(a))}9(m[1]==".")r=E.4W(r,m[2]);9(m[1]=="#"){H e=[];M(H i=0;r[i];i++)9(r[i].4l("1T")==m[2]){e=[r[i]];22}r=e}d=r}t=t.1o(k,"")}}9(t){H b=E.1A(t,r);d=r=b.r;t=E.33(b.t)}}9(t)d=[];9(d&&o==d[0])d.44();2f=E.1S(2f,d);I 2f},4W:G(r,m,a){m=" "+m+" ";H c=[];M(H i=0;r[i];i++){H b=(" "+r[i].1m+" ").1e(m)>=0;9(!a&&b||a&&!b)c.1a(r[i])}I c},1A:G(t,r,h){H d;1Y(t&&t!=d){d=t;H p=E.68,m;M(H i=0;p[i];i++){m=p[i].2L(t);9(m){t=t.7O(m[0].L);m[2]=m[2].1o(/\\\\/g,"");22}}9(!m)22;9(m[1]==":"&&m[2]=="5T")r=E.1A(m[3],r,Q).r;J 9(m[1]==".")r=E.4W(r,m[2],h);J 9(m[1]=="["){H g=[],N=m[3];M(H i=0,31=r.L;i<31;i++){H a=r[i],z=a[E.5o[m[2]]||m[2]];9(z==S||/6B|3g|29/.12(m[2]))z=E.1y(a,m[2])||\'\';9((N==""&&!!z||N=="="&&z==m[5]||N=="!="&&z!=m[5]||N=="^="&&z&&!z.1e(m[5])||N=="$="&&z.67(z.L-m[5].L)==m[5]||(N=="*="||N=="~=")&&z.1e(m[5])>=0)^h)g.1a(a)}r=g}J 9(m[1]==":"&&m[2]=="2R-46"){H e={},g=[],12=/(\\d*)n\\+?(\\d*)/.2L(m[3]=="6f"&&"2n"||m[3]=="6d"&&"2n+1"||!/\\D/.12(m[3])&&"n+"+m[3]||m[3]),3o=(12[1]||1)-0,d=12[2]-0;M(H i=0,31=r.L;i<31;i++){H j=r[i],14=j.14,1T=E.K(14);9(!e[1T]){H c=1;M(H n=14.1t;n;n=n.2i)9(n.1z==1)n.4U=c++;e[1T]=Q}H b=P;9(3o==1){9(d==0||j.4U==d)b=Q}J 9((j.4U+d)%3o==0)b=Q;9(b^h)g.1a(j)}r=g}J{H f=E.55[m[1]];9(1n f!="1M")f=E.55[m[1]][m[2]];f=3p("P||G(a,i){I "+f+"}");r=E.2T(r,f,h)}}I{r:r,t:t}},4e:G(b,c){H d=[];H a=b[c];1Y(a&&a!=U){9(a.1z==1)d.1a(a);a=a[c]}I d},2R:G(a,e,c,b){e=e||1;H d=0;M(;a;a=a[c])9(a.1z==1&&++d==e)22;I a},5c:G(n,a){H r=[];M(;n;n=n.2i){9(n.1z==1&&(!a||n!=a))r.1a(n)}I r}});E.1h={1f:G(g,e,c,h){9(E.V.1g&&g.41!=11)g=17;9(!c.2r)c.2r=6.2r++;9(h!=11){H d=c;c=G(){I d.15(6,1k)};c.K=h;c.2r=d.2r}H i=e.2p(".");e=i[0];c.N=i[1];H b=E.K(g,"2A")||E.K(g,"2A",{});H f=E.K(g,"2m",G(){H a;9(1n E=="11"||E.1h.4T)I a;a=E.1h.2m.15(g,1k);I a});H j=b[e];9(!j){j=b[e]={};9(g.4R)g.4R(e,f,P);J g.7N("40"+e,f)}j[c.2r]=c;6.23[e]=Q},2r:1,23:{},2e:G(d,c,b){H e=E.K(d,"2A"),2O,4J;9(1n c=="1M"){H a=c.2p(".");c=a[0]}9(e){9(c&&c.N){b=c.4P;c=c.N}9(!c){M(c 1j e)6.2e(d,c)}J 9(e[c]){9(b)2G e[c][b.2r];J M(b 1j e[c])9(!a[1]||e[c][b].N==a[1])2G e[c][b];M(2O 1j e[c])22;9(!2O){9(d.4O)d.4O(c,E.K(d,"2m"),P);J d.7M("40"+c,E.K(d,"2m"));2O=S;2G e[c]}}M(2O 1j e)22;9(!2O){E.30(d,"2A");E.30(d,"2m")}}},1L:G(d,b,e,c,f){b=E.2h(b||[]);9(!e){9(6.23[d])E("*").1f([17,U]).1L(d,b)}J{H a,2O,1b=E.1p(e[d]||S),4N=!b[0]||!b[0].2B;9(4N)b.4Z(6.4M({N:d,2o:e}));9(E.1p(E.K(e,"2m")))a=E.K(e,"2m").15(e,b);9(!1b&&e["40"+d]&&e["40"+d].15(e,b)===P)a=P;9(4N)b.44();9(f&&f.15(e,b)===P)a=P;9(1b&&c!==P&&a!==P&&!(E.Y(e,\'a\')&&d=="4L")){6.4T=Q;e[d]()}6.4T=P}I a},2m:G(d){H a;d=E.1h.4M(d||17.1h||{});H b=d.N.2p(".");d.N=b[0];H c=E.K(6,"2A")&&E.K(6,"2A")[d.N],3m=1C.3x.2s.3c(1k,1);3m.4Z(d);M(H j 1j c){3m[0].4P=c[j];3m[0].K=c[j].K;9(!b[1]||c[j].N==b[1]){H e=c[j].15(6,3m);9(a!==P)a=e;9(e===P){d.2B();d.3L()}}}9(E.V.1g)d.2o=d.2B=d.3L=d.4P=d.K=S;I a},4M:G(c){H a=c;c=E.1i({},a);c.2B=G(){9(a.2B)a.2B();a.7I=P};c.3L=G(){9(a.3L)a.3L();a.7H=Q};9(!c.2o&&c.64)c.2o=c.64;9(E.V.1H&&c.2o.1z==3)c.2o=a.2o.14;9(!c.4H&&c.4G)c.4H=c.4G==c.2o?c.7E:c.4G;9(c.63==S&&c.62!=S){H e=U.35,b=U.1K;c.63=c.62+(e&&e.2D||b.2D||0);c.7C=c.7B+(e&&e.2z||b.2z||0)}9(!c.3R&&(c.60||c.5Z))c.3R=c.60||c.5Z;9(!c.5Y&&c.5W)c.5Y=c.5W;9(!c.3R&&c.2y)c.3R=(c.2y&1?1:(c.2y&2?3:(c.2y&4?2:0)));I c}};E.1b.1i({3Q:G(c,a,b){I c=="5V"?6.2P(c,a,b):6.O(G(){E.1h.1f(6,c,b||a,b&&a)})},2P:G(d,b,c){I 6.O(G(){E.1h.1f(6,d,G(a){E(6).5U(a);I(c||b).15(6,1k)},c&&b)})},5U:G(a,b){I 6.O(G(){E.1h.2e(6,a,b)})},1L:G(c,a,b){I 6.O(G(){E.1h.1L(c,a,6,Q,b)})},7y:G(c,a,b){9(6[0])I E.1h.1L(c,a,6[0],P,b)},25:G(){H a=1k;I 6.4L(G(e){6.4E=0==6.4E?1:0;e.2B();I a[6.4E].15(6,[e])||P})},7x:G(f,g){G 4x(e){H p=e.4H;1Y(p&&p!=6)2c{p=p.14}27(e){p=6};9(p==6)I P;I(e.N=="4w"?f:g).15(6,[e])}I 6.4w(4x).5S(4x)},2d:G(f){5R();9(E.3W)f.15(U,[E]);J E.3i.1a(G(){I f.15(6,[E])});I 6}});E.1i({3W:P,3i:[],2d:G(){9(!E.3W){E.3W=Q;9(E.3i){E.O(E.3i,G(){6.15(U)});E.3i=S}9(E.V.39||E.V.3a)U.4O("5Q",E.2d,P);9(!17.7v.L)E(17).37(G(){E("#4C").2e()})}}});E.O(("7u,7o,37,7n,6n,5V,4L,7m,"+"7l,7j,7i,4w,5S,7p,24,"+"50,7q,7r,7s,3U").2p(","),G(i,o){E.1b[o]=G(f){I f?6.3Q(o,f):6.1L(o)}});H x=P;G 5R(){9(x)I;x=Q;9(E.V.39||E.V.3a)U.4R("5Q",E.2d,P);J 9(E.V.1g){U.7e("<7d"+"7c 1T=4C 7b=Q "+"3g=//:><\\/1P>");H a=U.42("4C");9(a)a.5O=G(){9(6.2C!="1l")I;E.2d()};a=S}J 9(E.V.1H)E.4B=41(G(){9(U.2C=="5N"||U.2C=="1l"){4A(E.4B);E.4B=S;E.2d()}},10);E.1h.1f(17,"37",E.2d)}E.1b.1i({37:G(g,d,c){9(E.1p(g))I 6.3Q("37",g);H e=g.1e(" ");9(e>=0){H i=g.2s(e,g.L);g=g.2s(0,e)}c=c||G(){};H f="4F";9(d)9(E.1p(d)){c=d;d=S}J{d=E.3f(d);f="5M"}H h=6;E.3w({1u:g,N:f,K:d,1l:G(a,b){9(b=="1E"||b=="5L")h.4n(i?E("<1r/>").3e(a.4p.1o(/<1P(.|\\s)*?\\/1P>/g,"")).1X(i):a.4p);58(G(){h.O(c,[a.4p,b,a])},13)}});I 6},7a:G(){I E.3f(6.5K())},5K:G(){I 6.1W(G(){I E.Y(6,"3B")?E.2h(6.79):6}).1A(G(){I 6.2J&&!6.36&&(6.2K||/24|6a/i.12(6.Y)||/2t|1O|51/i.12(6.N))}).1W(G(i,c){H b=E(6).2V();I b==S?S:b.1d==1C?E.1W(b,G(i,a){I{2J:c.2J,1N:a}}):{2J:c.2J,1N:b}}).28()}});E.O("5J,5I,5H,6e,5G,5F".2p(","),G(i,o){E.1b[o]=G(f){I 6.3Q(o,f)}});H B=(1q 3v).3u();E.1i({28:G(d,b,a,c){9(E.1p(b)){a=b;b=S}I E.3w({N:"4F",1u:d,K:b,1E:a,1Z:c})},78:G(b,a){I E.28(b,S,a,"1P")},77:G(c,b,a){I E.28(c,b,a,"3S")},76:G(d,b,a,c){9(E.1p(b)){a=b;b={}}I E.3w({N:"5M",1u:d,K:b,1E:a,1Z:c})},80:G(a){E.1i(E.4u,a)},4u:{23:Q,N:"4F",2H:0,5E:"75/x-73-3B-72",6l:Q,3h:Q,K:S},4b:{},3w:G(s){H f,48=/=(\\?|%3F)/g,1s,K;s=E.1i(Q,s,E.1i(Q,{},E.4u,s));9(s.K&&s.6l&&1n s.K!="1M")s.K=E.3f(s.K);H q=s.1u.1e("?");9(q>-1){s.K=(s.K?s.K+"&":"")+s.1u.2s(q+1);s.1u=s.1u.2s(0,q)}9(s.1Z=="5b"){9(!s.K||!s.K.1U(48))s.K=(s.K?s.K+"&":"")+(s.5b||"6X")+"=?";s.1Z="3S"}9(s.1Z=="3S"&&s.K&&s.K.1U(48)){f="5b"+B++;s.K=s.K.1o(48,"="+f);s.1Z="1P";17[f]=G(a){K=a;1E();17[f]=11;2c{2G 17[f]}27(e){}}}9(s.1Z=="1P"&&s.1I==S)s.1I=P;9(s.1I===P&&s.N.2F()=="28")s.K=(s.K?s.K+"&":"")+"56="+(1q 3v()).3u();9(s.K&&s.N.2F()=="28"){s.1u+="?"+s.K;s.K=S}9(s.23&&!E.5a++)E.1h.1L("5J");9(!s.1u.1e("6W")&&s.1Z=="1P"){H h=U.4q("8g")[0];H g=U.5r("1P");g.3g=s.1u;9(!f&&(s.1E||s.1l)){H j=P;g.9Q=g.5O=G(){9(!j&&(!6.2C||6.2C=="5N"||6.2C=="1l")){j=Q;1E();1l();h.3k(g)}}}h.57(g);I}H k=P;H i=17.6V?1q 6V("9O.9N"):1q 6U();i.9M(s.N,s.1u,s.3h);9(s.K)i.5B("9J-9H",s.5E);9(s.5A)i.5B("9G-5z-9F",E.4b[s.1u]||"9E, 9C 9B 9z 5v:5v:5v 9y");i.5B("X-9w-9v","6U");9(s.6R)s.6R(i);9(s.23)E.1h.1L("5F",[i,s]);H c=G(a){9(!k&&i&&(i.2C==4||a=="2H")){k=Q;9(d){4A(d);d=S}1s=a=="2H"&&"2H"||!E.6Q(i)&&"3U"||s.5A&&E.6O(i,s.1u)&&"5L"||"1E";9(1s=="1E"){2c{K=E.6N(i,s.1Z)}27(e){1s="5t"}}9(1s=="1E"){H b;2c{b=i.5i("6M-5z")}27(e){}9(s.5A&&b)E.4b[s.1u]=b;9(!f)1E()}J E.5s(s,i,1s);1l();9(s.3h)i=S}};9(s.3h){H d=41(c,13);9(s.2H>0)58(G(){9(i){i.9p();9(!k)c("2H")}},s.2H)}2c{i.9n(s.K)}27(e){E.5s(s,i,S,e)}9(!s.3h)c();I i;G 1E(){9(s.1E)s.1E(K,1s);9(s.23)E.1h.1L("5G",[i,s])}G 1l(){9(s.1l)s.1l(i,1s);9(s.23)E.1h.1L("5H",[i,s]);9(s.23&&!--E.5a)E.1h.1L("5I")}},5s:G(s,a,b,e){9(s.3U)s.3U(a,b,e);9(s.23)E.1h.1L("6e",[a,s,e])},5a:0,6Q:G(r){2c{I!r.1s&&9l.9k=="52:"||(r.1s>=6K&&r.1s<9j)||r.1s==6J||E.V.1H&&r.1s==11}27(e){}I P},6O:G(a,c){2c{H b=a.5i("6M-5z");I a.1s==6J||b==E.4b[c]||E.V.1H&&a.1s==11}27(e){}I P},6N:G(r,b){H c=r.5i("9i-N");H d=b=="6y"||!b&&c&&c.1e("6y")>=0;H a=d?r.9h:r.4p;9(d&&a.35.34=="5t")6E"5t";9(b=="1P")E.5h(a);9(b=="3S")a=3p("("+a+")");I a},3f:G(a){H s=[];9(a.1d==1C||a.4d)E.O(a,G(){s.1a(3b(6.2J)+"="+3b(6.1N))});J M(H j 1j a)9(a[j]&&a[j].1d==1C)E.O(a[j],G(){s.1a(3b(j)+"="+3b(6))});J s.1a(3b(j)+"="+3b(a[j]));I s.65("&").1o(/%20/g,"+")}});E.1b.1i({1x:G(b,a){I b?6.1V({1G:"1x",2E:"1x",1v:"1x"},b,a):6.1A(":1O").O(G(){6.R.19=6.3d?6.3d:"";9(E.18(6,"19")=="2j")6.R.19="2U"}).1B()},1w:G(b,a){I b?6.1V({1G:"1w",2E:"1w",1v:"1w"},b,a):6.1A(":3X").O(G(){6.3d=6.3d||E.18(6,"19");9(6.3d=="2j")6.3d="2U";6.R.19="2j"}).1B()},6G:E.1b.25,25:G(a,b){I E.1p(a)&&E.1p(b)?6.6G(a,b):a?6.1V({1G:"25",2E:"25",1v:"25"},a,b):6.O(G(){E(6)[E(6).3j(":1O")?"1x":"1w"]()})},9c:G(b,a){I 6.1V({1G:"1x"},b,a)},9a:G(b,a){I 6.1V({1G:"1w"},b,a)},99:G(b,a){I 6.1V({1G:"25"},b,a)},98:G(b,a){I 6.1V({1v:"1x"},b,a)},97:G(b,a){I 6.1V({1v:"1w"},b,a)},95:G(c,a,b){I 6.1V({1v:a},c,b)},1V:G(j,h,g,f){H i=E.6C(h,g,f);I 6[i.3I===P?"O":"3I"](G(){i=E.1i({},i);H d=E(6).3j(":1O"),3r=6;M(H p 1j j){9(j[p]=="1w"&&d||j[p]=="1x"&&!d)I E.1p(i.1l)&&i.1l.15(6);9(p=="1G"||p=="2E"){i.19=E.18(6,"19");i.2N=6.R.2N}}9(i.2N!=S)6.R.2N="1O";i.3H=E.1i({},j);E.O(j,G(c,a){H e=1q E.2w(3r,i,c);9(/25|1x|1w/.12(a))e[a=="25"?d?"1x":"1w":a](j);J{H b=a.3z().1U(/^([+-]?)([\\d.]+)(.*)$/),1Q=e.2b(Q)||0;9(b){1B=3K(b[2]),2k=b[3]||"2I";9(2k!="2I"){3r.R[c]=1B+2k;1Q=(1B/e.2b(Q))*1Q;3r.R[c]=1Q+2k}9(b[1])1B=((b[1]=="-"?-1:1)*1B)+1Q;e.3J(1Q,1B,2k)}J e.3J(1Q,a,"")}});I Q})},3I:G(a,b){9(!b){b=a;a="2w"}9(!1k.L)I A(6[0],a);I 6.O(G(){9(b.1d==1C)A(6,a,b);J{A(6,a).1a(b);9(A(6,a).L==1)b.15(6)}})},9f:G(){H a=E.2Z;I 6.O(G(){M(H i=0;i<a.L;i++)9(a[i].T==6)a.6D(i--,1)}).5p()}});H A=G(b,c,a){9(!b)I;H q=E.K(b,c+"3I");9(!q||a)q=E.K(b,c+"3I",a?E.2h(a):[]);I q};E.1b.5p=G(a){a=a||"2w";I 6.O(G(){H q=A(6,a);q.44();9(q.L)q[0].15(6)})};E.1i({6C:G(b,a,c){H d=b&&b.1d==8Z?b:{1l:c||!c&&a||E.1p(b)&&b,2a:b,3E:c&&a||a&&a.1d!=8Y&&a};d.2a=(d.2a&&d.2a.1d==4X?d.2a:{8X:8W,8U:6K}[d.2a])||9o;d.3C=d.1l;d.1l=G(){E(6).5p();9(E.1p(d.3C))d.3C.15(6)};I d},3E:{6I:G(p,n,b,a){I b+a*p},5q:G(p,n,b,a){I((-32.8S(p*32.8R)/2)+0.5)*a+b}},2Z:[],2w:G(b,c,a){6.W=c;6.T=b;6.1c=a;9(!c.3A)c.3A={}}});E.2w.3x={4j:G(){9(6.W.2M)6.W.2M.15(6.T,[6.2l,6]);(E.2w.2M[6.1c]||E.2w.2M.6w)(6);9(6.1c=="1G"||6.1c=="2E")6.T.R.19="2U"},2b:G(a){9(6.T[6.1c]!=S&&6.T.R[6.1c]==S)I 6.T[6.1c];H r=3K(E.3O(6.T,6.1c,a));I r&&r>-8P?r:3K(E.18(6.T,6.1c))||0},3J:G(c,b,e){6.5n=(1q 3v()).3u();6.1Q=c;6.1B=b;6.2k=e||6.2k||"2I";6.2l=6.1Q;6.4g=6.4i=0;6.4j();H f=6;G t(){I f.2M()}t.T=6.T;E.2Z.1a(t);9(E.2Z.L==1){H d=41(G(){H a=E.2Z;M(H i=0;i<a.L;i++)9(!a[i]())a.6D(i--,1);9(!a.L)4A(d)},13)}},1x:G(){6.W.3A[6.1c]=E.1y(6.T.R,6.1c);6.W.1x=Q;6.3J(0,6.2b());9(6.1c=="2E"||6.1c=="1G")6.T.R[6.1c]="8N";E(6.T).1x()},1w:G(){6.W.3A[6.1c]=E.1y(6.T.R,6.1c);6.W.1w=Q;6.3J(6.2b(),0)},2M:G(){H t=(1q 3v()).3u();9(t>6.W.2a+6.5n){6.2l=6.1B;6.4g=6.4i=1;6.4j();6.W.3H[6.1c]=Q;H a=Q;M(H i 1j 6.W.3H)9(6.W.3H[i]!==Q)a=P;9(a){9(6.W.19!=S){6.T.R.2N=6.W.2N;6.T.R.19=6.W.19;9(E.18(6.T,"19")=="2j")6.T.R.19="2U"}9(6.W.1w)6.T.R.19="2j";9(6.W.1w||6.W.1x)M(H p 1j 6.W.3H)E.1y(6.T.R,p,6.W.3A[p])}9(a&&E.1p(6.W.1l))6.W.1l.15(6.T);I P}J{H n=t-6.5n;6.4i=n/6.W.2a;6.4g=E.3E[6.W.3E||(E.3E.5q?"5q":"6I")](6.4i,n,0,1,6.W.2a);6.2l=6.1Q+((6.1B-6.1Q)*6.4g);6.4j()}I Q}};E.2w.2M={2D:G(a){a.T.2D=a.2l},2z:G(a){a.T.2z=a.2l},1v:G(a){E.1y(a.T.R,"1v",a.2l)},6w:G(a){a.T.R[a.1c]=a.2l+a.2k}};E.1b.6m=G(){H c=0,3y=0,T=6[0],5m;9(T)8L(E.V){H b=E.18(T,"2W")=="4D",1D=T.14,21=T.21,2Q=T.3N,5y=1H&&!b&&3q(4f)<8J;9(T.6v){5x=T.6v();1f(5x.1R+32.2Y(2Q.35.2D,2Q.1K.2D),5x.3y+32.2Y(2Q.35.2z,2Q.1K.2z));9(1g){H d=E("4n").18("9L");d=(d=="8G"||E.5f&&3q(4f)>=7)&&2||d;1f(-d,-d)}}J{1f(T.5j,T.5C);1Y(21){1f(21.5j,21.5C);9(39&&/^t[d|h]$/i.12(1D.34)||!5y)d(21);9(5y&&!b&&E.18(21,"2W")=="4D")b=Q;21=21.21}1Y(1D.34&&/^1K|4n$/i.12(1D.34)){9(/^8D|1F-9R.*$/i.12(E.18(1D,"19")))1f(-1D.2D,-1D.2z);9(39&&E.18(1D,"2N")!="3X")d(1D);1D=1D.14}9(1H&&b)1f(-2Q.1K.5j,-2Q.1K.5C)}5m={3y:3y,1R:c}}I 5m;G d(a){1f(E.18(a,"8C"),E.18(a,"9T"))}G 1f(l,t){c+=3q(l)||0;3y+=3q(t)||0}}})();',62,615,'||||||this|||if|||||||||||||||||||||||||||||||||function|var|return|else|data|length|for|type|each|false|true|style|null|elem|document|browser|options||nodeName|||undefined|test||parentNode|apply|jQuery|window|css|display|push|fn|prop|constructor|indexOf|add|msie|event|extend|in|arguments|complete|className|typeof|replace|isFunction|new|div|status|firstChild|url|opacity|hide|show|attr|nodeType|filter|end|Array|parent|success|table|height|safari|cache|tbody|body|trigger|string|value|hidden|script|start|left|merge|id|match|animate|map|find|while|dataType||offsetParent|break|global|select|toggle|toUpperCase|catch|get|selected|duration|cur|try|ready|remove|done|al|makeArray|nextSibling|none|unit|now|handle||target|split|swap|guid|slice|text|stack|pushStack|fx|tb|button|scrollTop|events|preventDefault|readyState|scrollLeft|width|toLowerCase|delete|timeout|px|name|checked|exec|step|overflow|ret|one|doc|nth|inArray|grep|block|val|position|childNodes|max|timers|removeData|rl|Math|trim|tagName|documentElement|disabled|load|insertBefore|mozilla|opera|encodeURIComponent|call|oldblock|append|param|src|async|readyList|is|removeChild|color|args|last|first|eval|parseInt|self|domManip|has|getTime|Date|ajax|prototype|top|toString|orig|form|old|innerHTML|easing||multiFilter|curAnim|queue|custom|parseFloat|stopPropagation|defaultView|ownerDocument|curCSS|getComputedStyle|bind|which|json|String|error|static|isReady|visible|oWidth|oHeight|on|setInterval|getElementById|currentStyle|shift|ol|child|RegExp|jsre|input|isXMLDoc|lastModified|previousSibling|jquery|dir|version|pos|styleFloat|state|update|tr|getAttribute|el|html|empty|responseText|getElementsByTagName|float|radio|runtimeStyle|ajaxSettings|visibility|mouseover|handleHover|getPropertyValue|selectedIndex|clearInterval|safariTimer|__ie_init|absolute|lastToggle|GET|fromElement|relatedTarget|clean|index|init|click|fix|evt|removeEventListener|handler|andSelf|addEventListener|cloneNode|triggered|nodeIndex|unique|classFilter|Number|prevObject|unshift|submit|password|file|after|removeAttribute|expr|_|appendChild|setTimeout|client|active|jsonp|sibling|win|deep|boxModel|cssFloat|globalEval|getResponseHeader|offsetLeft|lastChild|wrapAll|results|startTime|props|dequeue|swing|createElement|handleError|parsererror|checkbox|00|object|box|safari2|Modified|ifModified|setRequestHeader|offsetTop|col|contentType|ajaxSend|ajaxSuccess|ajaxComplete|ajaxStop|ajaxStart|serializeArray|notmodified|POST|loaded|onreadystatechange|appendTo|DOMContentLoaded|bindReady|mouseout|not|unbind|unload|ctrlKey|removeAttr|metaKey|keyCode|charCode|Width|clientX|pageX|srcElement|join|outerHTML|substr|parse|zoom|textarea|reset|image|odd|ajaxError|even|before|quickClass|quickID|quickChild|prepend|processData|offset|scroll|execScript|contents|uuid|continue|textContent|clone|setArray|getBoundingClientRect|_default|nodeValue|xml|100|alpha|href|speed|splice|throw|createTextNode|_toggle|replaceWith|linear|304|200|colgroup|Last|httpData|httpNotModified|fl|httpSuccess|beforeSend|fieldset|webkit|XMLHttpRequest|ActiveXObject|http|callback|img|br|attributes|abbr|urlencoded|www|pixelLeft|application|post|getJSON|getScript|elements|serialize|defer|ipt|scr|write|clientWidth|hasClass|clientHeight|mousemove|mouseup|relative|mousedown|dblclick|resize|focus|change|keydown|keypress|keyup|FORM|blur|frames|right|hover|triggerHandler|offsetWidth|offsetHeight|clientY|pageY|border|toElement|padding|Left|cancelBubble|returnValue|Right|Bottom|Top|detachEvent|attachEvent|substring|animated|line|header|weight|font|enabled|innerText|contains|only|eq|gt|ajaxSetup|lt|size|uFFFF|u0128|417|inner|Height|toggleClass|removeClass|addClass|replaceAll|insertAfter|prependTo|contentWindow|contentDocument|head|wrap|iframe|children|noConflict|siblings|prevAll|nextAll|prev|wrapInner|next|parents|maxLength|maxlength|readOnly|Boolean|readonly|class|htmlFor|CSS1Compat|compatMode|compatible|borderLeftWidth|inline|ie|ra|medium|it|rv|522|userAgent|with|navigator|1px|concat|10000|array|PI|cos|ig|fast|NaN|600|slow|Function|Object|setAttribute|reverse|changed|be|can|fadeTo|property|fadeOut|fadeIn|slideToggle|slideUp|getAttributeNode|slideDown|method|action|stop|cssText|responseXML|content|300|protocol|location|option|send|400|abort|th|td|cap|colg|tfoot|With|Requested|thead|GMT|1970|leg|Jan|01|opt|Thu|Since|If|Type|area|Content|hr|borderWidth|open|XMLHTTP|Microsoft|meta|onload|row|link|borderTopWidth|specified'.split('|'),0,{}))
/* jQuery Calendar v2.7
Written by Marc Grabanski (m@marcgrabanski.com) and enhanced by Keith Wood (kbwood@iprimus.com.au).
Copyright (c) 2007 Marc Grabanski (http://marcgrabanski.com/code/jquery-calendar)
Dual licensed under the GPL (http://www.gnu.org/licenses/gpl-3.0.txt) and
CC (http://creativecommons.org/licenses/by/3.0/) licenses. "Share or Remix it but please Attribute the authors."
Date: 09-03-2007 */
/* PopUp Calendar manager.
Use the singleton instance of this class, popUpCal, to interact with the calendar.
Settings for (groups of) calendars are maintained in an instance object
(PopUpCalInstance), allowing multiple different settings on the same page. */
function PopUpCal() {
this._nextId = 0; // Next ID for a calendar instance
this._inst = []; // List of instances indexed by ID
this._curInst = null; // The current instance in use
this._disabledInputs = []; // List of calendar inputs that have been disabled
this._popUpShowing = false; // True if the popup calendar is showing , false if not
this._inDialog = false; // True if showing within a "dialog", false if not
this.regional = []; // Available regional settings, indexed by language code
this.regional[''] = { // Default regional settings
clearText: 'Clear', // Display text for clear link
closeText: 'Close', // Display text for close link
prevText: '<Prev', // Display text for previous month link
nextText: 'Next>', // Display text for next month link
currentText: 'Today', // Display text for current month link
dayNames: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Names of days starting at Sunday
monthNames: ['January','February','March','April','May','June',
'July','August','September','October','November','December'], // Names of months
dateFormat: 'DMY/' // First three are day, month, year in the required order,
// fourth (optional) is the separator, e.g. US would be 'MDY/', ISO would be 'YMD-'
};
this._defaults = { // Global defaults for all the calendar instances
autoPopUp: 'focus', // 'focus' for popup on focus,
// 'button' for trigger button, or 'both' for either
appendText: '', // Display text following the input box, e.g. showing the format
buttonText: '...', // Text for trigger button
buttonImage: '', // URL for trigger button image
buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
closeAtTop: true, // True to have the clear/close at the top,
// false to have them at the bottom
hideIfNoPrevNext: false, // True to hide next/previous month links
// if not applicable, false to just disable them
changeMonth: true, // True if month can be selected directly, false if only prev/next
changeYear: true, // True if year can be selected directly, false if only prev/next
yearRange: '-10:+10', // Range of years to display in drop-down,
// either relative to current year (-nn:+nn) or absolute (nnnn:nnnn)
firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
changeFirstDay: true, // True to click on day name to change, false to remain as set
showOtherMonths: false, // True to show dates in other months, false to leave blank
minDate: null, // The earliest selectable date, or null for no limit
maxDate: null, // The latest selectable date, or null for no limit
speed: 'medium', // Speed of display/closure
customDate: null, // Function that takes a date and returns an array with
// [0] = true if selectable, false if not,
// [1] = custom CSS class name(s) or '', e.g. popUpCal.noWeekends
fieldSettings: null, // Function that takes an input field and
// returns a set of custom settings for the calendar
onSelect: null // Define a callback function when a date is selected
};
$.extend(this._defaults, this.regional['']);
this._calendarDiv = $('<div id="calendar_div"></div>');
$(document.body).append(this._calendarDiv);
$(document.body).mousedown(this._checkExternalClick);
}
$.extend(PopUpCal.prototype, {
/* Register a new calendar instance - with custom settings. */
_register: function(inst) {
var id = this._nextId++;
this._inst[id] = inst;
return id;
},
/* Retrieve a particular calendar instance based on its ID. */
_getInst: function(id) {
return this._inst[id] || id;
},
/* Override the default settings for all instances of the calendar.
@param settings object - the new settings to use as defaults (anonymous object)
@return void */
setDefaults: function(settings) {
$.extend(this._defaults, settings || {});
},
/* Handle keystrokes. */
_doKeyDown: function(e) {
var inst = popUpCal._getInst(this._calId);
if (popUpCal._popUpShowing) {
switch (e.keyCode) {
case 9: popUpCal.hideCalendar(inst, '');
break; // hide on tab out
case 13: popUpCal._selectDate(inst);
break; // select the value on enter
case 27: popUpCal.hideCalendar(inst, inst._get('speed'));
break; // hide on escape
case 33: popUpCal._adjustDate(inst, -1, (e.ctrlKey ? 'Y' : 'M'));
break; // previous month/year on page up/+ ctrl
case 34: popUpCal._adjustDate(inst, +1, (e.ctrlKey ? 'Y' : 'M'));
break; // next month/year on page down/+ ctrl
case 35: if (e.ctrlKey) popUpCal._clearDate(inst);
break; // clear on ctrl+end
case 36: if (e.ctrlKey) popUpCal._gotoToday(inst);
break; // current on ctrl+home
case 37: if (e.ctrlKey) popUpCal._adjustDate(inst, -1, 'D');
break; // -1 day on ctrl+left
case 38: if (e.ctrlKey) popUpCal._adjustDate(inst, -7, 'D');
break; // -1 week on ctrl+up
case 39: if (e.ctrlKey) popUpCal._adjustDate(inst, +1, 'D');
break; // +1 day on ctrl+right
case 40: if (e.ctrlKey) popUpCal._adjustDate(inst, +7, 'D');
break; // +1 week on ctrl+down
}
}
else if (e.keyCode == 36 && e.ctrlKey) { // display the calendar on ctrl+home
popUpCal.showFor(this);
}
},
/* Filter entered characters. */
_doKeyPress: function(e) {
var inst = popUpCal._getInst(this._calId);
var chr = String.fromCharCode(e.charCode == undefined ? e.keyCode : e.charCode);
return (chr < ' ' || chr == inst._get('dateFormat').charAt(3) ||
(chr >= '0' && chr <= '9')); // only allow numbers and separator
},
/* Attach the calendar to an input field. */
_connectCalendar: function(target, inst) {
var $input = $(target);
var appendText = inst._get('appendText');
if (appendText) {
$input.after('<span class="calendar_append">' + appendText + '</span>');
}
var autoPopUp = inst._get('autoPopUp');
if (autoPopUp == 'focus' || autoPopUp == 'both') { // pop-up calendar when in the marked field
$input.focus(this.showFor);
}
if (autoPopUp == 'button' || autoPopUp == 'both') { // pop-up calendar when button clicked
var buttonText = inst._get('buttonText');
var buttonImage = inst._get('buttonImage');
var buttonImageOnly = inst._get('buttonImageOnly');
var trigger = $(buttonImageOnly ? '<img class="calendar_trigger" src="' +
buttonImage + '" alt="' + buttonText + '" title="' + buttonText + '"/>' :
'<button type="button" class="calendar_trigger">' + (buttonImage != '' ?
'<img src="' + buttonImage + '" alt="' + buttonText + '" title="' + buttonText + '"/>' :
buttonText) + '</button>');
$input.wrap('<span class="calendar_wrap"></span>').after(trigger);
trigger.click(this.showFor);
}
$input.keydown(this._doKeyDown).keypress(this._doKeyPress);
$input[0]._calId = inst._id;
},
/* Attach an inline calendar to a div. */
_inlineCalendar: function(target, inst) {
$(target).append(inst._calendarDiv);
target._calId = inst._id;
var date = new Date();
inst._selectedDay = date.getDate();
inst._selectedMonth = date.getMonth();
inst._selectedYear = date.getFullYear();
popUpCal._adjustDate(inst);
},
/* Pop-up the calendar in a "dialog" box.
@param dateText string - the initial date to display (in the current format)
@param onSelect function - the function(dateText) to call when a date is selected
@param settings object - update the dialog calendar instance's settings (anonymous object)
@param pos int[2] - coordinates for the dialog's position within the screen
leave empty for default (screen centre)
@return void */
dialogCalendar: function(dateText, onSelect, settings, pos) {
var inst = this._dialogInst; // internal instance
if (!inst) {
inst = this._dialogInst = new PopUpCalInstance({}, false);
this._dialogInput = $('<input type="text" size="1" style="position: absolute; top: -100px;"/>');
this._dialogInput.keydown(this._doKeyDown);
$('body').append(this._dialogInput);
this._dialogInput[0]._calId = inst._id;
}
$.extend(inst._settings, settings || {});
this._dialogInput.val(dateText);
/* Cross Browser Positioning */
if (self.innerHeight) { // all except Explorer
windowWidth = self.innerWidth;
windowHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;
} else if (document.body) { // other Explorers
windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight;
}
this._pos = pos || // should use actual width/height below
[(windowWidth / 2) - 100, (windowHeight / 2) - 100];
// move input on screen for focus, but hidden behind dialog
this._dialogInput.css('left', this._pos[0] + 'px').css('top', this._pos[1] + 'px');
inst._settings.onSelect = onSelect;
this._inDialog = true;
this._calendarDiv.addClass('calendar_dialog');
this.showFor(this._dialogInput[0]);
if ($.blockUI) {
$.blockUI(this._calendarDiv);
}
},
/* Enable the input field(s) for entry.
@param inputs element/object - single input field or jQuery collection of input fields
@return void */
enableFor: function(inputs) {
inputs = (inputs.jquery ? inputs : $(inputs));
inputs.each(function() {
this.disabled = false;
$('../button.calendar_trigger', this).each(function() { this.disabled = false; });
$('../img.calendar_trigger',
this).css({opacity:'1.0',cursor:''});
var $this = this;
popUpCal._disabledInputs = $.map(popUpCal._disabledInputs,
function(value) { return (value == $this ? null : value); }); // delete entry
});
},
/* Disable the input field(s) from entry.
@param inputs element/object - single input field or jQuery collection of input fields
@return void */
disableFor: function(inputs) {
inputs = (inputs.jquery ? inputs : $(inputs));
inputs.each(function() {
this.disabled = true;
$('../button.calendar_trigger', this).each(function() { this.disabled = true; });
$('../img.calendar_trigger', this).css({opacity:'0.5',cursor:'default'});
var $this = this;
popUpCal._disabledInputs = $.map(popUpCal._disabledInputs,
function(value) { return (value == $this ? null : value); }); // delete entry
popUpCal._disabledInputs[popUpCal._disabledInputs.length] = this;
});
},
/* Update the settings for a calendar attached to an input field or division.
@param control element - the input field or div/span attached to the calendar
@param settings object - the new settings to update
@return void */
reconfigureFor: function(control, settings) {
var inst = this._getInst(control._calId);
if (inst) {
$.extend(inst._settings, settings || {});
this._updateCalendar(inst);
}
},
/* Set the date for a calendar attached to an input field or division.
@param control element - the input field or div/span attached to the calendar
@param date Date - the new date
@return void */
setDateFor: function(control, date) {
var inst = this._getInst(control._calId);
if (inst) {
inst._setDate(date);
}
},
/* Retrieve the date for a calendar attached to an input field or division.
@param control element - the input field or div/span attached to the calendar
@return Date - the current date */
getDateFor: function(control) {
var inst = this._getInst(control._calId);
return (inst ? inst._getDate() : null);
},
/* Pop-up the calendar for a given input field.
@param target element - the input field attached to the calendar
@return void */
showFor: function(target) {
var input = (target.nodeName && target.nodeName.toLowerCase() == 'input' ? target : this);
if (input.nodeName.toLowerCase() != 'input') { // find from button/image trigger
input = $('input', input.parentNode)[0];
}
if (popUpCal._lastInput == input) { // already here
return;
}
for (var i = 0; i < popUpCal._disabledInputs.length; i++) { // check not disabled
if (popUpCal._disabledInputs[i] == input) {
return;
}
}
var inst = popUpCal._getInst(input._calId);
popUpCal.hideCalendar(inst, '');
popUpCal._lastInput = input;
inst._setDateFromField(input);
if (popUpCal._inDialog) { // hide cursor
input.value = '';
}
if (!popUpCal._pos) { // position below input
popUpCal._pos = popUpCal._findPos(input);
popUpCal._pos[1] += input.offsetHeight;
}
inst._calendarDiv.css('position', (popUpCal._inDialog && $.blockUI ? 'static' : 'absolute')).
css('left', popUpCal._pos[0] + 'px').css('top', popUpCal._pos[1] + 'px');
popUpCal._pos = null;
var fieldSettings = inst._get('fieldSettings');
$.extend(inst._settings, (fieldSettings ? fieldSettings(input) : {}));
popUpCal._showCalendar(inst);
},
/* Construct and display the calendar. */
_showCalendar: function(id) {
var inst = this._getInst(id);
popUpCal._updateCalendar(inst);
if (!inst._inline) {
var speed = inst._get('speed');
inst._calendarDiv.show(speed, function() {
popUpCal._popUpShowing = true;
popUpCal._afterShow(inst);
});
if (speed == '') {
popUpCal._popUpShowing = true;
popUpCal._afterShow(inst);
}
if (inst._input[0].type != 'hidden') {
inst._input[0].focus();
}
this._curInst = inst;
}
},
/* Generate the calendar content. */
_updateCalendar: function(inst) {
inst._calendarDiv.empty().append(inst._generateCalendar());
if (inst._input && inst._input != 'hidden') {
inst._input[0].focus();
}
},
/* Tidy up after displaying the calendar. */
_afterShow: function(inst) {
if ($.browser.msie) { // fix IE < 7 select problems
$('#calendar_cover').css({width: inst._calendarDiv[0].offsetWidth + 4,
height: inst._calendarDiv[0].offsetHeight + 4});
}
/*// re-position on screen if necessary
var calDiv = inst._calendarDiv[0];
var pos = popUpCal._findPos(inst._input[0]);
if ((calDiv.offsetLeft + calDiv.offsetWidth) >
(document.body.clientWidth + document.body.scrollLeft)) {
inst._calendarDiv.css('left', (pos[0] + inst._input[0].offsetWidth - calDiv.offsetWidth) + 'px');
}
if ((calDiv.offsetTop + calDiv.offsetHeight) >
(document.body.clientHeight + document.body.scrollTop)) {
inst._calendarDiv.css('top', (pos[1] - calDiv.offsetHeight) + 'px');
}*/
},
/* Hide the calendar from view.
@param id string/object - the ID of the current calendar instance,
or the instance itself
@param speed string - the speed at which to close the calendar
@return void */
hideCalendar: function(id, speed) {
var inst = this._getInst(id);
if (popUpCal._popUpShowing) {
speed = (speed != null ? speed : inst._get('speed'));
inst._calendarDiv.hide(speed, function() {
popUpCal._tidyDialog(inst);
});
if (speed == '') {
popUpCal._tidyDialog(inst);
}
popUpCal._popUpShowing = false;
popUpCal._lastInput = null;
inst._settings.prompt = null;
if (popUpCal._inDialog) {
popUpCal._dialogInput.css('position', 'absolute').
css('left', '0px').css('top', '-100px');
if ($.blockUI) {
$.unblockUI();
$('body').append(this._calendarDiv);
}
}
popUpCal._inDialog = false;
}
popUpCal._curInst = null;
},
/* Tidy up after a dialog display. */
_tidyDialog: function(inst) {
inst._calendarDiv.removeClass('calendar_dialog');
$('.calendar_prompt', inst._calendarDiv).remove();
},
/* Close calendar if clicked elsewhere. */
_checkExternalClick: function(event) {
if (!popUpCal._curInst) {
return;
}
var target = $(event.target);
if( (target.parents("#calendar_div").length == 0)
&& (target.attr('class') != 'calendar_trigger')
&& popUpCal._popUpShowing
&& !(popUpCal._inDialog && $.blockUI) )
{
popUpCal.hideCalendar(popUpCal._curInst, '');
}
},
/* Adjust one of the date sub-fields. */
_adjustDate: function(id, offset, period) {
var inst = this._getInst(id);
inst._adjustDate(offset, period);
this._updateCalendar(inst);
},
/* Action for current link. */
_gotoToday: function(id) {
var date = new Date();
var inst = this._getInst(id);
inst._selectedDay = date.getDate();
inst._selectedMonth = date.getMonth();
inst._selectedYear = date.getFullYear();
this._adjustDate(inst);
},
/* Action for selecting a new month/year. */
_selectMonthYear: function(id, select, period) {
var inst = this._getInst(id);
inst._selectingMonthYear = false;
inst[period == 'M' ? '_selectedMonth' : '_selectedYear'] =
select.options[select.selectedIndex].value - 0;
this._adjustDate(inst);
},
/* Restore input focus after not changing month/year. */
_clickMonthYear: function(id) {
var inst = this._getInst(id);
if (inst._input && inst._selectingMonthYear && !$.browser.msie) {
inst._input[0].focus();
}
inst._selectingMonthYear = !inst._selectingMonthYear;
},
/* Action for changing the first week day. */
_changeFirstDay: function(id, a) {
var inst = this._getInst(id);
var dayNames = inst._get('dayNames');
var value = a.firstChild.nodeValue;
for (var i = 0; i < 7; i++) {
if (dayNames[i] == value) {
inst._settings.firstDay = i;
break;
}
}
this._updateCalendar(inst);
},
/* Action for selecting a day. */
_selectDay: function(id, td) {
var inst = this._getInst(id);
inst._selectedDay = $("a", td).html();
this._selectDate(id);
},
/* Erase the input field and hide the calendar. */
_clearDate: function(id) {
this._selectDate(id, '');
},
/* Update the input field with the selected date. */
_selectDate: function(id, dateStr) {
var inst = this._getInst(id);
dateStr = (dateStr != null ? dateStr : inst._formatDate());
if (inst._input) {
inst._input.val(dateStr);
}
var onSelect = inst._get('onSelect');
if (onSelect) {
onSelect(dateStr); // trigger custom callback
}
else {
inst._input.trigger('change'); // fire the change event
}
if (inst._inline) {
this._updateCalendar(inst);
}
else {
this.hideCalendar(inst, inst._get('speed'));
}
},
/* Set as customDate function to prevent selection of weekends.
@param date Date - the date to customise
@return [boolean, string] - is this date selectable?, what is its CSS class? */
noWeekends: function(date) {
var day = date.getDay();
return [(day > 0 && day < 6), ''];
},
/* Find an object's position on the screen. */
_findPos: function(obj) {
if (obj.type == 'hidden') {
obj = obj.nextSibling;
}
var curleft = curtop = 0;
if (obj.offsetParent) {
curleft = obj.offsetLeft;
curtop = obj.offsetTop;
while (obj = obj.offsetParent) {
var origcurleft = curleft;
curleft += obj.offsetLeft;
if (curleft < 0) {
curleft = origcurleft;
}
curtop += obj.offsetTop;
}
}
return [curleft,curtop];
}
});
/* Individualised settings for calendars applied to one or more related inputs.
Instances are managed and manipulated through the PopUpCal manager. */
function PopUpCalInstance(settings, inline) {
this._id = popUpCal._register(this);
this._selectedDay = 0;
this._selectedMonth = 0; // 0-11
this._selectedYear = 0; // 4-digit year
this._input = null; // The attached input field
this._inline = inline; // True if showing inline, false if used in a popup
this._calendarDiv = (!inline ? popUpCal._calendarDiv :
$('<div id="calendar_div_' + this._id + '" class="calendar_inline"></div>'));
if (inline) {
var date = new Date();
this._currentDay = date.getDate();
this._currentMonth = date.getMonth();
this._currentYear = date.getFullYear();
}
// customise the calendar object - uses manager defaults if not overridden
this._settings = $.extend({}, settings || {}); // clone
}
$.extend(PopUpCalInstance.prototype, {
/* Get a setting value, defaulting if necessary. */
_get: function(name) {
return (this._settings[name] != null ? this._settings[name] : popUpCal._defaults[name]);
},
/* Parse existing date and initialise calendar. */
_setDateFromField: function(input) {
this._input = $(input);
var dateFormat = this._get('dateFormat');
var currentDate = this._input.val().split(dateFormat.charAt(3));
if (currentDate.length == 3) {
this._currentDay = parseInt(currentDate[dateFormat.indexOf('D')], 10);
this._currentMonth = parseInt(currentDate[dateFormat.indexOf('M')], 10) - 1;
this._currentYear = parseInt(currentDate[dateFormat.indexOf('Y')], 10);
}
else {
var date = new Date();
this._currentDay = date.getDate();
this._currentMonth = date.getMonth();
this._currentYear = date.getFullYear();
}
this._selectedDay = this._currentDay;
this._selectedMonth = this._currentMonth;
this._selectedYear = this._currentYear;
this._adjustDate();
},
/* Set the date directly. */
_setDate: function(date) {
this._selectedDay = this._currentDay = date.getDate();
this._selectedMonth = this._currentMonth = date.getMonth();
this._selectedYear = this._currentYear = date.getFullYear();
this._adjustDate();
},
/* Retrieve the date directly. */
_getDate: function() {
return new Date(this._currentYear, this._currentMonth, this._currentDay);
},
/* Generate the HTML for the current state of the calendar. */
_generateCalendar: function() {
var today = new Date();
today = new Date(today.getFullYear(), today.getMonth(), today.getDate()); // clear time
// build the calendar HTML
var controls = '<div class="calendar_control">' +
'<a class="calendar_clear" onclick="popUpCal._clearDate(' + this._id + ');">' +
this._get('clearText') + '</a>' +
'<a class="calendar_close" onclick="popUpCal.hideCalendar(' + this._id + ');">' +
this._get('closeText') + '</a></div>';
var prompt = this._get('prompt');
var closeAtTop = this._get('closeAtTop');
var hideIfNoPrevNext = this._get('hideIfNoPrevNext');
// controls and links
var html = (prompt ? '<div class="calendar_prompt">' + prompt + '</div>' : '') +
(closeAtTop && !this._inline ? controls : '') + '<div class="calendar_links">' +
(this._canAdjustMonth(-1) ? '<a class="calendar_prev" ' +
'onclick="popUpCal._adjustDate(' + this._id + ', -1, \'M\');">' + this._get('prevText') + '</a>' :
(hideIfNoPrevNext ? '' : '<label class="calendar_prev">' + this._get('prevText') + '</label>')) +
(this._isInRange(today) ? '<a class="calendar_current" ' +
'onclick="popUpCal._gotoToday(' + this._id + ');">' + this._get('currentText') + '</a>' : '') +
(this._canAdjustMonth(+1) ? '<a class="calendar_next" ' +
'onclick="popUpCal._adjustDate(' + this._id + ', +1, \'M\');">' + this._get('nextText') + '</a>' :
(hideIfNoPrevNext ? '' : '<label class="calendar_next">' + this._get('nextText') + '</label>')) +
'</div><div class="calendar_header">';
var minDate = this._get('minDate');
var maxDate = this._get('maxDate');
// month selection
var monthNames = this._get('monthNames');
if (!this._get('changeMonth')) {
html += monthNames[this._selectedMonth] + ' ';
}
else {
var inMinYear = (minDate && minDate.getFullYear() == this._selectedYear);
var inMaxYear = (maxDate && maxDate.getFullYear() == this._selectedYear);
html += '<select class="calendar_newMonth" ' +
'onchange="popUpCal._selectMonthYear(' + this._id + ', this, \'M\');" ' +
'onclick="popUpCal._clickMonthYear(' + this._id + ');">';
for (var month = 0; month < 12; month++) {
if ((!inMinYear || month >= minDate.getMonth()) &&
(!inMaxYear || month <= maxDate.getMonth())) {
html += '<option value="' + month + '"' +
(month == this._selectedMonth ? ' selected="selected"' : '') +
'>' + monthNames[month] + '</option>';
}
}
html += '</select>';
}
// year selection
if (!this._get('changeYear')) {
html += this._selectedYear;
}
else {
// determine range of years to display
var years = this._get('yearRange').split(':');
var year = 0;
var endYear = 0;
if (years.length != 2) {
year = this._selectedYear - 10;
endYear = this._selectedYear + 10;
}
else if (years[0].charAt(0) == '+' || years[0].charAt(0) == '-') {
year = this._selectedYear + parseInt(years[0], 10);
endYear = this._selectedYear + parseInt(years[1], 10);
}
else {
year = parseInt(years[0], 10);
endYear = parseInt(years[1], 10);
}
year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
html += '<select class="calendar_newYear" onchange="popUpCal._selectMonthYear(' +
this._id + ', this, \'Y\');" ' + 'onclick="popUpCal._clickMonthYear(' +
this._id + ');">';
for (; year <= endYear; year++) {
html += '<option value="' + year + '"' +
(year == this._selectedYear ? ' selected="selected"' : '') +
'>' + year + '</option>';
}
html += '</select>';
}
html += '</div><table class="calendar" cellpadding="0" cellspacing="0"><thead>' +
'<tr class="calendar_titleRow">';
var firstDay = this._get('firstDay');
var changeFirstDay = this._get('changeFirstDay');
var dayNames = this._get('dayNames');
for (var dow = 0; dow < 7; dow++) { // days of the week
html += '<td>' + (!changeFirstDay ? '' : '<a onclick="popUpCal._changeFirstDay(' +
this._id + ', this);">') + dayNames[(dow + firstDay) % 7] +
(changeFirstDay ? '</a>' : '') + '</td>';
}
html += '</tr></thead><tbody>';
var daysInMonth = this._getDaysInMonth(this._selectedYear, this._selectedMonth);
this._selectedDay = Math.min(this._selectedDay, daysInMonth);
var leadDays = (this._getFirstDayOfMonth(this._selectedYear, this._selectedMonth) - firstDay + 7) % 7;
var currentDate = new Date(this._currentYear, this._currentMonth, this._currentDay);
var selectedDate = new Date(this._selectedYear, this._selectedMonth, this._selectedDay);
var printDate = new Date(this._selectedYear, this._selectedMonth, 1 - leadDays);
var numRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate
var customDate = this._get('customDate');
var showOtherMonths = this._get('showOtherMonths');
for (var row = 0; row < numRows; row++) { // create calendar rows
html += '<tr class="calendar_daysRow">';
for (var dow = 0; dow < 7; dow++) { // create calendar days
var customSettings = (customDate ? customDate(printDate) : [true, '']);
var otherMonth = (printDate.getMonth() != this._selectedMonth);
var unselectable = otherMonth || !customSettings[0] ||
(minDate && printDate < minDate) || (maxDate && printDate > maxDate);
html += '<td class="calendar_daysCell' +
((dow + firstDay + 6) % 7 >= 5 ? ' calendar_weekEndCell' : '') + // highlight weekends
(otherMonth ? ' calendar_otherMonth' : '') + // highlight days from other months
(printDate.getTime() == selectedDate.getTime() ? ' calendar_daysCellOver' : '') + // highlight selected day
(unselectable ? ' calendar_unselectable' : '') + // highlight unselectable days
(!otherMonth || showOtherMonths ? ' ' + customSettings[1] : '') + // highlight custom dates
(printDate.getTime() == currentDate.getTime() ? ' calendar_currentDay' : // highlight current day
(printDate.getTime() == today.getTime() ? ' calendar_today' : '')) + '"' + // highlight today (if different)
(unselectable ? '' : ' onmouseover="$(this).addClass(\'calendar_daysCellOver\');"' +
' onmouseout="$(this).removeClass(\'calendar_daysCellOver\');"' +
' onclick="popUpCal._selectDay(' + this._id + ', this);"') + '>' + // actions
(otherMonth ? (showOtherMonths ? printDate.getDate() : ' ') : // display for other months
(unselectable ? printDate.getDate() : '<a>' + printDate.getDate() + '</a>')) + '</td>'; // display for this month
printDate.setDate(printDate.getDate() + 1);
}
html += '</tr>';
}
html += '</tbody></table>' + (!closeAtTop && !this._inline ? controls : '') +
'<div style="clear: both;"></div>' + (!$.browser.msie ? '' :
'<!--[if lte IE 6.5]><iframe src="javascript:false;" class="calendar_cover"></iframe><![endif]-->');
return html;
},
/* Adjust one of the date sub-fields. */
_adjustDate: function(offset, period) {
var date = new Date(this._selectedYear + (period == 'Y' ? offset : 0),
this._selectedMonth + (period == 'M' ? offset : 0),
this._selectedDay + (period == 'D' ? offset : 0));
// ensure it is within the bounds set
var minDate = this._get('minDate');
var maxDate = this._get('maxDate');
date = (minDate && date < minDate ? minDate : date);
date = (maxDate && date > maxDate ? maxDate : date);
this._selectedDay = date.getDate();
this._selectedMonth = date.getMonth();
this._selectedYear = date.getFullYear();
},
/* Find the number of days in a given month. */
_getDaysInMonth: function(year, month) {
return 32 - new Date(year, month, 32).getDate();
},
/* Find the day of the week of the first of a month. */
_getFirstDayOfMonth: function(year, month) {
return new Date(year, month, 1).getDay();
},
/* Determines if we should allow a "next/prev" month display change. */
_canAdjustMonth: function(offset) {
var date = new Date(this._selectedYear, this._selectedMonth + offset, 1);
if (offset < 0) {
date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
}
return this._isInRange(date);
},
/* Is the given date in the accepted range? */
_isInRange: function(date) {
var minDate = this._get('minDate');
var maxDate = this._get('maxDate');
return ((!minDate || date >= minDate) && (!maxDate || date <= maxDate));
},
/* Format the given date for display. */
_formatDate: function() {
var day = this._currentDay = this._selectedDay;
var month = this._currentMonth = this._selectedMonth;
var year = this._currentYear = this._selectedYear;
month++; // adjust javascript month
var dateFormat = this._get('dateFormat');
var dateString = '';
for (var i = 0; i < 3; i++) {
dateString += dateFormat.charAt(3) +
(dateFormat.charAt(i) == 'D' ? (day < 10 ? '0' : '') + day :
(dateFormat.charAt(i) == 'M' ? (month < 10 ? '0' : '') + month :
(dateFormat.charAt(i) == 'Y' ? year : '?')));
}
return dateString.substring(dateFormat.charAt(3) ? 1 : 0);
}
});
/* Attach the calendar to a jQuery selection.
@param settings object - the new settings to use for this calendar instance (anonymous)
@return jQuery object - for chaining further calls */
$.fn.calendar = function(settings) {
return this.each(function() {
// check for settings on the control itself - in namespace 'cal:'
var inlineSettings = null;
for (attrName in popUpCal._defaults) {
var attrValue = this.getAttribute('cal:' + attrName);
if (attrValue) {
inlineSettings = inlineSettings || {};
try {
inlineSettings[attrName] = eval(attrValue);
}
catch (err) {
inlineSettings[attrName] = attrValue;
}
}
}
var nodeName = this.nodeName.toLowerCase();
if (nodeName == 'input') {
var instSettings = (inlineSettings ? $.extend($.extend({}, settings || {}),
inlineSettings || {}) : settings); // clone and customise
var inst = (inst && !inlineSettings ? inst :
new PopUpCalInstance(instSettings, false));
popUpCal._connectCalendar(this, inst);
}
else if (nodeName == 'div' || nodeName == 'span') {
var instSettings = $.extend($.extend({}, settings || {}),
inlineSettings || {}); // clone and customise
var inst = new PopUpCalInstance(instSettings, true);
popUpCal._inlineCalendar(this, inst);
}
});
};
/* Initialise the calendar. */
$(document).ready(function() {
popUpCal = new PopUpCal(); // singleton instance
});
/* MarcGrabanski.com v2.7 */
/* Pop-Up Calendar Built from Scratch by Marc Grabanski */
/* Enhanced by Keith Wood (kbwood@iprimus.com.au). */
/* Under the Creative Commons Licence http://creativecommons.org/licenses/by/3.0/
Share or Remix it but please Attribute the authors. */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('I 2m(){8.3t=0;8.2h=[];8.1L=O;8.1i=[];8.1t=X;8.1v=X;8.2g=[];8.2g[\'\']={2Q:\'5R\',3R:\'5p\',2u:\'&58;51\',2H:\'4D&4z;\',3d:\'4t\',2k:[\'4o\',\'4k\',\'4g\',\'4a\',\'5P\',\'5G\',\'5D\'],3O:[\'5o\',\'5l\',\'5j\',\'5d\',\'57\',\'56\',\'50\',\'4V\',\'4P\',\'4J\',\'4C\',\'4A\'],1R:\'4x/\'};8.1E={3f:\'1z\',3c:\'\',31:\'...\',30:\'\',2W:X,2U:1c,2R:X,2P:1c,2N:1c,2K:\'-10:+10\',2I:0,3Z:1c,3W:X,28:O,26:O,1J:\'5u\',3M:O,3K:O,2w:O};$.14(8.1E,8.2g[\'\']);8.S=$(\'<V 3A="3y"></V>\');$(1d.1r).1K(8.S);$(1d.1r).55(8.3F)}$.14(2m.3I,{3q:I(a){F b=8.3t++;8.2h[b]=a;N b},U:I(a){N 8.2h[a]||a},4F:I(a){$.14(8.1E,a||{})},2p:I(e){F a=G.U(8.1g);H(G.1t){4y(e.2l){1a 9:G.1q(a,\'\');11;1a 13:G.1P(a);11;1a 27:G.1q(a,a.J(\'1J\'));11;1a 33:G.T(a,-1,(e.1j?\'Y\':\'M\'));11;1a 34:G.T(a,+1,(e.1j?\'Y\':\'M\'));11;1a 35:H(e.1j)G.2y(a);11;1a 36:H(e.1j)G.2B(a);11;1a 37:H(e.1j)G.T(a,-1,\'D\');11;1a 38:H(e.1j)G.T(a,-7,\'D\');11;1a 39:H(e.1j)G.T(a,+1,\'D\');11;1a 40:H(e.1j)G.T(a,+7,\'D\');11}}19 H(e.2l==36&&e.1j){G.1A(8)}},2J:I(e){F a=G.U(8.1g);F b=45.5N(e.43==5K?e.2l:e.43);N(b<\' \'||b==a.J(\'1R\').1k(3)||(b>=\'0\'&&b<=\'9\'))},3U:I(a,b){F c=$(a);F d=b.J(\'3c\');H(d){c.3Q(\'<1F K="5v">\'+d+\'</1F>\')}F e=b.J(\'3f\');H(e==\'1z\'||e==\'2r\'){c.1z(8.1A)}H(e==\'1x\'||e==\'2r\'){F f=b.J(\'31\');F g=b.J(\'30\');F h=b.J(\'2W\');F i=$(h?\'<20 K="1s" 2v="\'+g+\'" 3E="\'+f+\'" 3C="\'+f+\'"/>\':\'<1x 2a="1x" K="1s">\'+(g!=\'\'?\'<20 2v="\'+g+\'" 3E="\'+f+\'" 3C="\'+f+\'"/>\':f)+\'</1x>\');c.5i(\'<1F K="5h"></1F>\').3Q(i);i.5f(8.1A)}c.3z(8.2p).5c(8.2J);c[0].1g=b.R},3w:I(a,b){$(a).1K(b.S);a.1g=b.R;F c=P W();b.17=c.16();b.Q=c.1b();b.L=c.15();G.T(b)},53:I(a,b,c,d){F e=8.3r;H(!e){e=8.3r=P 1H({},X);8.1m=$(\'<1I 2a="4U" 4S="1" 3N="2C: 2q; 25: -3X;"/>\');8.1m.3z(8.2p);$(\'1r\').1K(8.1m);8.1m[0].1g=e.R}$.14(e.1l,c||{});8.1m.2G(a);H(2F.41){1W=2F.4B;1V=2F.41}19 H(1d.1U&&1d.1U.2o){1W=1d.1U.3m;1V=1d.1U.2o}19 H(1d.1r){1W=1d.1r.3m;1V=1d.1r.2o}8.1h=d||[(1W/2)-3l,(1V/2)-3l];8.1m.18(\'2n\',8.1h[0]+\'1S\').18(\'25\',8.1h[1]+\'1S\');e.1l.2w=b;8.1v=1c;8.S.3k(\'3j\');8.1A(8.1m[0]);H($.1C){$.1C(8.S)}},4w:I(c){c=(c.3i?c:$(c));c.1D(I(){8.1Q=X;$(\'../1x.1s\',8).1D(I(){8.1Q=X});$(\'../20.1s\',8).18({3h:\'1.0\',3g:\'\'});F b=8;G.1i=$.3e(G.1i,I(a){N(a==b?O:a)})})},4v:I(c){c=(c.3i?c:$(c));c.1D(I(){8.1Q=1c;$(\'../1x.1s\',8).1D(I(){8.1Q=1c});$(\'../20.1s\',8).18({3h:\'0.5\',3g:\'4u\'});F b=8;G.1i=$.3e(G.1i,I(a){N(a==b?O:a)});G.1i[G.1i.1B]=8})},4s:I(a,b){F c=8.U(a.1g);H(c){$.14(c.1l,b||{});8.1w(c)}},4r:I(a,b){F c=8.U(a.1g);H(c){c.3b(b)}},4q:I(a){F b=8.U(a.1g);N(b?b.3a():O)},1A:I(a){F b=(a.1O&&a.1O.2j()==\'1I\'?a:8);H(b.1O.2j()!=\'1I\'){b=$(\'1I\',b.4p)[0]}H(G.2i==b){N}1f(F i=0;i<G.1i.1B;i++){H(G.1i[i]==b){N}}F c=G.U(b.1g);G.1q(c,\'\');G.2i=b;c.2Z(b);H(G.1v){b.24=\'\'}H(!G.1h){G.1h=G.2Y(b);G.1h[1]+=b.3H}c.S.18(\'2C\',(G.1v&&$.1C?\'4n\':\'2q\')).18(\'2n\',G.1h[0]+\'1S\').18(\'25\',G.1h[1]+\'1S\');G.1h=O;F d=c.J(\'3K\');$.14(c.1l,(d?d(b):{}));G.2V(c)},2V:I(a){F b=8.U(a);G.1w(b);H(!b.1G){F c=b.J(\'1J\');b.S.4m(c,I(){G.1t=1c;G.2f(b)});H(c==\'\'){G.1t=1c;G.2f(b)}H(b.Z[0].2a!=\'2e\'){b.Z[0].1z()}8.1L=b}},1w:I(a){a.S.4l().1K(a.2T());H(a.Z&&a.Z!=\'2e\'){a.Z[0].1z()}},2f:I(a){H($.2d.2D){$(\'#2S\').18({4j:a.S[0].4i+4,4h:a.S[0].3H+4})}},1q:I(a,b){F c=8.U(a);H(G.1t){b=(b!=O?b:c.J(\'1J\'));c.S.4f(b,I(){G.2E(c)});H(b==\'\'){G.2E(c)}G.1t=X;G.2i=O;c.1l.2O=O;H(G.1v){G.1m.18(\'2C\',\'2q\').18(\'2n\',\'4e\').18(\'25\',\'-3X\');H($.1C){$.4d();$(\'1r\').1K(8.S)}}G.1v=X}G.1L=O},2E:I(a){a.S.2M(\'3j\');$(\'.2L\',a.S).4b()},3F:I(a){H(!G.1L){N}F b=$(a.49);H((b.48("#3y").1B==0)&&(b.47(\'K\')!=\'1s\')&&G.1t&&!(G.1v&&$.1C)){G.1q(G.1L,\'\')}},T:I(a,b,c){F d=8.U(a);d.T(b,c);8.1w(d)},2B:I(a){F b=P W();F c=8.U(a);c.17=b.16();c.Q=b.1b();c.L=b.15();8.T(c)},2b:I(a,b,c){F d=8.U(a);d.1M=X;d[c==\'M\'?\'Q\':\'L\']=b.46[b.4c].24-0;8.T(d)},2c:I(a){F b=8.U(a);H(b.Z&&b.1M&&!$.2d.2D){b.Z[0].1z()}b.1M=!b.1M},44:I(b,a){F c=8.U(b);F d=c.J(\'2k\');F e=a.5M.5L;1f(F i=0;i<7;i++){H(d[i]==e){c.1l.2I=i;11}}8.1w(c)},42:I(a,b){F c=8.U(a);c.17=$("a",b).5J();8.1P(a)},2y:I(a){8.1P(a,\'\')},1P:I(a,b){F c=8.U(a);b=(b!=O?b:c.3Y());H(c.Z){c.Z.2G(b)}F d=c.J(\'2w\');H(d){d(b)}19{c.Z.5I(\'5H\')}H(c.1G){8.1w(c)}19{8.1q(c,c.J(\'1J\'))}},5F:I(a){F b=a.3V();N[(b>0&&b<6),\'\']},2Y:I(a){H(a.2a==\'2e\'){a=a.5E}F b=1N=0;H(a.3T){b=a.3S;1N=a.2X;5B(a=a.3T){F c=b;b+=a.3S;H(b<0){b=c}1N+=a.2X}}N[b,1N]}});I 1H(a,b){8.R=G.3q(8);8.17=0;8.Q=0;8.L=0;8.Z=O;8.1G=b;8.S=(!b?G.S:$(\'<V 3A="5A\'+8.R+\'" K="5z"></V>\'));H(b){F c=P W();8.1n=c.16();8.1o=c.1b();8.1p=c.15()}8.1l=$.14({},a||{})}$.14(1H.3I,{J:I(a){N(8.1l[a]!=O?8.1l[a]:G.1E[a])},2Z:I(a){8.Z=$(a);F b=8.J(\'1R\');F c=8.Z.2G().3P(b.1k(3));H(c.1B==3){8.1n=1u(c[b.2A(\'D\')],10);8.1o=1u(c[b.2A(\'M\')],10)-1;8.1p=1u(c[b.2A(\'Y\')],10)}19{F d=P W();8.1n=d.16();8.1o=d.1b();8.1p=d.15()}8.17=8.1n;8.Q=8.1o;8.L=8.1p;8.T()},3b:I(a){8.17=8.1n=a.16();8.Q=8.1o=a.1b();8.L=8.1p=a.15();8.T()},3a:I(){N P W(8.1p,8.1o,8.1n)},2T:I(){F a=P W();a=P W(a.15(),a.1b(),a.16());F b=\'<V K="5t">\'+\'<a K="5s" 1e="G.2y(\'+8.R+\');">\'+8.J(\'2Q\')+\'</a>\'+\'<a K="5r" 1e="G.1q(\'+8.R+\');">\'+8.J(\'3R\')+\'</a></V>\';F c=8.J(\'2O\');F d=8.J(\'2U\');F e=8.J(\'2R\');F f=(c?\'<V K="2L">\'+c+\'</V>\':\'\')+(d&&!8.1G?b:\'\')+\'<V K="5q">\'+(8.2t(-1)?\'<a K="3L" \'+\'1e="G.T(\'+8.R+\', -1, \\\'M\\\');">\'+8.J(\'2u\')+\'</a>\':(e?\'\':\'<1T K="3L">\'+8.J(\'2u\')+\'</1T>\'))+(8.2x(a)?\'<a K="5n" \'+\'1e="G.2B(\'+8.R+\');">\'+8.J(\'3d\')+\'</a>\':\'\')+(8.2t(+1)?\'<a K="3J" \'+\'1e="G.T(\'+8.R+\', +1, \\\'M\\\');">\'+8.J(\'2H\')+\'</a>\':(e?\'\':\'<1T K="3J">\'+8.J(\'2H\')+\'</1T>\'))+\'</V><V K="5m">\';F g=8.J(\'28\');F h=8.J(\'26\');F i=8.J(\'3O\');H(!8.J(\'2P\')){f+=i[8.Q]+\'&3G;\'}19{F j=(g&&g.15()==8.L);F k=(h&&h.15()==8.L);f+=\'<1X K="5k" \'+\'3D="G.2b(\'+8.R+\', 8, \\\'M\\\');" \'+\'1e="G.2c(\'+8.R+\');">\';1f(F l=0;l<12;l++){H((!j||l>=g.1b())&&(!k||l<=h.1b())){f+=\'<1Y 24="\'+l+\'"\'+(l==8.Q?\' 1Z="1Z"\':\'\')+\'>\'+i[l]+\'</1Y>\'}}f+=\'</1X>\'}H(!8.J(\'2N\')){f+=8.L}19{F m=8.J(\'2K\').3P(\':\');F n=0;F o=0;H(m.1B!=2){n=8.L-10;o=8.L+10}19 H(m[0].1k(0)==\'+\'||m[0].1k(0)==\'-\'){n=8.L+1u(m[0],10);o=8.L+1u(m[1],10)}19{n=1u(m[0],10);o=1u(m[1],10)}n=(g?21.5g(n,g.15()):n);o=(h?21.3B(o,h.15()):o);f+=\'<1X K="5e" 3D="G.2b(\'+8.R+\', 8, \\\'Y\\\');" \'+\'1e="G.2c(\'+8.R+\');">\';1f(;n<=o;n++){f+=\'<1Y 24="\'+n+\'"\'+(n==8.L?\' 1Z="1Z"\':\'\')+\'>\'+n+\'</1Y>\'}f+=\'</1X>\'}f+=\'</V><3p K="3s" 5b="0" 5a="0"><3x>\'+\'<23 K="59">\';F p=8.J(\'2I\');F q=8.J(\'3Z\');F r=8.J(\'2k\');1f(F s=0;s<7;s++){f+=\'<22>\'+(!q?\'\':\'<a 1e="G.44(\'+8.R+\', 8);">\')+r[(s+p)%7]+(q?\'</a>\':\'\')+\'</22>\'}f+=\'</23></3x><3v>\';F t=8.2s(8.L,8.Q);8.17=21.3B(8.17,t);F u=(8.3u(8.L,8.Q)-p+7)%7;F v=P W(8.1p,8.1o,8.1n);F w=P W(8.L,8.Q,8.17);F x=P W(8.L,8.Q,1-u);F y=21.54((u+t)/7);F z=8.J(\'3M\');F A=8.J(\'3W\');1f(F B=0;B<y;B++){f+=\'<23 K="52">\';1f(F s=0;s<7;s++){F C=(z?z(x):[1c,\'\']);F D=(x.1b()!=8.Q);F E=D||!C[0]||(g&&x<g)||(h&&x>h);f+=\'<22 K="4Z\'+((s+p+6)%7>=5?\' 4Y\':\'\')+(D?\' 4X\':\'\')+(x.1y()==w.1y()?\' 2z\':\'\')+(E?\' 4W\':\'\')+(!D||A?\' \'+C[1]:\'\')+(x.1y()==v.1y()?\' 4T\':(x.1y()==a.1y()?\' 5w\':\'\'))+\'"\'+(E?\'\':\' 5x="$(8).3k(\\\'2z\\\');"\'+\' 5y="$(8).2M(\\\'2z\\\');"\'+\' 1e="G.42(\'+8.R+\', 8);"\')+\'>\'+(D?(A?x.16():\'&3G;\'):(E?x.16():\'<a>\'+x.16()+\'</a>\'))+\'</22>\';x.3o(x.16()+1)}f+=\'</23>\'}f+=\'</3v></3p>\'+(!d&&!8.1G?b:\'\')+\'<V 3N="4R: 2r;"></V>\'+(!$.2d.2D?\'\':\'<!--[H 4Q 5C 6.5]><3n 2v="4O:X;" K="2S"></3n><![4N]-->\');N f},T:I(a,b){F c=P W(8.L+(b==\'Y\'?a:0),8.Q+(b==\'M\'?a:0),8.17+(b==\'D\'?a:0));F d=8.J(\'28\');F e=8.J(\'26\');c=(d&&c<d?d:c);c=(e&&c>e?e:c);8.17=c.16();8.Q=c.1b();8.L=c.15()},2s:I(a,b){N 32-P W(a,b,32).16()},3u:I(a,b){N P W(a,b,1).3V()},2t:I(a){F b=P W(8.L,8.Q+a,1);H(a<0){b.3o(8.2s(b.15(),b.1b()))}N 8.2x(b)},2x:I(a){F b=8.J(\'28\');F c=8.J(\'26\');N((!b||a>=b)&&(!c||a<=c))},3Y:I(){F a=8.1n=8.17;F b=8.1o=8.Q;F c=8.1p=8.L;b++;F d=8.J(\'1R\');F e=\'\';1f(F i=0;i<3;i++){e+=d.1k(3)+(d.1k(i)==\'D\'?(a<10?\'0\':\'\')+a:(d.1k(i)==\'M\'?(b<10?\'0\':\'\')+b:(d.1k(i)==\'Y\'?c:\'?\')))}N e.4M(d.1k(3)?1:0)}});$.4L.3s=I(f){N 8.1D(I(){F a=O;1f(29 4K G.1E){F b=8.4I(\'4H:\'+29);H(b){a=a||{};4G{a[29]=5O(b)}4E(5Q){a[29]=b}}}F c=8.1O.2j();H(c==\'1I\'){F d=(a?$.14($.14({},f||{}),a||{}):f);F e=(e&&!a?e:P 1H(d,X));G.3U(8,e)}19 H(c==\'V\'||c==\'1F\'){F d=$.14($.14({},f||{}),a||{});F e=P 1H(d,1c);G.3w(8,e)}})};$(1d).5S(I(){G=P 2m()});',62,365,'||||||||this|||||||||||||||||||||||||||||||||var|popUpCal|if|function|_get|class|_selectedYear||return|null|new|_selectedMonth|_id|_calendarDiv|_adjustDate|_getInst|div|Date|false||_input||break|||extend|getFullYear|getDate|_selectedDay|css|else|case|getMonth|true|document|onclick|for|_calId|_pos|_disabledInputs|ctrlKey|charAt|_settings|_dialogInput|_currentDay|_currentMonth|_currentYear|hideCalendar|body|calendar_trigger|_popUpShowing|parseInt|_inDialog|_updateCalendar|button|getTime|focus|showFor|length|blockUI|each|_defaults|span|_inline|PopUpCalInstance|input|speed|append|_curInst|_selectingMonthYear|curtop|nodeName|_selectDate|disabled|dateFormat|px|label|documentElement|windowHeight|windowWidth|select|option|selected|img|Math|td|tr|value|top|maxDate||minDate|attrName|type|_selectMonthYear|_clickMonthYear|browser|hidden|_afterShow|regional|_inst|_lastInput|toLowerCase|dayNames|keyCode|PopUpCal|left|clientHeight|_doKeyDown|absolute|both|_getDaysInMonth|_canAdjustMonth|prevText|src|onSelect|_isInRange|_clearDate|calendar_daysCellOver|indexOf|_gotoToday|position|msie|_tidyDialog|self|val|nextText|firstDay|_doKeyPress|yearRange|calendar_prompt|removeClass|changeYear|prompt|changeMonth|clearText|hideIfNoPrevNext|calendar_cover|_generateCalendar|closeAtTop|_showCalendar|buttonImageOnly|offsetTop|_findPos|_setDateFromField|buttonImage|buttonText|||||||||_getDate|_setDate|appendText|currentText|map|autoPopUp|cursor|opacity|jquery|calendar_dialog|addClass|100|clientWidth|iframe|setDate|table|_register|_dialogInst|calendar|_nextId|_getFirstDayOfMonth|tbody|_inlineCalendar|thead|calendar_div|keydown|id|min|title|onchange|alt|_checkExternalClick|nbsp|offsetHeight|prototype|calendar_next|fieldSettings|calendar_prev|customDate|style|monthNames|split|after|closeText|offsetLeft|offsetParent|_connectCalendar|getDay|showOtherMonths|100px|_formatDate|changeFirstDay||innerHeight|_selectDay|charCode|_changeFirstDay|String|options|attr|parents|target|We|remove|selectedIndex|unblockUI|0px|hide|Tu|height|offsetWidth|width|Mo|empty|show|static|Su|parentNode|getDateFor|setDateFor|reconfigureFor|Today|default|disableFor|enableFor|DMY|switch|gt|December|innerWidth|November|Next|catch|setDefaults|try|cal|getAttribute|October|in|fn|substring|endif|javascript|September|lte|clear|size|calendar_currentDay|text|August|calendar_unselectable|calendar_otherMonth|calendar_weekEndCell|calendar_daysCell|July|Prev|calendar_daysRow|dialogCalendar|ceil|mousedown|June|May|lt|calendar_titleRow|cellspacing|cellpadding|keypress|April|calendar_newYear|click|max|calendar_wrap|wrap|March|calendar_newMonth|February|calendar_header|calendar_current|January|Close|calendar_links|calendar_close|calendar_clear|calendar_control|medium|calendar_append|calendar_today|onmouseover|onmouseout|calendar_inline|calendar_div_|while|IE|Sa|nextSibling|noWeekends|Fr|change|trigger|html|undefined|nodeValue|firstChild|fromCharCode|eval|Th|err|Clear|ready'.split('|'),0,{}))
(function(){
/*
* jQuery 1.2.1 - New Wave Javascript
*
* Copyright (c) 2007 John Resig (jquery.com)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* $Date: 2007-09-16 23:42:06 -0400 (Sun, 16 Sep 2007) $
* $Rev: 3353 $
*/
// Map over jQuery in case of overwrite
if ( typeof jQuery != "undefined" )
var _jQuery = jQuery;
var jQuery = window.jQuery = function(selector, context) {
// If the context is a namespace object, return a new object
return this instanceof jQuery ?
this.init(selector, context) :
new jQuery(selector, context);
};
// Map over the $ in case of overwrite
if ( typeof $ != "undefined" )
var _$ = $;
// Map the jQuery namespace to the '$' one
window.$ = jQuery;
var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/;
jQuery.fn = jQuery.prototype = {
init: function(selector, context) {
// Make sure that a selection was provided
selector = selector || document;
// Handle HTML strings
if ( typeof selector == "string" ) {
var m = quickExpr.exec(selector);
if ( m && (m[1] || !context) ) {
// HANDLE: $(html) -> $(array)
if ( m[1] )
selector = jQuery.clean( [ m[1] ], context );
// HANDLE: $("#id")
else {
var tmp = document.getElementById( m[3] );
if ( tmp )
// Handle the case where IE and Opera return items
// by name instead of ID
if ( tmp.id != m[3] )
return jQuery().find( selector );
else {
this[0] = tmp;
this.length = 1;
return this;
}
else
selector = [];
}
// HANDLE: $(expr)
} else
return new jQuery( context ).find( selector );
// HANDLE: $(function)
// Shortcut for document ready
} else if ( jQuery.isFunction(selector) )
return new jQuery(document)[ jQuery.fn.ready ? "ready" : "load" ]( selector );
return this.setArray(
// HANDLE: $(array)
selector.constructor == Array && selector ||
// HANDLE: $(arraylike)
// Watch for when an array-like object is passed as the selector
(selector.jquery || selector.length && selector != window && !selector.nodeType && selector[0] != undefined && selector[0].nodeType) && jQuery.makeArray( selector ) ||
// HANDLE: $(*)
[ selector ] );
},
jquery: "1.2.1",
size: function() {
return this.length;
},
length: 0,
get: function( num ) {
return num == undefined ?
// Return a 'clean' array
jQuery.makeArray( this ) :
// Return just the object
this[num];
},
pushStack: function( a ) {
var ret = jQuery(a);
ret.prevObject = this;
return ret;
},
setArray: function( a ) {
this.length = 0;
Array.prototype.push.apply( this, a );
return this;
},
each: function( fn, args ) {
return jQuery.each( this, fn, args );
},
index: function( obj ) {
var pos = -1;
this.each(function(i){
if ( this == obj ) pos = i;
});
return pos;
},
attr: function( key, value, type ) {
var obj = key;
// Look for the case where we're accessing a style value
if ( key.constructor == String )
if ( value == undefined )
return this.length && jQuery[ type || "attr" ]( this[0], key ) || undefined;
else {
obj = {};
obj[ key ] = value;
}
// Check to see if we're setting style values
return this.each(function(index){
// Set all the styles
for ( var prop in obj )
jQuery.attr(
type ? this.style : this,
prop, jQuery.prop(this, obj[prop], type, index, prop)
);
});
},
css: function( key, value ) {
return this.attr( key, value, "curCSS" );
},
text: function(e) {
if ( typeof e != "object" && e != null )
return this.empty().append( document.createTextNode( e ) );
var t = "";
jQuery.each( e || this, function(){
jQuery.each( this.childNodes, function(){
if ( this.nodeType != 8 )
t += this.nodeType != 1 ?
this.nodeValue : jQuery.fn.text([ this ]);
});
});
return t;
},
wrapAll: function(html) {
if ( this[0] )
// The elements to wrap the target around
jQuery(html, this[0].ownerDocument)
.clone()
.insertBefore(this[0])
.map(function(){
var elem = this;
while ( elem.firstChild )
elem = elem.firstChild;
return elem;
})
.append(this);
return this;
},
wrapInner: function(html) {
return this.each(function(){
jQuery(this).contents().wrapAll(html);
});
},
wrap: function(html) {
return this.each(function(){
jQuery(this).wrapAll(html);
});
},
append: function() {
return this.domManip(arguments, true, 1, function(a){
this.appendChild( a );
});
},
prepend: function() {
return this.domManip(arguments, true, -1, function(a){
this.insertBefore( a, this.firstChild );
});
},
before: function() {
return this.domManip(arguments, false, 1, function(a){
this.parentNode.insertBefore( a, this );
});
},
after: function() {
return this.domManip(arguments, false, -1, function(a){
this.parentNode.insertBefore( a, this.nextSibling );
});
},
end: function() {
return this.prevObject || jQuery([]);
},
find: function(t) {
var data = jQuery.map(this, function(a){ return jQuery.find(t,a); });
return this.pushStack( /[^+>] [^+>]/.test( t ) || t.indexOf("..") > -1 ?
jQuery.unique( data ) : data );
},
clone: function(events) {
// Do the clone
var ret = this.map(function(){
return this.outerHTML ? jQuery(this.outerHTML)[0] : this.cloneNode(true);
});
// Need to set the expando to null on the cloned set if it exists
// removeData doesn't work here, IE removes it from the original as well
// this is primarily for IE but the data expando shouldn't be copied over in any browser
var clone = ret.find("*").andSelf().each(function(){
if ( this[ expando ] != undefined )
this[ expando ] = null;
});
// Copy the events from the original to the clone
if (events === true)
this.find("*").andSelf().each(function(i) {
var events = jQuery.data(this, "events");
for ( var type in events )
for ( var handler in events[type] )
jQuery.event.add(clone[i], type, events[type][handler], events[type][handler].data);
});
// Return the cloned set
return ret;
},
filter: function(t) {
return this.pushStack(
jQuery.isFunction( t ) &&
jQuery.grep(this, function(el, index){
return t.apply(el, [index]);
}) ||
jQuery.multiFilter(t,this) );
},
not: function(t) {
return this.pushStack(
t.constructor == String &&
jQuery.multiFilter(t, this, true) ||
jQuery.grep(this, function(a) {
return ( t.constructor == Array || t.jquery )
? jQuery.inArray( a, t ) < 0
: a != t;
})
);
},
add: function(t) {
return this.pushStack( jQuery.merge(
this.get(),
t.constructor == String ?
jQuery(t).get() :
t.length != undefined && (!t.nodeName || jQuery.nodeName(t, "form")) ?
t : [t] )
);
},
is: function(expr) {
return expr ? jQuery.multiFilter(expr,this).length > 0 : false;
},
hasClass: function(expr) {
return this.is("." + expr);
},
val: function( val ) {
if ( val == undefined ) {
if ( this.length ) {
var elem = this[0];
// We need to handle select boxes special
if ( jQuery.nodeName(elem, "select") ) {
var index = elem.selectedIndex,
a = [],
options = elem.options,
one = elem.type == "select-one";
// Nothing was selected
if ( index < 0 )
return null;
// Loop through all the selected options
for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
var option = options[i];
if ( option.selected ) {
// Get the specifc value for the option
var val = jQuery.browser.msie && !option.attributes["value"].specified ? option.text : option.value;
// We don't need an array for one selects
if ( one )
return val;
// Multi-Selects return an array
a.push(val);
}
}
return a;
// Everything else, we just grab the value
} else
return this[0].value.replace(/\r/g, "");
}
} else
return this.each(function(){
if ( val.constructor == Array && /radio|checkbox/.test(this.type) )
this.checked = (jQuery.inArray(this.value, val) >= 0 ||
jQuery.inArray(this.name, val) >= 0);
else if ( jQuery.nodeName(this, "select") ) {
var tmp = val.constructor == Array ? val : [val];
jQuery("option", this).each(function(){
this.selected = (jQuery.inArray(this.value, tmp) >= 0 ||
jQuery.inArray(this.text, tmp) >= 0);
});
if ( !tmp.length )
this.selectedIndex = -1;
} else
this.value = val;
});
},
html: function( val ) {
return val == undefined ?
( this.length ? this[0].innerHTML : null ) :
this.empty().append( val );
},
replaceWith: function( val ) {
return this.after( val ).remove();
},
eq: function(i){
return this.slice(i, i+1);
},
slice: function() {
return this.pushStack( Array.prototype.slice.apply( this, arguments ) );
},
map: function(fn) {
return this.pushStack(jQuery.map( this, function(elem,i){
return fn.call( elem, i, elem );
}));
},
andSelf: function() {
return this.add( this.prevObject );
},
domManip: function(args, table, dir, fn) {
var clone = this.length > 1, a;
return this.each(function(){
if ( !a ) {
a = jQuery.clean(args, this.ownerDocument);
if ( dir < 0 )
a.reverse();
}
var obj = this;
if ( table && jQuery.nodeName(this, "table") && jQuery.nodeName(a[0], "tr") )
obj = this.getElementsByTagName("tbody")[0] || this.appendChild(document.createElement("tbody"));
jQuery.each( a, function(){
var elem = clone ? this.cloneNode(true) : this;
if ( !evalScript(0, elem) )
fn.call( obj, elem );
});
});
}
};
function evalScript(i, elem){
var script = jQuery.nodeName(elem, "script");
if ( script ) {
if ( elem.src )
jQuery.ajax({ url: elem.src, async: false, dataType: "script" });
else
jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
if ( elem.parentNode )
elem.parentNode.removeChild(elem);
} else if ( elem.nodeType == 1 )
jQuery("script", elem).each(evalScript);
return script;
}
jQuery.extend = jQuery.fn.extend = function() {
// copy reference to target object
var target = arguments[0] || {}, a = 1, al = arguments.length, deep = false;
// Handle a deep copy situation
if ( target.constructor == Boolean ) {
deep = target;
target = arguments[1] || {};
}
// extend jQuery itself if only one argument is passed
if ( al == 1 ) {
target = this;
a = 0;
}
var prop;
for ( ; a < al; a++ )
// Only deal with non-null/undefined values
if ( (prop = arguments[a]) != null )
// Extend the base object
for ( var i in prop ) {
// Prevent never-ending loop
if ( target == prop[i] )
continue;
// Recurse if we're merging object values
if ( deep && typeof prop[i] == 'object' && target[i] )
jQuery.extend( target[i], prop[i] );
// Don't bring in undefined values
else if ( prop[i] != undefined )
target[i] = prop[i];
}
// Return the modified object
return target;
};
var expando = "jQuery" + (new Date()).getTime(), uuid = 0, win = {};
jQuery.extend({
noConflict: function(deep) {
window.$ = _$;
if ( deep )
window.jQuery = _jQuery;
return jQuery;
},
// This may seem like some crazy code, but trust me when I say that this
// is the only cross-browser way to do this. --John
isFunction: function( fn ) {
return !!fn && typeof fn != "string" && !fn.nodeName &&
fn.constructor != Array && /function/i.test( fn + "" );
},
// check if an element is in a XML document
isXMLDoc: function(elem) {
return elem.documentElement && !elem.body ||
elem.tagName && elem.ownerDocument && !elem.ownerDocument.body;
},
// Evalulates a script in a global context
// Evaluates Async. in Safari 2 :-(
globalEval: function( data ) {
data = jQuery.trim( data );
if ( data ) {
if ( window.execScript )
window.execScript( data );
else if ( jQuery.browser.safari )
// safari doesn't provide a synchronous global eval
window.setTimeout( data, 0 );
else
eval.call( window, data );
}
},
nodeName: function( elem, name ) {
return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
},
cache: {},
data: function( elem, name, data ) {
elem = elem == window ? win : elem;
var id = elem[ expando ];
// Compute a unique ID for the element
if ( !id )
id = elem[ expando ] = ++uuid;
// Only generate the data cache if we're
// trying to access or manipulate it
if ( name && !jQuery.cache[ id ] )
jQuery.cache[ id ] = {};
// Prevent overriding the named cache with undefined values
if ( data != undefined )
jQuery.cache[ id ][ name ] = data;
// Return the named cache data, or the ID for the element
return name ? jQuery.cache[ id ][ name ] : id;
},
removeData: function( elem, name ) {
elem = elem == window ? win : elem;
var id = elem[ expando ];
// If we want to remove a specific section of the element's data
if ( name ) {
if ( jQuery.cache[ id ] ) {
// Remove the section of cache data
delete jQuery.cache[ id ][ name ];
// If we've removed all the data, remove the element's cache
name = "";
for ( name in jQuery.cache[ id ] ) break;
if ( !name )
jQuery.removeData( elem );
}
// Otherwise, we want to remove all of the element's data
} else {
// Clean up the element expando
try {
delete elem[ expando ];
} catch(e){
// IE has trouble directly removing the expando
// but it's ok with using removeAttribute
if ( elem.removeAttribute )
elem.removeAttribute( expando );
}
// Completely remove the data cache
delete jQuery.cache[ id ];
}
},
// args is for internal usage only
each: function( obj, fn, args ) {
if ( args ) {
if ( obj.length == undefined )
for ( var i in obj )
fn.apply( obj[i], args );
else
for ( var i = 0, ol = obj.length; i < ol; i++ )
if ( fn.apply( obj[i], args ) === false ) break;
// A special, fast, case for the most common use of each
} else {
if ( obj.length == undefined )
for ( var i in obj )
fn.call( obj[i], i, obj[i] );
else
for ( var i = 0, ol = obj.length, val = obj[0];
i < ol && fn.call(val,i,val) !== false; val = obj[++i] ){}
}
return obj;
},
prop: function(elem, value, type, index, prop){
// Handle executable functions
if ( jQuery.isFunction( value ) )
value = value.call( elem, [index] );
// exclude the following css properties to add px
var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i;
// Handle passing in a number to a CSS property
return value && value.constructor == Number && type == "curCSS" && !exclude.test(prop) ?
value + "px" :
value;
},
className: {
// internal only, use addClass("class")
add: function( elem, c ){
jQuery.each( (c || "").split(/\s+/), function(i, cur){
if ( !jQuery.className.has( elem.className, cur ) )
elem.className += ( elem.className ? " " : "" ) + cur;
});
},
// internal only, use removeClass("class")
remove: function( elem, c ){
elem.className = c != undefined ?
jQuery.grep( elem.className.split(/\s+/), function(cur){
return !jQuery.className.has( c, cur );
}).join(" ") : "";
},
// internal only, use is(".class")
has: function( t, c ) {
return jQuery.inArray( c, (t.className || t).toString().split(/\s+/) ) > -1;
}
},
swap: function(e,o,f) {
for ( var i in o ) {
e.style["old"+i] = e.style[i];
e.style[i] = o[i];
}
f.apply( e, [] );
for ( var i in o )
e.style[i] = e.style["old"+i];
},
css: function(e,p) {
if ( p == "height" || p == "width" ) {
var old = {}, oHeight, oWidth, d = ["Top","Bottom","Right","Left"];
jQuery.each( d, function(){
old["padding" + this] = 0;
old["border" + this + "Width"] = 0;
});
jQuery.swap( e, old, function() {
if ( jQuery(e).is(':visible') ) {
oHeight = e.offsetHeight;
oWidth = e.offsetWidth;
} else {
e = jQuery(e.cloneNode(true))
.find(":radio").removeAttr("checked").end()
.css({
visibility: "hidden", position: "absolute", display: "block", right: "0", left: "0"
}).appendTo(e.parentNode)[0];
var parPos = jQuery.css(e.parentNode,"position") || "static";
if ( parPos == "static" )
e.parentNode.style.position = "relative";
oHeight = e.clientHeight;
oWidth = e.clientWidth;
if ( parPos == "static" )
e.parentNode.style.position = "static";
e.parentNode.removeChild(e);
}
});
return p == "height" ? oHeight : oWidth;
}
return jQuery.curCSS( e, p );
},
curCSS: function(elem, prop, force) {
var ret, stack = [], swap = [];
// A helper method for determining if an element's values are broken
function color(a){
if ( !jQuery.browser.safari )
return false;
var ret = document.defaultView.getComputedStyle(a,null);
return !ret || ret.getPropertyValue("color") == "";
}
if (prop == "opacity" && jQuery.browser.msie) {
ret = jQuery.attr(elem.style, "opacity");
return ret == "" ? "1" : ret;
}
if (prop.match(/float/i))
prop = styleFloat;
if (!force && elem.style[prop])
ret = elem.style[prop];
else if (document.defaultView && document.defaultView.getComputedStyle) {
if (prop.match(/float/i))
prop = "float";
prop = prop.replace(/([A-Z])/g,"-$1").toLowerCase();
var cur = document.defaultView.getComputedStyle(elem, null);
if ( cur && !color(elem) )
ret = cur.getPropertyValue(prop);
// If the element isn't reporting its values properly in Safari
// then some display: none elements are involved
else {
// Locate all of the parent display: none elements
for ( var a = elem; a && color(a); a = a.parentNode )
stack.unshift(a);
// Go through and make them visible, but in reverse
// (It would be better if we knew the exact display type that they had)
for ( a = 0; a < stack.length; a++ )
if ( color(stack[a]) ) {
swap[a] = stack[a].style.display;
stack[a].style.display = "block";
}
// Since we flip the display style, we have to handle that
// one special, otherwise get the value
ret = prop == "display" && swap[stack.length-1] != null ?
"none" :
document.defaultView.getComputedStyle(elem,null).getPropertyValue(prop) || "";
// Finally, revert the display styles back
for ( a = 0; a < swap.length; a++ )
if ( swap[a] != null )
stack[a].style.display = swap[a];
}
if ( prop == "opacity" && ret == "" )
ret = "1";
} else if (elem.currentStyle) {
var newProp = prop.replace(/\-(\w)/g,function(m,c){return c.toUpperCase();});
ret = elem.currentStyle[prop] || elem.currentStyle[newProp];
// From the awesome hack by Dean Edwards
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
// If we're not dealing with a regular pixel number
// but a number that has a weird ending, we need to convert it to pixels
if ( !/^\d+(px)?$/i.test(ret) && /^\d/.test(ret) ) {
var style = elem.style.left;
var runtimeStyle = elem.runtimeStyle.left;
elem.runtimeStyle.left = elem.currentStyle.left;
elem.style.left = ret || 0;
ret = elem.style.pixelLeft + "px";
elem.style.left = style;
elem.runtimeStyle.left = runtimeStyle;
}
}
return ret;
},
clean: function(a, doc) {
var r = [];
doc = doc || document;
jQuery.each( a, function(i,arg){
if ( !arg ) return;
if ( arg.constructor == Number )
arg = arg.toString();
// Convert html string into DOM nodes
if ( typeof arg == "string" ) {
// Fix "XHTML"-style tags in all browsers
arg = arg.replace(/(<(\w+)[^>]*?)\/>/g, function(m, all, tag){
return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area)$/i)? m : all+"></"+tag+">";
});
// Trim whitespace, otherwise indexOf won't work as expected
var s = jQuery.trim(arg).toLowerCase(), div = doc.createElement("div"), tb = [];
var wrap =
// option or optgroup
!s.indexOf("<opt") &&
[1, "<select>", "</select>"] ||
!s.indexOf("<leg") &&
[1, "<fieldset>", "</fieldset>"] ||
s.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
[1, "<table>", "</table>"] ||
!s.indexOf("<tr") &&
[2, "<table><tbody>", "</tbody></table>"] ||
// <thead> matched above
(!s.indexOf("<td") || !s.indexOf("<th")) &&
[3, "<table><tbody><tr>", "</tr></tbody></table>"] ||
!s.indexOf("<col") &&
[2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"] ||
// IE can't serialize <link> and <script> tags normally
jQuery.browser.msie &&
[1, "div<div>", "</div>"] ||
[0,"",""];
// Go to html and back, then peel off extra wrappers
div.innerHTML = wrap[1] + arg + wrap[2];
// Move to the right depth
while ( wrap[0]-- )
div = div.lastChild;
// Remove IE's autoinserted <tbody> from table fragments
if ( jQuery.browser.msie ) {
// String was a <table>, *may* have spurious <tbody>
if ( !s.indexOf("<table") && s.indexOf("<tbody") < 0 )
tb = div.firstChild && div.firstChild.childNodes;
// String was a bare <thead> or <tfoot>
else if ( wrap[1] == "<table>" && s.indexOf("<tbody") < 0 )
tb = div.childNodes;
for ( var n = tb.length-1; n >= 0 ; --n )
if ( jQuery.nodeName(tb[n], "tbody") && !tb[n].childNodes.length )
tb[n].parentNode.removeChild(tb[n]);
// IE completely kills leading whitespace when innerHTML is used
if ( /^\s/.test(arg) )
div.insertBefore( doc.createTextNode( arg.match(/^\s*/)[0] ), div.firstChild );
}
arg = jQuery.makeArray( div.childNodes );
}
if ( 0 === arg.length && (!jQuery.nodeName(arg, "form") && !jQuery.nodeName(arg, "select")) )
return;
if ( arg[0] == undefined || jQuery.nodeName(arg, "form") || arg.options )
r.push( arg );
else
r = jQuery.merge( r, arg );
});
return r;
},
attr: function(elem, name, value){
var fix = jQuery.isXMLDoc(elem) ? {} : jQuery.props;
// Safari mis-reports the default selected property of a hidden option
// Accessing the parent's selectedIndex property fixes it
if ( name == "selected" && jQuery.browser.safari )
elem.parentNode.selectedIndex;
// Certain attributes only work when accessed via the old DOM 0 way
if ( fix[name] ) {
if ( value != undefined ) elem[fix[name]] = value;
return elem[fix[name]];
} else if ( jQuery.browser.msie && name == "style" )
return jQuery.attr( elem.style, "cssText", value );
else if ( value == undefined && jQuery.browser.msie && jQuery.nodeName(elem, "form") && (name == "action" || name == "method") )
return elem.getAttributeNode(name).nodeValue;
// IE elem.getAttribute passes even for style
else if ( elem.tagName ) {
if ( value != undefined ) {
if ( name == "type" && jQuery.nodeName(elem,"input") && elem.parentNode )
throw "type property can't be changed";
elem.setAttribute( name, value );
}
if ( jQuery.browser.msie && /href|src/.test(name) && !jQuery.isXMLDoc(elem) )
return elem.getAttribute( name, 2 );
return elem.getAttribute( name );
// elem is actually elem.style ... set the style
} else {
// IE actually uses filters for opacity
if ( name == "opacity" && jQuery.browser.msie ) {
if ( value != undefined ) {
// IE has trouble with opacity if it does not have layout
// Force it by setting the zoom level
elem.zoom = 1;
// Set the alpha filter to set the opacity
elem.filter = (elem.filter || "").replace(/alpha\([^)]*\)/,"") +
(parseFloat(value).toString() == "NaN" ? "" : "alpha(opacity=" + value * 100 + ")");
}
return elem.filter ?
(parseFloat( elem.filter.match(/opacity=([^)]*)/)[1] ) / 100).toString() : "";
}
name = name.replace(/-([a-z])/ig,function(z,b){return b.toUpperCase();});
if ( value != undefined ) elem[name] = value;
return elem[name];
}
},
trim: function(t){
return (t||"").replace(/^\s+|\s+$/g, "");
},
makeArray: function( a ) {
var r = [];
// Need to use typeof to fight Safari childNodes crashes
if ( typeof a != "array" )
for ( var i = 0, al = a.length; i < al; i++ )
r.push( a[i] );
else
r = a.slice( 0 );
return r;
},
inArray: function( b, a ) {
for ( var i = 0, al = a.length; i < al; i++ )
if ( a[i] == b )
return i;
return -1;
},
merge: function(first, second) {
// We have to loop this way because IE & Opera overwrite the length
// expando of getElementsByTagName
// Also, we need to make sure that the correct elements are being returned
// (IE returns comment nodes in a '*' query)
if ( jQuery.browser.msie ) {
for ( var i = 0; second[i]; i++ )
if ( second[i].nodeType != 8 )
first.push(second[i]);
} else
for ( var i = 0; second[i]; i++ )
first.push(second[i]);
return first;
},
unique: function(first) {
var r = [], done = {};
try {
for ( var i = 0, fl = first.length; i < fl; i++ ) {
var id = jQuery.data(first[i]);
if ( !done[id] ) {
done[id] = true;
r.push(first[i]);
}
}
} catch(e) {
r = first;
}
return r;
},
grep: function(elems, fn, inv) {
// If a string is passed in for the function, make a function
// for it (a handy shortcut)
if ( typeof fn == "string" )
fn = eval("false||function(a,i){return " + fn + "}");
var result = [];
// Go through the array, only saving the items
// that pass the validator function
for ( var i = 0, el = elems.length; i < el; i++ )
if ( !inv && fn(elems[i],i) || inv && !fn(elems[i],i) )
result.push( elems[i] );
return result;
},
map: function(elems, fn) {
// If a string is passed in for the function, make a function
// for it (a handy shortcut)
if ( typeof fn == "string" )
fn = eval("false||function(a){return " + fn + "}");
var result = [];
// Go through the array, translating each of the items to their
// new value (or values).
for ( var i = 0, el = elems.length; i < el; i++ ) {
var val = fn(elems[i],i);
if ( val !== null && val != undefined ) {
if ( val.constructor != Array ) val = [val];
result = result.concat( val );
}
}
return result;
}
});
var userAgent = navigator.userAgent.toLowerCase();
// Figure out what browser is being used
jQuery.browser = {
version: (userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1],
safari: /webkit/.test(userAgent),
opera: /opera/.test(userAgent),
msie: /msie/.test(userAgent) && !/opera/.test(userAgent),
mozilla: /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent)
};
var styleFloat = jQuery.browser.msie ? "styleFloat" : "cssFloat";
jQuery.extend({
// Check to see if the W3C box model is being used
boxModel: !jQuery.browser.msie || document.compatMode == "CSS1Compat",
styleFloat: jQuery.browser.msie ? "styleFloat" : "cssFloat",
props: {
"for": "htmlFor",
"class": "className",
"float": styleFloat,
cssFloat: styleFloat,
styleFloat: styleFloat,
innerHTML: "innerHTML",
className: "className",
value: "value",
disabled: "disabled",
checked: "checked",
readonly: "readOnly",
selected: "selected",
maxlength: "maxLength"
}
});
jQuery.each({
parent: "a.parentNode",
parents: "jQuery.dir(a,'parentNode')",
next: "jQuery.nth(a,2,'nextSibling')",
prev: "jQuery.nth(a,2,'previousSibling')",
nextAll: "jQuery.dir(a,'nextSibling')",
prevAll: "jQuery.dir(a,'previousSibling')",
siblings: "jQuery.sibling(a.parentNode.firstChild,a)",
children: "jQuery.sibling(a.firstChild)",
contents: "jQuery.nodeName(a,'iframe')?a.contentDocument||a.contentWindow.document:jQuery.makeArray(a.childNodes)"
}, function(i,n){
jQuery.fn[ i ] = function(a) {
var ret = jQuery.map(this,n);
if ( a && typeof a == "string" )
ret = jQuery.multiFilter(a,ret);
return this.pushStack( jQuery.unique(ret) );
};
});
jQuery.each({
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
insertAfter: "after",
replaceAll: "replaceWith"
}, function(i,n){
jQuery.fn[ i ] = function(){
var a = arguments;
return this.each(function(){
for ( var j = 0, al = a.length; j < al; j++ )
jQuery(a[j])[n]( this );
});
};
});
jQuery.each( {
removeAttr: function( key ) {
jQuery.attr( this, key, "" );
this.removeAttribute( key );
},
addClass: function(c){
jQuery.className.add(this,c);
},
removeClass: function(c){
jQuery.className.remove(this,c);
},
toggleClass: function( c ){
jQuery.className[ jQuery.className.has(this,c) ? "remove" : "add" ](this, c);
},
remove: function(a){
if ( !a || jQuery.filter( a, [this] ).r.length ) {
jQuery.removeData( this );
this.parentNode.removeChild( this );
}
},
empty: function() {
// Clean up the cache
jQuery("*", this).each(function(){ jQuery.removeData(this); });
while ( this.firstChild )
this.removeChild( this.firstChild );
}
}, function(i,n){
jQuery.fn[ i ] = function() {
return this.each( n, arguments );
};
});
jQuery.each( [ "Height", "Width" ], function(i,name){
var n = name.toLowerCase();
jQuery.fn[ n ] = function(h) {
return this[0] == window ?
jQuery.browser.safari && self["inner" + name] ||
jQuery.boxModel && Math.max(document.documentElement["client" + name], document.body["client" + name]) ||
document.body["client" + name] :
this[0] == document ?
Math.max( document.body["scroll" + name], document.body["offset" + name] ) :
h == undefined ?
( this.length ? jQuery.css( this[0], n ) : null ) :
this.css( n, h.constructor == String ? h : h + "px" );
};
});
var chars = jQuery.browser.safari && parseInt(jQuery.browser.version) < 417 ?
"(?:[\\w*_-]|\\\\.)" :
"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",
quickChild = new RegExp("^>\\s*(" + chars + "+)"),
quickID = new RegExp("^(" + chars + "+)(#)(" + chars + "+)"),
quickClass = new RegExp("^([#.]?)(" + chars + "*)");
jQuery.extend({
expr: {
"": "m[2]=='*'||jQuery.nodeName(a,m[2])",
"#": "a.getAttribute('id')==m[2]",
":": {
// Position Checks
lt: "i<m[3]-0",
gt: "i>m[3]-0",
nth: "m[3]-0==i",
eq: "m[3]-0==i",
first: "i==0",
last: "i==r.length-1",
even: "i%2==0",
odd: "i%2",
// Child Checks
"first-child": "a.parentNode.getElementsByTagName('*')[0]==a",
"last-child": "jQuery.nth(a.parentNode.lastChild,1,'previousSibling')==a",
"only-child": "!jQuery.nth(a.parentNode.lastChild,2,'previousSibling')",
// Parent Checks
parent: "a.firstChild",
empty: "!a.firstChild",
// Text Check
contains: "(a.textContent||a.innerText||jQuery(a).text()||'').indexOf(m[3])>=0",
// Visibility
visible: '"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden"',
hidden: '"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden"',
// Form attributes
enabled: "!a.disabled",
disabled: "a.disabled",
checked: "a.checked",
selected: "a.selected||jQuery.attr(a,'selected')",
// Form elements
text: "'text'==a.type",
radio: "'radio'==a.type",
checkbox: "'checkbox'==a.type",
file: "'file'==a.type",
password: "'password'==a.type",
submit: "'submit'==a.type",
image: "'image'==a.type",
reset: "'reset'==a.type",
button: '"button"==a.type||jQuery.nodeName(a,"button")',
input: "/input|select|textarea|button/i.test(a.nodeName)",
// :has()
has: "jQuery.find(m[3],a).length",
// :header
header: "/h\\d/i.test(a.nodeName)",
// :animated
animated: "jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length"
}
},
// The regular expressions that power the parsing engine
parse: [
// Match: [@value='test'], [@foo]
/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,
// Match: :contains('foo')
/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,
// Match: :even, :last-chlid, #id, .class
new RegExp("^([:.#]*)(" + chars + "+)")
],
multiFilter: function( expr, elems, not ) {
var old, cur = [];
while ( expr && expr != old ) {
old = expr;
var f = jQuery.filter( expr, elems, not );
expr = f.t.replace(/^\s*,\s*/, "" );
cur = not ? elems = f.r : jQuery.merge( cur, f.r );
}
return cur;
},
find: function( t, context ) {
// Quickly handle non-string expressions
if ( typeof t != "string" )
return [ t ];
// Make sure that the context is a DOM Element
if ( context && !context.nodeType )
context = null;
// Set the correct context (if none is provided)
context = context || document;
// Initialize the search
var ret = [context], done = [], last;
// Continue while a selector expression exists, and while
// we're no longer looping upon ourselves
while ( t && last != t ) {
var r = [];
last = t;
t = jQuery.trim(t);
var foundToken = false;
// An attempt at speeding up child selectors that
// point to a specific element tag
var re = quickChild;
var m = re.exec(t);
if ( m ) {
var nodeName = m[1].toUpperCase();
// Perform our own iteration and filter
for ( var i = 0; ret[i]; i++ )
for ( var c = ret[i].firstChild; c; c = c.nextSibling )
if ( c.nodeType == 1 && (nodeName == "*" || c.nodeName.toUpperCase() == nodeName.toUpperCase()) )
r.push( c );
ret = r;
t = t.replace( re, "" );
if ( t.indexOf(" ") == 0 ) continue;
foundToken = true;
} else {
re = /^([>+~])\s*(\w*)/i;
if ( (m = re.exec(t)) != null ) {
r = [];
var nodeName = m[2], merge = {};
m = m[1];
for ( var j = 0, rl = ret.length; j < rl; j++ ) {
var n = m == "~" || m == "+" ? ret[j].nextSibling : ret[j].firstChild;
for ( ; n; n = n.nextSibling )
if ( n.nodeType == 1 ) {
var id = jQuery.data(n);
if ( m == "~" && merge[id] ) break;
if (!nodeName || n.nodeName.toUpperCase() == nodeName.toUpperCase() ) {
if ( m == "~" ) merge[id] = true;
r.push( n );
}
if ( m == "+" ) break;
}
}
ret = r;
// And remove the token
t = jQuery.trim( t.replace( re, "" ) );
foundToken = true;
}
}
// See if there's still an expression, and that we haven't already
// matched a token
if ( t && !foundToken ) {
// Handle multiple expressions
if ( !t.indexOf(",") ) {
// Clean the result set
if ( context == ret[0] ) ret.shift();
// Merge the result sets
done = jQuery.merge( done, ret );
// Reset the context
r = ret = [context];
// Touch up the selector string
t = " " + t.substr(1,t.length);
} else {
// Optimize for the case nodeName#idName
var re2 = quickID;
var m = re2.exec(t);
// Re-organize the results, so that they're consistent
if ( m ) {
m = [ 0, m[2], m[3], m[1] ];
} else {
// Otherwise, do a traditional filter check for
// ID, class, and element selectors
re2 = quickClass;
m = re2.exec(t);
}
m[2] = m[2].replace(/\\/g, "");
var elem = ret[ret.length-1];
// Try to do a global search by ID, where we can
if ( m[1] == "#" && elem && elem.getElementById && !jQuery.isXMLDoc(elem) ) {
// Optimization for HTML document case
var oid = elem.getElementById(m[2]);
// Do a quick check for the existence of the actual ID attribute
// to avoid selecting by the name attribute in IE
// also check to insure id is a string to avoid selecting an element with the name of 'id' inside a form
if ( (jQuery.browser.msie||jQuery.browser.opera) && oid && typeof oid.id == "string" && oid.id != m[2] )
oid = jQuery('[@id="'+m[2]+'"]', elem)[0];
// Do a quick check for node name (where applicable) so
// that div#foo searches will be really fast
ret = r = oid && (!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : [];
} else {
// We need to find all descendant elements
for ( var i = 0; ret[i]; i++ ) {
// Grab the tag name being searched for
var tag = m[1] == "#" && m[3] ? m[3] : m[1] != "" || m[0] == "" ? "*" : m[2];
// Handle IE7 being really dumb about <object>s
if ( tag == "*" && ret[i].nodeName.toLowerCase() == "object" )
tag = "param";
r = jQuery.merge( r, ret[i].getElementsByTagName( tag ));
}
// It's faster to filter by class and be done with it
if ( m[1] == "." )
r = jQuery.classFilter( r, m[2] );
// Same with ID filtering
if ( m[1] == "#" ) {
var tmp = [];
// Try to find the element with the ID
for ( var i = 0; r[i]; i++ )
if ( r[i].getAttribute("id") == m[2] ) {
tmp = [ r[i] ];
break;
}
r = tmp;
}
ret = r;
}
t = t.replace( re2, "" );
}
}
// If a selector string still exists
if ( t ) {
// Attempt to filter it
var val = jQuery.filter(t,r);
ret = r = val.r;
t = jQuery.trim(val.t);
}
}
// An error occurred with the selector;
// just return an empty set instead
if ( t )
ret = [];
// Remove the root context
if ( ret && context == ret[0] )
ret.shift();
// And combine the results
done = jQuery.merge( done, ret );
return done;
},
classFilter: function(r,m,not){
m = " " + m + " ";
var tmp = [];
for ( var i = 0; r[i]; i++ ) {
var pass = (" " + r[i].className + " ").indexOf( m ) >= 0;
if ( !not && pass || not && !pass )
tmp.push( r[i] );
}
return tmp;
},
filter: function(t,r,not) {
var last;
// Look for common filter expressions
while ( t && t != last ) {
last = t;
var p = jQuery.parse, m;
for ( var i = 0; p[i]; i++ ) {
m = p[i].exec( t );
if ( m ) {
// Remove what we just matched
t = t.substring( m[0].length );
m[2] = m[2].replace(/\\/g, "");
break;
}
}
if ( !m )
break;
// :not() is a special case that can be optimized by
// keeping it out of the expression list
if ( m[1] == ":" && m[2] == "not" )
r = jQuery.filter(m[3], r, true).r;
// We can get a big speed boost by filtering by class here
else if ( m[1] == "." )
r = jQuery.classFilter(r, m[2], not);
else if ( m[1] == "[" ) {
var tmp = [], type = m[3];
for ( var i = 0, rl = r.length; i < rl; i++ ) {
var a = r[i], z = a[ jQuery.props[m[2]] || m[2] ];
if ( z == null || /href|src|selected/.test(m[2]) )
z = jQuery.attr(a,m[2]) || '';
if ( (type == "" && !!z ||
type == "=" && z == m[5] ||
type == "!=" && z != m[5] ||
type == "^=" && z && !z.indexOf(m[5]) ||
type == "$=" && z.substr(z.length - m[5].length) == m[5] ||
(type == "*=" || type == "~=") && z.indexOf(m[5]) >= 0) ^ not )
tmp.push( a );
}
r = tmp;
// We can get a speed boost by handling nth-child here
} else if ( m[1] == ":" && m[2] == "nth-child" ) {
var merge = {}, tmp = [],
test = /(\d*)n\+?(\d*)/.exec(
m[3] == "even" && "2n" || m[3] == "odd" && "2n+1" ||
!/\D/.test(m[3]) && "n+" + m[3] || m[3]),
first = (test[1] || 1) - 0, last = test[2] - 0;
for ( var i = 0, rl = r.length; i < rl; i++ ) {
var node = r[i], parentNode = node.parentNode, id = jQuery.data(parentNode);
if ( !merge[id] ) {
var c = 1;
for ( var n = parentNode.firstChild; n; n = n.nextSibling )
if ( n.nodeType == 1 )
n.nodeIndex = c++;
merge[id] = true;
}
var add = false;
if ( first == 1 ) {
if ( last == 0 || node.nodeIndex == last )
add = true;
} else if ( (node.nodeIndex + last) % first == 0 )
add = true;
if ( add ^ not )
tmp.push( node );
}
r = tmp;
// Otherwise, find the expression to execute
} else {
var f = jQuery.expr[m[1]];
if ( typeof f != "string" )
f = jQuery.expr[m[1]][m[2]];
// Build a custom macro to enclose it
f = eval("false||function(a,i){return " + f + "}");
// Execute it against the current filter
r = jQuery.grep( r, f, not );
}
}
// Return an array of filtered elements (r)
// and the modified expression string (t)
return { r: r, t: t };
},
dir: function( elem, dir ){
var matched = [];
var cur = elem[dir];
while ( cur && cur != document ) {
if ( cur.nodeType == 1 )
matched.push( cur );
cur = cur[dir];
}
return matched;
},
nth: function(cur,result,dir,elem){
result = result || 1;
var num = 0;
for ( ; cur; cur = cur[dir] )
if ( cur.nodeType == 1 && ++num == result )
break;
return cur;
},
sibling: function( n, elem ) {
var r = [];
for ( ; n; n = n.nextSibling ) {
if ( n.nodeType == 1 && (!elem || n != elem) )
r.push( n );
}
return r;
}
});
/*
* A number of helper functions used for managing events.
* Many of the ideas behind this code orignated from
* Dean Edwards' addEvent library.
*/
jQuery.event = {
// Bind an event to an element
// Original by Dean Edwards
add: function(element, type, handler, data) {
// For whatever reason, IE has trouble passing the window object
// around, causing it to be cloned in the process
if ( jQuery.browser.msie && element.setInterval != undefined )
element = window;
// Make sure that the function being executed has a unique ID
if ( !handler.guid )
handler.guid = this.guid++;
// if data is passed, bind to handler
if( data != undefined ) {
// Create temporary function pointer to original handler
var fn = handler;
// Create unique handler function, wrapped around original handler
handler = function() {
// Pass arguments and context to original handler
return fn.apply(this, arguments);
};
// Store data in unique handler
handler.data = data;
// Set the guid of unique handler to the same of original handler, so it can be removed
handler.guid = fn.guid;
}
// Namespaced event handlers
var parts = type.split(".");
type = parts[0];
handler.type = parts[1];
// Init the element's event structure
var events = jQuery.data(element, "events") || jQuery.data(element, "events", {});
var handle = jQuery.data(element, "handle", function(){
// returned undefined or false
var val;
// Handle the second event of a trigger and when
// an event is called after a page has unloaded
if ( typeof jQuery == "undefined" || jQuery.event.triggered )
return val;
val = jQuery.event.handle.apply(element, arguments);
return val;
});
// Get the current list of functions bound to this event
var handlers = events[type];
// Init the event handler queue
if (!handlers) {
handlers = events[type] = {};
// And bind the global event handler to the element
if (element.addEventListener)
element.addEventListener(type, handle, false);
else
element.attachEvent("on" + type, handle);
}
// Add the function to the element's handler list
handlers[handler.guid] = handler;
// Keep track of which events have been used, for global triggering
this.global[type] = true;
},
guid: 1,
global: {},
// Detach an event or set of events from an element
remove: function(element, type, handler) {
var events = jQuery.data(element, "events"), ret, index;
// Namespaced event handlers
if ( typeof type == "string" ) {
var parts = type.split(".");
type = parts[0];
}
if ( events ) {
// type is actually an event object here
if ( type && type.type ) {
handler = type.handler;
type = type.type;
}
if ( !type ) {
for ( type in events )
this.remove( element, type );
} else if ( events[type] ) {
// remove the given handler for the given type
if ( handler )
delete events[type][handler.guid];
// remove all handlers for the given type
else
for ( handler in events[type] )
// Handle the removal of namespaced events
if ( !parts[1] || events[type][handler].type == parts[1] )
delete events[type][handler];
// remove generic event handler if no more handlers exist
for ( ret in events[type] ) break;
if ( !ret ) {
if (element.removeEventListener)
element.removeEventListener(type, jQuery.data(element, "handle"), false);
else
element.detachEvent("on" + type, jQuery.data(element, "handle"));
ret = null;
delete events[type];
}
}
// Remove the expando if it's no longer used
for ( ret in events ) break;
if ( !ret ) {
jQuery.removeData( element, "events" );
jQuery.removeData( element, "handle" );
}
}
},
trigger: function(type, data, element, donative, extra) {
// Clone the incoming data, if any
data = jQuery.makeArray(data || []);
// Handle a global trigger
if ( !element ) {
// Only trigger if we've ever bound an event for it
if ( this.global[type] )
jQuery("*").add([window, document]).trigger(type, data);
// Handle triggering a single element
} else {
var val, ret, fn = jQuery.isFunction( element[ type ] || null ),
// Check to see if we need to provide a fake event, or not
evt = !data[0] || !data[0].preventDefault;
// Pass along a fake event
if ( evt )
data.unshift( this.fix({ type: type, target: element }) );
// Enforce the right trigger type
data[0].type = type;
// Trigger the event
if ( jQuery.isFunction( jQuery.data(element, "handle") ) )
val = jQuery.data(element, "handle").apply( element, data );
// Handle triggering native .onfoo handlers
if ( !fn && element["on"+type] && element["on"+type].apply( element, data ) === false )
val = false;
// Extra functions don't get the custom event object
if ( evt )
data.shift();
// Handle triggering of extra function
if ( extra && extra.apply( element, data ) === false )
val = false;
// Trigger the native events (except for clicks on links)
if ( fn && donative !== false && val !== false && !(jQuery.nodeName(element, 'a') && type == "click") ) {
this.triggered = true;
element[ type ]();
}
this.triggered = false;
}
return val;
},
handle: function(event) {
// returned undefined or false
var val;
// Empty object is for triggered events with no data
event = jQuery.event.fix( event || window.event || {} );
// Namespaced event handlers
var parts = event.type.split(".");
event.type = parts[0];
var c = jQuery.data(this, "events") && jQuery.data(this, "events")[event.type], args = Array.prototype.slice.call( arguments, 1 );
args.unshift( event );
for ( var j in c ) {
// Pass in a reference to the handler function itself
// So that we can later remove it
args[0].handler = c[j];
args[0].data = c[j].data;
// Filter the functions by class
if ( !parts[1] || c[j].type == parts[1] ) {
var tmp = c[j].apply( this, args );
if ( val !== false )
val = tmp;
if ( tmp === false ) {
event.preventDefault();
event.stopPropagation();
}
}
}
// Clean up added properties in IE to prevent memory leak
if (jQuery.browser.msie)
event.target = event.preventDefault = event.stopPropagation =
event.handler = event.data = null;
return val;
},
fix: function(event) {
// store a copy of the original event object
// and clone to set read-only properties
var originalEvent = event;
event = jQuery.extend({}, originalEvent);
// add preventDefault and stopPropagation since
// they will not work on the clone
event.preventDefault = function() {
// if preventDefault exists run it on the original event
if (originalEvent.preventDefault)
originalEvent.preventDefault();
// otherwise set the returnValue property of the original event to false (IE)
originalEvent.returnValue = false;
};
event.stopPropagation = function() {
// if stopPropagation exists run it on the original event
if (originalEvent.stopPropagation)
originalEvent.stopPropagation();
// otherwise set the cancelBubble property of the original event to true (IE)
originalEvent.cancelBubble = true;
};
// Fix target property, if necessary
if ( !event.target && event.srcElement )
event.target = event.srcElement;
// check if target is a textnode (safari)
if (jQuery.browser.safari && event.target.nodeType == 3)
event.target = originalEvent.target.parentNode;
// Add relatedTarget, if necessary
if ( !event.relatedTarget && event.fromElement )
event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement;
// Calculate pageX/Y if missing and clientX/Y available
if ( event.pageX == null && event.clientX != null ) {
var e = document.documentElement, b = document.body;
event.pageX = event.clientX + (e && e.scrollLeft || b.scrollLeft || 0);
event.pageY = event.clientY + (e && e.scrollTop || b.scrollTop || 0);
}
// Add which for key events
if ( !event.which && (event.charCode || event.keyCode) )
event.which = event.charCode || event.keyCode;
// Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)
if ( !event.metaKey && event.ctrlKey )
event.metaKey = event.ctrlKey;
// Add which for click: 1 == left; 2 == middle; 3 == right
// Note: button is not normalized, so don't use it
if ( !event.which && event.button )
event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
return event;
}
};
jQuery.fn.extend({
bind: function( type, data, fn ) {
return type == "unload" ? this.one(type, data, fn) : this.each(function(){
jQuery.event.add( this, type, fn || data, fn && data );
});
},
one: function( type, data, fn ) {
return this.each(function(){
jQuery.event.add( this, type, function(event) {
jQuery(this).unbind(event);
return (fn || data).apply( this, arguments);
}, fn && data);
});
},
unbind: function( type, fn ) {
return this.each(function(){
jQuery.event.remove( this, type, fn );
});
},
trigger: function( type, data, fn ) {
return this.each(function(){
jQuery.event.trigger( type, data, this, true, fn );
});
},
triggerHandler: function( type, data, fn ) {
if ( this[0] )
return jQuery.event.trigger( type, data, this[0], false, fn );
},
toggle: function() {
// Save reference to arguments for access in closure
var a = arguments;
return this.click(function(e) {
// Figure out which function to execute
this.lastToggle = 0 == this.lastToggle ? 1 : 0;
// Make sure that clicks stop
e.preventDefault();
// and execute the function
return a[this.lastToggle].apply( this, [e] ) || false;
});
},
hover: function(f,g) {
// A private function for handling mouse 'hovering'
function handleHover(e) {
// Check if mouse(over|out) are still within the same parent element
var p = e.relatedTarget;
// Traverse up the tree
while ( p && p != this ) try { p = p.parentNode; } catch(e) { p = this; };
// If we actually just moused on to a sub-element, ignore it
if ( p == this ) return false;
// Execute the right function
return (e.type == "mouseover" ? f : g).apply(this, [e]);
}
// Bind the function to the two event listeners
return this.mouseover(handleHover).mouseout(handleHover);
},
ready: function(f) {
// Attach the listeners
bindReady();
// If the DOM is already ready
if ( jQuery.isReady )
// Execute the function immediately
f.apply( document, [jQuery] );
// Otherwise, remember the function for later
else
// Add the function to the wait list
jQuery.readyList.push( function() { return f.apply(this, [jQuery]); } );
return this;
}
});
jQuery.extend({
/*
* All the code that makes DOM Ready work nicely.
*/
isReady: false,
readyList: [],
// Handle when the DOM is ready
ready: function() {
// Make sure that the DOM is not already loaded
if ( !jQuery.isReady ) {
// Remember that the DOM is ready
jQuery.isReady = true;
// If there are functions bound, to execute
if ( jQuery.readyList ) {
// Execute all of them
jQuery.each( jQuery.readyList, function(){
this.apply( document );
});
// Reset the list of functions
jQuery.readyList = null;
}
// Remove event listener to avoid memory leak
if ( jQuery.browser.mozilla || jQuery.browser.opera )
document.removeEventListener( "DOMContentLoaded", jQuery.ready, false );
// Remove script element used by IE hack
if( !window.frames.length ) // don't remove if frames are present (#1187)
jQuery(window).load(function(){ jQuery("#__ie_init").remove(); });
}
}
});
jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
"mousedown,mouseup,mousemove,mouseover,mouseout,change,select," +
"submit,keydown,keypress,keyup,error").split(","), function(i,o){
// Handle event binding
jQuery.fn[o] = function(f){
return f ? this.bind(o, f) : this.trigger(o);
};
});
var readyBound = false;
function bindReady(){
if ( readyBound ) return;
readyBound = true;
// If Mozilla is used
if ( jQuery.browser.mozilla || jQuery.browser.opera )
// Use the handy event callback
document.addEventListener( "DOMContentLoaded", jQuery.ready, false );
// If IE is used, use the excellent hack by Matthias Miller
// http://www.outofhanwell.com/blog/index.php?title=the_window_onload_problem_revisited
else if ( jQuery.browser.msie ) {
// Only works if you document.write() it
document.write("<scr" + "ipt id=__ie_init defer=true " +
"src=//:><\/script>");
// Use the defer script hack
var script = document.getElementById("__ie_init");
// script does not exist if jQuery is loaded dynamically
if ( script )
script.onreadystatechange = function() {
if ( this.readyState != "complete" ) return;
jQuery.ready();
};
// Clear from memory
script = null;
// If Safari is used
} else if ( jQuery.browser.safari )
// Continually check to see if the document.readyState is valid
jQuery.safariTimer = setInterval(function(){
// loaded and complete are both valid states
if ( document.readyState == "loaded" ||
document.readyState == "complete" ) {
// If either one are found, remove the timer
clearInterval( jQuery.safariTimer );
jQuery.safariTimer = null;
// and execute any waiting functions
jQuery.ready();
}
}, 10);
// A fallback to window.onload, that will always work
jQuery.event.add( window, "load", jQuery.ready );
}
jQuery.fn.extend({
load: function( url, params, callback ) {
if ( jQuery.isFunction( url ) )
return this.bind("load", url);
var off = url.indexOf(" ");
if ( off >= 0 ) {
var selector = url.slice(off, url.length);
url = url.slice(0, off);
}
callback = callback || function(){};
// Default to a GET request
var type = "GET";
// If the second parameter was provided
if ( params )
// If it's a function
if ( jQuery.isFunction( params ) ) {
// We assume that it's the callback
callback = params;
params = null;
// Otherwise, build a param string
} else {
params = jQuery.param( params );
type = "POST";
}
var self = this;
// Request the remote document
jQuery.ajax({
url: url,
type: type,
data: params,
complete: function(res, status){
// If successful, inject the HTML into all the matched elements
if ( status == "success" || status == "notmodified" )
// See if a selector was specified
self.html( selector ?
// Create a dummy div to hold the results
jQuery("<div/>")
// inject the contents of the document in, removing the scripts
// to avoid any 'Permission Denied' errors in IE
.append(res.responseText.replace(/<script(.|\s)*?\/script>/g, ""))
// Locate the specified elements
.find(selector) :
// If not, just inject the full result
res.responseText );
// Add delay to account for Safari's delay in globalEval
setTimeout(function(){
self.each( callback, [res.responseText, status, res] );
}, 13);
}
});
return this;
},
serialize: function() {
return jQuery.param(this.serializeArray());
},
serializeArray: function() {
return this.map(function(){
return jQuery.nodeName(this, "form") ?
jQuery.makeArray(this.elements) : this;
})
.filter(function(){
return this.name && !this.disabled &&
(this.checked || /select|textarea/i.test(this.nodeName) ||
/text|hidden|password/i.test(this.type));
})
.map(function(i, elem){
var val = jQuery(this).val();
return val == null ? null :
val.constructor == Array ?
jQuery.map( val, function(val, i){
return {name: elem.name, value: val};
}) :
{name: elem.name, value: val};
}).get();
}
});
// Attach a bunch of functions for handling common AJAX events
jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i,o){
jQuery.fn[o] = function(f){
return this.bind(o, f);
};
});
var jsc = (new Date).getTime();
jQuery.extend({
get: function( url, data, callback, type ) {
// shift arguments if data argument was ommited
if ( jQuery.isFunction( data ) ) {
callback = data;
data = null;
}
return jQuery.ajax({
type: "GET",
url: url,
data: data,
success: callback,
dataType: type
});
},
getScript: function( url, callback ) {
return jQuery.get(url, null, callback, "script");
},
getJSON: function( url, data, callback ) {
return jQuery.get(url, data, callback, "json");
},
post: function( url, data, callback, type ) {
if ( jQuery.isFunction( data ) ) {
callback = data;
data = {};
}
return jQuery.ajax({
type: "POST",
url: url,
data: data,
success: callback,
dataType: type
});
},
ajaxSetup: function( settings ) {
jQuery.extend( jQuery.ajaxSettings, settings );
},
ajaxSettings: {
global: true,
type: "GET",
timeout: 0,
contentType: "application/x-www-form-urlencoded",
processData: true,
async: true,
data: null
},
// Last-Modified header cache for next request
lastModified: {},
ajax: function( s ) {
var jsonp, jsre = /=(\?|%3F)/g, status, data;
// Extend the settings, but re-extend 's' so that it can be
// checked again later (in the test suite, specifically)
s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings, s));
// convert data if not already a string
if ( s.data && s.processData && typeof s.data != "string" )
s.data = jQuery.param(s.data);
// Handle JSONP Parameter Callbacks
if ( s.dataType == "jsonp" ) {
if ( s.type.toLowerCase() == "get" ) {
if ( !s.url.match(jsre) )
s.url += (s.url.match(/\?/) ? "&" : "?") + (s.jsonp || "callback") + "=?";
} else if ( !s.data || !s.data.match(jsre) )
s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
s.dataType = "json";
}
// Build temporary JSONP function
if ( s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre)) ) {
jsonp = "jsonp" + jsc++;
// Replace the =? sequence both in the query string and the data
if ( s.data )
s.data = s.data.replace(jsre, "=" + jsonp);
s.url = s.url.replace(jsre, "=" + jsonp);
// We need to make sure
// that a JSONP style response is executed properly
s.dataType = "script";
// Handle JSONP-style loading
window[ jsonp ] = function(tmp){
data = tmp;
success();
complete();
// Garbage collect
window[ jsonp ] = undefined;
try{ delete window[ jsonp ]; } catch(e){}
};
}
if ( s.dataType == "script" && s.cache == null )
s.cache = false;
if ( s.cache === false && s.type.toLowerCase() == "get" )
s.url += (s.url.match(/\?/) ? "&" : "?") + "_=" + (new Date()).getTime();
// If data is available, append data to url for get requests
if ( s.data && s.type.toLowerCase() == "get" ) {
s.url += (s.url.match(/\?/) ? "&" : "?") + s.data;
// IE likes to send both get and post data, prevent this
s.data = null;
}
// Watch for a new set of requests
if ( s.global && ! jQuery.active++ )
jQuery.event.trigger( "ajaxStart" );
// If we're requesting a remote document
// and trying to load JSON or Script
if ( !s.url.indexOf("http") && s.dataType == "script" ) {
var head = document.getElementsByTagName("head")[0];
var script = document.createElement("script");
script.src = s.url;
// Handle Script loading
if ( !jsonp && (s.success || s.complete) ) {
var done = false;
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function(){
if ( !done && (!this.readyState ||
this.readyState == "loaded" || this.readyState == "complete") ) {
done = true;
success();
complete();
head.removeChild( script );
}
};
}
head.appendChild(script);
// We handle everything using the script element injection
return;
}
var requestDone = false;
// Create the request object; Microsoft failed to properly
// implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
var xml = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
// Open the socket
xml.open(s.type, s.url, s.async);
// Set the correct header, if data is being sent
if ( s.data )
xml.setRequestHeader("Content-Type", s.contentType);
// Set the If-Modified-Since header, if ifModified mode.
if ( s.ifModified )
xml.setRequestHeader("If-Modified-Since",
jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" );
// Set header so the called script knows that it's an XMLHttpRequest
xml.setRequestHeader("X-Requested-With", "XMLHttpRequest");
// Allow custom headers/mimetypes
if ( s.beforeSend )
s.beforeSend(xml);
if ( s.global )
jQuery.event.trigger("ajaxSend", [xml, s]);
// Wait for a response to come back
var onreadystatechange = function(isTimeout){
// The transfer is complete and the data is available, or the request timed out
if ( !requestDone && xml && (xml.readyState == 4 || isTimeout == "timeout") ) {
requestDone = true;
// clear poll interval
if (ival) {
clearInterval(ival);
ival = null;
}
status = isTimeout == "timeout" && "timeout" ||
!jQuery.httpSuccess( xml ) && "error" ||
s.ifModified && jQuery.httpNotModified( xml, s.url ) && "notmodified" ||
"success";
if ( status == "success" ) {
// Watch for, and catch, XML document parse errors
try {
// process the data (runs the xml through httpData regardless of callback)
data = jQuery.httpData( xml, s.dataType );
} catch(e) {
status = "parsererror";
}
}
// Make sure that the request was successful or notmodified
if ( status == "success" ) {
// Cache Last-Modified header, if ifModified mode.
var modRes;
try {
modRes = xml.getResponseHeader("Last-Modified");
} catch(e) {} // swallow exception thrown by FF if header is not available
if ( s.ifModified && modRes )
jQuery.lastModified[s.url] = modRes;
// JSONP handles its own success callback
if ( !jsonp )
success();
} else
jQuery.handleError(s, xml, status);
// Fire the complete handlers
complete();
// Stop memory leaks
if ( s.async )
xml = null;
}
};
if ( s.async ) {
// don't attach the handler to the request, just poll it instead
var ival = setInterval(onreadystatechange, 13);
// Timeout checker
if ( s.timeout > 0 )
setTimeout(function(){
// Check to see if the request is still happening
if ( xml ) {
// Cancel the request
xml.abort();
if( !requestDone )
onreadystatechange( "timeout" );
}
}, s.timeout);
}
// Send the data
try {
xml.send(s.data);
} catch(e) {
jQuery.handleError(s, xml, null, e);
}
// firefox 1.5 doesn't fire statechange for sync requests
if ( !s.async )
onreadystatechange();
// return XMLHttpRequest to allow aborting the request etc.
return xml;
function success(){
// If a local callback was specified, fire it and pass it the data
if ( s.success )
s.success( data, status );
// Fire the global callback
if ( s.global )
jQuery.event.trigger( "ajaxSuccess", [xml, s] );
}
function complete(){
// Process result
if ( s.complete )
s.complete(xml, status);
// The request was completed
if ( s.global )
jQuery.event.trigger( "ajaxComplete", [xml, s] );
// Handle the global AJAX counter
if ( s.global && ! --jQuery.active )
jQuery.event.trigger( "ajaxStop" );
}
},
handleError: function( s, xml, status, e ) {
// If a local callback was specified, fire it
if ( s.error ) s.error( xml, status, e );
// Fire the global callback
if ( s.global )
jQuery.event.trigger( "ajaxError", [xml, s, e] );
},
// Counter for holding the number of active queries
active: 0,
// Determines if an XMLHttpRequest was successful or not
httpSuccess: function( r ) {
try {
return !r.status && location.protocol == "file:" ||
( r.status >= 200 && r.status < 300 ) || r.status == 304 ||
jQuery.browser.safari && r.status == undefined;
} catch(e){}
return false;
},
// Determines if an XMLHttpRequest returns NotModified
httpNotModified: function( xml, url ) {
try {
var xmlRes = xml.getResponseHeader("Last-Modified");
// Firefox always returns 200. check Last-Modified date
return xml.status == 304 || xmlRes == jQuery.lastModified[url] ||
jQuery.browser.safari && xml.status == undefined;
} catch(e){}
return false;
},
httpData: function( r, type ) {
var ct = r.getResponseHeader("content-type");
var xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0;
var data = xml ? r.responseXML : r.responseText;
if ( xml && data.documentElement.tagName == "parsererror" )
throw "parsererror";
// If the type is "script", eval it in global context
if ( type == "script" )
jQuery.globalEval( data );
// Get the JavaScript object, if JSON is used.
if ( type == "json" )
data = eval("(" + data + ")");
return data;
},
// Serialize an array of form elements or a set of
// key/values into a query string
param: function( a ) {
var s = [];
// If an array was passed in, assume that it is an array
// of form elements
if ( a.constructor == Array || a.jquery )
// Serialize the form elements
jQuery.each( a, function(){
s.push( encodeURIComponent(this.name) + "=" + encodeURIComponent( this.value ) );
});
// Otherwise, assume that it's an object of key/value pairs
else
// Serialize the key/values
for ( var j in a )
// If the value is an array then the key names need to be repeated
if ( a[j] && a[j].constructor == Array )
jQuery.each( a[j], function(){
s.push( encodeURIComponent(j) + "=" + encodeURIComponent( this ) );
});
else
s.push( encodeURIComponent(j) + "=" + encodeURIComponent( a[j] ) );
// Return the resulting serialization
return s.join("&").replace(/%20/g, "+");
}
});
jQuery.fn.extend({
show: function(speed,callback){
return speed ?
this.animate({
height: "show", width: "show", opacity: "show"
}, speed, callback) :
this.filter(":hidden").each(function(){
this.style.display = this.oldblock ? this.oldblock : "";
if ( jQuery.css(this,"display") == "none" )
this.style.display = "block";
}).end();
},
hide: function(speed,callback){
return speed ?
this.animate({
height: "hide", width: "hide", opacity: "hide"
}, speed, callback) :
this.filter(":visible").each(function(){
this.oldblock = this.oldblock || jQuery.css(this,"display");
if ( this.oldblock == "none" )
this.oldblock = "block";
this.style.display = "none";
}).end();
},
// Save the old toggle function
_toggle: jQuery.fn.toggle,
toggle: function( fn, fn2 ){
return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?
this._toggle( fn, fn2 ) :
fn ?
this.animate({
height: "toggle", width: "toggle", opacity: "toggle"
}, fn, fn2) :
this.each(function(){
jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ]();
});
},
slideDown: function(speed,callback){
return this.animate({height: "show"}, speed, callback);
},
slideUp: function(speed,callback){
return this.animate({height: "hide"}, speed, callback);
},
slideToggle: function(speed, callback){
return this.animate({height: "toggle"}, speed, callback);
},
fadeIn: function(speed, callback){
return this.animate({opacity: "show"}, speed, callback);
},
fadeOut: function(speed, callback){
return this.animate({opacity: "hide"}, speed, callback);
},
fadeTo: function(speed,to,callback){
return this.animate({opacity: to}, speed, callback);
},
animate: function( prop, speed, easing, callback ) {
var opt = jQuery.speed(speed, easing, callback);
return this[ opt.queue === false ? "each" : "queue" ](function(){
opt = jQuery.extend({}, opt);
var hidden = jQuery(this).is(":hidden"), self = this;
for ( var p in prop ) {
if ( prop[p] == "hide" && hidden || prop[p] == "show" && !hidden )
return jQuery.isFunction(opt.complete) && opt.complete.apply(this);
if ( p == "height" || p == "width" ) {
// Store display property
opt.display = jQuery.css(this, "display");
// Make sure that nothing sneaks out
opt.overflow = this.style.overflow;
}
}
if ( opt.overflow != null )
this.style.overflow = "hidden";
opt.curAnim = jQuery.extend({}, prop);
jQuery.each( prop, function(name, val){
var e = new jQuery.fx( self, opt, name );
if ( /toggle|show|hide/.test(val) )
e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop );
else {
var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),
start = e.cur(true) || 0;
if ( parts ) {
var end = parseFloat(parts[2]),
unit = parts[3] || "px";
// We need to compute starting value
if ( unit != "px" ) {
self.style[ name ] = (end || 1) + unit;
start = ((end || 1) / e.cur(true)) * start;
self.style[ name ] = start + unit;
}
// If a +=/-= token was provided, we're doing a relative animation
if ( parts[1] )
end = ((parts[1] == "-=" ? -1 : 1) * end) + start;
e.custom( start, end, unit );
} else
e.custom( start, val, "" );
}
});
// For JS strict compliance
return true;
});
},
queue: function(type, fn){
if ( jQuery.isFunction(type) ) {
fn = type;
type = "fx";
}
if ( !type || (typeof type == "string" && !fn) )
return queue( this[0], type );
return this.each(function(){
if ( fn.constructor == Array )
queue(this, type, fn);
else {
queue(this, type).push( fn );
if ( queue(this, type).length == 1 )
fn.apply(this);
}
});
},
stop: function(){
var timers = jQuery.timers;
return this.each(function(){
for ( var i = 0; i < timers.length; i++ )
if ( timers[i].elem == this )
timers.splice(i--, 1);
}).dequeue();
}
});
var queue = function( elem, type, array ) {
if ( !elem )
return;
var q = jQuery.data( elem, type + "queue" );
if ( !q || array )
q = jQuery.data( elem, type + "queue",
array ? jQuery.makeArray(array) : [] );
return q;
};
jQuery.fn.dequeue = function(type){
type = type || "fx";
return this.each(function(){
var q = queue(this, type);
q.shift();
if ( q.length )
q[0].apply( this );
});
};
jQuery.extend({
speed: function(speed, easing, fn) {
var opt = speed && speed.constructor == Object ? speed : {
complete: fn || !fn && easing ||
jQuery.isFunction( speed ) && speed,
duration: speed,
easing: fn && easing || easing && easing.constructor != Function && easing
};
opt.duration = (opt.duration && opt.duration.constructor == Number ?
opt.duration :
{ slow: 600, fast: 200 }[opt.duration]) || 400;
// Queueing
opt.old = opt.complete;
opt.complete = function(){
jQuery(this).dequeue();
if ( jQuery.isFunction( opt.old ) )
opt.old.apply( this );
};
return opt;
},
easing: {
linear: function( p, n, firstNum, diff ) {
return firstNum + diff * p;
},
swing: function( p, n, firstNum, diff ) {
return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
}
},
timers: [],
fx: function( elem, options, prop ){
this.options = options;
this.elem = elem;
this.prop = prop;
if ( !options.orig )
options.orig = {};
}
});
jQuery.fx.prototype = {
// Simple function for setting a style value
update: function(){
if ( this.options.step )
this.options.step.apply( this.elem, [ this.now, this ] );
(jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );
// Set display property to block for height/width animations
if ( this.prop == "height" || this.prop == "width" )
this.elem.style.display = "block";
},
// Get the current size
cur: function(force){
if ( this.elem[this.prop] != null && this.elem.style[this.prop] == null )
return this.elem[ this.prop ];
var r = parseFloat(jQuery.curCSS(this.elem, this.prop, force));
return r && r > -10000 ? r : parseFloat(jQuery.css(this.elem, this.prop)) || 0;
},
// Start an animation from one number to another
custom: function(from, to, unit){
this.startTime = (new Date()).getTime();
this.start = from;
this.end = to;
this.unit = unit || this.unit || "px";
this.now = this.start;
this.pos = this.state = 0;
this.update();
var self = this;
function t(){
return self.step();
}
t.elem = this.elem;
jQuery.timers.push(t);
if ( jQuery.timers.length == 1 ) {
var timer = setInterval(function(){
var timers = jQuery.timers;
for ( var i = 0; i < timers.length; i++ )
if ( !timers[i]() )
timers.splice(i--, 1);
if ( !timers.length )
clearInterval( timer );
}, 13);
}
},
// Simple 'show' function
show: function(){
// Remember where we started, so that we can go back to it later
this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
this.options.show = true;
// Begin the animation
this.custom(0, this.cur());
// Make sure that we start at a small width/height to avoid any
// flash of content
if ( this.prop == "width" || this.prop == "height" )
this.elem.style[this.prop] = "1px";
// Start by showing the element
jQuery(this.elem).show();
},
// Simple 'hide' function
hide: function(){
// Remember where we started, so that we can go back to it later
this.options.orig[this.prop] = jQuery.attr( this.elem.style, this.prop );
this.options.hide = true;
// Begin the animation
this.custom(this.cur(), 0);
},
// Each step of an animation
step: function(){
var t = (new Date()).getTime();
if ( t > this.options.duration + this.startTime ) {
this.now = this.end;
this.pos = this.state = 1;
this.update();
this.options.curAnim[ this.prop ] = true;
var done = true;
for ( var i in this.options.curAnim )
if ( this.options.curAnim[i] !== true )
done = false;
if ( done ) {
if ( this.options.display != null ) {
// Reset the overflow
this.elem.style.overflow = this.options.overflow;
// Reset the display
this.elem.style.display = this.options.display;
if ( jQuery.css(this.elem, "display") == "none" )
this.elem.style.display = "block";
}
// Hide the element if the "hide" operation was done
if ( this.options.hide )
this.elem.style.display = "none";
// Reset the properties, if the item has been hidden or shown
if ( this.options.hide || this.options.show )
for ( var p in this.options.curAnim )
jQuery.attr(this.elem.style, p, this.options.orig[p]);
}
// If a callback was provided, execute it
if ( done && jQuery.isFunction( this.options.complete ) )
// Execute the complete function
this.options.complete.apply( this.elem );
return false;
} else {
var n = t - this.startTime;
this.state = n / this.options.duration;
// Perform the easing function, defaults to swing
this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing" : "linear")](this.state, n, 0, 1, this.options.duration);
this.now = this.start + ((this.end - this.start) * this.pos);
// Perform the next step of the animation
this.update();
}
return true;
}
};
jQuery.fx.step = {
scrollLeft: function(fx){
fx.elem.scrollLeft = fx.now;
},
scrollTop: function(fx){
fx.elem.scrollTop = fx.now;
},
opacity: function(fx){
jQuery.attr(fx.elem.style, "opacity", fx.now);
},
_default: function(fx){
fx.elem.style[ fx.prop ] = fx.now + fx.unit;
}
};
// The Offset Method
// Originally By Brandon Aaron, part of the Dimension Plugin
// http://jquery.com/plugins/project/dimensions
jQuery.fn.offset = function() {
var left = 0, top = 0, elem = this[0], results;
if ( elem ) with ( jQuery.browser ) {
var absolute = jQuery.css(elem, "position") == "absolute",
parent = elem.parentNode,
offsetParent = elem.offsetParent,
doc = elem.ownerDocument,
safari2 = safari && parseInt(version) < 522;
// Use getBoundingClientRect if available
if ( elem.getBoundingClientRect ) {
box = elem.getBoundingClientRect();
// Add the document scroll offsets
add(
box.left + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft),
box.top + Math.max(doc.documentElement.scrollTop, doc.body.scrollTop)
);
// IE adds the HTML element's border, by default it is medium which is 2px
// IE 6 and IE 7 quirks mode the border width is overwritable by the following css html { border: 0; }
// IE 7 standards mode, the border is always 2px
if ( msie ) {
var border = jQuery("html").css("borderWidth");
border = (border == "medium" || jQuery.boxModel && parseInt(version) >= 7) && 2 || border;
add( -border, -border );
}
// Otherwise loop through the offsetParents and parentNodes
} else {
// Initial element offsets
add( elem.offsetLeft, elem.offsetTop );
// Get parent offsets
while ( offsetParent ) {
// Add offsetParent offsets
add( offsetParent.offsetLeft, offsetParent.offsetTop );
// Mozilla and Safari > 2 does not include the border on offset parents
// However Mozilla adds the border for table cells
if ( mozilla && /^t[d|h]$/i.test(parent.tagName) || !safari2 )
border( offsetParent );
// Safari <= 2 doubles body offsets with an absolutely positioned element or parent
if ( safari2 && !absolute && jQuery.css(offsetParent, "position") == "absolute" )
absolute = true;
// Get next offsetParent
offsetParent = offsetParent.offsetParent;
}
// Get parent scroll offsets
while ( parent.tagName && !/^body|html$/i.test(parent.tagName) ) {
// Work around opera inline/table scrollLeft/Top bug
if ( !/^inline|table-row.*$/i.test(jQuery.css(parent, "display")) )
// Subtract parent scroll offsets
add( -parent.scrollLeft, -parent.scrollTop );
// Mozilla does not add the border for a parent that has overflow != visible
if ( mozilla && jQuery.css(parent, "overflow") != "visible" )
border( parent );
// Get next parent
parent = parent.parentNode;
}
// Safari doubles body offsets with an absolutely positioned element or parent
if ( safari2 && absolute )
add( -doc.body.offsetLeft, -doc.body.offsetTop );
}
// Return an object with top and left properties
results = { top: top, left: left };
}
return results;
function border(elem) {
add( jQuery.css(elem, "borderLeftWidth"), jQuery.css(elem, "borderTopWidth") );
}
function add(l, t) {
left += parseInt(l) || 0;
top += parseInt(t) || 0;
}
};
})();
// Adapted from MIT Licensed: http://www.kryogenix.org/code/browser/sorttable/
Sortable = {};
(function() { // Closure for namespace protection.
var SORT_COLUMN_INDEX;
function sortables_init() {
// Find all tables with class sortable and make them sortable
if (!document.getElementsByTagName) return;
tbls = document.getElementsByTagName("table");
for (ti=0;ti<tbls.length;ti++) {
thisTbl = tbls[ti];
if (((' '+thisTbl.className+' ').indexOf("sortable") != -1) && (thisTbl.id)) {
ts_makeSortable(thisTbl);
}
}
}
Sortable.init = sortables_init; // Exposed!
function ts_makeSortable(table) {
if (table.rows && table.rows.length > 0) {
var firstRow = table.rows[0];
}
if (!firstRow) return;
if ((' '+table.className+' ').indexOf(" sortableVisited ") != -1) // This check makes the function rerunnable/idempotent.
return;
table.className = table.className + " sortableVisited";
// We have a first row: assume it's the header, and make its contents clickable links
for (var i=0;i<firstRow.cells.length;i++) {
var cell = firstRow.cells[i];
var txt = ts_getInnerText(cell);
cell.innerHTML = '<a href="#" class="sortheader" onclick="Sortable.resort(this);return false;">'+txt+'<span class="sortarrow"> </span></a>';
cell.className = "sortheader";
}
}
Sortable.initTable = ts_makeSortable; // Exposed!
function ts_getInnerText(el) {
if (typeof el == "string") return el;
if (typeof el == "undefined") { return el };
if (el.innerText) return el.innerText; //Not needed but it is faster
var str = "";
var cs = el.childNodes;
var l = cs.length;
for (var i = 0; i < l; i++) {
switch (cs[i].nodeType) {
case 1: //ELEMENT_NODE
str += ts_getInnerText(cs[i]);
break;
case 3: //TEXT_NODE
str += cs[i].nodeValue;
break;
}
}
return str;
}
function ts_resortTable(lnk) {
// get the span
var span;
for (var ci=0;ci<lnk.childNodes.length;ci++) {
if (lnk.childNodes[ci].tagName && lnk.childNodes[ci].tagName.toLowerCase() == 'span') span = lnk.childNodes[ci];
}
var spantext = ts_getInnerText(span);
var td = lnk.parentNode;
var column = td.cellIndex;
var table = getParent(td,'TABLE');
// Work out a type for the column
if (table.rows.length <= 1) return;
var itm = ts_getInnerText(table.rows[1].cells[column]);
sortfn = ts_sort_caseinsensitive;
if (itm.match(/^\d\d[\/-]\d\d[\/-]\d\d\d\d$/)) sortfn = ts_sort_date;
if (itm.match(/^\d\d[\/-]\d\d[\/-]\d\d$/)) sortfn = ts_sort_date;
if (itm.match(/^[£$]/)) sortfn = ts_sort_currency;
if (itm.match(/^[\d\.]+$/)) sortfn = ts_sort_numeric;
SORT_COLUMN_INDEX = column;
var firstRow = new Array();
var newRows = new Array();
for (i=0;i<table.rows[0].length;i++) { firstRow[i] = table.rows[0][i]; }
for (j=1;j<table.rows.length;j++) { newRows[j-1] = table.rows[j]; }
newRows.sort(sortfn);
if (span.getAttribute("sortdir") == 'down') {
ARROW = ' ↑';
newRows.reverse();
span.setAttribute('sortdir','up');
} else {
ARROW = ' ↓';
span.setAttribute('sortdir','down');
}
// We appendChild rows that already exist to the tbody, so it moves them rather than creating new ones
// don't do sortbottom rows
for (i=0;i<newRows.length;i++) { if (!newRows[i].className || (newRows[i].className && (newRows[i].className.indexOf('sortbottom') == -1))) table.tBodies[0].appendChild(newRows[i]);}
// do sortbottom rows only
for (i=0;i<newRows.length;i++) { if (newRows[i].className && (newRows[i].className.indexOf('sortbottom') != -1)) table.tBodies[0].appendChild(newRows[i]);}
// Delete any other arrows there may be showing
var allspans = document.getElementsByTagName("span");
for (var ci=0;ci<allspans.length;ci++) {
if (allspans[ci].className == 'sortarrow') {
if (getParent(allspans[ci],"table") == getParent(lnk,"table")) { // in the same table as us?
allspans[ci].innerHTML = ' ';
}
}
}
span.innerHTML = ARROW;
}
Sortable.resort = ts_resortTable; // Exposed!
function getParent(el, pTagName) {
if (el == null) return null;
else if (el.nodeType == 1 && el.tagName.toLowerCase() == pTagName.toLowerCase()) // Gecko bug, supposed to be uppercase
return el;
else
return getParent(el.parentNode, pTagName);
}
function ts_sort_date(a,b) {
// y2k notes: two digit years less than 50 are treated as 20XX, greater than 50 are treated as 19XX
aa = ts_getInnerText(a.cells[SORT_COLUMN_INDEX]);
bb = ts_getInnerText(b.cells[SORT_COLUMN_INDEX]);
if (aa.length == 10) {
dt1 = aa.substr(6,4)+aa.substr(3,2)+aa.substr(0,2);
} else {
yr = aa.substr(6,2);
if (parseInt(yr) < 50) { yr = '20'+yr; } else { yr = '19'+yr; }
dt1 = yr+aa.substr(3,2)+aa.substr(0,2);
}
if (bb.length == 10) {
dt2 = bb.substr(6,4)+bb.substr(3,2)+bb.substr(0,2);
} else {
yr = bb.substr(6,2);
if (parseInt(yr) < 50) { yr = '20'+yr; } else { yr = '19'+yr; }
dt2 = yr+bb.substr(3,2)+bb.substr(0,2);
}
if (dt1==dt2) return 0;
if (dt1<dt2) return -1;
return 1;
}
function ts_sort_currency(a,b) {
aa = ts_getInnerText(a.cells[SORT_COLUMN_INDEX]).replace(/[^0-9.]/g,'');
bb = ts_getInnerText(b.cells[SORT_COLUMN_INDEX]).replace(/[^0-9.]/g,'');
return parseFloat(aa) - parseFloat(bb);
}
function ts_sort_numeric(a,b) {
aa = parseFloat(ts_getInnerText(a.cells[SORT_COLUMN_INDEX]));
if (isNaN(aa)) aa = 0;
bb = parseFloat(ts_getInnerText(b.cells[SORT_COLUMN_INDEX]));
if (isNaN(bb)) bb = 0;
return aa-bb;
}
function ts_sort_caseinsensitive(a,b) {
aa = ts_getInnerText(a.cells[SORT_COLUMN_INDEX]).toLowerCase();
bb = ts_getInnerText(b.cells[SORT_COLUMN_INDEX]).toLowerCase();
if (aa==bb) return 0;
if (aa<bb) return -1;
return 1;
}
function ts_sort_default(a,b) {
aa = ts_getInnerText(a.cells[SORT_COLUMN_INDEX]);
bb = ts_getInnerText(b.cells[SORT_COLUMN_INDEX]);
if (aa==bb) return 0;
if (aa<bb) return -1;
return 1;
}
function addEvent(elm, evType, fn, useCapture)
// addEvent and removeEvent
// cross-browser event handling for IE5+, NS6 and Mozilla
// By Scott Andrew
{
if (elm.addEventListener){
elm.addEventListener(evType, fn, useCapture);
return true;
} else if (elm.attachEvent){
var r = elm.attachEvent("on"+evType, fn);
return r;
} else {
alert("Handler could not be removed");
}
}
// addEvent(window, "load", sortables_init);
}) ();
/**
* TrimPath Base Utilities. Release 1.0.0.
* Copyright (C) 2005 - 2007 TrimPath.
*/
if (typeof(TrimPath) == 'undefined')
TrimPath = {};
(function(safeEval) { // Using a closure to keep global namespace clean.
var theMath = Math;
var theIsNaN = isNaN;
var theParseInt = parseInt;
var theParseFloat = parseFloat;
var logStart = new Date().getTime();
var MANY_ZEROS = '00000000000000000';
var baseUtil = TrimPath.baseUtil = {
noop : function() {},
noopThis : function() { return this; },
noopNull : function() { return null; },
noopFalse : function() { return false; },
safeEval : safeEval,
safeParseInt : function(str, defaultValue) {
var result = theParseInt(str);
if (theIsNaN(result) == true)
return defaultValue || 0;
return result;
},
safeParseFloat : function(str, defaultValue) {
var result = theParseFloat(str);
if (theIsNaN(result) == true)
return defaultValue || 0.0;
return result;
},
log : function(msg) {
if (document != null) {
var log = document.getElementById("TrimPath_log");
if (log) {
log.insertBefore(document.createElement("BR"), log.firstChild);
log.insertBefore(document.createTextNode((new Date().getTime() - logStart) + ": " + msg), log.firstChild);
}
}
},
logJson : function(obj) {
baseUtil.log(TrimPath.json.toJsonString(obj));
},
leftZeroPad : function(val, minLength) {
if (typeof(val) != "string")
val = String(val);
return (MANY_ZEROS.substring(0, minLength - val.length)) + val;
},
eventually : function(callback, delay) {
setTimeout(callback, delay || 10);
},
browser : {
isIE : (typeof(navigator) != 'undefined' &&
navigator.userAgent.toLowerCase().indexOf("msie") != -1)
},
appendEventHandler : function(obj, handlerName, handler) {
var prevHandler = obj[handlerName];
if (prevHandler != null &&
typeof(prevHandler) == 'function') {
obj[handlerName] = function(evt) {
prevHandler(evt);
handler(evt);
}
obj = null;
} else
obj[handlerName] = handler;
},
makeEventHandler : function(handler, handlerInfo) {
return function(evt) {
evt = (evt) ? evt : ((window.event) ? window.event : null);
if (evt)
return handler(evt, baseUtil.getEventTarget(evt), handlerInfo);
}
},
stopEvent : function(evt) {
evt.returnValue = false;
evt.cancelBubble = true;
if (evt.preventDefault != null)
evt.preventDefault();
if (evt.stopPropagation != null)
evt.stopPropagation();
return false; // For easy calling like: return stopEvent(evt);
},
getEventTarget : function(evt) {
return (evt.target) ? evt.target : evt.srcElement;
},
findEventPageXY : function(evt, scrollOffsetXY) {
if (evt.offsetX || evt.offsetY) {
var targetPageXY = baseUtil.findElementPageXY((evt.target) ? evt.target : evt.srcElement);
return [ evt.offsetX + targetPageXY[0], evt.offsetY + targetPageXY[1] ];
}
if (scrollOffsetXY == null) // The scrollOffsetXY hack is because Mozilla's pageXY doesn't handle scrolled divs.
scrollOffsetXY = [0, 0];
if (evt.pageX || evt.pageY)
return [ evt.pageX + scrollOffsetXY[0], evt.pageY + scrollOffsetXY[1]];
return [ evt.clientX + document.body.scrollLeft, evt.clientY + document.body.scrollTop ];
},
findElementPageXY : function(obj) {
return baseUtil.sumOverAncestors(obj, 'offsetLeft', 'offsetTop', 'offsetParent');
},
findElementScrollXY : function(obj) {
return baseUtil.sumOverAncestors(obj, 'scrollLeft', 'scrollTop', 'parentNode');
},
sumOverAncestors : function(obj, xName, yName, parentName) {
xName = xName || 'offsetLeft';
yName = yName || 'offsetTop';
parentName = parentName || 'offsetParent';
var point = [0, 0];
if (obj[parentName]) {
while (obj[parentName]) {
point[0] += (obj[xName] || 0);
point[1] += (obj[yName] || 0);
obj = obj[parentName];
}
}
return point;
},
getElementRect : function(el) {
if (el != null &&
el.offsetTop != null &&
el.offsetLeft != null)
return [ el.offsetTop,
el.offsetLeft,
el.offsetWidth,
el.offsetHeight ];
return null;
},
hasValue : function(str, value) {
return (str != null) &&
(str.search != null) &&
(str.search('(^|\\s)' + value + '(\\s|$)') >= 0);
},
removeValue : function(str, value) {
if (str != null)
return str.replace(new RegExp('(^|\\s)' + value + '(\\s|$)'), '$1$2');
return null;
},
hasClass : function(el, className) {
return el != null &&
baseUtil.hasValue(el.className, className);
},
addClass : function(object, className) {
if (object != null &&
baseUtil.hasClass(object, className) == false) {
if (object.className) {
object.className += ' '+className;
} else {
object.className = className;
}
}
},
removeClass : function(object, className) {
if (object != null)
object.className = baseUtil.removeValue(object.className, className);
},
toggleClass : function(object, className) {
var curr = baseUtil.hasClass(object, className);
if (curr == true)
baseUtil.removeClass(object, className);
else
baseUtil.addClass(object, className);
return !curr;
},
getElementsWithClassName : function(parent, className, tagName) {
if (parent == null)
parent = document.body;
var result = [];
var els = parent.getElementsByTagName(tagName || "DIV");
for (var i = 0; i < els.length; i++)
if (baseUtil.hasClass(els[i], className))
result.push(els[i]);
return result;
},
getChildrenWithClassName : function(parent, className) {
var result = [];
if (parent != null) {
for (var el = parent.firstChild; el != null; el = el.nextSibling) { // NOTE: Only return direct descendants.
if (el.nodeType == 1) { // ELEMENT_NODE
if (baseUtil.hasClass(el, className))
result.push(el);
}
}
}
return result;
},
getChildElementIndex : function(el, ignoreElementsWithClassName) {
var i = -1;
while (el != null) {
if (el.nodeType == 1 && // ELEMENT_NODE
(ignoreElementsWithClassName == null ||
baseUtil.hasClass(el, ignoreElementsWithClassName) == false))
i += 1;
el = el.previousSibling;
}
return i >= 0 ? i : null; // Returns 0-based index.
},
getChildElementByIndex : function(parent, childIndex, ignoreElementsWithClassName) {
if (parent != null &&
childIndex != null) {
for (var el = parent.firstChild; el != null; el = el.nextSibling) { // NOTE: Only return direct descendants.
if (el.nodeType == 1 && // ELEMENT_NODE
(ignoreElementsWithClassName == null ||
baseUtil.hasClass(el, ignoreElementsWithClassName) == false)) {
if (childIndex <= 0)
return el;
childIndex -= 1;
}
}
}
return null;
},
getChildElements : function(parent) {
var result = [];
if (parent != null) {
for (var el = parent.firstChild; el != null; el = el.nextSibling) { // NOTE: Only return direct descendants.
if (el.nodeType == 1) // ELEMENT_NODE
result.push(el);
}
}
return result;
},
getParent : function(node, tagName, className) { // Walk upwards from node until matching tagName and className.
while (node != null) {
if ((tagName == null || // The tagName matches, where null means any match.
tagName == node.tagName) &&
(className == null || // The className matches, where null means any match.
baseUtil.hasClass(node, className)))
return node;
node = node.parentNode;
}
return node;
},
visitElementHierarchy : function(el, visitorFunc) {
if (el != null) {
visitorFunc(el);
for (var c = el.firstChild; c != null; c = c.nextSibling)
if (c.nodeType == 1) // ELEMENT_NODE
baseUtil.visitElementHierarchy(c, visitorFunc);
}
},
getComputedStyle : function(el, styleProp) {
if (el != null) {
if (el.currentStyle != null)
return el.currentStyle[styleProp];
if (window.getComputedStyle != null)
return document.defaultView.getComputedStyle(el, null).getPropertyValue(styleProp);
}
return null;
},
getRand : function(from, to) {
return theMath.random() * (to - from) + from;
},
genId : function(prefix) {
if (prefix == null)
prefix = "id";
return prefix + "-" + ((new Date().getTime()) - baseUtil.genId_BASE) + "-" + theMath.floor(theMath.random() * 100000);
},
genId_BASE : (new Date("2006/08/01")).getTime(),
genKey : function(prefix) { // Transient keys which are unique during the document's lifespan.
baseUtil.genKeyCounter += 1; // Useful for map lookup keys.
return prefix + ':' + baseUtil.genKeyCounter;
},
genKeyCounter : 0,
getMapKeys : function(map, optTestProperty) {
var result = [];
for (var k in map)
if ((map[k] != null) &&
(optTestProperty == null ||
map[k][optTestProperty] != null))
result.push(k);
return result;
},
keyValueArrayToMap : function(flatKeyValueArray) { // Ex: [ 'key1', 'value1', 'key2', 'value2' ].
var result = {};
for (var i = 0; i < flatKeyValueArray.length; i += 2)
result[flatKeyValueArray[i]] = flatKeyValueArray[i+1];
return result;
},
shallowCopyMap : function(map) {
if (map == null)
return null;
var result = {};
for (var k in map)
result[k] = map[k];
return result;
},
cleanWhitespaceDeep : function(element) { // Removes all whitespace nodes from a DOM element tree.
for (var el = element.firstChild, next = null; el != null; el = next) {
next = el.nextSibling;
if (el.nodeType == 3 && /^\s*$/.test(el.nodeValue))
element.removeChild(el);
else if (el.nodeType == 1)
baseUtil.cleanWhitespaceDeep(el);
}
return element;
},
timeMethod : function(obj, methName) {
var orig = obj[methName];
obj[methName] = function() {
baseUtil.log(methName + "...");
var result = orig.apply(obj, arguments);
baseUtil.log(methName + "...done");
return result;
}
obj = null;
},
ratioPtPx : null,
requireRatioPtPx : function() {
if (this.ratioPtPx == null) {
var r = document.getElementById("TrimPath_baseUtil_ratioPtPx");
if (r == null) {
r = document.createElement("DIV");
r.id = "TrimPath_baseUtil_ratioPtPx";
r.style.position = "absolute";
r.style.top = "-100pt";
r.style.left = "-100pt";
r.style.width = "100pt";
r.style.height = "100pt";
document.body.appendChild(r);
}
}
},
getRatioPtPx : function() {
if (this.ratioPtPx == null) {
var r = document.getElementById("TrimPath_baseUtil_ratioPtPx");
if (r != null) {
this.ratioPtPx = [ 100.0 / r.offsetWidth, 100.0 / r.offsetHeight ];
r.parentNode.removeChild(r);
}
}
return this.ratioPtPx;
},
getHiddenContainer : function() {
if (typeof(document) == 'undefined' ||
document == null)
return null;
var c = document.getElementById("TrimPath_baseUtil_hiddenContainer");
if (c == null) {
c = document.createElement("DIV");
c.id = "TrimPath_baseUtil_hiddenContainer";
c.style.display = "none";
document.body.appendChild(c);
}
return c;
},
scrollIntoView : function(el) { // Assume some ancestor element has a scrolling overflow style.
if (el != null &&
el.offsetWidth > 0 &&
el.offsetHeight > 0 &&
el.style.display != "none") {
for (var parentEl = el.parentNode; parentEl != null; parentEl = parentEl.parentNode)
if (parentEl.scrollHeight > parentEl.offsetHeight)
break;
if (parentEl != null) {
var elX = el.offsetLeft;
var elY = el.offsetTop;
var sTop = parentEl.scrollTop;
var sLeft = parentEl.scrollLeft;
var sHeight = parentEl.clientHeight;
var sWidth = parentEl.clientWidth;
if (elY < sTop)
parentEl.scrollTop = elY;
else if ((elY + el.offsetHeight) > (sTop + sHeight))
parentEl.scrollTop = elY + el.offsetHeight - sHeight;
if (elX < sLeft)
parentEl.scrollLeft = elX;
else if ((elX + el.offsetWidth) > (sLeft + sWidth))
parentEl.scrollLeft = elX + el.offsetWidth - sWidth;
}
}
},
trim : function(str) {
return str.replace(/^\s*(.*?)\s*$/, '$1'); // Trim whitespace.
},
toHTML : function(node, optimized) {
if (optimized) {
var result = node.outerHTML;
if (result != null) {
result = result.replace(/<IMG (.*?)>/g, "<IMG $1\/>");
result = result.replace(/(class|width|height)=([a-zA-Z0-9_\-\:]+)/g, '$1="$2"');
result = result.replace(/<(\/?):/g, "<$1");
result = result.replace(/^\s*(.*?)/, '$1');
return result;
}
}
var out = [];
baseUtil.toHTMLArray(node, out);
return out.join('').replace(/<\/BR>/g, '');
},
toHTMLArray : function(node, out) {
if (node != null) {
if (node.nodeType == 1) { // ELEMENT_NODE
if (baseUtil.toHTMLStartTagArray(node, out)) {
var child = node.firstChild;
if (child != null) {
if (child.nodeType == 1 && // ELEMENT_NODE
child.tagName == "SVG" &&
child.nextSibling != null &&
child.nextSibling.nodeType == 1) {
// SVG nodes (non-XHTML) in IE are presented strangely as a flatten tag list.
// Here we assume any SVG tags normally have zero siblings. So, any
// siblings means we must be in IE, needing this hack.
//
baseUtil.toHTMLStartTagArray(child, out);
child = child.nextSibling;
while (child != null) {
baseUtil.toHTMLArray(child, out);
child = child.nextSibling;
}
out.push("</SVG>");
} else {
while (child != null) {
baseUtil.toHTMLArray(child, out);
child = child.nextSibling;
}
}
}
out.push("</" + node.tagName + ">");
}
} else if (node.nodeType == 3) { // TEXT_NODE
out.push(node.data.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>'));
}
}
},
toHTMLStartTagArray : function(node, out) {
if (node.tagName.charAt(0) == '/') // IE hack, where <IMG></IMG> becomes <IMG><//IMG>.
return false;
out.push("<");
out.push(node.tagName);
var classDone = false;
for (var i = 0; i < node.attributes.length; i++) {
var key = node.attributes[i].name;
var val = node.getAttribute(key);
if (val != null &&
val != "") {
if (key[0] == '-') // FF hack for "-moz-XXX" attributes.
continue;
if ((key == "contentEditable" && val == "inherit") ||
(key == "start" && node.tagName == "IMG") ||
(key == "class") ||
(key == "rowspan") ||
(key == "colspan"))
continue; // IE hack.
if (typeof(val) == "string") {
out.push(' ' + key + '="' + val.replace(/"/g, "'") + '"');
} else if (key == "style" && val.cssText != "") {
out.push(' style="' + val.cssText + '"');
}
if (key == "class")
classDone = true;
}
}
if (classDone == false &&
node.className != null && // IE hack, where class doesn't appear in attributes.
node.className.length > 0)
out.push(' class="' + node.className.replace("spreadsheetCellActive", "") + '"');
if (node.colSpan > 1) // IE hack, where colspan doesn't appear in attributes.
out.push(' colspan="' + node.colSpan + '"');
if (node.rowSpan > 1) // IE hack, where rowspan doesn't appear in attributes.
out.push(' rowspan="' + node.rowSpan + '"');
if (node.tagName == "COL") { // IE hack, which doesn't like <COL..></COL>.
out.push('/>');
return false;
}
out.push(">");
return true;
},
parseHTML : function(htmlStr) {
if (htmlStr != null) {
if (window.ActiveXObject &&
htmlStr.match(/<SVG/i)) {
// IE doesn't parse SVG tags well, so resort to backflips...
var el = baseUtil.parseXML(htmlStr);
if (el != null)
return baseUtil.copyNode(el);
} else {
var containerEl = document.getElementById("TrimPath_parseHTML");
if (containerEl == null) {
containerEl = document.createElement("DIV");
containerEl.id = "TrimPath_parseHTML";
containerEl.style.display = "none";
document.body.appendChild(containerEl);
}
containerEl.innerHTML = htmlStr;
var el = baseUtil.getChildElementByIndex(containerEl, 0);
if (el != null) {
containerEl.removeChild(el);
containerEl.innerHTML = "";
return el;
}
}
}
return null;
},
parseXML : function(xmlStr) {
if (window.DOMParser) {
var dom = (new DOMParser()).parseFromString(xmlStr, "text/xml");
if (dom != null &&
dom.documentElement != null &&
dom.documentElement.nodeName != "parsererror")
return dom.documentElement;
} else if (window.ActiveXObject) {
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
if (xmlDoc != null) {
xmlDoc.async = false;
xmlDoc.loadXML(xmlStr);
return xmlDoc.documentElement;
}
}
},
copyNode : function(src, doc) {
if (src != null) {
if (src.nodeType == 1) { // ELEMENT_NODE
var nodeName = src.nodeName;
var dst = (doc || document).createElement(nodeName);
if (dst != null) {
var classDone = false;
for (var attrs = src.attributes,
i = 0; i < attrs.length; i++) {
var name = attrs[i].name;
if (name == "class") {
dst.className = attrs[i].value;
classDone = true;
} else if (name == "style") {
for (var rules = attrs[i].value.split(';'),
j = 0; j < rules.length; j++) {
var rule = rules[j];
var eqIndex = rule.indexOf(':');
var ruleKey = baseUtil.trim(rule.substring(0, eqIndex));
var ruleVal = baseUtil.trim(rule.substring(eqIndex + 1));
dst.style[ruleKey.toLowerCase()] = ruleVal;
}
} else {
dst.setAttribute(name, attrs[i].value);
}
}
if (classDone == false &&
src.className != null &&
src.className.length > 0)
dst.className = src.className;
for (var srcChild = src.firstChild; srcChild != null; srcChild = srcChild.nextSibling) {
var dstChild = baseUtil.copyNode(srcChild, doc);
if (dstChild != null)
dst.appendChild(dstChild);
}
return dst;
}
} else if (src.nodeType == 3) { // TEXT_NODE
return (doc || document).createTextNode(src.nodeValue);
}
}
return null;
},
vecLength : function(vec) {
return Math.sqrt(baseUtil.vecDotProduct(vec, vec));
},
vecNormalize : function(vec, vecDest) {
vecDest = vecDest || vec;
var len = baseUtil.vecLength(vec);
for (var i = 0; i < vec.length; i++)
vecDest[i] = vec[i] / len;
return vecDest;
},
vecDotProduct : function(vec1, vec2) {
var sum = 0.0;
for (var i = 0; i < vec1.length; i++)
sum += (vec1[i] * vec2[i]);
return sum;
},
vecRotate : function(vec, rad, vecDest) { // Only x,y vectors currently.
var c = Math.cos(rad);
var s = Math.sin(rad);
vecDest = vecDest || vec;
var x = vec[0];
var y = vec[1];
vecDest[0] = x * c - y * s;
vecDest[1] = y * c + x * s;
return vecDest;
},
vecRotateAt : function(vec, atXY, rad, vecDest) { // Ex: [ top, left, width, height ], Math.PI/2.0.
vecDest = vecDest || vec;
if (atXY != null) {
vecDest[0] = vec[0] - atXY[0];
vecDest[1] = vec[1] - atXY[1];
baseUtil.vecRotate(vecDest, rad, vecDest);
} else
baseUtil.vecRotate(vec, rad, vecDest);
if (atXY != null) {
vecDest[0] = vecDest[0] + atXY[0];
vecDest[1] = vecDest[1] + atXY[1];
}
return vecDest;
},
ratioDegRad : 180.0 / Math.PI,
ratioRadDeg : Math.PI / 180.0,
vecBBox : function(vecs, bbox) { // Only x,y vectors currently.
var big = 0x40000000; // NOTE: Math.MAX/MIN_VALUE compares wrongly sometimes.
bbox = bbox || [ [big, -big], [-big, big] ];
for (var i = 0; vecs != null && i < vecs.length; i++) {
bbox[0][0] = Math.min(bbox[0][0], vecs[i][0]); // Vector space X,Y grows to the right-and-up.
bbox[0][1] = Math.max(bbox[0][1], vecs[i][1]);
bbox[1][0] = Math.max(bbox[1][0], vecs[i][0]);
bbox[1][1] = Math.min(bbox[1][1], vecs[i][1]);
}
return bbox;
},
scaleVecs : function(vecs, scaleVec) {
if (vecs != null &&
scaleVec != null) {
for (var i = 0; i < vecs.length; i++) {
for (var j = 0; j < scaleVec.length; j++)
vecs[i][j] = vecs[i][j] * scaleVec[j];
}
}
return vecs;
},
eventuallyOnceMap : {},
eventuallyOnce : function(id, delayHandler, delayMillis) {
var setupTime = (new Date()).getTime();
if (baseUtil.eventuallyOnceMap[id] == null) {
baseUtil.eventually(function() {
var info = baseUtil.eventuallyOnceMap[id];
baseUtil.eventuallyOnceMap[id] = null;
if (info != null) {
if (info.setupTime == setupTime)
info.delayHandler();
else
baseUtil.eventuallyOnce(info.id, info.delayHandler, info.delayMillis);
}
}, delayMillis);
}
var info = baseUtil.eventuallyOnceMap[id] = baseUtil.eventuallyOnceMap[id] || {}
info.delayHandler = delayHandler,
info.delayMillis = delayMillis,
info.setupTime = setupTime;
},
eventuallyOnceClear : function(id) {
baseUtil.eventuallyOnceMap[id] = null;
},
makeDelayedEventHandler : function(callback, delayMillis, defaultReturnValue) {
var lastEventTime = null;
var lastEvent = null;
var delayHandler = function() {
var evt = lastEvent;
var now = (new Date()).getTime();
if (lastEventTime != null &&
lastEventTime + delayMillis <= now + 1) {
lastEventTime = null;
lastEvent = null;
callback(evt);
} else {
lastEventTime = now;
baseUtil.eventually(delayHandler, delayMillis);
}
}
return function(event) {
if (lastEventTime == null)
baseUtil.eventually(delayHandler, delayMillis);
lastEvent = event;
lastEventTime = (new Date()).getTime();
return defaultReturnValue;
}
}
}
/////////////////////////////////////////////////////////
var json = TrimPath.json = {
jsonEval : function(json) {
return baseUtil.safeEval('(' + json + ')');
},
toJsonString : function(arg, prefix) { // Put into TrimPath namespace to avoid version conflicts.
return json.toJsonStringArray(arg, [], prefix).join('');
},
toJsonStringArray : function(arg, out, prefix) {
out = out || [];
var u; // undefined
switch (typeof arg) {
case 'object':
if (arg) {
if (arg.constructor == Array) {
out.push('[');
for (var i = 0; i < arg.length; ++i) {
if (i <= 0) {
if (prefix != null && arg.length > 1)
out.push(' ');
} else {
out.push(',\n');
if (prefix != null)
out.push(prefix);
}
json.toJsonStringArray(arg[i], out, prefix != null ? prefix + " " : null);
}
out.push(']');
return out;
} else if (typeof(arg.toString) != 'undefined') {
out.push('{');
var first = true;
var nextPrefix = (prefix != null) ? (prefix + " ") : null;
for (var i in arg) {
if (String(i).charAt(0) != '_') { // Ignore private attributes.
var curr = out.length; // Record position to allow undo when arg[i] is undefined.
if (first) {
if (prefix != null)
out.push(' ');
} else {
out.push(',\n');
if (prefix != null)
out.push(prefix);
}
json.toJsonStringArray(i, out, nextPrefix);
if (prefix == null)
out.push(':');
else
out.push(': ');
json.toJsonStringArray(arg[i], out, nextPrefix);
if (out[out.length - 1] == u)
out.splice(curr, out.length - curr);
else
first = false;
}
}
out.push('}');
return out;
}
return out;
}
out.push('null');
return out;
case 'unknown':
case 'undefined':
case 'function':
out.push(u);
return out;
case 'string':
out.push('"')
out.push(arg.replace(/(["\\])/g, '\\$1').replace(/\r/g, '').replace(/\n/g, '\\n'));
out.push('"');
return out;
default:
out.push(String(arg));
return out;
}
}
}
/////////////////////////////////////////////////////////
var hierType = baseUtil.hierType = function(el) {
return (el == null || (el.appendChild != null)) ? 'dom' : 'json';
}
var hierDispatch = function(funcName) {
return function(el) { // First arg (el) must be an hier storage element.
return hier.types[hierType(el)][funcName].apply(this, arguments);
}
}
var hier = baseUtil.hier = { // Uniform accessors for DOM and JSON element storage hierarchies.
types : {
dom : { // Functions that work on DOM element storage hierarchies.
createElement : function(tagName) { return document.createElement(tagName); },
appendChild : function(parent, child) { parent.appendChild(child); },
removeChild : function(parent, child) { parent.removeChild(child); },
insertBefore : function(parent, child, before) { return parent.insertBefore(child, before); },
getParent : function(el) { return el.parentNode; },
getFirstChild : function(parent) { return parent.firstChild; },
getChildElementIndex : function(parent, child) {
return baseUtil.getChildElementIndex(child);
},
getChildrenWithClassName : baseUtil.getChildrenWithClassName,
getAttribute : function(el, k) { return el.getAttribute(k); },
setAttribute : function(el, k, v) { el.setAttribute(k, v); },
removeAttribute : function(el, k) { el.removeAttribute(k); },
cloneHier : function(el) { return el.cloneNode(true); } // Clones the entire hierarchy.
},
json : { // Functions that work on JSON element storage hierarchies.
createElement : function(tagName) {
var result = { style: {} };
if (tagName != null)
result.tagName = tagName;
return result;
},
appendChild : function(parent, child) {
if (child != null) {
hier.types.json.removeChild(child._parent, child);
if (parent != null) {
var children = parent.children;
if (children == null)
children = parent.children = [];
children.push(child);
child._parent = parent;
}
}
},
removeChild : function(parent, child) {
if (parent != null &&
parent.children != null) {
var i = hier.types.json.getChildElementIndex(parent, child);
if (i != null && i >= 0)
parent.children.splice(i, 1);
}
if (child != null &&
child._parent != null)
delete child._parent;
},
insertBefore : function(parent, child, before) {
if (before == null)
return hier.types.json.appendChild(parent, child);
if (child != null) {
hier.types.json.removeChild(child._parent, child);
if (parent != null) {
var i = hier.types.json.getChildElementIndex(parent, before);
if (i != null && i >= 0) {
var children = parent.children;
if (children == null)
children = parent.children = [];
children.splice(i, 0, child);
child._parent = parent;
}
}
}
},
getParent : function(el) {
return el._parent;
},
getFirstChild : function(parent) {
if (parent &&
parent.children) {
return parent.children[0];
}
return null;
},
getChildElementIndex : function(parent, child) {
if (child != null &&
parent != null &&
parent.children != null) {
var siblings = parent.children;
for (var i = siblings.length - 1; i >= 0; i--) {
if (siblings[i] == child)
return i;
}
}
return null;
},
getChildrenWithClassName : function(parent, className) {
var result = [];
if (parent != null &&
parent.children != null) {
for (var i = 0; i < parent.children.length; i++) {
if (baseUtil.hasClass(parent.children[i], className))
result.push(parent.children[i]);
}
}
return result;
},
getAttribute : function(el, k) { return el[k]; },
setAttribute : function(el, k, v) { el[k] = v; },
removeAttribute : function(el, k) { delete el[k]; },
cloneHier : function(el) {
if (el != null)
return safeEval('(' + TrimPath.json.toJsonString(el) + ')');
return null;
}
}
},
appendChild : hierDispatch('appendChild'),
removeChild : hierDispatch('removeChild'),
insertBefore : hierDispatch('insertBefore'),
getParent : hierDispatch('getParent'),
getFirstChild : hierDispatch('getFirstChild'),
getChildElementIndex : hierDispatch('getChildElementIndex'),
getChildrenWithClassName : hierDispatch('getChildrenWithClassName'),
getAttribute : hierDispatch('getAttribute'),
setAttribute : hierDispatch('setAttribute'),
removeAttribute : hierDispatch('removeAttribute'),
cloneHier : hierDispatch('cloneHier')
}
}) (function(s) { return eval(s); });
/**
* TrimPath Drag Drop. Release 1.0.0.
* Copyright (C) 2005 - 2007 TrimPath.
*/
if (typeof(TrimPath) == 'undefined')
TrimPath = {};
(function() { // Using a closure to keep global namespace clean.
var baseUtil = TrimPath.baseUtil;
var dragDrop = TrimPath.dragDrop = {
makeDraggable : function(el, options) {
var handler = baseUtil.makeEventHandler(dragDrop.onmousedown, options);
if (el instanceof Array ||
el.length != null) {
for (var i = 0; i < el.length; i++)
el[i].onmousedown = handler;
} else
el.onmousedown = handler;
},
current : null,
onmousedown: function(event, target, options) {
options = options || {};
if (options.dragSourceId != null)
target = document.getElementById(options.dragSourceId);
if (target != null &&
dragDrop.current == null) {
var current = dragDrop.current = {
dragObject : options.dragSourceClone == true ? target.cloneNode(true) : target,
dragSource : target,
options : options,
offsetXY : [0, 0]
}
// TODO: Firefox does not support event.offsetX/Y.
//
current.offsetXY[0] = options.offsetX || event.offsetX || 0;
current.offsetXY[1] = options.offsetY || event.offsetY || 0;
if (options.originId != null) {
var originEl = document.getElementById(options.originId);
if (originEl != null) {
var xy = baseUtil.findElementPageXY(originEl);
if (xy != null) {
current.offsetXY[0] = xy[0];
current.offsetXY[1] = xy[1];
}
}
}
current.dragObject.style.position = "absolute";
current.dragObject.style.top = event.clientY - current.offsetXY[1] + document.body.scrollTop;
current.dragObject.style.left = event.clientX - current.offsetXY[0] + document.body.scrollLeft;
current.dragObject.style.width = current.dragSource.offsetWidth + 'px';
current.dragObject.style.zIndex = current.options.zIndex || 1000;
if (current.options.opacity) {
current.dragObject.style.opacity = current.options.opacity;
current.dragObject.style.filter = 'alpha(opacity=' + (current.options.opacity * 100) +')'
}
if (options.dragSourceClone == true)
document.body.appendChild(current.dragObject);
if (current.options.dragSourceVisible == false)
current.options.dragSource.style.visibility = "hidden";
document.onmousemove = TrimPath.dragDrop.onmousemove;
document.onmouseup = TrimPath.dragDrop.onmouseup;
document.onkeypress = TrimPath.dragDrop.onkeypress;
if (current.options.onStart != null)
current.options.onStart(current, event, target);
return baseUtil.stopEvent(event);
}
},
onmousemove: baseUtil.makeEventHandler(function(event, target) {
var current = dragDrop.current;
if (current != null &&
current.dragObject != null) {
current.dragObject.style.top = event.clientY - current.offsetXY[1] + document.body.scrollTop;
current.dragObject.style.left = event.clientX - current.offsetXY[0] + document.body.scrollLeft;
}
return baseUtil.stopEvent(event);
}),
onmouseup: baseUtil.makeEventHandler(function(event, target) {
var dropped = true;
var current = dragDrop.current;
if (current != null &&
current.dragObject != null &&
current.options != null &&
current.options.droppableIds != null) {
dropped = false;
var dragObjectXY = baseUtil.findElementPageXY(current.dragObject);
for (var i = 0; dropped == false && i < current.options.droppableIds.length; i++) {
var droppable = document.getElementById(current.options.droppableIds[i]);
if (droppable != null) {
var droppableXY = baseUtil.findElementPageXY(droppable);
var droppableWidth = droppable.offsetWidth || 0;
var droppableHeight = droppable.offsetHeight || 0;
// Sometimes offsetWidth/Height is mysteriously 0, so climb to the parent hierarchy.
//
while (droppable != null &&
droppable != document.body &&
(droppableWidth == 0 ||
droppableHeight == 0)) {
droppableWidth = droppableWidth || droppable.offsetWidth;
droppableHeight = droppableHeight || droppable.offsetHeight;
droppable = droppable.parentNode;
}
if (dragObjectXY[0] >= droppableXY[0] - current.dragObject.offsetWidth &&
dragObjectXY[1] >= droppableXY[1] - current.dragObject.offsetHeight &&
dragObjectXY[0] <= droppableXY[0] + droppableWidth &&
dragObjectXY[1] <= droppableXY[1] + droppableHeight)
dropped = droppable.id;
}
}
}
dragDrop.endDrag(event, target, dropped);
return baseUtil.stopEvent(event);
}),
onkeypress: baseUtil.makeEventHandler(function(event, target) {
var keyCode = (event.keyCode) ? event.keyCode : event.which;
if (keyCode == 27) // ESC key.
dragDrop.endDrag(event, target, false);
return baseUtil.stopEvent(event);
}),
endDrag : function(event, target, dropped) {
document.onmousemove = null;
document.onmouseup = null;
document.onkeypress = null;
var current = dragDrop.current;
if (current != null) {
if (current.options != null) {
if (dropped != false) {
if (current.options.onDrop != null)
current.options.onDrop(current, event, target, dropped);
} else {
if (current.options.onAbort != null)
current.options.onAbort(current, event, target);
}
if (current.options.onEnd != null)
current.options.onEnd(current, event, target);
}
}
dragDrop.current = null;
}
}
}) ();