Commit 004edf55e6535c444e2902e6f0d582132cbe43d9

Authored by Jarrett Jordaan
1 parent 1bc36acc

PT:1434165: InstaView updated to use jquery instead of prototype js library.

Committed by: Jarrett Jordaan

Reviewed by: Megan Watson
plugins/thumbnails/resources/lightbox/css/lightbox.css deleted
1   -#lightbox{ position: absolute; left: 0; width: 100%; z-index: 100; text-align: center; line-height: 0;}
2   -#lightbox img{ width: auto; height: auto;}
3   -#lightbox a img{ border: none; }
4   -
5   -#outerImageContainer{ position: relative; background-color: #fff; width: 250px; height: 250px; margin: 0 auto; }
6   -#imageContainer{ padding: 10px; }
7   -
8   -#loading{ position: absolute; top: 40%; left: 0%; height: 25%; width: 100%; text-align: center; line-height: 0; }
9   -#hoverNav{ position: absolute; top: 0; left: 0; height: 100%; width: 100%; z-index: 10; }
10   -#imageContainer>#hoverNav{ left: 0;}
11   -#hoverNav a{ outline: none;}
12   -
13   -#prevLink, #nextLink{ width: 49%; height: 100%; background-image: url(data:image/gif;base64,AAAA); /* Trick IE into showing hover */ display: block; }
14   -#prevLink { left: 0; float: left;}
15   -#nextLink { right: 0; float: right;}
16   -#prevLink:hover, #prevLink:visited:hover { background: url(../images/prevlabel.gif) left 15% no-repeat; }
17   -#nextLink:hover, #nextLink:visited:hover { background: url(../images/nextlabel.gif) right 15% no-repeat; }
18   -
19   -#imageDataContainer{ font: 10px Verdana, Helvetica, sans-serif; background-color: #fff; margin: 0 auto; line-height: 1.4em; overflow: auto; width: 100% ; }
20   -
21   -#imageData{ padding:0 10px; color: #666; }
22   -#imageData #imageDetails{ width: 70%; float: left; text-align: left; }
23   -#imageData #caption{ font-weight: bold; }
24   -#imageData #numberDisplay{ display: block; clear: left; padding-bottom: 1.0em; }
25   -#imageData #bottomNavClose{ width: 66px; float: right; padding-bottom: 0.7em; outline: none;}
26   -
27   -#overlay{ position: absolute; top: 0; left: 0; z-index: 90; width: 100%; height: 500px; background-color: #000; }
plugins/thumbnails/resources/lightbox/images/bullet.gif deleted

49 Bytes

plugins/thumbnails/resources/lightbox/images/close.gif deleted

222 Bytes

plugins/thumbnails/resources/lightbox/images/closelabel.gif deleted

979 Bytes

plugins/thumbnails/resources/lightbox/images/donate-button.gif deleted

723 Bytes

plugins/thumbnails/resources/lightbox/images/download-icon.gif deleted

1.12 KB

plugins/thumbnails/resources/lightbox/images/image-1.jpg deleted

36.7 KB

plugins/thumbnails/resources/lightbox/images/loading.gif deleted

2.7 KB

plugins/thumbnails/resources/lightbox/images/nextlabel.gif deleted

1.22 KB

plugins/thumbnails/resources/lightbox/images/prevlabel.gif deleted

1.23 KB

plugins/thumbnails/resources/lightbox/images/thumb-1.jpg deleted

2.81 KB

plugins/thumbnails/resources/lightbox/index.html deleted
1   -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2   - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3   -<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
4   -<head>
5   -
6   - <title>Lightbox JS v2.0 | Test Page</title>
7   -
8   - <link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
9   -
10   - <script src="js/prototype.js" type="text/javascript"></script>
11   - <script src="js/scriptaculous.js?load=effects,builder" type="text/javascript"></script>
12   - <script src="js/lightbox.js" type="text/javascript"></script>
13   -
14   - <style type="text/css">
15   - body{ color: #333; font: 13px 'Lucida Grande', Verdana, sans-serif; }
16   - </style>
17   -
18   -</head>
19   -<body>
20   -
21   -
22   -<h1><a href="http://www.lokeshdhakar.com/projects/lightbox2/">Lightbox JS <em>v2.04</em></a></h1>
23   -<p><a href="http://www.lokeshdhakar.com">by Lokesh Dhakar</a></p>
24   -
25   -<h2>Example</h2>
26   -
27   -<a href="images/image-1.jpg" rel="lightbox"><img src="images/thumb-1.jpg" width="100" height="40" alt="" /></a>
28   -
29   -
30   -
31   -
32   -<h2>How to Use:</h2>
33   -<h3>Part 1 - Setup</h3>
34   -<ol>
35   -<li>Lightbox v2.0 uses the Prototype Framework and Scriptaculous Effects Library. You will need to include these three Javascript files in your header.
36   -<pre><code>&lt;script type=&quot;text/javascript&quot; src=&quot;js/prototype.js&quot;&gt;&lt;/script&gt;
37   -&lt;script type=&quot;text/javascript&quot; src=&quot;js/scriptaculous.js?load=effects,builder&quot;&gt;&lt;/script&gt;
38   -&lt;script type=&quot;text/javascript&quot; src=&quot;js/lightbox.js&quot;&gt;&lt;/script&gt;
39   -</code></pre>
40   -</li>
41   -<li>Include the Lightbox CSS file (or append your active stylesheet with the Lightbox styles).
42   -<pre><code>&lt;link rel=&quot;stylesheet&quot; href=&quot;css/lightbox.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;
43   -</code></pre>
44   -</li>
45   -<li>Check the CSS and make sure the referenced <code>prevlabel.gif</code> and <code>nextlabel.gif</code> files are in the right location. Also, make sure the <code>loading.gif</code> and <code>closelabel.gif</code> files as referenced near the top of the <code>lightbox.js</code> file are in the right location.</li>
46   -</ol>
47   -<h3>Part 2 - Activate</h3>
48   -<ol>
49   -<li>Add a <code>rel="lightbox"</code> attribute to any link tag to activate the lightbox. For example:
50   -<pre><code>&lt;a href=&quot;images/image-1.jpg&quot; rel=&quot;lightbox&quot; title=&quot;my caption&quot;&gt;image #1&lt;/a&gt;
51   -</code></pre>
52   -<em>Optional: </em>Use the <code>title</code> attribute if you want to show a caption. </li>
53   -<li>If you have a set of related images that you would like to group, follow step one but additionally include a group name between square brackets in the rel attribute. For example:
54   -<pre><code>&lt;a href=&quot;images/image-1.jpg&quot; rel=&quot;lightbox[roadtrip]&quot;&gt;image #1&lt;/a&gt;
55   -&lt;a href=&quot;images/image-2.jpg&quot; rel=&quot;lightbox[roadtrip]&quot;&gt;image #2&lt;/a&gt;
56   -&lt;a href=&quot;images/image-3.jpg&quot; rel=&quot;lightbox[roadtrip]&quot;&gt;image #3&lt;/a&gt;
57   -</code></pre>
58   -No limits to the number of image sets per page or how many images are allowed in each set. Go nuts!</li>
59   -</ol>
60   -
61   -
62   -</body>
63   -</html>
plugins/thumbnails/resources/lightbox/js/builder.js deleted
1   -// script.aculo.us builder.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
2   -
3   -// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
4   -//
5   -// script.aculo.us is freely distributable under the terms of an MIT-style license.
6   -// For details, see the script.aculo.us web site: http://script.aculo.us/
7   -
8   -var Builder = {
9   - NODEMAP: {
10   - AREA: 'map',
11   - CAPTION: 'table',
12   - COL: 'table',
13   - COLGROUP: 'table',
14   - LEGEND: 'fieldset',
15   - OPTGROUP: 'select',
16   - OPTION: 'select',
17   - PARAM: 'object',
18   - TBODY: 'table',
19   - TD: 'table',
20   - TFOOT: 'table',
21   - TH: 'table',
22   - THEAD: 'table',
23   - TR: 'table'
24   - },
25   - // note: For Firefox < 1.5, OPTION and OPTGROUP tags are currently broken,
26   - // due to a Firefox bug
27   - node: function(elementName) {
28   - elementName = elementName.toUpperCase();
29   -
30   - // try innerHTML approach
31   - var parentTag = this.NODEMAP[elementName] || 'div';
32   - var parentElement = document.createElement(parentTag);
33   - try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707
34   - parentElement.innerHTML = "<" + elementName + "></" + elementName + ">";
35   - } catch(e) {}
36   - var element = parentElement.firstChild || null;
37   -
38   - // see if browser added wrapping tags
39   - if(element && (element.tagName.toUpperCase() != elementName))
40   - element = element.getElementsByTagName(elementName)[0];
41   -
42   - // fallback to createElement approach
43   - if(!element) element = document.createElement(elementName);
44   -
45   - // abort if nothing could be created
46   - if(!element) return;
47   -
48   - // attributes (or text)
49   - if(arguments[1])
50   - if(this._isStringOrNumber(arguments[1]) ||
51   - (arguments[1] instanceof Array) ||
52   - arguments[1].tagName) {
53   - this._children(element, arguments[1]);
54   - } else {
55   - var attrs = this._attributes(arguments[1]);
56   - if(attrs.length) {
57   - try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707
58   - parentElement.innerHTML = "<" +elementName + " " +
59   - attrs + "></" + elementName + ">";
60   - } catch(e) {}
61   - element = parentElement.firstChild || null;
62   - // workaround firefox 1.0.X bug
63   - if(!element) {
64   - element = document.createElement(elementName);
65   - for(attr in arguments[1])
66   - element[attr == 'class' ? 'className' : attr] = arguments[1][attr];
67   - }
68   - if(element.tagName.toUpperCase() != elementName)
69   - element = parentElement.getElementsByTagName(elementName)[0];
70   - }
71   - }
72   -
73   - // text, or array of children
74   - if(arguments[2])
75   - this._children(element, arguments[2]);
76   -
77   - return element;
78   - },
79   - _text: function(text) {
80   - return document.createTextNode(text);
81   - },
82   -
83   - ATTR_MAP: {
84   - 'className': 'class',
85   - 'htmlFor': 'for'
86   - },
87   -
88   - _attributes: function(attributes) {
89   - var attrs = [];
90   - for(attribute in attributes)
91   - attrs.push((attribute in this.ATTR_MAP ? this.ATTR_MAP[attribute] : attribute) +
92   - '="' + attributes[attribute].toString().escapeHTML().gsub(/"/,'&quot;') + '"');
93   - return attrs.join(" ");
94   - },
95   - _children: function(element, children) {
96   - if(children.tagName) {
97   - element.appendChild(children);
98   - return;
99   - }
100   - if(typeof children=='object') { // array can hold nodes and text
101   - children.flatten().each( function(e) {
102   - if(typeof e=='object')
103   - element.appendChild(e)
104   - else
105   - if(Builder._isStringOrNumber(e))
106   - element.appendChild(Builder._text(e));
107   - });
108   - } else
109   - if(Builder._isStringOrNumber(children))
110   - element.appendChild(Builder._text(children));
111   - },
112   - _isStringOrNumber: function(param) {
113   - return(typeof param=='string' || typeof param=='number');
114   - },
115   - build: function(html) {
116   - var element = this.node('div');
117   - $(element).update(html.strip());
118   - return element.down();
119   - },
120   - dump: function(scope) {
121   - if(typeof scope != 'object' && typeof scope != 'function') scope = window; //global scope
122   -
123   - var tags = ("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY " +
124   - "BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET " +
125   - "FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+
126   - "KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+
127   - "PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+
128   - "TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/);
129   -
130   - tags.each( function(tag){
131   - scope[tag] = function() {
132   - return Builder.node.apply(Builder, [tag].concat($A(arguments)));
133   - }
134   - });
135   - }
136   -}
plugins/thumbnails/resources/lightbox/js/effects.js deleted
1   -// script.aculo.us effects.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
2   -
3   -// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
4   -// Contributors:
5   -// Justin Palmer (http://encytemedia.com/)
6   -// Mark Pilgrim (http://diveintomark.org/)
7   -// Martin Bialasinki
8   -//
9   -// script.aculo.us is freely distributable under the terms of an MIT-style license.
10   -// For details, see the script.aculo.us web site: http://script.aculo.us/
11   -
12   -// converts rgb() and #xxx to #xxxxxx format,
13   -// returns self (or first argument) if not convertable
14   -String.prototype.parseColor = function() {
15   - var color = '#';
16   - if (this.slice(0,4) == 'rgb(') {
17   - var cols = this.slice(4,this.length-1).split(',');
18   - var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);
19   - } else {
20   - if (this.slice(0,1) == '#') {
21   - if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();
22   - if (this.length==7) color = this.toLowerCase();
23   - }
24   - }
25   - return (color.length==7 ? color : (arguments[0] || this));
26   -};
27   -
28   -/*--------------------------------------------------------------------------*/
29   -
30   -Element.collectTextNodes = function(element) {
31   - return $A($(element).childNodes).collect( function(node) {
32   - return (node.nodeType==3 ? node.nodeValue :
33   - (node.hasChildNodes() ? Element.collectTextNodes(node) : ''));
34   - }).flatten().join('');
35   -};
36   -
37   -Element.collectTextNodesIgnoreClass = function(element, className) {
38   - return $A($(element).childNodes).collect( function(node) {
39   - return (node.nodeType==3 ? node.nodeValue :
40   - ((node.hasChildNodes() && !Element.hasClassName(node,className)) ?
41   - Element.collectTextNodesIgnoreClass(node, className) : ''));
42   - }).flatten().join('');
43   -};
44   -
45   -Element.setContentZoom = function(element, percent) {
46   - element = $(element);
47   - element.setStyle({fontSize: (percent/100) + 'em'});
48   - if (Prototype.Browser.WebKit) window.scrollBy(0,0);
49   - return element;
50   -};
51   -
52   -Element.getInlineOpacity = function(element){
53   - return $(element).style.opacity || '';
54   -};
55   -
56   -Element.forceRerendering = function(element) {
57   - try {
58   - element = $(element);
59   - var n = document.createTextNode(' ');
60   - element.appendChild(n);
61   - element.removeChild(n);
62   - } catch(e) { }
63   -};
64   -
65   -/*--------------------------------------------------------------------------*/
66   -
67   -var Effect = {
68   - _elementDoesNotExistError: {
69   - name: 'ElementDoesNotExistError',
70   - message: 'The specified DOM element does not exist, but is required for this effect to operate'
71   - },
72   - Transitions: {
73   - linear: Prototype.K,
74   - sinoidal: function(pos) {
75   - return (-Math.cos(pos*Math.PI)/2) + 0.5;
76   - },
77   - reverse: function(pos) {
78   - return 1-pos;
79   - },
80   - flicker: function(pos) {
81   - var pos = ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4;
82   - return pos > 1 ? 1 : pos;
83   - },
84   - wobble: function(pos) {
85   - return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
86   - },
87   - pulse: function(pos, pulses) {
88   - pulses = pulses || 5;
89   - return (
90   - ((pos % (1/pulses)) * pulses).round() == 0 ?
91   - ((pos * pulses * 2) - (pos * pulses * 2).floor()) :
92   - 1 - ((pos * pulses * 2) - (pos * pulses * 2).floor())
93   - );
94   - },
95   - spring: function(pos) {
96   - return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6));
97   - },
98   - none: function(pos) {
99   - return 0;
100   - },
101   - full: function(pos) {
102   - return 1;
103   - }
104   - },
105   - DefaultOptions: {
106   - duration: 1.0, // seconds
107   - fps: 100, // 100= assume 66fps max.
108   - sync: false, // true for combining
109   - from: 0.0,
110   - to: 1.0,
111   - delay: 0.0,
112   - queue: 'parallel'
113   - },
114   - tagifyText: function(element) {
115   - var tagifyStyle = 'position:relative';
116   - if (Prototype.Browser.IE) tagifyStyle += ';zoom:1';
117   -
118   - element = $(element);
119   - $A(element.childNodes).each( function(child) {
120   - if (child.nodeType==3) {
121   - child.nodeValue.toArray().each( function(character) {
122   - element.insertBefore(
123   - new Element('span', {style: tagifyStyle}).update(
124   - character == ' ' ? String.fromCharCode(160) : character),
125   - child);
126   - });
127   - Element.remove(child);
128   - }
129   - });
130   - },
131   - multiple: function(element, effect) {
132   - var elements;
133   - if (((typeof element == 'object') ||
134   - Object.isFunction(element)) &&
135   - (element.length))
136   - elements = element;
137   - else
138   - elements = $(element).childNodes;
139   -
140   - var options = Object.extend({
141   - speed: 0.1,
142   - delay: 0.0
143   - }, arguments[2] || { });
144   - var masterDelay = options.delay;
145   -
146   - $A(elements).each( function(element, index) {
147   - new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay }));
148   - });
149   - },
150   - PAIRS: {
151   - 'slide': ['SlideDown','SlideUp'],
152   - 'blind': ['BlindDown','BlindUp'],
153   - 'appear': ['Appear','Fade']
154   - },
155   - toggle: function(element, effect) {
156   - element = $(element);
157   - effect = (effect || 'appear').toLowerCase();
158   - var options = Object.extend({
159   - queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
160   - }, arguments[2] || { });
161   - Effect[element.visible() ?
162   - Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
163   - }
164   -};
165   -
166   -Effect.DefaultOptions.transition = Effect.Transitions.sinoidal;
167   -
168   -/* ------------- core effects ------------- */
169   -
170   -Effect.ScopedQueue = Class.create(Enumerable, {
171   - initialize: function() {
172   - this.effects = [];
173   - this.interval = null;
174   - },
175   - _each: function(iterator) {
176   - this.effects._each(iterator);
177   - },
178   - add: function(effect) {
179   - var timestamp = new Date().getTime();
180   -
181   - var position = Object.isString(effect.options.queue) ?
182   - effect.options.queue : effect.options.queue.position;
183   -
184   - switch(position) {
185   - case 'front':
186   - // move unstarted effects after this effect
187   - this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) {
188   - e.startOn += effect.finishOn;
189   - e.finishOn += effect.finishOn;
190   - });
191   - break;
192   - case 'with-last':
193   - timestamp = this.effects.pluck('startOn').max() || timestamp;
194   - break;
195   - case 'end':
196   - // start effect after last queued effect has finished
197   - timestamp = this.effects.pluck('finishOn').max() || timestamp;
198   - break;
199   - }
200   -
201   - effect.startOn += timestamp;
202   - effect.finishOn += timestamp;
203   -
204   - if (!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit))
205   - this.effects.push(effect);
206   -
207   - if (!this.interval)
208   - this.interval = setInterval(this.loop.bind(this), 15);
209   - },
210   - remove: function(effect) {
211   - this.effects = this.effects.reject(function(e) { return e==effect });
212   - if (this.effects.length == 0) {
213   - clearInterval(this.interval);
214   - this.interval = null;
215   - }
216   - },
217   - loop: function() {
218   - var timePos = new Date().getTime();
219   - for(var i=0, len=this.effects.length;i<len;i++)
220   - this.effects[i] && this.effects[i].loop(timePos);
221   - }
222   -});
223   -
224   -Effect.Queues = {
225   - instances: $H(),
226   - get: function(queueName) {
227   - if (!Object.isString(queueName)) return queueName;
228   -
229   - return this.instances.get(queueName) ||
230   - this.instances.set(queueName, new Effect.ScopedQueue());
231   - }
232   -};
233   -Effect.Queue = Effect.Queues.get('global');
234   -
235   -Effect.Base = Class.create({
236   - position: null,
237   - start: function(options) {
238   - function codeForEvent(options,eventName){
239   - return (
240   - (options[eventName+'Internal'] ? 'this.options.'+eventName+'Internal(this);' : '') +
241   - (options[eventName] ? 'this.options.'+eventName+'(this);' : '')
242   - );
243   - }
244   - if (options && options.transition === false) options.transition = Effect.Transitions.linear;
245   - this.options = Object.extend(Object.extend({ },Effect.DefaultOptions), options || { });
246   - this.currentFrame = 0;
247   - this.state = 'idle';
248   - this.startOn = this.options.delay*1000;
249   - this.finishOn = this.startOn+(this.options.duration*1000);
250   - this.fromToDelta = this.options.to-this.options.from;
251   - this.totalTime = this.finishOn-this.startOn;
252   - this.totalFrames = this.options.fps*this.options.duration;
253   -
254   - eval('this.render = function(pos){ '+
255   - 'if (this.state=="idle"){this.state="running";'+
256   - codeForEvent(this.options,'beforeSetup')+
257   - (this.setup ? 'this.setup();':'')+
258   - codeForEvent(this.options,'afterSetup')+
259   - '};if (this.state=="running"){'+
260   - 'pos=this.options.transition(pos)*'+this.fromToDelta+'+'+this.options.from+';'+
261   - 'this.position=pos;'+
262   - codeForEvent(this.options,'beforeUpdate')+
263   - (this.update ? 'this.update(pos);':'')+
264   - codeForEvent(this.options,'afterUpdate')+
265   - '}}');
266   -
267   - this.event('beforeStart');
268   - if (!this.options.sync)
269   - Effect.Queues.get(Object.isString(this.options.queue) ?
270   - 'global' : this.options.queue.scope).add(this);
271   - },
272   - loop: function(timePos) {
273   - if (timePos >= this.startOn) {
274   - if (timePos >= this.finishOn) {
275   - this.render(1.0);
276   - this.cancel();
277   - this.event('beforeFinish');
278   - if (this.finish) this.finish();
279   - this.event('afterFinish');
280   - return;
281   - }
282   - var pos = (timePos - this.startOn) / this.totalTime,
283   - frame = (pos * this.totalFrames).round();
284   - if (frame > this.currentFrame) {
285   - this.render(pos);
286   - this.currentFrame = frame;
287   - }
288   - }
289   - },
290   - cancel: function() {
291   - if (!this.options.sync)
292   - Effect.Queues.get(Object.isString(this.options.queue) ?
293   - 'global' : this.options.queue.scope).remove(this);
294   - this.state = 'finished';
295   - },
296   - event: function(eventName) {
297   - if (this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this);
298   - if (this.options[eventName]) this.options[eventName](this);
299   - },
300   - inspect: function() {
301   - var data = $H();
302   - for(property in this)
303   - if (!Object.isFunction(this[property])) data.set(property, this[property]);
304   - return '#<Effect:' + data.inspect() + ',options:' + $H(this.options).inspect() + '>';
305   - }
306   -});
307   -
308   -Effect.Parallel = Class.create(Effect.Base, {
309   - initialize: function(effects) {
310   - this.effects = effects || [];
311   - this.start(arguments[1]);
312   - },
313   - update: function(position) {
314   - this.effects.invoke('render', position);
315   - },
316   - finish: function(position) {
317   - this.effects.each( function(effect) {
318   - effect.render(1.0);
319   - effect.cancel();
320   - effect.event('beforeFinish');
321   - if (effect.finish) effect.finish(position);
322   - effect.event('afterFinish');
323   - });
324   - }
325   -});
326   -
327   -Effect.Tween = Class.create(Effect.Base, {
328   - initialize: function(object, from, to) {
329   - object = Object.isString(object) ? $(object) : object;
330   - var args = $A(arguments), method = args.last(),
331   - options = args.length == 5 ? args[3] : null;
332   - this.method = Object.isFunction(method) ? method.bind(object) :
333   - Object.isFunction(object[method]) ? object[method].bind(object) :
334   - function(value) { object[method] = value };
335   - this.start(Object.extend({ from: from, to: to }, options || { }));
336   - },
337   - update: function(position) {
338   - this.method(position);
339   - }
340   -});
341   -
342   -Effect.Event = Class.create(Effect.Base, {
343   - initialize: function() {
344   - this.start(Object.extend({ duration: 0 }, arguments[0] || { }));
345   - },
346   - update: Prototype.emptyFunction
347   -});
348   -
349   -Effect.Opacity = Class.create(Effect.Base, {
350   - initialize: function(element) {
351   - this.element = $(element);
352   - if (!this.element) throw(Effect._elementDoesNotExistError);
353   - // make this work on IE on elements without 'layout'
354   - if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout))
355   - this.element.setStyle({zoom: 1});
356   - var options = Object.extend({
357   - from: this.element.getOpacity() || 0.0,
358   - to: 1.0
359   - }, arguments[1] || { });
360   - this.start(options);
361   - },
362   - update: function(position) {
363   - this.element.setOpacity(position);
364   - }
365   -});
366   -
367   -Effect.Move = Class.create(Effect.Base, {
368   - initialize: function(element) {
369   - this.element = $(element);
370   - if (!this.element) throw(Effect._elementDoesNotExistError);
371   - var options = Object.extend({
372   - x: 0,
373   - y: 0,
374   - mode: 'relative'
375   - }, arguments[1] || { });
376   - this.start(options);
377   - },
378   - setup: function() {
379   - this.element.makePositioned();
380   - this.originalLeft = parseFloat(this.element.getStyle('left') || '0');
381   - this.originalTop = parseFloat(this.element.getStyle('top') || '0');
382   - if (this.options.mode == 'absolute') {
383   - this.options.x = this.options.x - this.originalLeft;
384   - this.options.y = this.options.y - this.originalTop;
385   - }
386   - },
387   - update: function(position) {
388   - this.element.setStyle({
389   - left: (this.options.x * position + this.originalLeft).round() + 'px',
390   - top: (this.options.y * position + this.originalTop).round() + 'px'
391   - });
392   - }
393   -});
394   -
395   -// for backwards compatibility
396   -Effect.MoveBy = function(element, toTop, toLeft) {
397   - return new Effect.Move(element,
398   - Object.extend({ x: toLeft, y: toTop }, arguments[3] || { }));
399   -};
400   -
401   -Effect.Scale = Class.create(Effect.Base, {
402   - initialize: function(element, percent) {
403   - this.element = $(element);
404   - if (!this.element) throw(Effect._elementDoesNotExistError);
405   - var options = Object.extend({
406   - scaleX: true,
407   - scaleY: true,
408   - scaleContent: true,
409   - scaleFromCenter: false,
410   - scaleMode: 'box', // 'box' or 'contents' or { } with provided values
411   - scaleFrom: 100.0,
412   - scaleTo: percent
413   - }, arguments[2] || { });
414   - this.start(options);
415   - },
416   - setup: function() {
417   - this.restoreAfterFinish = this.options.restoreAfterFinish || false;
418   - this.elementPositioning = this.element.getStyle('position');
419   -
420   - this.originalStyle = { };
421   - ['top','left','width','height','fontSize'].each( function(k) {
422   - this.originalStyle[k] = this.element.style[k];
423   - }.bind(this));
424   -
425   - this.originalTop = this.element.offsetTop;
426   - this.originalLeft = this.element.offsetLeft;
427   -
428   - var fontSize = this.element.getStyle('font-size') || '100%';
429   - ['em','px','%','pt'].each( function(fontSizeType) {
430   - if (fontSize.indexOf(fontSizeType)>0) {
431   - this.fontSize = parseFloat(fontSize);
432   - this.fontSizeType = fontSizeType;
433   - }
434   - }.bind(this));
435   -
436   - this.factor = (this.options.scaleTo - this.options.scaleFrom)/100;
437   -
438   - this.dims = null;
439   - if (this.options.scaleMode=='box')
440   - this.dims = [this.element.offsetHeight, this.element.offsetWidth];
441   - if (/^content/.test(this.options.scaleMode))
442   - this.dims = [this.element.scrollHeight, this.element.scrollWidth];
443   - if (!this.dims)
444   - this.dims = [this.options.scaleMode.originalHeight,
445   - this.options.scaleMode.originalWidth];
446   - },
447   - update: function(position) {
448   - var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position);
449   - if (this.options.scaleContent && this.fontSize)
450   - this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType });
451   - this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale);
452   - },
453   - finish: function(position) {
454   - if (this.restoreAfterFinish) this.element.setStyle(this.originalStyle);
455   - },
456   - setDimensions: function(height, width) {
457   - var d = { };
458   - if (this.options.scaleX) d.width = width.round() + 'px';
459   - if (this.options.scaleY) d.height = height.round() + 'px';
460   - if (this.options.scaleFromCenter) {
461   - var topd = (height - this.dims[0])/2;
462   - var leftd = (width - this.dims[1])/2;
463   - if (this.elementPositioning == 'absolute') {
464   - if (this.options.scaleY) d.top = this.originalTop-topd + 'px';
465   - if (this.options.scaleX) d.left = this.originalLeft-leftd + 'px';
466   - } else {
467   - if (this.options.scaleY) d.top = -topd + 'px';
468   - if (this.options.scaleX) d.left = -leftd + 'px';
469   - }
470   - }
471   - this.element.setStyle(d);
472   - }
473   -});
474   -
475   -Effect.Highlight = Class.create(Effect.Base, {
476   - initialize: function(element) {
477   - this.element = $(element);
478   - if (!this.element) throw(Effect._elementDoesNotExistError);
479   - var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || { });
480   - this.start(options);
481   - },
482   - setup: function() {
483   - // Prevent executing on elements not in the layout flow
484   - if (this.element.getStyle('display')=='none') { this.cancel(); return; }
485   - // Disable background image during the effect
486   - this.oldStyle = { };
487   - if (!this.options.keepBackgroundImage) {
488   - this.oldStyle.backgroundImage = this.element.getStyle('background-image');
489   - this.element.setStyle({backgroundImage: 'none'});
490   - }
491   - if (!this.options.endcolor)
492   - this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff');
493   - if (!this.options.restorecolor)
494   - this.options.restorecolor = this.element.getStyle('background-color');
495   - // init color calculations
496   - this._base = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this));
497   - this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this));
498   - },
499   - update: function(position) {
500   - this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){
501   - return m+((this._base[i]+(this._delta[i]*position)).round().toColorPart()); }.bind(this)) });
502   - },
503   - finish: function() {
504   - this.element.setStyle(Object.extend(this.oldStyle, {
505   - backgroundColor: this.options.restorecolor
506   - }));
507   - }
508   -});
509   -
510   -Effect.ScrollTo = function(element) {
511   - var options = arguments[1] || { },
512   - scrollOffsets = document.viewport.getScrollOffsets(),
513   - elementOffsets = $(element).cumulativeOffset(),
514   - max = (window.height || document.body.scrollHeight) - document.viewport.getHeight();
515   -
516   - if (options.offset) elementOffsets[1] += options.offset;
517   -
518   - return new Effect.Tween(null,
519   - scrollOffsets.top,
520   - elementOffsets[1] > max ? max : elementOffsets[1],
521   - options,
522   - function(p){ scrollTo(scrollOffsets.left, p.round()) }
523   - );
524   -};
525   -
526   -/* ------------- combination effects ------------- */
527   -
528   -Effect.Fade = function(element) {
529   - element = $(element);
530   - var oldOpacity = element.getInlineOpacity();
531   - var options = Object.extend({
532   - from: element.getOpacity() || 1.0,
533   - to: 0.0,
534   - afterFinishInternal: function(effect) {
535   - if (effect.options.to!=0) return;
536   - effect.element.hide().setStyle({opacity: oldOpacity});
537   - }
538   - }, arguments[1] || { });
539   - return new Effect.Opacity(element,options);
540   -};
541   -
542   -Effect.Appear = function(element) {
543   - element = $(element);
544   - var options = Object.extend({
545   - from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0),
546   - to: 1.0,
547   - // force Safari to render floated elements properly
548   - afterFinishInternal: function(effect) {
549   - effect.element.forceRerendering();
550   - },
551   - beforeSetup: function(effect) {
552   - effect.element.setOpacity(effect.options.from).show();
553   - }}, arguments[1] || { });
554   - return new Effect.Opacity(element,options);
555   -};
556   -
557   -Effect.Puff = function(element) {
558   - element = $(element);
559   - var oldStyle = {
560   - opacity: element.getInlineOpacity(),
561   - position: element.getStyle('position'),
562   - top: element.style.top,
563   - left: element.style.left,
564   - width: element.style.width,
565   - height: element.style.height
566   - };
567   - return new Effect.Parallel(
568   - [ new Effect.Scale(element, 200,
569   - { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }),
570   - new Effect.Opacity(element, { sync: true, to: 0.0 } ) ],
571   - Object.extend({ duration: 1.0,
572   - beforeSetupInternal: function(effect) {
573   - Position.absolutize(effect.effects[0].element)
574   - },
575   - afterFinishInternal: function(effect) {
576   - effect.effects[0].element.hide().setStyle(oldStyle); }
577   - }, arguments[1] || { })
578   - );
579   -};
580   -
581   -Effect.BlindUp = function(element) {
582   - element = $(element);
583   - element.makeClipping();
584   - return new Effect.Scale(element, 0,
585   - Object.extend({ scaleContent: false,
586   - scaleX: false,
587   - restoreAfterFinish: true,
588   - afterFinishInternal: function(effect) {
589   - effect.element.hide().undoClipping();
590   - }
591   - }, arguments[1] || { })
592   - );
593   -};
594   -
595   -Effect.BlindDown = function(element) {
596   - element = $(element);
597   - var elementDimensions = element.getDimensions();
598   - return new Effect.Scale(element, 100, Object.extend({
599   - scaleContent: false,
600   - scaleX: false,
601   - scaleFrom: 0,
602   - scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
603   - restoreAfterFinish: true,
604   - afterSetup: function(effect) {
605   - effect.element.makeClipping().setStyle({height: '0px'}).show();
606   - },
607   - afterFinishInternal: function(effect) {
608   - effect.element.undoClipping();
609   - }
610   - }, arguments[1] || { }));
611   -};
612   -
613   -Effect.SwitchOff = function(element) {
614   - element = $(element);
615   - var oldOpacity = element.getInlineOpacity();
616   - return new Effect.Appear(element, Object.extend({
617   - duration: 0.4,
618   - from: 0,
619   - transition: Effect.Transitions.flicker,
620   - afterFinishInternal: function(effect) {
621   - new Effect.Scale(effect.element, 1, {
622   - duration: 0.3, scaleFromCenter: true,
623   - scaleX: false, scaleContent: false, restoreAfterFinish: true,
624   - beforeSetup: function(effect) {
625   - effect.element.makePositioned().makeClipping();
626   - },
627   - afterFinishInternal: function(effect) {
628   - effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity});
629   - }
630   - })
631   - }
632   - }, arguments[1] || { }));
633   -};
634   -
635   -Effect.DropOut = function(element) {
636   - element = $(element);
637   - var oldStyle = {
638   - top: element.getStyle('top'),
639   - left: element.getStyle('left'),
640   - opacity: element.getInlineOpacity() };
641   - return new Effect.Parallel(
642   - [ new Effect.Move(element, {x: 0, y: 100, sync: true }),
643   - new Effect.Opacity(element, { sync: true, to: 0.0 }) ],
644   - Object.extend(
645   - { duration: 0.5,
646   - beforeSetup: function(effect) {
647   - effect.effects[0].element.makePositioned();
648   - },
649   - afterFinishInternal: function(effect) {
650   - effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle);
651   - }
652   - }, arguments[1] || { }));
653   -};
654   -
655   -Effect.Shake = function(element) {
656   - element = $(element);
657   - var options = Object.extend({
658   - distance: 20,
659   - duration: 0.5
660   - }, arguments[1] || {});
661   - var distance = parseFloat(options.distance);
662   - var split = parseFloat(options.duration) / 10.0;
663   - var oldStyle = {
664   - top: element.getStyle('top'),
665   - left: element.getStyle('left') };
666   - return new Effect.Move(element,
667   - { x: distance, y: 0, duration: split, afterFinishInternal: function(effect) {
668   - new Effect.Move(effect.element,
669   - { x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) {
670   - new Effect.Move(effect.element,
671   - { x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) {
672   - new Effect.Move(effect.element,
673   - { x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) {
674   - new Effect.Move(effect.element,
675   - { x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) {
676   - new Effect.Move(effect.element,
677   - { x: -distance, y: 0, duration: split, afterFinishInternal: function(effect) {
678   - effect.element.undoPositioned().setStyle(oldStyle);
679   - }}) }}) }}) }}) }}) }});
680   -};
681   -
682   -Effect.SlideDown = function(element) {
683   - element = $(element).cleanWhitespace();
684   - // SlideDown need to have the content of the element wrapped in a container element with fixed height!
685   - var oldInnerBottom = element.down().getStyle('bottom');
686   - var elementDimensions = element.getDimensions();
687   - return new Effect.Scale(element, 100, Object.extend({
688   - scaleContent: false,
689   - scaleX: false,
690   - scaleFrom: window.opera ? 0 : 1,
691   - scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
692   - restoreAfterFinish: true,
693   - afterSetup: function(effect) {
694   - effect.element.makePositioned();
695   - effect.element.down().makePositioned();
696   - if (window.opera) effect.element.setStyle({top: ''});
697   - effect.element.makeClipping().setStyle({height: '0px'}).show();
698   - },
699   - afterUpdateInternal: function(effect) {
700   - effect.element.down().setStyle({bottom:
701   - (effect.dims[0] - effect.element.clientHeight) + 'px' });
702   - },
703   - afterFinishInternal: function(effect) {
704   - effect.element.undoClipping().undoPositioned();
705   - effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); }
706   - }, arguments[1] || { })
707   - );
708   -};
709   -
710   -Effect.SlideUp = function(element) {
711   - element = $(element).cleanWhitespace();
712   - var oldInnerBottom = element.down().getStyle('bottom');
713   - var elementDimensions = element.getDimensions();
714   - return new Effect.Scale(element, window.opera ? 0 : 1,
715   - Object.extend({ scaleContent: false,
716   - scaleX: false,
717   - scaleMode: 'box',
718   - scaleFrom: 100,
719   - scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
720   - restoreAfterFinish: true,
721   - afterSetup: function(effect) {
722   - effect.element.makePositioned();
723   - effect.element.down().makePositioned();
724   - if (window.opera) effect.element.setStyle({top: ''});
725   - effect.element.makeClipping().show();
726   - },
727   - afterUpdateInternal: function(effect) {
728   - effect.element.down().setStyle({bottom:
729   - (effect.dims[0] - effect.element.clientHeight) + 'px' });
730   - },
731   - afterFinishInternal: function(effect) {
732   - effect.element.hide().undoClipping().undoPositioned();
733   - effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom});
734   - }
735   - }, arguments[1] || { })
736   - );
737   -};
738   -
739   -// Bug in opera makes the TD containing this element expand for a instance after finish
740   -Effect.Squish = function(element) {
741   - return new Effect.Scale(element, window.opera ? 1 : 0, {
742   - restoreAfterFinish: true,
743   - beforeSetup: function(effect) {
744   - effect.element.makeClipping();
745   - },
746   - afterFinishInternal: function(effect) {
747   - effect.element.hide().undoClipping();
748   - }
749   - });
750   -};
751   -
752   -Effect.Grow = function(element) {
753   - element = $(element);
754   - var options = Object.extend({
755   - direction: 'center',
756   - moveTransition: Effect.Transitions.sinoidal,
757   - scaleTransition: Effect.Transitions.sinoidal,
758   - opacityTransition: Effect.Transitions.full
759   - }, arguments[1] || { });
760   - var oldStyle = {
761   - top: element.style.top,
762   - left: element.style.left,
763   - height: element.style.height,
764   - width: element.style.width,
765   - opacity: element.getInlineOpacity() };
766   -
767   - var dims = element.getDimensions();
768   - var initialMoveX, initialMoveY;
769   - var moveX, moveY;
770   -
771   - switch (options.direction) {
772   - case 'top-left':
773   - initialMoveX = initialMoveY = moveX = moveY = 0;
774   - break;
775   - case 'top-right':
776   - initialMoveX = dims.width;
777   - initialMoveY = moveY = 0;
778   - moveX = -dims.width;
779   - break;
780   - case 'bottom-left':
781   - initialMoveX = moveX = 0;
782   - initialMoveY = dims.height;
783   - moveY = -dims.height;
784   - break;
785   - case 'bottom-right':
786   - initialMoveX = dims.width;
787   - initialMoveY = dims.height;
788   - moveX = -dims.width;
789   - moveY = -dims.height;
790   - break;
791   - case 'center':
792   - initialMoveX = dims.width / 2;
793   - initialMoveY = dims.height / 2;
794   - moveX = -dims.width / 2;
795   - moveY = -dims.height / 2;
796   - break;
797   - }
798   -
799   - return new Effect.Move(element, {
800   - x: initialMoveX,
801   - y: initialMoveY,
802   - duration: 0.01,
803   - beforeSetup: function(effect) {
804   - effect.element.hide().makeClipping().makePositioned();
805   - },
806   - afterFinishInternal: function(effect) {
807   - new Effect.Parallel(
808   - [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }),
809   - new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }),
810   - new Effect.Scale(effect.element, 100, {
811   - scaleMode: { originalHeight: dims.height, originalWidth: dims.width },
812   - sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true})
813   - ], Object.extend({
814   - beforeSetup: function(effect) {
815   - effect.effects[0].element.setStyle({height: '0px'}).show();
816   - },
817   - afterFinishInternal: function(effect) {
818   - effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);
819   - }
820   - }, options)
821   - )
822   - }
823   - });
824   -};
825   -
826   -Effect.Shrink = function(element) {
827   - element = $(element);
828   - var options = Object.extend({
829   - direction: 'center',
830   - moveTransition: Effect.Transitions.sinoidal,
831   - scaleTransition: Effect.Transitions.sinoidal,
832   - opacityTransition: Effect.Transitions.none
833   - }, arguments[1] || { });
834   - var oldStyle = {
835   - top: element.style.top,
836   - left: element.style.left,
837   - height: element.style.height,
838   - width: element.style.width,
839   - opacity: element.getInlineOpacity() };
840   -
841   - var dims = element.getDimensions();
842   - var moveX, moveY;
843   -
844   - switch (options.direction) {
845   - case 'top-left':
846   - moveX = moveY = 0;
847   - break;
848   - case 'top-right':
849   - moveX = dims.width;
850   - moveY = 0;
851   - break;
852   - case 'bottom-left':
853   - moveX = 0;
854   - moveY = dims.height;
855   - break;
856   - case 'bottom-right':
857   - moveX = dims.width;
858   - moveY = dims.height;
859   - break;
860   - case 'center':
861   - moveX = dims.width / 2;
862   - moveY = dims.height / 2;
863   - break;
864   - }
865   -
866   - return new Effect.Parallel(
867   - [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }),
868   - new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}),
869   - new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition })
870   - ], Object.extend({
871   - beforeStartInternal: function(effect) {
872   - effect.effects[0].element.makePositioned().makeClipping();
873   - },
874   - afterFinishInternal: function(effect) {
875   - effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); }
876   - }, options)
877   - );
878   -};
879   -
880   -Effect.Pulsate = function(element) {
881   - element = $(element);
882   - var options = arguments[1] || { };
883   - var oldOpacity = element.getInlineOpacity();
884   - var transition = options.transition || Effect.Transitions.sinoidal;
885   - var reverser = function(pos){ return transition(1-Effect.Transitions.pulse(pos, options.pulses)) };
886   - reverser.bind(transition);
887   - return new Effect.Opacity(element,
888   - Object.extend(Object.extend({ duration: 2.0, from: 0,
889   - afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); }
890   - }, options), {transition: reverser}));
891   -};
892   -
893   -Effect.Fold = function(element) {
894   - element = $(element);
895   - var oldStyle = {
896   - top: element.style.top,
897   - left: element.style.left,
898   - width: element.style.width,
899   - height: element.style.height };
900   - element.makeClipping();
901   - return new Effect.Scale(element, 5, Object.extend({
902   - scaleContent: false,
903   - scaleX: false,
904   - afterFinishInternal: function(effect) {
905   - new Effect.Scale(element, 1, {
906   - scaleContent: false,
907   - scaleY: false,
908   - afterFinishInternal: function(effect) {
909   - effect.element.hide().undoClipping().setStyle(oldStyle);
910   - } });
911   - }}, arguments[1] || { }));
912   -};
913   -
914   -Effect.Morph = Class.create(Effect.Base, {
915   - initialize: function(element) {
916   - this.element = $(element);
917   - if (!this.element) throw(Effect._elementDoesNotExistError);
918   - var options = Object.extend({
919   - style: { }
920   - }, arguments[1] || { });
921   -
922   - if (!Object.isString(options.style)) this.style = $H(options.style);
923   - else {
924   - if (options.style.include(':'))
925   - this.style = options.style.parseStyle();
926   - else {
927   - this.element.addClassName(options.style);
928   - this.style = $H(this.element.getStyles());
929   - this.element.removeClassName(options.style);
930   - var css = this.element.getStyles();
931   - this.style = this.style.reject(function(style) {
932   - return style.value == css[style.key];
933   - });
934   - options.afterFinishInternal = function(effect) {
935   - effect.element.addClassName(effect.options.style);
936   - effect.transforms.each(function(transform) {
937   - effect.element.style[transform.style] = '';
938   - });
939   - }
940   - }
941   - }
942   - this.start(options);
943   - },
944   -
945   - setup: function(){
946   - function parseColor(color){
947   - if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff';
948   - color = color.parseColor();
949   - return $R(0,2).map(function(i){
950   - return parseInt( color.slice(i*2+1,i*2+3), 16 )
951   - });
952   - }
953   - this.transforms = this.style.map(function(pair){
954   - var property = pair[0], value = pair[1], unit = null;
955   -
956   - if (value.parseColor('#zzzzzz') != '#zzzzzz') {
957   - value = value.parseColor();
958   - unit = 'color';
959   - } else if (property == 'opacity') {
960   - value = parseFloat(value);
961   - if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout))
962   - this.element.setStyle({zoom: 1});
963   - } else if (Element.CSS_LENGTH.test(value)) {
964   - var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/);
965   - value = parseFloat(components[1]);
966   - unit = (components.length == 3) ? components[2] : null;
967   - }
968   -
969   - var originalValue = this.element.getStyle(property);
970   - return {
971   - style: property.camelize(),
972   - originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0),
973   - targetValue: unit=='color' ? parseColor(value) : value,
974   - unit: unit
975   - };
976   - }.bind(this)).reject(function(transform){
977   - return (
978   - (transform.originalValue == transform.targetValue) ||
979   - (
980   - transform.unit != 'color' &&
981   - (isNaN(transform.originalValue) || isNaN(transform.targetValue))
982   - )
983   - )
984   - });
985   - },
986   - update: function(position) {
987   - var style = { }, transform, i = this.transforms.length;
988   - while(i--)
989   - style[(transform = this.transforms[i]).style] =
990   - transform.unit=='color' ? '#'+
991   - (Math.round(transform.originalValue[0]+
992   - (transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart() +
993   - (Math.round(transform.originalValue[1]+
994   - (transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart() +
995   - (Math.round(transform.originalValue[2]+
996   - (transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart() :
997   - (transform.originalValue +
998   - (transform.targetValue - transform.originalValue) * position).toFixed(3) +
999   - (transform.unit === null ? '' : transform.unit);
1000   - this.element.setStyle(style, true);
1001   - }
1002   -});
1003   -
1004   -Effect.Transform = Class.create({
1005   - initialize: function(tracks){
1006   - this.tracks = [];
1007   - this.options = arguments[1] || { };
1008   - this.addTracks(tracks);
1009   - },
1010   - addTracks: function(tracks){
1011   - tracks.each(function(track){
1012   - track = $H(track);
1013   - var data = track.values().first();
1014   - this.tracks.push($H({
1015   - ids: track.keys().first(),
1016   - effect: Effect.Morph,
1017   - options: { style: data }
1018   - }));
1019   - }.bind(this));
1020   - return this;
1021   - },
1022   - play: function(){
1023   - return new Effect.Parallel(
1024   - this.tracks.map(function(track){
1025   - var ids = track.get('ids'), effect = track.get('effect'), options = track.get('options');
1026   - var elements = [$(ids) || $$(ids)].flatten();
1027   - return elements.map(function(e){ return new effect(e, Object.extend({ sync:true }, options)) });
1028   - }).flatten(),
1029   - this.options
1030   - );
1031   - }
1032   -});
1033   -
1034   -Element.CSS_PROPERTIES = $w(
1035   - 'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' +
1036   - 'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' +
1037   - 'borderRightColor borderRightStyle borderRightWidth borderSpacing ' +
1038   - 'borderTopColor borderTopStyle borderTopWidth bottom clip color ' +
1039   - 'fontSize fontWeight height left letterSpacing lineHeight ' +
1040   - 'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+
1041   - 'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' +
1042   - 'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' +
1043   - 'right textIndent top width wordSpacing zIndex');
1044   -
1045   -Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;
1046   -
1047   -String.__parseStyleElement = document.createElement('div');
1048   -String.prototype.parseStyle = function(){
1049   - var style, styleRules = $H();
1050   - if (Prototype.Browser.WebKit)
1051   - style = new Element('div',{style:this}).style;
1052   - else {
1053   - String.__parseStyleElement.innerHTML = '<div style="' + this + '"></div>';
1054   - style = String.__parseStyleElement.childNodes[0].style;
1055   - }
1056   -
1057   - Element.CSS_PROPERTIES.each(function(property){
1058   - if (style[property]) styleRules.set(property, style[property]);
1059   - });
1060   -
1061   - if (Prototype.Browser.IE && this.include('opacity'))
1062   - styleRules.set('opacity', this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]);
1063   -
1064   - return styleRules;
1065   -};
1066   -
1067   -if (document.defaultView && document.defaultView.getComputedStyle) {
1068   - Element.getStyles = function(element) {
1069   - var css = document.defaultView.getComputedStyle($(element), null);
1070   - return Element.CSS_PROPERTIES.inject({ }, function(styles, property) {
1071   - styles[property] = css[property];
1072   - return styles;
1073   - });
1074   - };
1075   -} else {
1076   - Element.getStyles = function(element) {
1077   - element = $(element);
1078   - var css = element.currentStyle, styles;
1079   - styles = Element.CSS_PROPERTIES.inject({ }, function(results, property) {
1080   - results[property] = css[property];
1081   - return results;
1082   - });
1083   - if (!styles.opacity) styles.opacity = element.getOpacity();
1084   - return styles;
1085   - };
1086   -};
1087   -
1088   -Effect.Methods = {
1089   - morph: function(element, style) {
1090   - element = $(element);
1091   - new Effect.Morph(element, Object.extend({ style: style }, arguments[2] || { }));
1092   - return element;
1093   - },
1094   - visualEffect: function(element, effect, options) {
1095   - element = $(element)
1096   - var s = effect.dasherize().camelize(), klass = s.charAt(0).toUpperCase() + s.substring(1);
1097   - new Effect[klass](element, options);
1098   - return element;
1099   - },
1100   - highlight: function(element, options) {
1101   - element = $(element);
1102   - new Effect.Highlight(element, options);
1103   - return element;
1104   - }
1105   -};
1106   -
1107   -$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+
1108   - 'pulsate shake puff squish switchOff dropOut').each(
1109   - function(effect) {
1110   - Effect.Methods[effect] = function(element, options){
1111   - element = $(element);
1112   - Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options);
1113   - return element;
1114   - }
1115   - }
1116   -);
1117   -
1118   -$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each(
1119   - function(f) { Effect.Methods[f] = Element[f]; }
1120   -);
1121   -
1122   -Element.addMethods(Effect.Methods);
plugins/thumbnails/resources/lightbox/js/lightbox.js deleted
1   -// -----------------------------------------------------------------------------------
2   -//
3   -// Lightbox v2.04
4   -// by Lokesh Dhakar - http://www.lokeshdhakar.com
5   -// Last Modification: 2/9/08
6   -//
7   -// For more information, visit:
8   -// http://lokeshdhakar.com/projects/lightbox2/
9   -//
10   -// Licensed under the Creative Commons Attribution 2.5 License - http://creativecommons.org/licenses/by/2.5/
11   -// - Free for use in both personal and commercial projects
12   -// - Attribution requires leaving author name, author link, and the license info intact.
13   -//
14   -// Thanks: Scott Upton(uptonic.com), Peter-Paul Koch(quirksmode.com), and Thomas Fuchs(mir.aculo.us) for ideas, libs, and snippets.
15   -// Artemy Tregubenko (arty.name) for cleanup and help in updating to latest ver of proto-aculous.
16   -//
17   -// -----------------------------------------------------------------------------------
18   -/*
19   -
20   - Table of Contents
21   - -----------------
22   - Configuration
23   -
24   - Lightbox Class Declaration
25   - - initialize()
26   - - updateImageList()
27   - - start()
28   - - changeImage()
29   - - resizeImageContainer()
30   - - showImage()
31   - - updateDetails()
32   - - updateNav()
33   - - enableKeyboardNav()
34   - - disableKeyboardNav()
35   - - keyboardAction()
36   - - preloadNeighborImages()
37   - - end()
38   -
39   - Function Calls
40   - - document.observe()
41   -
42   -*/
43   -// -----------------------------------------------------------------------------------
44   -
45   -//
46   -// Configurationl
47   -//
48   -LightboxOptions = Object.extend({
49   - fileLoadingImage: 'plugins/thumbnails/resources/lightbox/images/loading.gif',
50   - fileBottomNavCloseImage: 'plugins/thumbnails/resources/lightbox/images/closelabel.gif',
51   -
52   - overlayOpacity: 0.8, // controls transparency of shadow overlay
53   -
54   - animate: true, // toggles resizing animations
55   - resizeSpeed: 7, // controls the speed of the image resizing animations (1=slowest and 10=fastest)
56   -
57   - borderSize: 10, //if you adjust the padding in the CSS, you will need to update this variable
58   -
59   - // When grouping images this is used to write: Image # of #.
60   - // Change it for non-english localization
61   - labelImage: "Image",
62   - labelOf: "of"
63   -}, window.LightboxOptions || {});
64   -
65   -// -----------------------------------------------------------------------------------
66   -
67   -var Lightbox = Class.create();
68   -
69   -Lightbox.prototype = {
70   - imageArray: [],
71   - activeImage: undefined,
72   -
73   - // initialize()
74   - // Constructor runs on completion of the DOM loading. Calls updateImageList and then
75   - // the function inserts html at the bottom of the page which is used to display the shadow
76   - // overlay and the image container.
77   - //
78   - initialize: function() {
79   -
80   - this.updateImageList();
81   -
82   - this.keyboardAction = this.keyboardAction.bindAsEventListener(this);
83   -
84   - if (LightboxOptions.resizeSpeed > 10) LightboxOptions.resizeSpeed = 10;
85   - if (LightboxOptions.resizeSpeed < 1) LightboxOptions.resizeSpeed = 1;
86   -
87   - this.resizeDuration = LightboxOptions.animate ? ((11 - LightboxOptions.resizeSpeed) * 0.15) : 0;
88   - this.overlayDuration = LightboxOptions.animate ? 0.2 : 0; // shadow fade in/out duration
89   -
90   - // When Lightbox starts it will resize itself from 250 by 250 to the current image dimension.
91   - // If animations are turned off, it will be hidden as to prevent a flicker of a
92   - // white 250 by 250 box.
93   - var size = (LightboxOptions.animate ? 250 : 1) + 'px';
94   -
95   -
96   - // Code inserts html at the bottom of the page that looks similar to this:
97   - //
98   - // <div id="overlay"></div>
99   - // <div id="lightbox">
100   - // <div id="outerImageContainer">
101   - // <div id="imageContainer">
102   - // <img id="lightboxImage">
103   - // <div style="" id="hoverNav">
104   - // <a href="#" id="prevLink"></a>
105   - // <a href="#" id="nextLink"></a>
106   - // </div>
107   - // <div id="loading">
108   - // <a href="#" id="loadingLink">
109   - // <img src="images/loading.gif">
110   - // </a>
111   - // </div>
112   - // </div>
113   - // </div>
114   - // <div id="imageDataContainer">
115   - // <div id="imageData">
116   - // <div id="imageDetails">
117   - // <span id="caption"></span>
118   - // <span id="numberDisplay"></span>
119   - // </div>
120   - // <div id="bottomNav">
121   - // <a href="#" id="bottomNavClose">
122   - // <img src="images/close.gif">
123   - // </a>
124   - // </div>
125   - // </div>
126   - // </div>
127   - // </div>
128   -
129   -
130   - var objBody = $$('body')[0];
131   -
132   - objBody.appendChild(Builder.node('div',{id:'overlay'}));
133   -
134   - objBody.appendChild(Builder.node('div',{id:'lightbox'}, [
135   - Builder.node('div',{id:'outerImageContainer'},
136   - Builder.node('div',{id:'imageContainer'}, [
137   - Builder.node('img',{id:'lightboxImage'}),
138   - Builder.node('div',{id:'hoverNav'}, [
139   - Builder.node('a',{id:'prevLink', href: '#' }),
140   - Builder.node('a',{id:'nextLink', href: '#' })
141   - ]),
142   - Builder.node('div',{id:'loading'},
143   - Builder.node('a',{id:'loadingLink', href: '#' },
144   - Builder.node('img', {src: LightboxOptions.fileLoadingImage})
145   - )
146   - )
147   - ])
148   - ),
149   - Builder.node('div', {id:'imageDataContainer'},
150   - Builder.node('div',{id:'imageData'}, [
151   - Builder.node('div',{id:'imageDetails'}, [
152   - Builder.node('span',{id:'caption'}),
153   - Builder.node('span',{id:'numberDisplay'})
154   - ]),
155   - Builder.node('div',{id:'bottomNav'},
156   - Builder.node('a',{id:'bottomNavClose', href: '#' },
157   - Builder.node('img', { src: LightboxOptions.fileBottomNavCloseImage })
158   - )
159   - )
160   - ])
161   - )
162   - ]));
163   -
164   -
165   - $('overlay').hide().observe('click', (function() { this.end(); }).bind(this));
166   - $('lightbox').hide().observe('click', (function(event) { if (event.element().id == 'lightbox') this.end(); }).bind(this));
167   - $('outerImageContainer').setStyle({ width: size, height: size });
168   - $('prevLink').observe('click', (function(event) { event.stop(); this.changeImage(this.activeImage - 1); }).bindAsEventListener(this));
169   - $('nextLink').observe('click', (function(event) { event.stop(); this.changeImage(this.activeImage + 1); }).bindAsEventListener(this));
170   - $('loadingLink').observe('click', (function(event) { event.stop(); this.end(); }).bind(this));
171   - $('bottomNavClose').observe('click', (function(event) { event.stop(); this.end(); }).bind(this));
172   -
173   - var th = this;
174   - (function(){
175   - var ids =
176   - 'overlay lightbox outerImageContainer imageContainer lightboxImage hoverNav prevLink nextLink loading loadingLink ' +
177   - 'imageDataContainer imageData imageDetails caption numberDisplay bottomNav bottomNavClose';
178   - $w(ids).each(function(id){ th[id] = $(id); });
179   - }).defer();
180   - },
181   -
182   - //
183   - // updateImageList()
184   - // Loops through anchor tags looking for 'lightbox' references and applies onclick
185   - // events to appropriate links. You can rerun after dynamically adding images w/ajax.
186   - //
187   - updateImageList: function() {
188   - this.updateImageList = Prototype.emptyFunction;
189   -
190   - document.observe('click', (function(event){
191   - var target = event.findElement('a[rel^=lightbox]') || event.findElement('area[rel^=lightbox]');
192   - if (target) {
193   - event.stop();
194   - this.start(target);
195   - }
196   - }).bind(this));
197   - },
198   -
199   - //
200   - // start()
201   - // Display overlay and lightbox. If image is part of a set, add siblings to imageArray.
202   - //
203   - start: function(imageLink) {
204   -
205   - $$('select', 'object', 'embed').each(function(node){ node.style.visibility = 'hidden' });
206   -
207   - // stretch overlay to fill page and fade in
208   - var arrayPageSize = this.getPageSize();
209   - $('overlay').setStyle({ width: arrayPageSize[0] + 'px', height: arrayPageSize[1] + 'px' });
210   -
211   - new Effect.Appear(this.overlay, { duration: this.overlayDuration, from: 0.0, to: LightboxOptions.overlayOpacity });
212   -
213   - this.imageArray = [];
214   - var imageNum = 0;
215   -
216   - if ((imageLink.rel == 'lightbox')){
217   - // if image is NOT part of a set, add single image to imageArray
218   - this.imageArray.push([imageLink.href, imageLink.title]);
219   - } else {
220   - // if image is part of a set..
221   - this.imageArray =
222   - $$(imageLink.tagName + '[href][rel="' + imageLink.rel + '"]').
223   - collect(function(anchor){ return [anchor.href, anchor.title]; }).
224   - uniq();
225   -
226   - while (this.imageArray[imageNum][0] != imageLink.href) { imageNum++; }
227   - }
228   -
229   - // calculate top and left offset for the lightbox
230   - var arrayPageScroll = document.viewport.getScrollOffsets();
231   - var lightboxTop = arrayPageScroll[1] + (document.viewport.getHeight() / 10);
232   - var lightboxLeft = arrayPageScroll[0];
233   - this.lightbox.setStyle({ top: lightboxTop + 'px', left: lightboxLeft + 'px' }).show();
234   -
235   - this.changeImage(imageNum);
236   - },
237   -
238   - //
239   - // changeImage()
240   - // Hide most elements and preload image in preparation for resizing image container.
241   - //
242   - changeImage: function(imageNum) {
243   -
244   - this.activeImage = imageNum; // update global var
245   -
246   - // hide elements during transition
247   - if (LightboxOptions.animate) this.loading.show();
248   - this.lightboxImage.hide();
249   - this.hoverNav.hide();
250   - this.prevLink.hide();
251   - this.nextLink.hide();
252   - // HACK: Opera9 does not currently support scriptaculous opacity and appear fx
253   - this.imageDataContainer.setStyle({opacity: .0001});
254   - this.numberDisplay.hide();
255   -
256   - var imgPreloader = new Image();
257   -
258   - // once image is preloaded, resize image container
259   -
260   -
261   - imgPreloader.onload = (function(){
262   - this.lightboxImage.src = this.imageArray[this.activeImage][0];
263   - this.resizeImageContainer(imgPreloader.width, imgPreloader.height);
264   - }).bind(this);
265   - imgPreloader.src = this.imageArray[this.activeImage][0];
266   - },
267   -
268   - //
269   - // resizeImageContainer()
270   - //
271   - resizeImageContainer: function(imgWidth, imgHeight) {
272   -
273   - // get current width and height
274   - var widthCurrent = this.outerImageContainer.getWidth();
275   - var heightCurrent = this.outerImageContainer.getHeight();
276   -
277   - // get new width and height
278   - var widthNew = (imgWidth + LightboxOptions.borderSize * 2);
279   - var heightNew = (imgHeight + LightboxOptions.borderSize * 2);
280   -
281   - // scalars based on change from old to new
282   - var xScale = (widthNew / widthCurrent) * 100;
283   - var yScale = (heightNew / heightCurrent) * 100;
284   -
285   - // calculate size difference between new and old image, and resize if necessary
286   - var wDiff = widthCurrent - widthNew;
287   - var hDiff = heightCurrent - heightNew;
288   -
289   - if (hDiff != 0) new Effect.Scale(this.outerImageContainer, yScale, {scaleX: false, duration: this.resizeDuration, queue: 'front'});
290   - if (wDiff != 0) new Effect.Scale(this.outerImageContainer, xScale, {scaleY: false, duration: this.resizeDuration, delay: this.resizeDuration});
291   -
292   - // if new and old image are same size and no scaling transition is necessary,
293   - // do a quick pause to prevent image flicker.
294   - var timeout = 0;
295   - if ((hDiff == 0) && (wDiff == 0)){
296   - timeout = 100;
297   - if (Prototype.Browser.IE) timeout = 250;
298   - }
299   -
300   - (function(){
301   - this.prevLink.setStyle({ height: imgHeight + 'px' });
302   - this.nextLink.setStyle({ height: imgHeight + 'px' });
303   - this.imageDataContainer.setStyle({ width: widthNew + 'px' });
304   -
305   - this.showImage();
306   - }).bind(this).delay(timeout / 1000);
307   - },
308   -
309   - //
310   - // showImage()
311   - // Display image and begin preloading neighbors.
312   - //
313   - showImage: function(){
314   - this.loading.hide();
315   - new Effect.Appear(this.lightboxImage, {
316   - duration: this.resizeDuration,
317   - queue: 'end',
318   - afterFinish: (function(){ this.updateDetails(); }).bind(this)
319   - });
320   - this.preloadNeighborImages();
321   - },
322   -
323   - //
324   - // updateDetails()
325   - // Display caption, image number, and bottom nav.
326   - //
327   - updateDetails: function() {
328   -
329   - // if caption is not null
330   - if (this.imageArray[this.activeImage][1] != ""){
331   - this.caption.update(this.imageArray[this.activeImage][1]).show();
332   - }
333   -
334   - // if image is part of set display 'Image x of x'
335   - if (this.imageArray.length > 1){
336   - this.numberDisplay.update( LightboxOptions.labelImage + ' ' + (this.activeImage + 1) + ' ' + LightboxOptions.labelOf + ' ' + this.imageArray.length).show();
337   - }
338   -
339   - new Effect.Parallel(
340   - [
341   - new Effect.SlideDown(this.imageDataContainer, { sync: true, duration: this.resizeDuration, from: 0.0, to: 1.0 }),
342   - new Effect.Appear(this.imageDataContainer, { sync: true, duration: this.resizeDuration })
343   - ],
344   - {
345   - duration: this.resizeDuration,
346   - afterFinish: (function() {
347   - // update overlay size and update nav
348   - var arrayPageSize = this.getPageSize();
349   - this.overlay.setStyle({ height: arrayPageSize[1] + 'px' });
350   - this.updateNav();
351   - }).bind(this)
352   - }
353   - );
354   - },
355   -
356   - //
357   - // updateNav()
358   - // Display appropriate previous and next hover navigation.
359   - //
360   - updateNav: function() {
361   -
362   - this.hoverNav.show();
363   -
364   - // if not first image in set, display prev image button
365   - if (this.activeImage > 0) this.prevLink.show();
366   -
367   - // if not last image in set, display next image button
368   - if (this.activeImage < (this.imageArray.length - 1)) this.nextLink.show();
369   -
370   - this.enableKeyboardNav();
371   - },
372   -
373   - //
374   - // enableKeyboardNav()
375   - //
376   - enableKeyboardNav: function() {
377   - document.observe('keydown', this.keyboardAction);
378   - },
379   -
380   - //
381   - // disableKeyboardNav()
382   - //
383   - disableKeyboardNav: function() {
384   - document.stopObserving('keydown', this.keyboardAction);
385   - },
386   -
387   - //
388   - // keyboardAction()
389   - //
390   - keyboardAction: function(event) {
391   - var keycode = event.keyCode;
392   -
393   - var escapeKey;
394   - if (event.DOM_VK_ESCAPE) { // mozilla
395   - escapeKey = event.DOM_VK_ESCAPE;
396   - } else { // ie
397   - escapeKey = 27;
398   - }
399   -
400   - var key = String.fromCharCode(keycode).toLowerCase();
401   -
402   - if (key.match(/x|o|c/) || (keycode == escapeKey)){ // close lightbox
403   - this.end();
404   - } else if ((key == 'p') || (keycode == 37)){ // display previous image
405   - if (this.activeImage != 0){
406   - this.disableKeyboardNav();
407   - this.changeImage(this.activeImage - 1);
408   - }
409   - } else if ((key == 'n') || (keycode == 39)){ // display next image
410   - if (this.activeImage != (this.imageArray.length - 1)){
411   - this.disableKeyboardNav();
412   - this.changeImage(this.activeImage + 1);
413   - }
414   - }
415   - },
416   -
417   - //
418   - // preloadNeighborImages()
419   - // Preload previous and next images.
420   - //
421   - preloadNeighborImages: function(){
422   - var preloadNextImage, preloadPrevImage;
423   - if (this.imageArray.length > this.activeImage + 1){
424   - preloadNextImage = new Image();
425   - preloadNextImage.src = this.imageArray[this.activeImage + 1][0];
426   - }
427   - if (this.activeImage > 0){
428   - preloadPrevImage = new Image();
429   - preloadPrevImage.src = this.imageArray[this.activeImage - 1][0];
430   - }
431   -
432   - },
433   -
434   - //
435   - // end()
436   - //
437   - end: function() {
438   - this.disableKeyboardNav();
439   - this.lightbox.hide();
440   - new Effect.Fade(this.overlay, { duration: this.overlayDuration });
441   - $$('select', 'object', 'embed').each(function(node){ node.style.visibility = 'visible' });
442   - },
443   -
444   - //
445   - // getPageSize()
446   - //
447   - getPageSize: function() {
448   -
449   - var xScroll, yScroll;
450   -
451   - if (window.innerHeight && window.scrollMaxY) {
452   - xScroll = window.innerWidth + window.scrollMaxX;
453   - yScroll = window.innerHeight + window.scrollMaxY;
454   - } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
455   - xScroll = document.body.scrollWidth;
456   - yScroll = document.body.scrollHeight;
457   - } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
458   - xScroll = document.body.offsetWidth;
459   - yScroll = document.body.offsetHeight;
460   - }
461   -
462   - var windowWidth, windowHeight;
463   -
464   - if (self.innerHeight) { // all except Explorer
465   - if(document.documentElement.clientWidth){
466   - windowWidth = document.documentElement.clientWidth;
467   - } else {
468   - windowWidth = self.innerWidth;
469   - }
470   - windowHeight = self.innerHeight;
471   - } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
472   - windowWidth = document.documentElement.clientWidth;
473   - windowHeight = document.documentElement.clientHeight;
474   - } else if (document.body) { // other Explorers
475   - windowWidth = document.body.clientWidth;
476   - windowHeight = document.body.clientHeight;
477   - }
478   -
479   - // for small pages with total height less then height of the viewport
480   - if(yScroll < windowHeight){
481   - pageHeight = windowHeight;
482   - } else {
483   - pageHeight = yScroll;
484   - }
485   -
486   - // for small pages with total width less then width of the viewport
487   - if(xScroll < windowWidth){
488   - pageWidth = xScroll;
489   - } else {
490   - pageWidth = windowWidth;
491   - }
492   -
493   - return [pageWidth,pageHeight];
494   - }
495   -}
496   -
497   -document.observe('dom:loaded', function () { new Lightbox(); });
498 0 \ No newline at end of file
plugins/thumbnails/resources/lightbox/js/prototype.js deleted
1   -/* Prototype JavaScript framework, version 1.6.0.2
2   - * (c) 2005-2008 Sam Stephenson
3   - *
4   - * Prototype is freely distributable under the terms of an MIT-style license.
5   - * For details, see the Prototype web site: http://www.prototypejs.org/
6   - *
7   - *--------------------------------------------------------------------------*/
8   -
9   -var Prototype = {
10   - Version: '1.6.0.2',
11   -
12   - Browser: {
13   - IE: !!(window.attachEvent && !window.opera),
14   - Opera: !!window.opera,
15   - WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
16   - Gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1,
17   - MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
18   - },
19   -
20   - BrowserFeatures: {
21   - XPath: !!document.evaluate,
22   - ElementExtensions: !!window.HTMLElement,
23   - SpecificElementExtensions:
24   - document.createElement('div').__proto__ &&
25   - document.createElement('div').__proto__ !==
26   - document.createElement('form').__proto__
27   - },
28   -
29   - ScriptFragment: '<script[^>]*>([\\S\\s]*?)<\/script>',
30   - JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/,
31   -
32   - emptyFunction: function() { },
33   - K: function(x) { return x }
34   -};
35   -
36   -if (Prototype.Browser.MobileSafari)
37   - Prototype.BrowserFeatures.SpecificElementExtensions = false;
38   -
39   -
40   -/* Based on Alex Arnell's inheritance implementation. */
41   -var Class = {
42   - create: function() {
43   - var parent = null, properties = $A(arguments);
44   - if (Object.isFunction(properties[0]))
45   - parent = properties.shift();
46   -
47   - function klass() {
48   - this.initialize.apply(this, arguments);
49   - }
50   -
51   - Object.extend(klass, Class.Methods);
52   - klass.superclass = parent;
53   - klass.subclasses = [];
54   -
55   - if (parent) {
56   - var subclass = function() { };
57   - subclass.prototype = parent.prototype;
58   - klass.prototype = new subclass;
59   - parent.subclasses.push(klass);
60   - }
61   -
62   - for (var i = 0; i < properties.length; i++)
63   - klass.addMethods(properties[i]);
64   -
65   - if (!klass.prototype.initialize)
66   - klass.prototype.initialize = Prototype.emptyFunction;
67   -
68   - klass.prototype.constructor = klass;
69   -
70   - return klass;
71   - }
72   -};
73   -
74   -Class.Methods = {
75   - addMethods: function(source) {
76   - var ancestor = this.superclass && this.superclass.prototype;
77   - var properties = Object.keys(source);
78   -
79   - if (!Object.keys({ toString: true }).length)
80   - properties.push("toString", "valueOf");
81   -
82   - for (var i = 0, length = properties.length; i < length; i++) {
83   - var property = properties[i], value = source[property];
84   - if (ancestor && Object.isFunction(value) &&
85   - value.argumentNames().first() == "$super") {
86   - var method = value, value = Object.extend((function(m) {
87   - return function() { return ancestor[m].apply(this, arguments) };
88   - })(property).wrap(method), {
89   - valueOf: function() { return method },
90   - toString: function() { return method.toString() }
91   - });
92   - }
93   - this.prototype[property] = value;
94   - }
95   -
96   - return this;
97   - }
98   -};
99   -
100   -var Abstract = { };
101   -
102   -Object.extend = function(destination, source) {
103   - for (var property in source)
104   - destination[property] = source[property];
105   - return destination;
106   -};
107   -
108   -Object.extend(Object, {
109   - inspect: function(object) {
110   - try {
111   - if (Object.isUndefined(object)) return 'undefined';
112   - if (object === null) return 'null';
113   - return object.inspect ? object.inspect() : String(object);
114   - } catch (e) {
115   - if (e instanceof RangeError) return '...';
116   - throw e;
117   - }
118   - },
119   -
120   - toJSON: function(object) {
121   - var type = typeof object;
122   - switch (type) {
123   - case 'undefined':
124   - case 'function':
125   - case 'unknown': return;
126   - case 'boolean': return object.toString();
127   - }
128   -
129   - if (object === null) return 'null';
130   - if (object.toJSON) return object.toJSON();
131   - if (Object.isElement(object)) return;
132   -
133   - var results = [];
134   - for (var property in object) {
135   - var value = Object.toJSON(object[property]);
136   - if (!Object.isUndefined(value))
137   - results.push(property.toJSON() + ': ' + value);
138   - }
139   -
140   - return '{' + results.join(', ') + '}';
141   - },
142   -
143   - toQueryString: function(object) {
144   - return $H(object).toQueryString();
145   - },
146   -
147   - toHTML: function(object) {
148   - return object && object.toHTML ? object.toHTML() : String.interpret(object);
149   - },
150   -
151   - keys: function(object) {
152   - var keys = [];
153   - for (var property in object)
154   - keys.push(property);
155   - return keys;
156   - },
157   -
158   - values: function(object) {
159   - var values = [];
160   - for (var property in object)
161   - values.push(object[property]);
162   - return values;
163   - },
164   -
165   - clone: function(object) {
166   - return Object.extend({ }, object);
167   - },
168   -
169   - isElement: function(object) {
170   - return object && object.nodeType == 1;
171   - },
172   -
173   - isArray: function(object) {
174   - return object != null && typeof object == "object" &&
175   - 'splice' in object && 'join' in object;
176   - },
177   -
178   - isHash: function(object) {
179   - return object instanceof Hash;
180   - },
181   -
182   - isFunction: function(object) {
183   - return typeof object == "function";
184   - },
185   -
186   - isString: function(object) {
187   - return typeof object == "string";
188   - },
189   -
190   - isNumber: function(object) {
191   - return typeof object == "number";
192   - },
193   -
194   - isUndefined: function(object) {
195   - return typeof object == "undefined";
196   - }
197   -});
198   -
199   -Object.extend(Function.prototype, {
200   - argumentNames: function() {
201   - var names = this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(",").invoke("strip");
202   - return names.length == 1 && !names[0] ? [] : names;
203   - },
204   -
205   - bind: function() {
206   - if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this;
207   - var __method = this, args = $A(arguments), object = args.shift();
208   - return function() {
209   - return __method.apply(object, args.concat($A(arguments)));
210   - }
211   - },
212   -
213   - bindAsEventListener: function() {
214   - var __method = this, args = $A(arguments), object = args.shift();
215   - return function(event) {
216   - return __method.apply(object, [event || window.event].concat(args));
217   - }
218   - },
219   -
220   - curry: function() {
221   - if (!arguments.length) return this;
222   - var __method = this, args = $A(arguments);
223   - return function() {
224   - return __method.apply(this, args.concat($A(arguments)));
225   - }
226   - },
227   -
228   - delay: function() {
229   - var __method = this, args = $A(arguments), timeout = args.shift() * 1000;
230   - return window.setTimeout(function() {
231   - return __method.apply(__method, args);
232   - }, timeout);
233   - },
234   -
235   - wrap: function(wrapper) {
236   - var __method = this;
237   - return function() {
238   - return wrapper.apply(this, [__method.bind(this)].concat($A(arguments)));
239   - }
240   - },
241   -
242   - methodize: function() {
243   - if (this._methodized) return this._methodized;
244   - var __method = this;
245   - return this._methodized = function() {
246   - return __method.apply(null, [this].concat($A(arguments)));
247   - };
248   - }
249   -});
250   -
251   -Function.prototype.defer = Function.prototype.delay.curry(0.01);
252   -
253   -Date.prototype.toJSON = function() {
254   - return '"' + this.getUTCFullYear() + '-' +
255   - (this.getUTCMonth() + 1).toPaddedString(2) + '-' +
256   - this.getUTCDate().toPaddedString(2) + 'T' +
257   - this.getUTCHours().toPaddedString(2) + ':' +
258   - this.getUTCMinutes().toPaddedString(2) + ':' +
259   - this.getUTCSeconds().toPaddedString(2) + 'Z"';
260   -};
261   -
262   -var Try = {
263   - these: function() {
264   - var returnValue;
265   -
266   - for (var i = 0, length = arguments.length; i < length; i++) {
267   - var lambda = arguments[i];
268   - try {
269   - returnValue = lambda();
270   - break;
271   - } catch (e) { }
272   - }
273   -
274   - return returnValue;
275   - }
276   -};
277   -
278   -RegExp.prototype.match = RegExp.prototype.test;
279   -
280   -RegExp.escape = function(str) {
281   - return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
282   -};
283   -
284   -/*--------------------------------------------------------------------------*/
285   -
286   -var PeriodicalExecuter = Class.create({
287   - initialize: function(callback, frequency) {
288   - this.callback = callback;
289   - this.frequency = frequency;
290   - this.currentlyExecuting = false;
291   -
292   - this.registerCallback();
293   - },
294   -
295   - registerCallback: function() {
296   - this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
297   - },
298   -
299   - execute: function() {
300   - this.callback(this);
301   - },
302   -
303   - stop: function() {
304   - if (!this.timer) return;
305   - clearInterval(this.timer);
306   - this.timer = null;
307   - },
308   -
309   - onTimerEvent: function() {
310   - if (!this.currentlyExecuting) {
311   - try {
312   - this.currentlyExecuting = true;
313   - this.execute();
314   - } finally {
315   - this.currentlyExecuting = false;
316   - }
317   - }
318   - }
319   -});
320   -Object.extend(String, {
321   - interpret: function(value) {
322   - return value == null ? '' : String(value);
323   - },
324   - specialChar: {
325   - '\b': '\\b',
326   - '\t': '\\t',
327   - '\n': '\\n',
328   - '\f': '\\f',
329   - '\r': '\\r',
330   - '\\': '\\\\'
331   - }
332   -});
333   -
334   -Object.extend(String.prototype, {
335   - gsub: function(pattern, replacement) {
336   - var result = '', source = this, match;
337   - replacement = arguments.callee.prepareReplacement(replacement);
338   -
339   - while (source.length > 0) {
340   - if (match = source.match(pattern)) {
341   - result += source.slice(0, match.index);
342   - result += String.interpret(replacement(match));
343   - source = source.slice(match.index + match[0].length);
344   - } else {
345   - result += source, source = '';
346   - }
347   - }
348   - return result;
349   - },
350   -
351   - sub: function(pattern, replacement, count) {
352   - replacement = this.gsub.prepareReplacement(replacement);
353   - count = Object.isUndefined(count) ? 1 : count;
354   -
355   - return this.gsub(pattern, function(match) {
356   - if (--count < 0) return match[0];
357   - return replacement(match);
358   - });
359   - },
360   -
361   - scan: function(pattern, iterator) {
362   - this.gsub(pattern, iterator);
363   - return String(this);
364   - },
365   -
366   - truncate: function(length, truncation) {
367   - length = length || 30;
368   - truncation = Object.isUndefined(truncation) ? '...' : truncation;
369   - return this.length > length ?
370   - this.slice(0, length - truncation.length) + truncation : String(this);
371   - },
372   -
373   - strip: function() {
374   - return this.replace(/^\s+/, '').replace(/\s+$/, '');
375   - },
376   -
377   - stripTags: function() {
378   - return this.replace(/<\/?[^>]+>/gi, '');
379   - },
380   -
381   - stripScripts: function() {
382   - return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
383   - },
384   -
385   - extractScripts: function() {
386   - var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
387   - var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
388   - return (this.match(matchAll) || []).map(function(scriptTag) {
389   - return (scriptTag.match(matchOne) || ['', ''])[1];
390   - });
391   - },
392   -
393   - evalScripts: function() {
394   - return this.extractScripts().map(function(script) { return eval(script) });
395   - },
396   -
397   - escapeHTML: function() {
398   - var self = arguments.callee;
399   - self.text.data = this;
400   - return self.div.innerHTML;
401   - },
402   -
403   - unescapeHTML: function() {
404   - var div = new Element('div');
405   - div.innerHTML = this.stripTags();
406   - return div.childNodes[0] ? (div.childNodes.length > 1 ?
407   - $A(div.childNodes).inject('', function(memo, node) { return memo+node.nodeValue }) :
408   - div.childNodes[0].nodeValue) : '';
409   - },
410   -
411   - toQueryParams: function(separator) {
412   - var match = this.strip().match(/([^?#]*)(#.*)?$/);
413   - if (!match) return { };
414   -
415   - return match[1].split(separator || '&').inject({ }, function(hash, pair) {
416   - if ((pair = pair.split('='))[0]) {
417   - var key = decodeURIComponent(pair.shift());
418   - var value = pair.length > 1 ? pair.join('=') : pair[0];
419   - if (value != undefined) value = decodeURIComponent(value);
420   -
421   - if (key in hash) {
422   - if (!Object.isArray(hash[key])) hash[key] = [hash[key]];
423   - hash[key].push(value);
424   - }
425   - else hash[key] = value;
426   - }
427   - return hash;
428   - });
429   - },
430   -
431   - toArray: function() {
432   - return this.split('');
433   - },
434   -
435   - succ: function() {
436   - return this.slice(0, this.length - 1) +
437   - String.fromCharCode(this.charCodeAt(this.length - 1) + 1);
438   - },
439   -
440   - times: function(count) {
441   - return count < 1 ? '' : new Array(count + 1).join(this);
442   - },
443   -
444   - camelize: function() {
445   - var parts = this.split('-'), len = parts.length;
446   - if (len == 1) return parts[0];
447   -
448   - var camelized = this.charAt(0) == '-'
449   - ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1)
450   - : parts[0];
451   -
452   - for (var i = 1; i < len; i++)
453   - camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);
454   -
455   - return camelized;
456   - },
457   -
458   - capitalize: function() {
459   - return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
460   - },
461   -
462   - underscore: function() {
463   - return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();
464   - },
465   -
466   - dasherize: function() {
467   - return this.gsub(/_/,'-');
468   - },
469   -
470   - inspect: function(useDoubleQuotes) {
471   - var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) {
472   - var character = String.specialChar[match[0]];
473   - return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16);
474   - });
475   - if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"';
476   - return "'" + escapedString.replace(/'/g, '\\\'') + "'";
477   - },
478   -
479   - toJSON: function() {
480   - return this.inspect(true);
481   - },
482   -
483   - unfilterJSON: function(filter) {
484   - return this.sub(filter || Prototype.JSONFilter, '#{1}');
485   - },
486   -
487   - isJSON: function() {
488   - var str = this;
489   - if (str.blank()) return false;
490   - str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, '');
491   - return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);
492   - },
493   -
494   - evalJSON: function(sanitize) {
495   - var json = this.unfilterJSON();
496   - try {
497   - if (!sanitize || json.isJSON()) return eval('(' + json + ')');
498   - } catch (e) { }
499   - throw new SyntaxError('Badly formed JSON string: ' + this.inspect());
500   - },
501   -
502   - include: function(pattern) {
503   - return this.indexOf(pattern) > -1;
504   - },
505   -
506   - startsWith: function(pattern) {
507   - return this.indexOf(pattern) === 0;
508   - },
509   -
510   - endsWith: function(pattern) {
511   - var d = this.length - pattern.length;
512   - return d >= 0 && this.lastIndexOf(pattern) === d;
513   - },
514   -
515   - empty: function() {
516   - return this == '';
517   - },
518   -
519   - blank: function() {
520   - return /^\s*$/.test(this);
521   - },
522   -
523   - interpolate: function(object, pattern) {
524   - return new Template(this, pattern).evaluate(object);
525   - }
526   -});
527   -
528   -if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, {
529   - escapeHTML: function() {
530   - return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
531   - },
532   - unescapeHTML: function() {
533   - return this.replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>');
534   - }
535   -});
536   -
537   -String.prototype.gsub.prepareReplacement = function(replacement) {
538   - if (Object.isFunction(replacement)) return replacement;
539   - var template = new Template(replacement);
540   - return function(match) { return template.evaluate(match) };
541   -};
542   -
543   -String.prototype.parseQuery = String.prototype.toQueryParams;
544   -
545   -Object.extend(String.prototype.escapeHTML, {
546   - div: document.createElement('div'),
547   - text: document.createTextNode('')
548   -});
549   -
550   -with (String.prototype.escapeHTML) div.appendChild(text);
551   -
552   -var Template = Class.create({
553   - initialize: function(template, pattern) {
554   - this.template = template.toString();
555   - this.pattern = pattern || Template.Pattern;
556   - },
557   -
558   - evaluate: function(object) {
559   - if (Object.isFunction(object.toTemplateReplacements))
560   - object = object.toTemplateReplacements();
561   -
562   - return this.template.gsub(this.pattern, function(match) {
563   - if (object == null) return '';
564   -
565   - var before = match[1] || '';
566   - if (before == '\\') return match[2];
567   -
568   - var ctx = object, expr = match[3];
569   - var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;
570   - match = pattern.exec(expr);
571   - if (match == null) return before;
572   -
573   - while (match != null) {
574   - var comp = match[1].startsWith('[') ? match[2].gsub('\\\\]', ']') : match[1];
575   - ctx = ctx[comp];
576   - if (null == ctx || '' == match[3]) break;
577   - expr = expr.substring('[' == match[3] ? match[1].length : match[0].length);
578   - match = pattern.exec(expr);
579   - }
580   -
581   - return before + String.interpret(ctx);
582   - });
583   - }
584   -});
585   -Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
586   -
587   -var $break = { };
588   -
589   -var Enumerable = {
590   - each: function(iterator, context) {
591   - var index = 0;
592   - iterator = iterator.bind(context);
593   - try {
594   - this._each(function(value) {
595   - iterator(value, index++);
596   - });
597   - } catch (e) {
598   - if (e != $break) throw e;
599   - }
600   - return this;
601   - },
602   -
603   - eachSlice: function(number, iterator, context) {
604   - iterator = iterator ? iterator.bind(context) : Prototype.K;
605   - var index = -number, slices = [], array = this.toArray();
606   - while ((index += number) < array.length)
607   - slices.push(array.slice(index, index+number));
608   - return slices.collect(iterator, context);
609   - },
610   -
611   - all: function(iterator, context) {
612   - iterator = iterator ? iterator.bind(context) : Prototype.K;
613   - var result = true;
614   - this.each(function(value, index) {
615   - result = result && !!iterator(value, index);
616   - if (!result) throw $break;
617   - });
618   - return result;
619   - },
620   -
621   - any: function(iterator, context) {
622   - iterator = iterator ? iterator.bind(context) : Prototype.K;
623   - var result = false;
624   - this.each(function(value, index) {
625   - if (result = !!iterator(value, index))
626   - throw $break;
627   - });
628   - return result;
629   - },
630   -
631   - collect: function(iterator, context) {
632   - iterator = iterator ? iterator.bind(context) : Prototype.K;
633   - var results = [];
634   - this.each(function(value, index) {
635   - results.push(iterator(value, index));
636   - });
637   - return results;
638   - },
639   -
640   - detect: function(iterator, context) {
641   - iterator = iterator.bind(context);
642   - var result;
643   - this.each(function(value, index) {
644   - if (iterator(value, index)) {
645   - result = value;
646   - throw $break;
647   - }
648   - });
649   - return result;
650   - },
651   -
652   - findAll: function(iterator, context) {
653   - iterator = iterator.bind(context);
654   - var results = [];
655   - this.each(function(value, index) {
656   - if (iterator(value, index))
657   - results.push(value);
658   - });
659   - return results;
660   - },
661   -
662   - grep: function(filter, iterator, context) {
663   - iterator = iterator ? iterator.bind(context) : Prototype.K;
664   - var results = [];
665   -
666   - if (Object.isString(filter))
667   - filter = new RegExp(filter);
668   -
669   - this.each(function(value, index) {
670   - if (filter.match(value))
671   - results.push(iterator(value, index));
672   - });
673   - return results;
674   - },
675   -
676   - include: function(object) {
677   - if (Object.isFunction(this.indexOf))
678   - if (this.indexOf(object) != -1) return true;
679   -
680   - var found = false;
681   - this.each(function(value) {
682   - if (value == object) {
683   - found = true;
684   - throw $break;
685   - }
686   - });
687   - return found;
688   - },
689   -
690   - inGroupsOf: function(number, fillWith) {
691   - fillWith = Object.isUndefined(fillWith) ? null : fillWith;
692   - return this.eachSlice(number, function(slice) {
693   - while(slice.length < number) slice.push(fillWith);
694   - return slice;
695   - });
696   - },
697   -
698   - inject: function(memo, iterator, context) {
699   - iterator = iterator.bind(context);
700   - this.each(function(value, index) {
701   - memo = iterator(memo, value, index);
702   - });
703   - return memo;
704   - },
705   -
706   - invoke: function(method) {
707   - var args = $A(arguments).slice(1);
708   - return this.map(function(value) {
709   - return value[method].apply(value, args);
710   - });
711   - },
712   -
713   - max: function(iterator, context) {
714   - iterator = iterator ? iterator.bind(context) : Prototype.K;
715   - var result;
716   - this.each(function(value, index) {
717   - value = iterator(value, index);
718   - if (result == null || value >= result)
719   - result = value;
720   - });
721   - return result;
722   - },
723   -
724   - min: function(iterator, context) {
725   - iterator = iterator ? iterator.bind(context) : Prototype.K;
726   - var result;
727   - this.each(function(value, index) {
728   - value = iterator(value, index);
729   - if (result == null || value < result)
730   - result = value;
731   - });
732   - return result;
733   - },
734   -
735   - partition: function(iterator, context) {
736   - iterator = iterator ? iterator.bind(context) : Prototype.K;
737   - var trues = [], falses = [];
738   - this.each(function(value, index) {
739   - (iterator(value, index) ?
740   - trues : falses).push(value);
741   - });
742   - return [trues, falses];
743   - },
744   -
745   - pluck: function(property) {
746   - var results = [];
747   - this.each(function(value) {
748   - results.push(value[property]);
749   - });
750   - return results;
751   - },
752   -
753   - reject: function(iterator, context) {
754   - iterator = iterator.bind(context);
755   - var results = [];
756   - this.each(function(value, index) {
757   - if (!iterator(value, index))
758   - results.push(value);
759   - });
760   - return results;
761   - },
762   -
763   - sortBy: function(iterator, context) {
764   - iterator = iterator.bind(context);
765   - return this.map(function(value, index) {
766   - return {value: value, criteria: iterator(value, index)};
767   - }).sort(function(left, right) {
768   - var a = left.criteria, b = right.criteria;
769   - return a < b ? -1 : a > b ? 1 : 0;
770   - }).pluck('value');
771   - },
772   -
773   - toArray: function() {
774   - return this.map();
775   - },
776   -
777   - zip: function() {
778   - var iterator = Prototype.K, args = $A(arguments);
779   - if (Object.isFunction(args.last()))
780   - iterator = args.pop();
781   -
782   - var collections = [this].concat(args).map($A);
783   - return this.map(function(value, index) {
784   - return iterator(collections.pluck(index));
785   - });
786   - },
787   -
788   - size: function() {
789   - return this.toArray().length;
790   - },
791   -
792   - inspect: function() {
793   - return '#<Enumerable:' + this.toArray().inspect() + '>';
794   - }
795   -};
796   -
797   -Object.extend(Enumerable, {
798   - map: Enumerable.collect,
799   - find: Enumerable.detect,
800   - select: Enumerable.findAll,
801   - filter: Enumerable.findAll,
802   - member: Enumerable.include,
803   - entries: Enumerable.toArray,
804   - every: Enumerable.all,
805   - some: Enumerable.any
806   -});
807   -function $A(iterable) {
808   - if (!iterable) return [];
809   - if (iterable.toArray) return iterable.toArray();
810   - var length = iterable.length || 0, results = new Array(length);
811   - while (length--) results[length] = iterable[length];
812   - return results;
813   -}
814   -
815   -if (Prototype.Browser.WebKit) {
816   - $A = function(iterable) {
817   - if (!iterable) return [];
818   - if (!(Object.isFunction(iterable) && iterable == '[object NodeList]') &&
819   - iterable.toArray) return iterable.toArray();
820   - var length = iterable.length || 0, results = new Array(length);
821   - while (length--) results[length] = iterable[length];
822   - return results;
823   - };
824   -}
825   -
826   -Array.from = $A;
827   -
828   -Object.extend(Array.prototype, Enumerable);
829   -
830   -if (!Array.prototype._reverse) Array.prototype._reverse = Array.prototype.reverse;
831   -
832   -Object.extend(Array.prototype, {
833   - _each: function(iterator) {
834   - for (var i = 0, length = this.length; i < length; i++)
835   - iterator(this[i]);
836   - },
837   -
838   - clear: function() {
839   - this.length = 0;
840   - return this;
841   - },
842   -
843   - first: function() {
844   - return this[0];
845   - },
846   -
847   - last: function() {
848   - return this[this.length - 1];
849   - },
850   -
851   - compact: function() {
852   - return this.select(function(value) {
853   - return value != null;
854   - });
855   - },
856   -
857   - flatten: function() {
858   - return this.inject([], function(array, value) {
859   - return array.concat(Object.isArray(value) ?
860   - value.flatten() : [value]);
861   - });
862   - },
863   -
864   - without: function() {
865   - var values = $A(arguments);
866   - return this.select(function(value) {
867   - return !values.include(value);
868   - });
869   - },
870   -
871   - reverse: function(inline) {
872   - return (inline !== false ? this : this.toArray())._reverse();
873   - },
874   -
875   - reduce: function() {
876   - return this.length > 1 ? this : this[0];
877   - },
878   -
879   - uniq: function(sorted) {
880   - return this.inject([], function(array, value, index) {
881   - if (0 == index || (sorted ? array.last() != value : !array.include(value)))
882   - array.push(value);
883   - return array;
884   - });
885   - },
886   -
887   - intersect: function(array) {
888   - return this.uniq().findAll(function(item) {
889   - return array.detect(function(value) { return item === value });
890   - });
891   - },
892   -
893   - clone: function() {
894   - return [].concat(this);
895   - },
896   -
897   - size: function() {
898   - return this.length;
899   - },
900   -
901   - inspect: function() {
902   - return '[' + this.map(Object.inspect).join(', ') + ']';
903   - },
904   -
905   - toJSON: function() {
906   - var results = [];
907   - this.each(function(object) {
908   - var value = Object.toJSON(object);
909   - if (!Object.isUndefined(value)) results.push(value);
910   - });
911   - return '[' + results.join(', ') + ']';
912   - }
913   -});
914   -
915   -// use native browser JS 1.6 implementation if available
916   -if (Object.isFunction(Array.prototype.forEach))
917   - Array.prototype._each = Array.prototype.forEach;
918   -
919   -if (!Array.prototype.indexOf) Array.prototype.indexOf = function(item, i) {
920   - i || (i = 0);
921   - var length = this.length;
922   - if (i < 0) i = length + i;
923   - for (; i < length; i++)
924   - if (this[i] === item) return i;
925   - return -1;
926   -};
927   -
928   -if (!Array.prototype.lastIndexOf) Array.prototype.lastIndexOf = function(item, i) {
929   - i = isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1;
930   - var n = this.slice(0, i).reverse().indexOf(item);
931   - return (n < 0) ? n : i - n - 1;
932   -};
933   -
934   -Array.prototype.toArray = Array.prototype.clone;
935   -
936   -function $w(string) {
937   - if (!Object.isString(string)) return [];
938   - string = string.strip();
939   - return string ? string.split(/\s+/) : [];
940   -}
941   -
942   -if (Prototype.Browser.Opera){
943   - Array.prototype.concat = function() {
944   - var array = [];
945   - for (var i = 0, length = this.length; i < length; i++) array.push(this[i]);
946   - for (var i = 0, length = arguments.length; i < length; i++) {
947   - if (Object.isArray(arguments[i])) {
948   - for (var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++)
949   - array.push(arguments[i][j]);
950   - } else {
951   - array.push(arguments[i]);
952   - }
953   - }
954   - return array;
955   - };
956   -}
957   -Object.extend(Number.prototype, {
958   - toColorPart: function() {
959   - return this.toPaddedString(2, 16);
960   - },
961   -
962   - succ: function() {
963   - return this + 1;
964   - },
965   -
966   - times: function(iterator) {
967   - $R(0, this, true).each(iterator);
968   - return this;
969   - },
970   -
971   - toPaddedString: function(length, radix) {
972   - var string = this.toString(radix || 10);
973   - return '0'.times(length - string.length) + string;
974   - },
975   -
976   - toJSON: function() {
977   - return isFinite(this) ? this.toString() : 'null';
978   - }
979   -});
980   -
981   -$w('abs round ceil floor').each(function(method){
982   - Number.prototype[method] = Math[method].methodize();
983   -});
984   -function $H(object) {
985   - return new Hash(object);
986   -};
987   -
988   -var Hash = Class.create(Enumerable, (function() {
989   -
990   - function toQueryPair(key, value) {
991   - if (Object.isUndefined(value)) return key;
992   - return key + '=' + encodeURIComponent(String.interpret(value));
993   - }
994   -
995   - return {
996   - initialize: function(object) {
997   - this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
998   - },
999   -
1000   - _each: function(iterator) {
1001   - for (var key in this._object) {
1002   - var value = this._object[key], pair = [key, value];
1003   - pair.key = key;
1004   - pair.value = value;
1005   - iterator(pair);
1006   - }
1007   - },
1008   -
1009   - set: function(key, value) {
1010   - return this._object[key] = value;
1011   - },
1012   -
1013   - get: function(key) {
1014   - return this._object[key];
1015   - },
1016   -
1017   - unset: function(key) {
1018   - var value = this._object[key];
1019   - delete this._object[key];
1020   - return value;
1021   - },
1022   -
1023   - toObject: function() {
1024   - return Object.clone(this._object);
1025   - },
1026   -
1027   - keys: function() {
1028   - return this.pluck('key');
1029   - },
1030   -
1031   - values: function() {
1032   - return this.pluck('value');
1033   - },
1034   -
1035   - index: function(value) {
1036   - var match = this.detect(function(pair) {
1037   - return pair.value === value;
1038   - });
1039   - return match && match.key;
1040   - },
1041   -
1042   - merge: function(object) {
1043   - return this.clone().update(object);
1044   - },
1045   -
1046   - update: function(object) {
1047   - return new Hash(object).inject(this, function(result, pair) {
1048   - result.set(pair.key, pair.value);
1049   - return result;
1050   - });
1051   - },
1052   -
1053   - toQueryString: function() {
1054   - return this.map(function(pair) {
1055   - var key = encodeURIComponent(pair.key), values = pair.value;
1056   -
1057   - if (values && typeof values == 'object') {
1058   - if (Object.isArray(values))
1059   - return values.map(toQueryPair.curry(key)).join('&');
1060   - }
1061   - return toQueryPair(key, values);
1062   - }).join('&');
1063   - },
1064   -
1065   - inspect: function() {
1066   - return '#<Hash:{' + this.map(function(pair) {
1067   - return pair.map(Object.inspect).join(': ');
1068   - }).join(', ') + '}>';
1069   - },
1070   -
1071   - toJSON: function() {
1072   - return Object.toJSON(this.toObject());
1073   - },
1074   -
1075   - clone: function() {
1076   - return new Hash(this);
1077   - }
1078   - }
1079   -})());
1080   -
1081   -Hash.prototype.toTemplateReplacements = Hash.prototype.toObject;
1082   -Hash.from = $H;
1083   -var ObjectRange = Class.create(Enumerable, {
1084   - initialize: function(start, end, exclusive) {
1085   - this.start = start;
1086   - this.end = end;
1087   - this.exclusive = exclusive;
1088   - },
1089   -
1090   - _each: function(iterator) {
1091   - var value = this.start;
1092   - while (this.include(value)) {
1093   - iterator(value);
1094   - value = value.succ();
1095   - }
1096   - },
1097   -
1098   - include: function(value) {
1099   - if (value < this.start)
1100   - return false;
1101   - if (this.exclusive)
1102   - return value < this.end;
1103   - return value <= this.end;
1104   - }
1105   -});
1106   -
1107   -var $R = function(start, end, exclusive) {
1108   - return new ObjectRange(start, end, exclusive);
1109   -};
1110   -
1111   -var Ajax = {
1112   - getTransport: function() {
1113   - return Try.these(
1114   - function() {return new XMLHttpRequest()},
1115   - function() {return new ActiveXObject('Msxml2.XMLHTTP')},
1116   - function() {return new ActiveXObject('Microsoft.XMLHTTP')}
1117   - ) || false;
1118   - },
1119   -
1120   - activeRequestCount: 0
1121   -};
1122   -
1123   -Ajax.Responders = {
1124   - responders: [],
1125   -
1126   - _each: function(iterator) {
1127   - this.responders._each(iterator);
1128   - },
1129   -
1130   - register: function(responder) {
1131   - if (!this.include(responder))
1132   - this.responders.push(responder);
1133   - },
1134   -
1135   - unregister: function(responder) {
1136   - this.responders = this.responders.without(responder);
1137   - },
1138   -
1139   - dispatch: function(callback, request, transport, json) {
1140   - this.each(function(responder) {
1141   - if (Object.isFunction(responder[callback])) {
1142   - try {
1143   - responder[callback].apply(responder, [request, transport, json]);
1144   - } catch (e) { }
1145   - }
1146   - });
1147   - }
1148   -};
1149   -
1150   -Object.extend(Ajax.Responders, Enumerable);
1151   -
1152   -Ajax.Responders.register({
1153   - onCreate: function() { Ajax.activeRequestCount++ },
1154   - onComplete: function() { Ajax.activeRequestCount-- }
1155   -});
1156   -
1157   -Ajax.Base = Class.create({
1158   - initialize: function(options) {
1159   - this.options = {
1160   - method: 'post',
1161   - asynchronous: true,
1162   - contentType: 'application/x-www-form-urlencoded',
1163   - encoding: 'UTF-8',
1164   - parameters: '',
1165   - evalJSON: true,
1166   - evalJS: true
1167   - };
1168   - Object.extend(this.options, options || { });
1169   -
1170   - this.options.method = this.options.method.toLowerCase();
1171   -
1172   - if (Object.isString(this.options.parameters))
1173   - this.options.parameters = this.options.parameters.toQueryParams();
1174   - else if (Object.isHash(this.options.parameters))
1175   - this.options.parameters = this.options.parameters.toObject();
1176   - }
1177   -});
1178   -
1179   -Ajax.Request = Class.create(Ajax.Base, {
1180   - _complete: false,
1181   -
1182   - initialize: function($super, url, options) {
1183   - $super(options);
1184   - this.transport = Ajax.getTransport();
1185   - this.request(url);
1186   - },
1187   -
1188   - request: function(url) {
1189   - this.url = url;
1190   - this.method = this.options.method;
1191   - var params = Object.clone(this.options.parameters);
1192   -
1193   - if (!['get', 'post'].include(this.method)) {
1194   - // simulate other verbs over post
1195   - params['_method'] = this.method;
1196   - this.method = 'post';
1197   - }
1198   -
1199   - this.parameters = params;
1200   -
1201   - if (params = Object.toQueryString(params)) {
1202   - // when GET, append parameters to URL
1203   - if (this.method == 'get')
1204   - this.url += (this.url.include('?') ? '&' : '?') + params;
1205   - else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent))
1206   - params += '&_=';
1207   - }
1208   -
1209   - try {
1210   - var response = new Ajax.Response(this);
1211   - if (this.options.onCreate) this.options.onCreate(response);
1212   - Ajax.Responders.dispatch('onCreate', this, response);
1213   -
1214   - this.transport.open(this.method.toUpperCase(), this.url,
1215   - this.options.asynchronous);
1216   -
1217   - if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1);
1218   -
1219   - this.transport.onreadystatechange = this.onStateChange.bind(this);
1220   - this.setRequestHeaders();
1221   -
1222   - this.body = this.method == 'post' ? (this.options.postBody || params) : null;
1223   - this.transport.send(this.body);
1224   -
1225   - /* Force Firefox to handle ready state 4 for synchronous requests */
1226   - if (!this.options.asynchronous && this.transport.overrideMimeType)
1227   - this.onStateChange();
1228   -
1229   - }
1230   - catch (e) {
1231   - this.dispatchException(e);
1232   - }
1233   - },
1234   -
1235   - onStateChange: function() {
1236   - var readyState = this.transport.readyState;
1237   - if (readyState > 1 && !((readyState == 4) && this._complete))
1238   - this.respondToReadyState(this.transport.readyState);
1239   - },
1240   -
1241   - setRequestHeaders: function() {
1242   - var headers = {
1243   - 'X-Requested-With': 'XMLHttpRequest',
1244   - 'X-Prototype-Version': Prototype.Version,
1245   - 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
1246   - };
1247   -
1248   - if (this.method == 'post') {
1249   - headers['Content-type'] = this.options.contentType +
1250   - (this.options.encoding ? '; charset=' + this.options.encoding : '');
1251   -
1252   - /* Force "Connection: close" for older Mozilla browsers to work
1253   - * around a bug where XMLHttpRequest sends an incorrect
1254   - * Content-length header. See Mozilla Bugzilla #246651.
1255   - */
1256   - if (this.transport.overrideMimeType &&
1257   - (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
1258   - headers['Connection'] = 'close';
1259   - }
1260   -
1261   - // user-defined headers
1262   - if (typeof this.options.requestHeaders == 'object') {
1263   - var extras = this.options.requestHeaders;
1264   -
1265   - if (Object.isFunction(extras.push))
1266   - for (var i = 0, length = extras.length; i < length; i += 2)
1267   - headers[extras[i]] = extras[i+1];
1268   - else
1269   - $H(extras).each(function(pair) { headers[pair.key] = pair.value });
1270   - }
1271   -
1272   - for (var name in headers)
1273   - this.transport.setRequestHeader(name, headers[name]);
1274   - },
1275   -
1276   - success: function() {
1277   - var status = this.getStatus();
1278   - return !status || (status >= 200 && status < 300);
1279   - },
1280   -
1281   - getStatus: function() {
1282   - try {
1283   - return this.transport.status || 0;
1284   - } catch (e) { return 0 }
1285   - },
1286   -
1287   - respondToReadyState: function(readyState) {
1288   - var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this);
1289   -
1290   - if (state == 'Complete') {
1291   - try {
1292   - this._complete = true;
1293   - (this.options['on' + response.status]
1294   - || this.options['on' + (this.success() ? 'Success' : 'Failure')]
1295   - || Prototype.emptyFunction)(response, response.headerJSON);
1296   - } catch (e) {
1297   - this.dispatchException(e);
1298   - }
1299   -
1300   - var contentType = response.getHeader('Content-type');
1301   - if (this.options.evalJS == 'force'
1302   - || (this.options.evalJS && this.isSameOrigin() && contentType
1303   - && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)))
1304   - this.evalResponse();
1305   - }
1306   -
1307   - try {
1308   - (this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON);
1309   - Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON);
1310   - } catch (e) {
1311   - this.dispatchException(e);
1312   - }
1313   -
1314   - if (state == 'Complete') {
1315   - // avoid memory leak in MSIE: clean up
1316   - this.transport.onreadystatechange = Prototype.emptyFunction;
1317   - }
1318   - },
1319   -
1320   - isSameOrigin: function() {
1321   - var m = this.url.match(/^\s*https?:\/\/[^\/]*/);
1322   - return !m || (m[0] == '#{protocol}//#{domain}#{port}'.interpolate({
1323   - protocol: location.protocol,
1324   - domain: document.domain,
1325   - port: location.port ? ':' + location.port : ''
1326   - }));
1327   - },
1328   -
1329   - getHeader: function(name) {
1330   - try {
1331   - return this.transport.getResponseHeader(name) || null;
1332   - } catch (e) { return null }
1333   - },
1334   -
1335   - evalResponse: function() {
1336   - try {
1337   - return eval((this.transport.responseText || '').unfilterJSON());
1338   - } catch (e) {
1339   - this.dispatchException(e);
1340   - }
1341   - },
1342   -
1343   - dispatchException: function(exception) {
1344   - (this.options.onException || Prototype.emptyFunction)(this, exception);
1345   - Ajax.Responders.dispatch('onException', this, exception);
1346   - }
1347   -});
1348   -
1349   -Ajax.Request.Events =
1350   - ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
1351   -
1352   -Ajax.Response = Class.create({
1353   - initialize: function(request){
1354   - this.request = request;
1355   - var transport = this.transport = request.transport,
1356   - readyState = this.readyState = transport.readyState;
1357   -
1358   - if((readyState > 2 && !Prototype.Browser.IE) || readyState == 4) {
1359   - this.status = this.getStatus();
1360   - this.statusText = this.getStatusText();
1361   - this.responseText = String.interpret(transport.responseText);
1362   - this.headerJSON = this._getHeaderJSON();
1363   - }
1364   -
1365   - if(readyState == 4) {
1366   - var xml = transport.responseXML;
1367   - this.responseXML = Object.isUndefined(xml) ? null : xml;
1368   - this.responseJSON = this._getResponseJSON();
1369   - }
1370   - },
1371   -
1372   - status: 0,
1373   - statusText: '',
1374   -
1375   - getStatus: Ajax.Request.prototype.getStatus,
1376   -
1377   - getStatusText: function() {
1378   - try {
1379   - return this.transport.statusText || '';
1380   - } catch (e) { return '' }
1381   - },
1382   -
1383   - getHeader: Ajax.Request.prototype.getHeader,
1384   -
1385   - getAllHeaders: function() {
1386   - try {
1387   - return this.getAllResponseHeaders();
1388   - } catch (e) { return null }
1389   - },
1390   -
1391   - getResponseHeader: function(name) {
1392   - return this.transport.getResponseHeader(name);
1393   - },
1394   -
1395   - getAllResponseHeaders: function() {
1396   - return this.transport.getAllResponseHeaders();
1397   - },
1398   -
1399   - _getHeaderJSON: function() {
1400   - var json = this.getHeader('X-JSON');
1401   - if (!json) return null;
1402   - json = decodeURIComponent(escape(json));
1403   - try {
1404   - return json.evalJSON(this.request.options.sanitizeJSON ||
1405   - !this.request.isSameOrigin());
1406   - } catch (e) {
1407   - this.request.dispatchException(e);
1408   - }
1409   - },
1410   -
1411   - _getResponseJSON: function() {
1412   - var options = this.request.options;
1413   - if (!options.evalJSON || (options.evalJSON != 'force' &&
1414   - !(this.getHeader('Content-type') || '').include('application/json')) ||
1415   - this.responseText.blank())
1416   - return null;
1417   - try {
1418   - return this.responseText.evalJSON(options.sanitizeJSON ||
1419   - !this.request.isSameOrigin());
1420   - } catch (e) {
1421   - this.request.dispatchException(e);
1422   - }
1423   - }
1424   -});
1425   -
1426   -Ajax.Updater = Class.create(Ajax.Request, {
1427   - initialize: function($super, container, url, options) {
1428   - this.container = {
1429   - success: (container.success || container),
1430   - failure: (container.failure || (container.success ? null : container))
1431   - };
1432   -
1433   - options = Object.clone(options);
1434   - var onComplete = options.onComplete;
1435   - options.onComplete = (function(response, json) {
1436   - this.updateContent(response.responseText);
1437   - if (Object.isFunction(onComplete)) onComplete(response, json);
1438   - }).bind(this);
1439   -
1440   - $super(url, options);
1441   - },
1442   -
1443   - updateContent: function(responseText) {
1444   - var receiver = this.container[this.success() ? 'success' : 'failure'],
1445   - options = this.options;
1446   -
1447   - if (!options.evalScripts) responseText = responseText.stripScripts();
1448   -
1449   - if (receiver = $(receiver)) {
1450   - if (options.insertion) {
1451   - if (Object.isString(options.insertion)) {
1452   - var insertion = { }; insertion[options.insertion] = responseText;
1453   - receiver.insert(insertion);
1454   - }
1455   - else options.insertion(receiver, responseText);
1456   - }
1457   - else receiver.update(responseText);
1458   - }
1459   - }
1460   -});
1461   -
1462   -Ajax.PeriodicalUpdater = Class.create(Ajax.Base, {
1463   - initialize: function($super, container, url, options) {
1464   - $super(options);
1465   - this.onComplete = this.options.onComplete;
1466   -
1467   - this.frequency = (this.options.frequency || 2);
1468   - this.decay = (this.options.decay || 1);
1469   -
1470   - this.updater = { };
1471   - this.container = container;
1472   - this.url = url;
1473   -
1474   - this.start();
1475   - },
1476   -
1477   - start: function() {
1478   - this.options.onComplete = this.updateComplete.bind(this);
1479   - this.onTimerEvent();
1480   - },
1481   -
1482   - stop: function() {
1483   - this.updater.options.onComplete = undefined;
1484   - clearTimeout(this.timer);
1485   - (this.onComplete || Prototype.emptyFunction).apply(this, arguments);
1486   - },
1487   -
1488   - updateComplete: function(response) {
1489   - if (this.options.decay) {
1490   - this.decay = (response.responseText == this.lastText ?
1491   - this.decay * this.options.decay : 1);
1492   -
1493   - this.lastText = response.responseText;
1494   - }
1495   - this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency);
1496   - },
1497   -
1498   - onTimerEvent: function() {
1499   - this.updater = new Ajax.Updater(this.container, this.url, this.options);
1500   - }
1501   -});
1502   -function $(element) {
1503   - if (arguments.length > 1) {
1504   - for (var i = 0, elements = [], length = arguments.length; i < length; i++)
1505   - elements.push($(arguments[i]));
1506   - return elements;
1507   - }
1508   - if (Object.isString(element))
1509   - element = document.getElementById(element);
1510   - return Element.extend(element);
1511   -}
1512   -
1513   -if (Prototype.BrowserFeatures.XPath) {
1514   - document._getElementsByXPath = function(expression, parentElement) {
1515   - var results = [];
1516   - var query = document.evaluate(expression, $(parentElement) || document,
1517   - null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
1518   - for (var i = 0, length = query.snapshotLength; i < length; i++)
1519   - results.push(Element.extend(query.snapshotItem(i)));
1520   - return results;
1521   - };
1522   -}
1523   -
1524   -/*--------------------------------------------------------------------------*/
1525   -
1526   -if (!window.Node) var Node = { };
1527   -
1528   -if (!Node.ELEMENT_NODE) {
1529   - // DOM level 2 ECMAScript Language Binding
1530   - Object.extend(Node, {
1531   - ELEMENT_NODE: 1,
1532   - ATTRIBUTE_NODE: 2,
1533   - TEXT_NODE: 3,
1534   - CDATA_SECTION_NODE: 4,
1535   - ENTITY_REFERENCE_NODE: 5,
1536   - ENTITY_NODE: 6,
1537   - PROCESSING_INSTRUCTION_NODE: 7,
1538   - COMMENT_NODE: 8,
1539   - DOCUMENT_NODE: 9,
1540   - DOCUMENT_TYPE_NODE: 10,
1541   - DOCUMENT_FRAGMENT_NODE: 11,
1542   - NOTATION_NODE: 12
1543   - });
1544   -}
1545   -
1546   -(function() {
1547   - var element = this.Element;
1548   - this.Element = function(tagName, attributes) {
1549   - attributes = attributes || { };
1550   - tagName = tagName.toLowerCase();
1551   - var cache = Element.cache;
1552   - if (Prototype.Browser.IE && attributes.name) {
1553   - tagName = '<' + tagName + ' name="' + attributes.name + '">';
1554   - delete attributes.name;
1555   - return Element.writeAttribute(document.createElement(tagName), attributes);
1556   - }
1557   - if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName));
1558   - return Element.writeAttribute(cache[tagName].cloneNode(false), attributes);
1559   - };
1560   - Object.extend(this.Element, element || { });
1561   -}).call(window);
1562   -
1563   -Element.cache = { };
1564   -
1565   -Element.Methods = {
1566   - visible: function(element) {
1567   - return $(element).style.display != 'none';
1568   - },
1569   -
1570   - toggle: function(element) {
1571   - element = $(element);
1572   - Element[Element.visible(element) ? 'hide' : 'show'](element);
1573   - return element;
1574   - },
1575   -
1576   - hide: function(element) {
1577   - $(element).style.display = 'none';
1578   - return element;
1579   - },
1580   -
1581   - show: function(element) {
1582   - $(element).style.display = '';
1583   - return element;
1584   - },
1585   -
1586   - remove: function(element) {
1587   - element = $(element);
1588   - element.parentNode.removeChild(element);
1589   - return element;
1590   - },
1591   -
1592   - update: function(element, content) {
1593   - element = $(element);
1594   - if (content && content.toElement) content = content.toElement();
1595   - if (Object.isElement(content)) return element.update().insert(content);
1596   - content = Object.toHTML(content);
1597   - element.innerHTML = content.stripScripts();
1598   - content.evalScripts.bind(content).defer();
1599   - return element;
1600   - },
1601   -
1602   - replace: function(element, content) {
1603   - element = $(element);
1604   - if (content && content.toElement) content = content.toElement();
1605   - else if (!Object.isElement(content)) {
1606   - content = Object.toHTML(content);
1607   - var range = element.ownerDocument.createRange();
1608   - range.selectNode(element);
1609   - content.evalScripts.bind(content).defer();
1610   - content = range.createContextualFragment(content.stripScripts());
1611   - }
1612   - element.parentNode.replaceChild(content, element);
1613   - return element;
1614   - },
1615   -
1616   - insert: function(element, insertions) {
1617   - element = $(element);
1618   -
1619   - if (Object.isString(insertions) || Object.isNumber(insertions) ||
1620   - Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML)))
1621   - insertions = {bottom:insertions};
1622   -
1623   - var content, insert, tagName, childNodes;
1624   -
1625   - for (var position in insertions) {
1626   - content = insertions[position];
1627   - position = position.toLowerCase();
1628   - insert = Element._insertionTranslations[position];
1629   -
1630   - if (content && content.toElement) content = content.toElement();
1631   - if (Object.isElement(content)) {
1632   - insert(element, content);
1633   - continue;
1634   - }
1635   -
1636   - content = Object.toHTML(content);
1637   -
1638   - tagName = ((position == 'before' || position == 'after')
1639   - ? element.parentNode : element).tagName.toUpperCase();
1640   -
1641   - childNodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
1642   -
1643   - if (position == 'top' || position == 'after') childNodes.reverse();
1644   - childNodes.each(insert.curry(element));
1645   -
1646   - content.evalScripts.bind(content).defer();
1647   - }
1648   -
1649   - return element;
1650   - },
1651   -
1652   - wrap: function(element, wrapper, attributes) {
1653   - element = $(element);
1654   - if (Object.isElement(wrapper))
1655   - $(wrapper).writeAttribute(attributes || { });
1656   - else if (Object.isString(wrapper)) wrapper = new Element(wrapper, attributes);
1657   - else wrapper = new Element('div', wrapper);
1658   - if (element.parentNode)
1659   - element.parentNode.replaceChild(wrapper, element);
1660   - wrapper.appendChild(element);
1661   - return wrapper;
1662   - },
1663   -
1664   - inspect: function(element) {
1665   - element = $(element);
1666   - var result = '<' + element.tagName.toLowerCase();
1667   - $H({'id': 'id', 'className': 'class'}).each(function(pair) {
1668   - var property = pair.first(), attribute = pair.last();
1669   - var value = (element[property] || '').toString();
1670   - if (value) result += ' ' + attribute + '=' + value.inspect(true);
1671   - });
1672   - return result + '>';
1673   - },
1674   -
1675   - recursivelyCollect: function(element, property) {
1676   - element = $(element);
1677   - var elements = [];
1678   - while (element = element[property])
1679   - if (element.nodeType == 1)
1680   - elements.push(Element.extend(element));
1681   - return elements;
1682   - },
1683   -
1684   - ancestors: function(element) {
1685   - return $(element).recursivelyCollect('parentNode');
1686   - },
1687   -
1688   - descendants: function(element) {
1689   - return $(element).select("*");
1690   - },
1691   -
1692   - firstDescendant: function(element) {
1693   - element = $(element).firstChild;
1694   - while (element && element.nodeType != 1) element = element.nextSibling;
1695   - return $(element);
1696   - },
1697   -
1698   - immediateDescendants: function(element) {
1699   - if (!(element = $(element).firstChild)) return [];
1700   - while (element && element.nodeType != 1) element = element.nextSibling;
1701   - if (element) return [element].concat($(element).nextSiblings());
1702   - return [];
1703   - },
1704   -
1705   - previousSiblings: function(element) {
1706   - return $(element).recursivelyCollect('previousSibling');
1707   - },
1708   -
1709   - nextSiblings: function(element) {
1710   - return $(element).recursivelyCollect('nextSibling');
1711   - },
1712   -
1713   - siblings: function(element) {
1714   - element = $(element);
1715   - return element.previousSiblings().reverse().concat(element.nextSiblings());
1716   - },
1717   -
1718   - match: function(element, selector) {
1719   - if (Object.isString(selector))
1720   - selector = new Selector(selector);
1721   - return selector.match($(element));
1722   - },
1723   -
1724   - up: function(element, expression, index) {
1725   - element = $(element);
1726   - if (arguments.length == 1) return $(element.parentNode);
1727   - var ancestors = element.ancestors();
1728   - return Object.isNumber(expression) ? ancestors[expression] :
1729   - Selector.findElement(ancestors, expression, index);
1730   - },
1731   -
1732   - down: function(element, expression, index) {
1733   - element = $(element);
1734   - if (arguments.length == 1) return element.firstDescendant();
1735   - return Object.isNumber(expression) ? element.descendants()[expression] :
1736   - element.select(expression)[index || 0];
1737   - },
1738   -
1739   - previous: function(element, expression, index) {
1740   - element = $(element);
1741   - if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element));
1742   - var previousSiblings = element.previousSiblings();
1743   - return Object.isNumber(expression) ? previousSiblings[expression] :
1744   - Selector.findElement(previousSiblings, expression, index);
1745   - },
1746   -
1747   - next: function(element, expression, index) {
1748   - element = $(element);
1749   - if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element));
1750   - var nextSiblings = element.nextSiblings();
1751   - return Object.isNumber(expression) ? nextSiblings[expression] :
1752   - Selector.findElement(nextSiblings, expression, index);
1753   - },
1754   -
1755   - select: function() {
1756   - var args = $A(arguments), element = $(args.shift());
1757   - return Selector.findChildElements(element, args);
1758   - },
1759   -
1760   - adjacent: function() {
1761   - var args = $A(arguments), element = $(args.shift());
1762   - return Selector.findChildElements(element.parentNode, args).without(element);
1763   - },
1764   -
1765   - identify: function(element) {
1766   - element = $(element);
1767   - var id = element.readAttribute('id'), self = arguments.callee;
1768   - if (id) return id;
1769   - do { id = 'anonymous_element_' + self.counter++ } while ($(id));
1770   - element.writeAttribute('id', id);
1771   - return id;
1772   - },
1773   -
1774   - readAttribute: function(element, name) {
1775   - element = $(element);
1776   - if (Prototype.Browser.IE) {
1777   - var t = Element._attributeTranslations.read;
1778   - if (t.values[name]) return t.values[name](element, name);
1779   - if (t.names[name]) name = t.names[name];
1780   - if (name.include(':')) {
1781   - return (!element.attributes || !element.attributes[name]) ? null :
1782   - element.attributes[name].value;
1783   - }
1784   - }
1785   - return element.getAttribute(name);
1786   - },
1787   -
1788   - writeAttribute: function(element, name, value) {
1789   - element = $(element);
1790   - var attributes = { }, t = Element._attributeTranslations.write;
1791   -
1792   - if (typeof name == 'object') attributes = name;
1793   - else attributes[name] = Object.isUndefined(value) ? true : value;
1794   -
1795   - for (var attr in attributes) {
1796   - name = t.names[attr] || attr;
1797   - value = attributes[attr];
1798   - if (t.values[attr]) name = t.values[attr](element, value);
1799   - if (value === false || value === null)
1800   - element.removeAttribute(name);
1801   - else if (value === true)
1802   - element.setAttribute(name, name);
1803   - else element.setAttribute(name, value);
1804   - }
1805   - return element;
1806   - },
1807   -
1808   - getHeight: function(element) {
1809   - return $(element).getDimensions().height;
1810   - },
1811   -
1812   - getWidth: function(element) {
1813   - return $(element).getDimensions().width;
1814   - },
1815   -
1816   - classNames: function(element) {
1817   - return new Element.ClassNames(element);
1818   - },
1819   -
1820   - hasClassName: function(element, className) {
1821   - if (!(element = $(element))) return;
1822   - var elementClassName = element.className;
1823   - return (elementClassName.length > 0 && (elementClassName == className ||
1824   - new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName)));
1825   - },
1826   -
1827   - addClassName: function(element, className) {
1828   - if (!(element = $(element))) return;
1829   - if (!element.hasClassName(className))
1830   - element.className += (element.className ? ' ' : '') + className;
1831   - return element;
1832   - },
1833   -
1834   - removeClassName: function(element, className) {
1835   - if (!(element = $(element))) return;
1836   - element.className = element.className.replace(
1837   - new RegExp("(^|\\s+)" + className + "(\\s+|$)"), ' ').strip();
1838   - return element;
1839   - },
1840   -
1841   - toggleClassName: function(element, className) {
1842   - if (!(element = $(element))) return;
1843   - return element[element.hasClassName(className) ?
1844   - 'removeClassName' : 'addClassName'](className);
1845   - },
1846   -
1847   - // removes whitespace-only text node children
1848   - cleanWhitespace: function(element) {
1849   - element = $(element);
1850   - var node = element.firstChild;
1851   - while (node) {
1852   - var nextNode = node.nextSibling;
1853   - if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
1854   - element.removeChild(node);
1855   - node = nextNode;
1856   - }
1857   - return element;
1858   - },
1859   -
1860   - empty: function(element) {
1861   - return $(element).innerHTML.blank();
1862   - },
1863   -
1864   - descendantOf: function(element, ancestor) {
1865   - element = $(element), ancestor = $(ancestor);
1866   - var originalAncestor = ancestor;
1867   -
1868   - if (element.compareDocumentPosition)
1869   - return (element.compareDocumentPosition(ancestor) & 8) === 8;
1870   -
1871   - if (element.sourceIndex && !Prototype.Browser.Opera) {
1872   - var e = element.sourceIndex, a = ancestor.sourceIndex,
1873   - nextAncestor = ancestor.nextSibling;
1874   - if (!nextAncestor) {
1875   - do { ancestor = ancestor.parentNode; }
1876   - while (!(nextAncestor = ancestor.nextSibling) && ancestor.parentNode);
1877   - }
1878   - if (nextAncestor && nextAncestor.sourceIndex)
1879   - return (e > a && e < nextAncestor.sourceIndex);
1880   - }
1881   -
1882   - while (element = element.parentNode)
1883   - if (element == originalAncestor) return true;
1884   - return false;
1885   - },
1886   -
1887   - scrollTo: function(element) {
1888   - element = $(element);
1889   - var pos = element.cumulativeOffset();
1890   - window.scrollTo(pos[0], pos[1]);
1891   - return element;
1892   - },
1893   -
1894   - getStyle: function(element, style) {
1895   - element = $(element);
1896   - style = style == 'float' ? 'cssFloat' : style.camelize();
1897   - var value = element.style[style];
1898   - if (!value) {
1899   - var css = document.defaultView.getComputedStyle(element, null);
1900   - value = css ? css[style] : null;
1901   - }
1902   - if (style == 'opacity') return value ? parseFloat(value) : 1.0;
1903   - return value == 'auto' ? null : value;
1904   - },
1905   -
1906   - getOpacity: function(element) {
1907   - return $(element).getStyle('opacity');
1908   - },
1909   -
1910   - setStyle: function(element, styles) {
1911   - element = $(element);
1912   - var elementStyle = element.style, match;
1913   - if (Object.isString(styles)) {
1914   - element.style.cssText += ';' + styles;
1915   - return styles.include('opacity') ?
1916   - element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element;
1917   - }
1918   - for (var property in styles)
1919   - if (property == 'opacity') element.setOpacity(styles[property]);
1920   - else
1921   - elementStyle[(property == 'float' || property == 'cssFloat') ?
1922   - (Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') :
1923   - property] = styles[property];
1924   -
1925   - return element;
1926   - },
1927   -
1928   - setOpacity: function(element, value) {
1929   - element = $(element);
1930   - element.style.opacity = (value == 1 || value === '') ? '' :
1931   - (value < 0.00001) ? 0 : value;
1932   - return element;
1933   - },
1934   -
1935   - getDimensions: function(element) {
1936   - element = $(element);
1937   - var display = $(element).getStyle('display');
1938   - if (display != 'none' && display != null) // Safari bug
1939   - return {width: element.offsetWidth, height: element.offsetHeight};
1940   -
1941   - // All *Width and *Height properties give 0 on elements with display none,
1942   - // so enable the element temporarily
1943   - var els = element.style;
1944   - var originalVisibility = els.visibility;
1945   - var originalPosition = els.position;
1946   - var originalDisplay = els.display;
1947   - els.visibility = 'hidden';
1948   - els.position = 'absolute';
1949   - els.display = 'block';
1950   - var originalWidth = element.clientWidth;
1951   - var originalHeight = element.clientHeight;
1952   - els.display = originalDisplay;
1953   - els.position = originalPosition;
1954   - els.visibility = originalVisibility;
1955   - return {width: originalWidth, height: originalHeight};
1956   - },
1957   -
1958   - makePositioned: function(element) {
1959   - element = $(element);
1960   - var pos = Element.getStyle(element, 'position');
1961   - if (pos == 'static' || !pos) {
1962   - element._madePositioned = true;
1963   - element.style.position = 'relative';
1964   - // Opera returns the offset relative to the positioning context, when an
1965   - // element is position relative but top and left have not been defined
1966   - if (window.opera) {
1967   - element.style.top = 0;
1968   - element.style.left = 0;
1969   - }
1970   - }
1971   - return element;
1972   - },
1973   -
1974   - undoPositioned: function(element) {
1975   - element = $(element);
1976   - if (element._madePositioned) {
1977   - element._madePositioned = undefined;
1978   - element.style.position =
1979   - element.style.top =
1980   - element.style.left =
1981   - element.style.bottom =
1982   - element.style.right = '';
1983   - }
1984   - return element;
1985   - },
1986   -
1987   - makeClipping: function(element) {
1988   - element = $(element);
1989   - if (element._overflow) return element;
1990   - element._overflow = Element.getStyle(element, 'overflow') || 'auto';
1991   - if (element._overflow !== 'hidden')
1992   - element.style.overflow = 'hidden';
1993   - return element;
1994   - },
1995   -
1996   - undoClipping: function(element) {
1997   - element = $(element);
1998   - if (!element._overflow) return element;
1999   - element.style.overflow = element._overflow == 'auto' ? '' : element._overflow;
2000   - element._overflow = null;
2001   - return element;
2002   - },
2003   -
2004   - cumulativeOffset: function(element) {
2005   - var valueT = 0, valueL = 0;
2006   - do {
2007   - valueT += element.offsetTop || 0;
2008   - valueL += element.offsetLeft || 0;
2009   - element = element.offsetParent;
2010   - } while (element);
2011   - return Element._returnOffset(valueL, valueT);
2012   - },
2013   -
2014   - positionedOffset: function(element) {
2015   - var valueT = 0, valueL = 0;
2016   - do {
2017   - valueT += element.offsetTop || 0;
2018   - valueL += element.offsetLeft || 0;
2019   - element = element.offsetParent;
2020   - if (element) {
2021   - if (element.tagName == 'BODY') break;
2022   - var p = Element.getStyle(element, 'position');
2023   - if (p !== 'static') break;
2024   - }
2025   - } while (element);
2026   - return Element._returnOffset(valueL, valueT);
2027   - },
2028   -
2029   - absolutize: function(element) {
2030   - element = $(element);
2031   - if (element.getStyle('position') == 'absolute') return;
2032   - // Position.prepare(); // To be done manually by Scripty when it needs it.
2033   -
2034   - var offsets = element.positionedOffset();
2035   - var top = offsets[1];
2036   - var left = offsets[0];
2037   - var width = element.clientWidth;
2038   - var height = element.clientHeight;
2039   -
2040   - element._originalLeft = left - parseFloat(element.style.left || 0);
2041   - element._originalTop = top - parseFloat(element.style.top || 0);
2042   - element._originalWidth = element.style.width;
2043   - element._originalHeight = element.style.height;
2044   -
2045   - element.style.position = 'absolute';
2046   - element.style.top = top + 'px';
2047   - element.style.left = left + 'px';
2048   - element.style.width = width + 'px';
2049   - element.style.height = height + 'px';
2050   - return element;
2051   - },
2052   -
2053   - relativize: function(element) {
2054   - element = $(element);
2055   - if (element.getStyle('position') == 'relative') return;
2056   - // Position.prepare(); // To be done manually by Scripty when it needs it.
2057   -
2058   - element.style.position = 'relative';
2059   - var top = parseFloat(element.style.top || 0) - (element._originalTop || 0);
2060   - var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);
2061   -
2062   - element.style.top = top + 'px';
2063   - element.style.left = left + 'px';
2064   - element.style.height = element._originalHeight;
2065   - element.style.width = element._originalWidth;
2066   - return element;
2067   - },
2068   -
2069   - cumulativeScrollOffset: function(element) {
2070   - var valueT = 0, valueL = 0;
2071   - do {
2072   - valueT += element.scrollTop || 0;
2073   - valueL += element.scrollLeft || 0;
2074   - element = element.parentNode;
2075   - } while (element);
2076   - return Element._returnOffset(valueL, valueT);
2077   - },
2078   -
2079   - getOffsetParent: function(element) {
2080   - if (element.offsetParent) return $(element.offsetParent);
2081   - if (element == document.body) return $(element);
2082   -
2083   - while ((element = element.parentNode) && element != document.body)
2084   - if (Element.getStyle(element, 'position') != 'static')
2085   - return $(element);
2086   -
2087   - return $(document.body);
2088   - },
2089   -
2090   - viewportOffset: function(forElement) {
2091   - var valueT = 0, valueL = 0;
2092   -
2093   - var element = forElement;
2094   - do {
2095   - valueT += element.offsetTop || 0;
2096   - valueL += element.offsetLeft || 0;
2097   -
2098   - // Safari fix
2099   - if (element.offsetParent == document.body &&
2100   - Element.getStyle(element, 'position') == 'absolute') break;
2101   -
2102   - } while (element = element.offsetParent);
2103   -
2104   - element = forElement;
2105   - do {
2106   - if (!Prototype.Browser.Opera || element.tagName == 'BODY') {
2107   - valueT -= element.scrollTop || 0;
2108   - valueL -= element.scrollLeft || 0;
2109   - }
2110   - } while (element = element.parentNode);
2111   -
2112   - return Element._returnOffset(valueL, valueT);
2113   - },
2114   -
2115   - clonePosition: function(element, source) {
2116   - var options = Object.extend({
2117   - setLeft: true,
2118   - setTop: true,
2119   - setWidth: true,
2120   - setHeight: true,
2121   - offsetTop: 0,
2122   - offsetLeft: 0
2123   - }, arguments[2] || { });
2124   -
2125   - // find page position of source
2126   - source = $(source);
2127   - var p = source.viewportOffset();
2128   -
2129   - // find coordinate system to use
2130   - element = $(element);
2131   - var delta = [0, 0];
2132   - var parent = null;
2133   - // delta [0,0] will do fine with position: fixed elements,
2134   - // position:absolute needs offsetParent deltas
2135   - if (Element.getStyle(element, 'position') == 'absolute') {
2136   - parent = element.getOffsetParent();
2137   - delta = parent.viewportOffset();
2138   - }
2139   -
2140   - // correct by body offsets (fixes Safari)
2141   - if (parent == document.body) {
2142   - delta[0] -= document.body.offsetLeft;
2143   - delta[1] -= document.body.offsetTop;
2144   - }
2145   -
2146   - // set position
2147   - if (options.setLeft) element.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px';
2148   - if (options.setTop) element.style.top = (p[1] - delta[1] + options.offsetTop) + 'px';
2149   - if (options.setWidth) element.style.width = source.offsetWidth + 'px';
2150   - if (options.setHeight) element.style.height = source.offsetHeight + 'px';
2151   - return element;
2152   - }
2153   -};
2154   -
2155   -Element.Methods.identify.counter = 1;
2156   -
2157   -Object.extend(Element.Methods, {
2158   - getElementsBySelector: Element.Methods.select,
2159   - childElements: Element.Methods.immediateDescendants
2160   -});
2161   -
2162   -Element._attributeTranslations = {
2163   - write: {
2164   - names: {
2165   - className: 'class',
2166   - htmlFor: 'for'
2167   - },
2168   - values: { }
2169   - }
2170   -};
2171   -
2172   -if (Prototype.Browser.Opera) {
2173   - Element.Methods.getStyle = Element.Methods.getStyle.wrap(
2174   - function(proceed, element, style) {
2175   - switch (style) {
2176   - case 'left': case 'top': case 'right': case 'bottom':
2177   - if (proceed(element, 'position') === 'static') return null;
2178   - case 'height': case 'width':
2179   - // returns '0px' for hidden elements; we want it to return null
2180   - if (!Element.visible(element)) return null;
2181   -
2182   - // returns the border-box dimensions rather than the content-box
2183   - // dimensions, so we subtract padding and borders from the value
2184   - var dim = parseInt(proceed(element, style), 10);
2185   -
2186   - if (dim !== element['offset' + style.capitalize()])
2187   - return dim + 'px';
2188   -
2189   - var properties;
2190   - if (style === 'height') {
2191   - properties = ['border-top-width', 'padding-top',
2192   - 'padding-bottom', 'border-bottom-width'];
2193   - }
2194   - else {
2195   - properties = ['border-left-width', 'padding-left',
2196   - 'padding-right', 'border-right-width'];
2197   - }
2198   - return properties.inject(dim, function(memo, property) {
2199   - var val = proceed(element, property);
2200   - return val === null ? memo : memo - parseInt(val, 10);
2201   - }) + 'px';
2202   - default: return proceed(element, style);
2203   - }
2204   - }
2205   - );
2206   -
2207   - Element.Methods.readAttribute = Element.Methods.readAttribute.wrap(
2208   - function(proceed, element, attribute) {
2209   - if (attribute === 'title') return element.title;
2210   - return proceed(element, attribute);
2211   - }
2212   - );
2213   -}
2214   -
2215   -else if (Prototype.Browser.IE) {
2216   - // IE doesn't report offsets correctly for static elements, so we change them
2217   - // to "relative" to get the values, then change them back.
2218   - Element.Methods.getOffsetParent = Element.Methods.getOffsetParent.wrap(
2219   - function(proceed, element) {
2220   - element = $(element);
2221   - var position = element.getStyle('position');
2222   - if (position !== 'static') return proceed(element);
2223   - element.setStyle({ position: 'relative' });
2224   - var value = proceed(element);
2225   - element.setStyle({ position: position });
2226   - return value;
2227   - }
2228   - );
2229   -
2230   - $w('positionedOffset viewportOffset').each(function(method) {
2231   - Element.Methods[method] = Element.Methods[method].wrap(
2232   - function(proceed, element) {
2233   - element = $(element);
2234   - var position = element.getStyle('position');
2235   - if (position !== 'static') return proceed(element);
2236   - // Trigger hasLayout on the offset parent so that IE6 reports
2237   - // accurate offsetTop and offsetLeft values for position: fixed.
2238   - var offsetParent = element.getOffsetParent();
2239   - if (offsetParent && offsetParent.getStyle('position') === 'fixed')
2240   - offsetParent.setStyle({ zoom: 1 });
2241   - element.setStyle({ position: 'relative' });
2242   - var value = proceed(element);
2243   - element.setStyle({ position: position });
2244   - return value;
2245   - }
2246   - );
2247   - });
2248   -
2249   - Element.Methods.getStyle = function(element, style) {
2250   - element = $(element);
2251   - style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize();
2252   - var value = element.style[style];
2253   - if (!value && element.currentStyle) value = element.currentStyle[style];
2254   -
2255   - if (style == 'opacity') {
2256   - if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/))
2257   - if (value[1]) return parseFloat(value[1]) / 100;
2258   - return 1.0;
2259   - }
2260   -
2261   - if (value == 'auto') {
2262   - if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none'))
2263   - return element['offset' + style.capitalize()] + 'px';
2264   - return null;
2265   - }
2266   - return value;
2267   - };
2268   -
2269   - Element.Methods.setOpacity = function(element, value) {
2270   - function stripAlpha(filter){
2271   - return filter.replace(/alpha\([^\)]*\)/gi,'');
2272   - }
2273   - element = $(element);
2274   - var currentStyle = element.currentStyle;
2275   - if ((currentStyle && !currentStyle.hasLayout) ||
2276   - (!currentStyle && element.style.zoom == 'normal'))
2277   - element.style.zoom = 1;
2278   -
2279   - var filter = element.getStyle('filter'), style = element.style;
2280   - if (value == 1 || value === '') {
2281   - (filter = stripAlpha(filter)) ?
2282   - style.filter = filter : style.removeAttribute('filter');
2283   - return element;
2284   - } else if (value < 0.00001) value = 0;
2285   - style.filter = stripAlpha(filter) +
2286   - 'alpha(opacity=' + (value * 100) + ')';
2287   - return element;
2288   - };
2289   -
2290   - Element._attributeTranslations = {
2291   - read: {
2292   - names: {
2293   - 'class': 'className',
2294   - 'for': 'htmlFor'
2295   - },
2296   - values: {
2297   - _getAttr: function(element, attribute) {
2298   - return element.getAttribute(attribute, 2);
2299   - },
2300   - _getAttrNode: function(element, attribute) {
2301   - var node = element.getAttributeNode(attribute);
2302   - return node ? node.value : "";
2303   - },
2304   - _getEv: function(element, attribute) {
2305   - attribute = element.getAttribute(attribute);
2306   - return attribute ? attribute.toString().slice(23, -2) : null;
2307   - },
2308   - _flag: function(element, attribute) {
2309   - return $(element).hasAttribute(attribute) ? attribute : null;
2310   - },
2311   - style: function(element) {
2312   - return element.style.cssText.toLowerCase();
2313   - },
2314   - title: function(element) {
2315   - return element.title;
2316   - }
2317   - }
2318   - }
2319   - };
2320   -
2321   - Element._attributeTranslations.write = {
2322   - names: Object.extend({
2323   - cellpadding: 'cellPadding',
2324   - cellspacing: 'cellSpacing'
2325   - }, Element._attributeTranslations.read.names),
2326   - values: {
2327   - checked: function(element, value) {
2328   - element.checked = !!value;
2329   - },
2330   -
2331   - style: function(element, value) {
2332   - element.style.cssText = value ? value : '';
2333   - }
2334   - }
2335   - };
2336   -
2337   - Element._attributeTranslations.has = {};
2338   -
2339   - $w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' +
2340   - 'encType maxLength readOnly longDesc').each(function(attr) {
2341   - Element._attributeTranslations.write.names[attr.toLowerCase()] = attr;
2342   - Element._attributeTranslations.has[attr.toLowerCase()] = attr;
2343   - });
2344   -
2345   - (function(v) {
2346   - Object.extend(v, {
2347   - href: v._getAttr,
2348   - src: v._getAttr,
2349   - type: v._getAttr,
2350   - action: v._getAttrNode,
2351   - disabled: v._flag,
2352   - checked: v._flag,
2353   - readonly: v._flag,
2354   - multiple: v._flag,
2355   - onload: v._getEv,
2356   - onunload: v._getEv,
2357   - onclick: v._getEv,
2358   - ondblclick: v._getEv,
2359   - onmousedown: v._getEv,
2360   - onmouseup: v._getEv,
2361   - onmouseover: v._getEv,
2362   - onmousemove: v._getEv,
2363   - onmouseout: v._getEv,
2364   - onfocus: v._getEv,
2365   - onblur: v._getEv,
2366   - onkeypress: v._getEv,
2367   - onkeydown: v._getEv,
2368   - onkeyup: v._getEv,
2369   - onsubmit: v._getEv,
2370   - onreset: v._getEv,
2371   - onselect: v._getEv,
2372   - onchange: v._getEv
2373   - });
2374   - })(Element._attributeTranslations.read.values);
2375   -}
2376   -
2377   -else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) {
2378   - Element.Methods.setOpacity = function(element, value) {
2379   - element = $(element);
2380   - element.style.opacity = (value == 1) ? 0.999999 :
2381   - (value === '') ? '' : (value < 0.00001) ? 0 : value;
2382   - return element;
2383   - };
2384   -}
2385   -
2386   -else if (Prototype.Browser.WebKit) {
2387   - Element.Methods.setOpacity = function(element, value) {
2388   - element = $(element);
2389   - element.style.opacity = (value == 1 || value === '') ? '' :
2390   - (value < 0.00001) ? 0 : value;
2391   -
2392   - if (value == 1)
2393   - if(element.tagName == 'IMG' && element.width) {
2394   - element.width++; element.width--;
2395   - } else try {
2396   - var n = document.createTextNode(' ');
2397   - element.appendChild(n);
2398   - element.removeChild(n);
2399   - } catch (e) { }
2400   -
2401   - return element;
2402   - };
2403   -
2404   - // Safari returns margins on body which is incorrect if the child is absolutely
2405   - // positioned. For performance reasons, redefine Element#cumulativeOffset for
2406   - // KHTML/WebKit only.
2407   - Element.Methods.cumulativeOffset = function(element) {
2408   - var valueT = 0, valueL = 0;
2409   - do {
2410   - valueT += element.offsetTop || 0;
2411   - valueL += element.offsetLeft || 0;
2412   - if (element.offsetParent == document.body)
2413   - if (Element.getStyle(element, 'position') == 'absolute') break;
2414   -
2415   - element = element.offsetParent;
2416   - } while (element);
2417   -
2418   - return Element._returnOffset(valueL, valueT);
2419   - };
2420   -}
2421   -
2422   -if (Prototype.Browser.IE || Prototype.Browser.Opera) {
2423   - // IE and Opera are missing .innerHTML support for TABLE-related and SELECT elements
2424   - Element.Methods.update = function(element, content) {
2425   - element = $(element);
2426   -
2427   - if (content && content.toElement) content = content.toElement();
2428   - if (Object.isElement(content)) return element.update().insert(content);
2429   -
2430   - content = Object.toHTML(content);
2431   - var tagName = element.tagName.toUpperCase();
2432   -
2433   - if (tagName in Element._insertionTranslations.tags) {
2434   - $A(element.childNodes).each(function(node) { element.removeChild(node) });
2435   - Element._getContentFromAnonymousElement(tagName, content.stripScripts())
2436   - .each(function(node) { element.appendChild(node) });
2437   - }
2438   - else element.innerHTML = content.stripScripts();
2439   -
2440   - content.evalScripts.bind(content).defer();
2441   - return element;
2442   - };
2443   -}
2444   -
2445   -if ('outerHTML' in document.createElement('div')) {
2446   - Element.Methods.replace = function(element, content) {
2447   - element = $(element);
2448   -
2449   - if (content && content.toElement) content = content.toElement();
2450   - if (Object.isElement(content)) {
2451   - element.parentNode.replaceChild(content, element);
2452   - return element;
2453   - }
2454   -
2455   - content = Object.toHTML(content);
2456   - var parent = element.parentNode, tagName = parent.tagName.toUpperCase();
2457   -
2458   - if (Element._insertionTranslations.tags[tagName]) {
2459   - var nextSibling = element.next();
2460   - var fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
2461   - parent.removeChild(element);
2462   - if (nextSibling)
2463   - fragments.each(function(node) { parent.insertBefore(node, nextSibling) });
2464   - else
2465   - fragments.each(function(node) { parent.appendChild(node) });
2466   - }
2467   - else element.outerHTML = content.stripScripts();
2468   -
2469   - content.evalScripts.bind(content).defer();
2470   - return element;
2471   - };
2472   -}
2473   -
2474   -Element._returnOffset = function(l, t) {
2475   - var result = [l, t];
2476   - result.left = l;
2477   - result.top = t;
2478   - return result;
2479   -};
2480   -
2481   -Element._getContentFromAnonymousElement = function(tagName, html) {
2482   - var div = new Element('div'), t = Element._insertionTranslations.tags[tagName];
2483   - if (t) {
2484   - div.innerHTML = t[0] + html + t[1];
2485   - t[2].times(function() { div = div.firstChild });
2486   - } else div.innerHTML = html;
2487   - return $A(div.childNodes);
2488   -};
2489   -
2490   -Element._insertionTranslations = {
2491   - before: function(element, node) {
2492   - element.parentNode.insertBefore(node, element);
2493   - },
2494   - top: function(element, node) {
2495   - element.insertBefore(node, element.firstChild);
2496   - },
2497   - bottom: function(element, node) {
2498   - element.appendChild(node);
2499   - },
2500   - after: function(element, node) {
2501   - element.parentNode.insertBefore(node, element.nextSibling);
2502   - },
2503   - tags: {
2504   - TABLE: ['<table>', '</table>', 1],
2505   - TBODY: ['<table><tbody>', '</tbody></table>', 2],
2506   - TR: ['<table><tbody><tr>', '</tr></tbody></table>', 3],
2507   - TD: ['<table><tbody><tr><td>', '</td></tr></tbody></table>', 4],
2508   - SELECT: ['<select>', '</select>', 1]
2509   - }
2510   -};
2511   -
2512   -(function() {
2513   - Object.extend(this.tags, {
2514   - THEAD: this.tags.TBODY,
2515   - TFOOT: this.tags.TBODY,
2516   - TH: this.tags.TD
2517   - });
2518   -}).call(Element._insertionTranslations);
2519   -
2520   -Element.Methods.Simulated = {
2521   - hasAttribute: function(element, attribute) {
2522   - attribute = Element._attributeTranslations.has[attribute] || attribute;
2523   - var node = $(element).getAttributeNode(attribute);
2524   - return node && node.specified;
2525   - }
2526   -};
2527   -
2528   -Element.Methods.ByTag = { };
2529   -
2530   -Object.extend(Element, Element.Methods);
2531   -
2532   -if (!Prototype.BrowserFeatures.ElementExtensions &&
2533   - document.createElement('div').__proto__) {
2534   - window.HTMLElement = { };
2535   - window.HTMLElement.prototype = document.createElement('div').__proto__;
2536   - Prototype.BrowserFeatures.ElementExtensions = true;
2537   -}
2538   -
2539   -Element.extend = (function() {
2540   - if (Prototype.BrowserFeatures.SpecificElementExtensions)
2541   - return Prototype.K;
2542   -
2543   - var Methods = { }, ByTag = Element.Methods.ByTag;
2544   -
2545   - var extend = Object.extend(function(element) {
2546   - if (!element || element._extendedByPrototype ||
2547   - element.nodeType != 1 || element == window) return element;
2548   -
2549   - var methods = Object.clone(Methods),
2550   - tagName = element.tagName, property, value;
2551   -
2552   - // extend methods for specific tags
2553   - if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]);
2554   -
2555   - for (property in methods) {
2556   - value = methods[property];
2557   - if (Object.isFunction(value) && !(property in element))
2558   - element[property] = value.methodize();
2559   - }
2560   -
2561   - element._extendedByPrototype = Prototype.emptyFunction;
2562   - return element;
2563   -
2564   - }, {
2565   - refresh: function() {
2566   - // extend methods for all tags (Safari doesn't need this)
2567   - if (!Prototype.BrowserFeatures.ElementExtensions) {
2568   - Object.extend(Methods, Element.Methods);
2569   - Object.extend(Methods, Element.Methods.Simulated);
2570   - }
2571   - }
2572   - });
2573   -
2574   - extend.refresh();
2575   - return extend;
2576   -})();
2577   -
2578   -Element.hasAttribute = function(element, attribute) {
2579   - if (element.hasAttribute) return element.hasAttribute(attribute);
2580   - return Element.Methods.Simulated.hasAttribute(element, attribute);
2581   -};
2582   -
2583   -Element.addMethods = function(methods) {
2584   - var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag;
2585   -
2586   - if (!methods) {
2587   - Object.extend(Form, Form.Methods);
2588   - Object.extend(Form.Element, Form.Element.Methods);
2589   - Object.extend(Element.Methods.ByTag, {
2590   - "FORM": Object.clone(Form.Methods),
2591   - "INPUT": Object.clone(Form.Element.Methods),
2592   - "SELECT": Object.clone(Form.Element.Methods),
2593   - "TEXTAREA": Object.clone(Form.Element.Methods)
2594   - });
2595   - }
2596   -
2597   - if (arguments.length == 2) {
2598   - var tagName = methods;
2599   - methods = arguments[1];
2600   - }
2601   -
2602   - if (!tagName) Object.extend(Element.Methods, methods || { });
2603   - else {
2604   - if (Object.isArray(tagName)) tagName.each(extend);
2605   - else extend(tagName);
2606   - }
2607   -
2608   - function extend(tagName) {
2609   - tagName = tagName.toUpperCase();
2610   - if (!Element.Methods.ByTag[tagName])
2611   - Element.Methods.ByTag[tagName] = { };
2612   - Object.extend(Element.Methods.ByTag[tagName], methods);
2613   - }
2614   -
2615   - function copy(methods, destination, onlyIfAbsent) {
2616   - onlyIfAbsent = onlyIfAbsent || false;
2617   - for (var property in methods) {
2618   - var value = methods[property];
2619   - if (!Object.isFunction(value)) continue;
2620   - if (!onlyIfAbsent || !(property in destination))
2621   - destination[property] = value.methodize();
2622   - }
2623   - }
2624   -
2625   - function findDOMClass(tagName) {
2626   - var klass;
2627   - var trans = {
2628   - "OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph",
2629   - "FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList",
2630   - "DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading",
2631   - "H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote",
2632   - "INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION":
2633   - "TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD":
2634   - "TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR":
2635   - "TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET":
2636   - "FrameSet", "IFRAME": "IFrame"
2637   - };
2638   - if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element';
2639   - if (window[klass]) return window[klass];
2640   - klass = 'HTML' + tagName + 'Element';
2641   - if (window[klass]) return window[klass];
2642   - klass = 'HTML' + tagName.capitalize() + 'Element';
2643   - if (window[klass]) return window[klass];
2644   -
2645   - window[klass] = { };
2646   - window[klass].prototype = document.createElement(tagName).__proto__;
2647   - return window[klass];
2648   - }
2649   -
2650   - if (F.ElementExtensions) {
2651   - copy(Element.Methods, HTMLElement.prototype);
2652   - copy(Element.Methods.Simulated, HTMLElement.prototype, true);
2653   - }
2654   -
2655   - if (F.SpecificElementExtensions) {
2656   - for (var tag in Element.Methods.ByTag) {
2657   - var klass = findDOMClass(tag);
2658   - if (Object.isUndefined(klass)) continue;
2659   - copy(T[tag], klass.prototype);
2660   - }
2661   - }
2662   -
2663   - Object.extend(Element, Element.Methods);
2664   - delete Element.ByTag;
2665   -
2666   - if (Element.extend.refresh) Element.extend.refresh();
2667   - Element.cache = { };
2668   -};
2669   -
2670   -document.viewport = {
2671   - getDimensions: function() {
2672   - var dimensions = { };
2673   - var B = Prototype.Browser;
2674   - $w('width height').each(function(d) {
2675   - var D = d.capitalize();
2676   - dimensions[d] = (B.WebKit && !document.evaluate) ? self['inner' + D] :
2677   - (B.Opera) ? document.body['client' + D] : document.documentElement['client' + D];
2678   - });
2679   - return dimensions;
2680   - },
2681   -
2682   - getWidth: function() {
2683   - return this.getDimensions().width;
2684   - },
2685   -
2686   - getHeight: function() {
2687   - return this.getDimensions().height;
2688   - },
2689   -
2690   - getScrollOffsets: function() {
2691   - return Element._returnOffset(
2692   - window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
2693   - window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop);
2694   - }
2695   -};
2696   -/* Portions of the Selector class are derived from Jack Slocum’s DomQuery,
2697   - * part of YUI-Ext version 0.40, distributed under the terms of an MIT-style
2698   - * license. Please see http://www.yui-ext.com/ for more information. */
2699   -
2700   -var Selector = Class.create({
2701   - initialize: function(expression) {
2702   - this.expression = expression.strip();
2703   - this.compileMatcher();
2704   - },
2705   -
2706   - shouldUseXPath: function() {
2707   - if (!Prototype.BrowserFeatures.XPath) return false;
2708   -
2709   - var e = this.expression;
2710   -
2711   - // Safari 3 chokes on :*-of-type and :empty
2712   - if (Prototype.Browser.WebKit &&
2713   - (e.include("-of-type") || e.include(":empty")))
2714   - return false;
2715   -
2716   - // XPath can't do namespaced attributes, nor can it read
2717   - // the "checked" property from DOM nodes
2718   - if ((/(\[[\w-]*?:|:checked)/).test(this.expression))
2719   - return false;
2720   -
2721   - return true;
2722   - },
2723   -
2724   - compileMatcher: function() {
2725   - if (this.shouldUseXPath())
2726   - return this.compileXPathMatcher();
2727   -
2728   - var e = this.expression, ps = Selector.patterns, h = Selector.handlers,
2729   - c = Selector.criteria, le, p, m;
2730   -
2731   - if (Selector._cache[e]) {
2732   - this.matcher = Selector._cache[e];
2733   - return;
2734   - }
2735   -
2736   - this.matcher = ["this.matcher = function(root) {",
2737   - "var r = root, h = Selector.handlers, c = false, n;"];
2738   -
2739   - while (e && le != e && (/\S/).test(e)) {
2740   - le = e;
2741   - for (var i in ps) {
2742   - p = ps[i];
2743   - if (m = e.match(p)) {
2744   - this.matcher.push(Object.isFunction(c[i]) ? c[i](m) :
2745   - new Template(c[i]).evaluate(m));
2746   - e = e.replace(m[0], '');
2747   - break;
2748   - }
2749   - }
2750   - }
2751   -
2752   - this.matcher.push("return h.unique(n);\n}");
2753   - eval(this.matcher.join('\n'));
2754   - Selector._cache[this.expression] = this.matcher;
2755   - },
2756   -
2757   - compileXPathMatcher: function() {
2758   - var e = this.expression, ps = Selector.patterns,
2759   - x = Selector.xpath, le, m;
2760   -
2761   - if (Selector._cache[e]) {
2762   - this.xpath = Selector._cache[e]; return;
2763   - }
2764   -
2765   - this.matcher = ['.//*'];
2766   - while (e && le != e && (/\S/).test(e)) {
2767   - le = e;
2768   - for (var i in ps) {
2769   - if (m = e.match(ps[i])) {
2770   - this.matcher.push(Object.isFunction(x[i]) ? x[i](m) :
2771   - new Template(x[i]).evaluate(m));
2772   - e = e.replace(m[0], '');
2773   - break;
2774   - }
2775   - }
2776   - }
2777   -
2778   - this.xpath = this.matcher.join('');
2779   - Selector._cache[this.expression] = this.xpath;
2780   - },
2781   -
2782   - findElements: function(root) {
2783   - root = root || document;
2784   - if (this.xpath) return document._getElementsByXPath(this.xpath, root);
2785   - return this.matcher(root);
2786   - },
2787   -
2788   - match: function(element) {
2789   - this.tokens = [];
2790   -
2791   - var e = this.expression, ps = Selector.patterns, as = Selector.assertions;
2792   - var le, p, m;
2793   -
2794   - while (e && le !== e && (/\S/).test(e)) {
2795   - le = e;
2796   - for (var i in ps) {
2797   - p = ps[i];
2798   - if (m = e.match(p)) {
2799   - // use the Selector.assertions methods unless the selector
2800   - // is too complex.
2801   - if (as[i]) {
2802   - this.tokens.push([i, Object.clone(m)]);
2803   - e = e.replace(m[0], '');
2804   - } else {
2805   - // reluctantly do a document-wide search
2806   - // and look for a match in the array
2807   - return this.findElements(document).include(element);
2808   - }
2809   - }
2810   - }
2811   - }
2812   -
2813   - var match = true, name, matches;
2814   - for (var i = 0, token; token = this.tokens[i]; i++) {
2815   - name = token[0], matches = token[1];
2816   - if (!Selector.assertions[name](element, matches)) {
2817   - match = false; break;
2818   - }
2819   - }
2820   -
2821   - return match;
2822   - },
2823   -
2824   - toString: function() {
2825   - return this.expression;
2826   - },
2827   -
2828   - inspect: function() {
2829   - return "#<Selector:" + this.expression.inspect() + ">";
2830   - }
2831   -});
2832   -
2833   -Object.extend(Selector, {
2834   - _cache: { },
2835   -
2836   - xpath: {
2837   - descendant: "//*",
2838   - child: "/*",
2839   - adjacent: "/following-sibling::*[1]",
2840   - laterSibling: '/following-sibling::*',
2841   - tagName: function(m) {
2842   - if (m[1] == '*') return '';
2843   - return "[local-name()='" + m[1].toLowerCase() +
2844   - "' or local-name()='" + m[1].toUpperCase() + "']";
2845   - },
2846   - className: "[contains(concat(' ', @class, ' '), ' #{1} ')]",
2847   - id: "[@id='#{1}']",
2848   - attrPresence: function(m) {
2849   - m[1] = m[1].toLowerCase();
2850   - return new Template("[@#{1}]").evaluate(m);
2851   - },
2852   - attr: function(m) {
2853   - m[1] = m[1].toLowerCase();
2854   - m[3] = m[5] || m[6];
2855   - return new Template(Selector.xpath.operators[m[2]]).evaluate(m);
2856   - },
2857   - pseudo: function(m) {
2858   - var h = Selector.xpath.pseudos[m[1]];
2859   - if (!h) return '';
2860   - if (Object.isFunction(h)) return h(m);
2861   - return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m);
2862   - },
2863   - operators: {
2864   - '=': "[@#{1}='#{3}']",
2865   - '!=': "[@#{1}!='#{3}']",
2866   - '^=': "[starts-with(@#{1}, '#{3}')]",
2867   - '$=': "[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']",
2868   - '*=': "[contains(@#{1}, '#{3}')]",
2869   - '~=': "[contains(concat(' ', @#{1}, ' '), ' #{3} ')]",
2870   - '|=': "[contains(concat('-', @#{1}, '-'), '-#{3}-')]"
2871   - },
2872   - pseudos: {
2873   - 'first-child': '[not(preceding-sibling::*)]',
2874   - 'last-child': '[not(following-sibling::*)]',
2875   - 'only-child': '[not(preceding-sibling::* or following-sibling::*)]',
2876   - 'empty': "[count(*) = 0 and (count(text()) = 0 or translate(text(), ' \t\r\n', '') = '')]",
2877   - 'checked': "[@checked]",
2878   - 'disabled': "[@disabled]",
2879   - 'enabled': "[not(@disabled)]",
2880   - 'not': function(m) {
2881   - var e = m[6], p = Selector.patterns,
2882   - x = Selector.xpath, le, v;
2883   -
2884   - var exclusion = [];
2885   - while (e && le != e && (/\S/).test(e)) {
2886   - le = e;
2887   - for (var i in p) {
2888   - if (m = e.match(p[i])) {
2889   - v = Object.isFunction(x[i]) ? x[i](m) : new Template(x[i]).evaluate(m);
2890   - exclusion.push("(" + v.substring(1, v.length - 1) + ")");
2891   - e = e.replace(m[0], '');
2892   - break;
2893   - }
2894   - }
2895   - }
2896   - return "[not(" + exclusion.join(" and ") + ")]";
2897   - },
2898   - 'nth-child': function(m) {
2899   - return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ", m);
2900   - },
2901   - 'nth-last-child': function(m) {
2902   - return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ", m);
2903   - },
2904   - 'nth-of-type': function(m) {
2905   - return Selector.xpath.pseudos.nth("position() ", m);
2906   - },
2907   - 'nth-last-of-type': function(m) {
2908   - return Selector.xpath.pseudos.nth("(last() + 1 - position()) ", m);
2909   - },
2910   - 'first-of-type': function(m) {
2911   - m[6] = "1"; return Selector.xpath.pseudos['nth-of-type'](m);
2912   - },
2913   - 'last-of-type': function(m) {
2914   - m[6] = "1"; return Selector.xpath.pseudos['nth-last-of-type'](m);
2915   - },
2916   - 'only-of-type': function(m) {
2917   - var p = Selector.xpath.pseudos; return p['first-of-type'](m) + p['last-of-type'](m);
2918   - },
2919   - nth: function(fragment, m) {
2920   - var mm, formula = m[6], predicate;
2921   - if (formula == 'even') formula = '2n+0';
2922   - if (formula == 'odd') formula = '2n+1';
2923   - if (mm = formula.match(/^(\d+)$/)) // digit only
2924   - return '[' + fragment + "= " + mm[1] + ']';
2925   - if (mm = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
2926   - if (mm[1] == "-") mm[1] = -1;
2927   - var a = mm[1] ? Number(mm[1]) : 1;
2928   - var b = mm[2] ? Number(mm[2]) : 0;
2929   - predicate = "[((#{fragment} - #{b}) mod #{a} = 0) and " +
2930   - "((#{fragment} - #{b}) div #{a} >= 0)]";
2931   - return new Template(predicate).evaluate({
2932   - fragment: fragment, a: a, b: b });
2933   - }
2934   - }
2935   - }
2936   - },
2937   -
2938   - criteria: {
2939   - tagName: 'n = h.tagName(n, r, "#{1}", c); c = false;',
2940   - className: 'n = h.className(n, r, "#{1}", c); c = false;',
2941   - id: 'n = h.id(n, r, "#{1}", c); c = false;',
2942   - attrPresence: 'n = h.attrPresence(n, r, "#{1}", c); c = false;',
2943   - attr: function(m) {
2944   - m[3] = (m[5] || m[6]);
2945   - return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(m);
2946   - },
2947   - pseudo: function(m) {
2948   - if (m[6]) m[6] = m[6].replace(/"/g, '\\"');
2949   - return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m);
2950   - },
2951   - descendant: 'c = "descendant";',
2952   - child: 'c = "child";',
2953   - adjacent: 'c = "adjacent";',
2954   - laterSibling: 'c = "laterSibling";'
2955   - },
2956   -
2957   - patterns: {
2958   - // combinators must be listed first
2959   - // (and descendant needs to be last combinator)
2960   - laterSibling: /^\s*~\s*/,
2961   - child: /^\s*>\s*/,
2962   - adjacent: /^\s*\+\s*/,
2963   - descendant: /^\s/,
2964   -
2965   - // selectors follow
2966   - tagName: /^\s*(\*|[\w\-]+)(\b|$)?/,
2967   - id: /^#([\w\-\*]+)(\b|$)/,
2968   - className: /^\.([\w\-\*]+)(\b|$)/,
2969   - pseudo:
2970   -/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/,
2971   - attrPresence: /^\[([\w]+)\]/,
2972   - attr: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/
2973   - },
2974   -
2975   - // for Selector.match and Element#match
2976   - assertions: {
2977   - tagName: function(element, matches) {
2978   - return matches[1].toUpperCase() == element.tagName.toUpperCase();
2979   - },
2980   -
2981   - className: function(element, matches) {
2982   - return Element.hasClassName(element, matches[1]);
2983   - },
2984   -
2985   - id: function(element, matches) {
2986   - return element.id === matches[1];
2987   - },
2988   -
2989   - attrPresence: function(element, matches) {
2990   - return Element.hasAttribute(element, matches[1]);
2991   - },
2992   -
2993   - attr: function(element, matches) {
2994   - var nodeValue = Element.readAttribute(element, matches[1]);
2995   - return nodeValue && Selector.operators[matches[2]](nodeValue, matches[5] || matches[6]);
2996   - }
2997   - },
2998   -
2999   - handlers: {
3000   - // UTILITY FUNCTIONS
3001   - // joins two collections
3002   - concat: function(a, b) {
3003   - for (var i = 0, node; node = b[i]; i++)
3004   - a.push(node);
3005   - return a;
3006   - },
3007   -
3008   - // marks an array of nodes for counting
3009   - mark: function(nodes) {
3010   - var _true = Prototype.emptyFunction;
3011   - for (var i = 0, node; node = nodes[i]; i++)
3012   - node._countedByPrototype = _true;
3013   - return nodes;
3014   - },
3015   -
3016   - unmark: function(nodes) {
3017   - for (var i = 0, node; node = nodes[i]; i++)
3018   - node._countedByPrototype = undefined;
3019   - return nodes;
3020   - },
3021   -
3022   - // mark each child node with its position (for nth calls)
3023   - // "ofType" flag indicates whether we're indexing for nth-of-type
3024   - // rather than nth-child
3025   - index: function(parentNode, reverse, ofType) {
3026   - parentNode._countedByPrototype = Prototype.emptyFunction;
3027   - if (reverse) {
3028   - for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) {
3029   - var node = nodes[i];
3030   - if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++;
3031   - }
3032   - } else {
3033   - for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++)
3034   - if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++;
3035   - }
3036   - },
3037   -
3038   - // filters out duplicates and extends all nodes
3039   - unique: function(nodes) {
3040   - if (nodes.length == 0) return nodes;
3041   - var results = [], n;
3042   - for (var i = 0, l = nodes.length; i < l; i++)
3043   - if (!(n = nodes[i])._countedByPrototype) {
3044   - n._countedByPrototype = Prototype.emptyFunction;
3045   - results.push(Element.extend(n));
3046   - }
3047   - return Selector.handlers.unmark(results);
3048   - },
3049   -
3050   - // COMBINATOR FUNCTIONS
3051   - descendant: function(nodes) {
3052   - var h = Selector.handlers;
3053   - for (var i = 0, results = [], node; node = nodes[i]; i++)
3054   - h.concat(results, node.getElementsByTagName('*'));
3055   - return results;
3056   - },
3057   -
3058   - child: function(nodes) {
3059   - var h = Selector.handlers;
3060   - for (var i = 0, results = [], node; node = nodes[i]; i++) {
3061   - for (var j = 0, child; child = node.childNodes[j]; j++)
3062   - if (child.nodeType == 1 && child.tagName != '!') results.push(child);
3063   - }
3064   - return results;
3065   - },
3066   -
3067   - adjacent: function(nodes) {
3068   - for (var i = 0, results = [], node; node = nodes[i]; i++) {
3069   - var next = this.nextElementSibling(node);
3070   - if (next) results.push(next);
3071   - }
3072   - return results;
3073   - },
3074   -
3075   - laterSibling: function(nodes) {
3076   - var h = Selector.handlers;
3077   - for (var i = 0, results = [], node; node = nodes[i]; i++)
3078   - h.concat(results, Element.nextSiblings(node));
3079   - return results;
3080   - },
3081   -
3082   - nextElementSibling: function(node) {
3083   - while (node = node.nextSibling)
3084   - if (node.nodeType == 1) return node;
3085   - return null;
3086   - },
3087   -
3088   - previousElementSibling: function(node) {
3089   - while (node = node.previousSibling)
3090   - if (node.nodeType == 1) return node;
3091   - return null;
3092   - },
3093   -
3094   - // TOKEN FUNCTIONS
3095   - tagName: function(nodes, root, tagName, combinator) {
3096   - var uTagName = tagName.toUpperCase();
3097   - var results = [], h = Selector.handlers;
3098   - if (nodes) {
3099   - if (combinator) {
3100   - // fastlane for ordinary descendant combinators
3101   - if (combinator == "descendant") {
3102   - for (var i = 0, node; node = nodes[i]; i++)
3103   - h.concat(results, node.getElementsByTagName(tagName));
3104   - return results;
3105   - } else nodes = this[combinator](nodes);
3106   - if (tagName == "*") return nodes;
3107   - }
3108   - for (var i = 0, node; node = nodes[i]; i++)
3109   - if (node.tagName.toUpperCase() === uTagName) results.push(node);
3110   - return results;
3111   - } else return root.getElementsByTagName(tagName);
3112   - },
3113   -
3114   - id: function(nodes, root, id, combinator) {
3115   - var targetNode = $(id), h = Selector.handlers;
3116   - if (!targetNode) return [];
3117   - if (!nodes && root == document) return [targetNode];
3118   - if (nodes) {
3119   - if (combinator) {
3120   - if (combinator == 'child') {
3121   - for (var i = 0, node; node = nodes[i]; i++)
3122   - if (targetNode.parentNode == node) return [targetNode];
3123   - } else if (combinator == 'descendant') {
3124   - for (var i = 0, node; node = nodes[i]; i++)
3125   - if (Element.descendantOf(targetNode, node)) return [targetNode];
3126   - } else if (combinator == 'adjacent') {
3127   - for (var i = 0, node; node = nodes[i]; i++)
3128   - if (Selector.handlers.previousElementSibling(targetNode) == node)
3129   - return [targetNode];
3130   - } else nodes = h[combinator](nodes);
3131   - }
3132   - for (var i = 0, node; node = nodes[i]; i++)
3133   - if (node == targetNode) return [targetNode];
3134   - return [];
3135   - }
3136   - return (targetNode && Element.descendantOf(targetNode, root)) ? [targetNode] : [];
3137   - },
3138   -
3139   - className: function(nodes, root, className, combinator) {
3140   - if (nodes && combinator) nodes = this[combinator](nodes);
3141   - return Selector.handlers.byClassName(nodes, root, className);
3142   - },
3143   -
3144   - byClassName: function(nodes, root, className) {
3145   - if (!nodes) nodes = Selector.handlers.descendant([root]);
3146   - var needle = ' ' + className + ' ';
3147   - for (var i = 0, results = [], node, nodeClassName; node = nodes[i]; i++) {
3148   - nodeClassName = node.className;
3149   - if (nodeClassName.length == 0) continue;
3150   - if (nodeClassName == className || (' ' + nodeClassName + ' ').include(needle))
3151   - results.push(node);
3152   - }
3153   - return results;
3154   - },
3155   -
3156   - attrPresence: function(nodes, root, attr, combinator) {
3157   - if (!nodes) nodes = root.getElementsByTagName("*");
3158   - if (nodes && combinator) nodes = this[combinator](nodes);
3159   - var results = [];
3160   - for (var i = 0, node; node = nodes[i]; i++)
3161   - if (Element.hasAttribute(node, attr)) results.push(node);
3162   - return results;
3163   - },
3164   -
3165   - attr: function(nodes, root, attr, value, operator, combinator) {
3166   - if (!nodes) nodes = root.getElementsByTagName("*");
3167   - if (nodes && combinator) nodes = this[combinator](nodes);
3168   - var handler = Selector.operators[operator], results = [];
3169   - for (var i = 0, node; node = nodes[i]; i++) {
3170   - var nodeValue = Element.readAttribute(node, attr);
3171   - if (nodeValue === null) continue;
3172   - if (handler(nodeValue, value)) results.push(node);
3173   - }
3174   - return results;
3175   - },
3176   -
3177   - pseudo: function(nodes, name, value, root, combinator) {
3178   - if (nodes && combinator) nodes = this[combinator](nodes);
3179   - if (!nodes) nodes = root.getElementsByTagName("*");
3180   - return Selector.pseudos[name](nodes, value, root);
3181   - }
3182   - },
3183   -
3184   - pseudos: {
3185   - 'first-child': function(nodes, value, root) {
3186   - for (var i = 0, results = [], node; node = nodes[i]; i++) {
3187   - if (Selector.handlers.previousElementSibling(node)) continue;
3188   - results.push(node);
3189   - }
3190   - return results;
3191   - },
3192   - 'last-child': function(nodes, value, root) {
3193   - for (var i = 0, results = [], node; node = nodes[i]; i++) {
3194   - if (Selector.handlers.nextElementSibling(node)) continue;
3195   - results.push(node);
3196   - }
3197   - return results;
3198   - },
3199   - 'only-child': function(nodes, value, root) {
3200   - var h = Selector.handlers;
3201   - for (var i = 0, results = [], node; node = nodes[i]; i++)
3202   - if (!h.previousElementSibling(node) && !h.nextElementSibling(node))
3203   - results.push(node);
3204   - return results;
3205   - },
3206   - 'nth-child': function(nodes, formula, root) {
3207   - return Selector.pseudos.nth(nodes, formula, root);
3208   - },
3209   - 'nth-last-child': function(nodes, formula, root) {
3210   - return Selector.pseudos.nth(nodes, formula, root, true);
3211   - },
3212   - 'nth-of-type': function(nodes, formula, root) {
3213   - return Selector.pseudos.nth(nodes, formula, root, false, true);
3214   - },
3215   - 'nth-last-of-type': function(nodes, formula, root) {
3216   - return Selector.pseudos.nth(nodes, formula, root, true, true);
3217   - },
3218   - 'first-of-type': function(nodes, formula, root) {
3219   - return Selector.pseudos.nth(nodes, "1", root, false, true);
3220   - },
3221   - 'last-of-type': function(nodes, formula, root) {
3222   - return Selector.pseudos.nth(nodes, "1", root, true, true);
3223   - },
3224   - 'only-of-type': function(nodes, formula, root) {
3225   - var p = Selector.pseudos;
3226   - return p['last-of-type'](p['first-of-type'](nodes, formula, root), formula, root);
3227   - },
3228   -
3229   - // handles the an+b logic
3230   - getIndices: function(a, b, total) {
3231   - if (a == 0) return b > 0 ? [b] : [];
3232   - return $R(1, total).inject([], function(memo, i) {
3233   - if (0 == (i - b) % a && (i - b) / a >= 0) memo.push(i);
3234   - return memo;
3235   - });
3236   - },
3237   -
3238   - // handles nth(-last)-child, nth(-last)-of-type, and (first|last)-of-type
3239   - nth: function(nodes, formula, root, reverse, ofType) {
3240   - if (nodes.length == 0) return [];
3241   - if (formula == 'even') formula = '2n+0';
3242   - if (formula == 'odd') formula = '2n+1';
3243   - var h = Selector.handlers, results = [], indexed = [], m;
3244   - h.mark(nodes);
3245   - for (var i = 0, node; node = nodes[i]; i++) {
3246   - if (!node.parentNode._countedByPrototype) {
3247   - h.index(node.parentNode, reverse, ofType);
3248   - indexed.push(node.parentNode);
3249   - }
3250   - }
3251   - if (formula.match(/^\d+$/)) { // just a number
3252   - formula = Number(formula);
3253   - for (var i = 0, node; node = nodes[i]; i++)
3254   - if (node.nodeIndex == formula) results.push(node);
3255   - } else if (m = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
3256   - if (m[1] == "-") m[1] = -1;
3257   - var a = m[1] ? Number(m[1]) : 1;
3258   - var b = m[2] ? Number(m[2]) : 0;
3259   - var indices = Selector.pseudos.getIndices(a, b, nodes.length);
3260   - for (var i = 0, node, l = indices.length; node = nodes[i]; i++) {
3261   - for (var j = 0; j < l; j++)
3262   - if (node.nodeIndex == indices[j]) results.push(node);
3263   - }
3264   - }
3265   - h.unmark(nodes);
3266   - h.unmark(indexed);
3267   - return results;
3268   - },
3269   -
3270   - 'empty': function(nodes, value, root) {
3271   - for (var i = 0, results = [], node; node = nodes[i]; i++) {
3272   - // IE treats comments as element nodes
3273   - if (node.tagName == '!' || (node.firstChild && !node.innerHTML.match(/^\s*$/))) continue;
3274   - results.push(node);
3275   - }
3276   - return results;
3277   - },
3278   -
3279   - 'not': function(nodes, selector, root) {
3280   - var h = Selector.handlers, selectorType, m;
3281   - var exclusions = new Selector(selector).findElements(root);
3282   - h.mark(exclusions);
3283   - for (var i = 0, results = [], node; node = nodes[i]; i++)
3284   - if (!node._countedByPrototype) results.push(node);
3285   - h.unmark(exclusions);
3286   - return results;
3287   - },
3288   -
3289   - 'enabled': function(nodes, value, root) {
3290   - for (var i = 0, results = [], node; node = nodes[i]; i++)
3291   - if (!node.disabled) results.push(node);
3292   - return results;
3293   - },
3294   -
3295   - 'disabled': function(nodes, value, root) {
3296   - for (var i = 0, results = [], node; node = nodes[i]; i++)
3297   - if (node.disabled) results.push(node);
3298   - return results;
3299   - },
3300   -
3301   - 'checked': function(nodes, value, root) {
3302   - for (var i = 0, results = [], node; node = nodes[i]; i++)
3303   - if (node.checked) results.push(node);
3304   - return results;
3305   - }
3306   - },
3307   -
3308   - operators: {
3309   - '=': function(nv, v) { return nv == v; },
3310   - '!=': function(nv, v) { return nv != v; },
3311   - '^=': function(nv, v) { return nv.startsWith(v); },
3312   - '$=': function(nv, v) { return nv.endsWith(v); },
3313   - '*=': function(nv, v) { return nv.include(v); },
3314   - '~=': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '); },
3315   - '|=': function(nv, v) { return ('-' + nv.toUpperCase() + '-').include('-' + v.toUpperCase() + '-'); }
3316   - },
3317   -
3318   - split: function(expression) {
3319   - var expressions = [];
3320   - expression.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) {
3321   - expressions.push(m[1].strip());
3322   - });
3323   - return expressions;
3324   - },
3325   -
3326   - matchElements: function(elements, expression) {
3327   - var matches = $$(expression), h = Selector.handlers;
3328   - h.mark(matches);
3329   - for (var i = 0, results = [], element; element = elements[i]; i++)
3330   - if (element._countedByPrototype) results.push(element);
3331   - h.unmark(matches);
3332   - return results;
3333   - },
3334   -
3335   - findElement: function(elements, expression, index) {
3336   - if (Object.isNumber(expression)) {
3337   - index = expression; expression = false;
3338   - }
3339   - return Selector.matchElements(elements, expression || '*')[index || 0];
3340   - },
3341   -
3342   - findChildElements: function(element, expressions) {
3343   - expressions = Selector.split(expressions.join(','));
3344   - var results = [], h = Selector.handlers;
3345   - for (var i = 0, l = expressions.length, selector; i < l; i++) {
3346   - selector = new Selector(expressions[i].strip());
3347   - h.concat(results, selector.findElements(element));
3348   - }
3349   - return (l > 1) ? h.unique(results) : results;
3350   - }
3351   -});
3352   -
3353   -if (Prototype.Browser.IE) {
3354   - Object.extend(Selector.handlers, {
3355   - // IE returns comment nodes on getElementsByTagName("*").
3356   - // Filter them out.
3357   - concat: function(a, b) {
3358   - for (var i = 0, node; node = b[i]; i++)
3359   - if (node.tagName !== "!") a.push(node);
3360   - return a;
3361   - },
3362   -
3363   - // IE improperly serializes _countedByPrototype in (inner|outer)HTML.
3364   - unmark: function(nodes) {
3365   - for (var i = 0, node; node = nodes[i]; i++)
3366   - node.removeAttribute('_countedByPrototype');
3367   - return nodes;
3368   - }
3369   - });
3370   -}
3371   -
3372   -function $$() {
3373   - return Selector.findChildElements(document, $A(arguments));
3374   -}
3375   -var Form = {
3376   - reset: function(form) {
3377   - $(form).reset();
3378   - return form;
3379   - },
3380   -
3381   - serializeElements: function(elements, options) {
3382   - if (typeof options != 'object') options = { hash: !!options };
3383   - else if (Object.isUndefined(options.hash)) options.hash = true;
3384   - var key, value, submitted = false, submit = options.submit;
3385   -
3386   - var data = elements.inject({ }, function(result, element) {
3387   - if (!element.disabled && element.name) {
3388   - key = element.name; value = $(element).getValue();
3389   - if (value != null && (element.type != 'submit' || (!submitted &&
3390   - submit !== false && (!submit || key == submit) && (submitted = true)))) {
3391   - if (key in result) {
3392   - // a key is already present; construct an array of values
3393   - if (!Object.isArray(result[key])) result[key] = [result[key]];
3394   - result[key].push(value);
3395   - }
3396   - else result[key] = value;
3397   - }
3398   - }
3399   - return result;
3400   - });
3401   -
3402   - return options.hash ? data : Object.toQueryString(data);
3403   - }
3404   -};
3405   -
3406   -Form.Methods = {
3407   - serialize: function(form, options) {
3408   - return Form.serializeElements(Form.getElements(form), options);
3409   - },
3410   -
3411   - getElements: function(form) {
3412   - return $A($(form).getElementsByTagName('*')).inject([],
3413   - function(elements, child) {
3414   - if (Form.Element.Serializers[child.tagName.toLowerCase()])
3415   - elements.push(Element.extend(child));
3416   - return elements;
3417   - }
3418   - );
3419   - },
3420   -
3421   - getInputs: function(form, typeName, name) {
3422   - form = $(form);
3423   - var inputs = form.getElementsByTagName('input');
3424   -
3425   - if (!typeName && !name) return $A(inputs).map(Element.extend);
3426   -
3427   - for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) {
3428   - var input = inputs[i];
3429   - if ((typeName && input.type != typeName) || (name && input.name != name))
3430   - continue;
3431   - matchingInputs.push(Element.extend(input));
3432   - }
3433   -
3434   - return matchingInputs;
3435   - },
3436   -
3437   - disable: function(form) {
3438   - form = $(form);
3439   - Form.getElements(form).invoke('disable');
3440   - return form;
3441   - },
3442   -
3443   - enable: function(form) {
3444   - form = $(form);
3445   - Form.getElements(form).invoke('enable');
3446   - return form;
3447   - },
3448   -
3449   - findFirstElement: function(form) {
3450   - var elements = $(form).getElements().findAll(function(element) {
3451   - return 'hidden' != element.type && !element.disabled;
3452   - });
3453   - var firstByIndex = elements.findAll(function(element) {
3454   - return element.hasAttribute('tabIndex') && element.tabIndex >= 0;
3455   - }).sortBy(function(element) { return element.tabIndex }).first();
3456   -
3457   - return firstByIndex ? firstByIndex : elements.find(function(element) {
3458   - return ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
3459   - });
3460   - },
3461   -
3462   - focusFirstElement: function(form) {
3463   - form = $(form);
3464   - form.findFirstElement().activate();
3465   - return form;
3466   - },
3467   -
3468   - request: function(form, options) {
3469   - form = $(form), options = Object.clone(options || { });
3470   -
3471   - var params = options.parameters, action = form.readAttribute('action') || '';
3472   - if (action.blank()) action = window.location.href;
3473   - options.parameters = form.serialize(true);
3474   -
3475   - if (params) {
3476   - if (Object.isString(params)) params = params.toQueryParams();
3477   - Object.extend(options.parameters, params);
3478   - }
3479   -
3480   - if (form.hasAttribute('method') && !options.method)
3481   - options.method = form.method;
3482   -
3483   - return new Ajax.Request(action, options);
3484   - }
3485   -};
3486   -
3487   -/*--------------------------------------------------------------------------*/
3488   -
3489   -Form.Element = {
3490   - focus: function(element) {
3491   - $(element).focus();
3492   - return element;
3493   - },
3494   -
3495   - select: function(element) {
3496   - $(element).select();
3497   - return element;
3498   - }
3499   -};
3500   -
3501   -Form.Element.Methods = {
3502   - serialize: function(element) {
3503   - element = $(element);
3504   - if (!element.disabled && element.name) {
3505   - var value = element.getValue();
3506   - if (value != undefined) {
3507   - var pair = { };
3508   - pair[element.name] = value;
3509   - return Object.toQueryString(pair);
3510   - }
3511   - }
3512   - return '';
3513   - },
3514   -
3515   - getValue: function(element) {
3516   - element = $(element);
3517   - var method = element.tagName.toLowerCase();
3518   - return Form.Element.Serializers[method](element);
3519   - },
3520   -
3521   - setValue: function(element, value) {
3522   - element = $(element);
3523   - var method = element.tagName.toLowerCase();
3524   - Form.Element.Serializers[method](element, value);
3525   - return element;
3526   - },
3527   -
3528   - clear: function(element) {
3529   - $(element).value = '';
3530   - return element;
3531   - },
3532   -
3533   - present: function(element) {
3534   - return $(element).value != '';
3535   - },
3536   -
3537   - activate: function(element) {
3538   - element = $(element);
3539   - try {
3540   - element.focus();
3541   - if (element.select && (element.tagName.toLowerCase() != 'input' ||
3542   - !['button', 'reset', 'submit'].include(element.type)))
3543   - element.select();
3544   - } catch (e) { }
3545   - return element;
3546   - },
3547   -
3548   - disable: function(element) {
3549   - element = $(element);
3550   - element.blur();
3551   - element.disabled = true;
3552   - return element;
3553   - },
3554   -
3555   - enable: function(element) {
3556   - element = $(element);
3557   - element.disabled = false;
3558   - return element;
3559   - }
3560   -};
3561   -
3562   -/*--------------------------------------------------------------------------*/
3563   -
3564   -var Field = Form.Element;
3565   -var $F = Form.Element.Methods.getValue;
3566   -
3567   -/*--------------------------------------------------------------------------*/
3568   -
3569   -Form.Element.Serializers = {
3570   - input: function(element, value) {
3571   - switch (element.type.toLowerCase()) {
3572   - case 'checkbox':
3573   - case 'radio':
3574   - return Form.Element.Serializers.inputSelector(element, value);
3575   - default:
3576   - return Form.Element.Serializers.textarea(element, value);
3577   - }
3578   - },
3579   -
3580   - inputSelector: function(element, value) {
3581   - if (Object.isUndefined(value)) return element.checked ? element.value : null;
3582   - else element.checked = !!value;
3583   - },
3584   -
3585   - textarea: function(element, value) {
3586   - if (Object.isUndefined(value)) return element.value;
3587   - else element.value = value;
3588   - },
3589   -
3590   - select: function(element, index) {
3591   - if (Object.isUndefined(index))
3592   - return this[element.type == 'select-one' ?
3593   - 'selectOne' : 'selectMany'](element);
3594   - else {
3595   - var opt, value, single = !Object.isArray(index);
3596   - for (var i = 0, length = element.length; i < length; i++) {
3597   - opt = element.options[i];
3598   - value = this.optionValue(opt);
3599   - if (single) {
3600   - if (value == index) {
3601   - opt.selected = true;
3602   - return;
3603   - }
3604   - }
3605   - else opt.selected = index.include(value);
3606   - }
3607   - }
3608   - },
3609   -
3610   - selectOne: function(element) {
3611   - var index = element.selectedIndex;
3612   - return index >= 0 ? this.optionValue(element.options[index]) : null;
3613   - },
3614   -
3615   - selectMany: function(element) {
3616   - var values, length = element.length;
3617   - if (!length) return null;
3618   -
3619   - for (var i = 0, values = []; i < length; i++) {
3620   - var opt = element.options[i];
3621   - if (opt.selected) values.push(this.optionValue(opt));
3622   - }
3623   - return values;
3624   - },
3625   -
3626   - optionValue: function(opt) {
3627   - // extend element because hasAttribute may not be native
3628   - return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text;
3629   - }
3630   -};
3631   -
3632   -/*--------------------------------------------------------------------------*/
3633   -
3634   -Abstract.TimedObserver = Class.create(PeriodicalExecuter, {
3635   - initialize: function($super, element, frequency, callback) {
3636   - $super(callback, frequency);
3637   - this.element = $(element);
3638   - this.lastValue = this.getValue();
3639   - },
3640   -
3641   - execute: function() {
3642   - var value = this.getValue();
3643   - if (Object.isString(this.lastValue) && Object.isString(value) ?
3644   - this.lastValue != value : String(this.lastValue) != String(value)) {
3645   - this.callback(this.element, value);
3646   - this.lastValue = value;
3647   - }
3648   - }
3649   -});
3650   -
3651   -Form.Element.Observer = Class.create(Abstract.TimedObserver, {
3652   - getValue: function() {
3653   - return Form.Element.getValue(this.element);
3654   - }
3655   -});
3656   -
3657   -Form.Observer = Class.create(Abstract.TimedObserver, {
3658   - getValue: function() {
3659   - return Form.serialize(this.element);
3660   - }
3661   -});
3662   -
3663   -/*--------------------------------------------------------------------------*/
3664   -
3665   -Abstract.EventObserver = Class.create({
3666   - initialize: function(element, callback) {
3667   - this.element = $(element);
3668   - this.callback = callback;
3669   -
3670   - this.lastValue = this.getValue();
3671   - if (this.element.tagName.toLowerCase() == 'form')
3672   - this.registerFormCallbacks();
3673   - else
3674   - this.registerCallback(this.element);
3675   - },
3676   -
3677   - onElementEvent: function() {
3678   - var value = this.getValue();
3679   - if (this.lastValue != value) {
3680   - this.callback(this.element, value);
3681   - this.lastValue = value;
3682   - }
3683   - },
3684   -
3685   - registerFormCallbacks: function() {
3686   - Form.getElements(this.element).each(this.registerCallback, this);
3687   - },
3688   -
3689   - registerCallback: function(element) {
3690   - if (element.type) {
3691   - switch (element.type.toLowerCase()) {
3692   - case 'checkbox':
3693   - case 'radio':
3694   - Event.observe(element, 'click', this.onElementEvent.bind(this));
3695   - break;
3696   - default:
3697   - Event.observe(element, 'change', this.onElementEvent.bind(this));
3698   - break;
3699   - }
3700   - }
3701   - }
3702   -});
3703   -
3704   -Form.Element.EventObserver = Class.create(Abstract.EventObserver, {
3705   - getValue: function() {
3706   - return Form.Element.getValue(this.element);
3707   - }
3708   -});
3709   -
3710   -Form.EventObserver = Class.create(Abstract.EventObserver, {
3711   - getValue: function() {
3712   - return Form.serialize(this.element);
3713   - }
3714   -});
3715   -if (!window.Event) var Event = { };
3716   -
3717   -Object.extend(Event, {
3718   - KEY_BACKSPACE: 8,
3719   - KEY_TAB: 9,
3720   - KEY_RETURN: 13,
3721   - KEY_ESC: 27,
3722   - KEY_LEFT: 37,
3723   - KEY_UP: 38,
3724   - KEY_RIGHT: 39,
3725   - KEY_DOWN: 40,
3726   - KEY_DELETE: 46,
3727   - KEY_HOME: 36,
3728   - KEY_END: 35,
3729   - KEY_PAGEUP: 33,
3730   - KEY_PAGEDOWN: 34,
3731   - KEY_INSERT: 45,
3732   -
3733   - cache: { },
3734   -
3735   - relatedTarget: function(event) {
3736   - var element;
3737   - switch(event.type) {
3738   - case 'mouseover': element = event.fromElement; break;
3739   - case 'mouseout': element = event.toElement; break;
3740   - default: return null;
3741   - }
3742   - return Element.extend(element);
3743   - }
3744   -});
3745   -
3746   -Event.Methods = (function() {
3747   - var isButton;
3748   -
3749   - if (Prototype.Browser.IE) {
3750   - var buttonMap = { 0: 1, 1: 4, 2: 2 };
3751   - isButton = function(event, code) {
3752   - return event.button == buttonMap[code];
3753   - };
3754   -
3755   - } else if (Prototype.Browser.WebKit) {
3756   - isButton = function(event, code) {
3757   - switch (code) {
3758   - case 0: return event.which == 1 && !event.metaKey;
3759   - case 1: return event.which == 1 && event.metaKey;
3760   - default: return false;
3761   - }
3762   - };
3763   -
3764   - } else {
3765   - isButton = function(event, code) {
3766   - return event.which ? (event.which === code + 1) : (event.button === code);
3767   - };
3768   - }
3769   -
3770   - return {
3771   - isLeftClick: function(event) { return isButton(event, 0) },
3772   - isMiddleClick: function(event) { return isButton(event, 1) },
3773   - isRightClick: function(event) { return isButton(event, 2) },
3774   -
3775   - element: function(event) {
3776   - var node = Event.extend(event).target;
3777   - return Element.extend(node.nodeType == Node.TEXT_NODE ? node.parentNode : node);
3778   - },
3779   -
3780   - findElement: function(event, expression) {
3781   - var element = Event.element(event);
3782   - if (!expression) return element;
3783   - var elements = [element].concat(element.ancestors());
3784   - return Selector.findElement(elements, expression, 0);
3785   - },
3786   -
3787   - pointer: function(event) {
3788   - return {
3789   - x: event.pageX || (event.clientX +
3790   - (document.documentElement.scrollLeft || document.body.scrollLeft)),
3791   - y: event.pageY || (event.clientY +
3792   - (document.documentElement.scrollTop || document.body.scrollTop))
3793   - };
3794   - },
3795   -
3796   - pointerX: function(event) { return Event.pointer(event).x },
3797   - pointerY: function(event) { return Event.pointer(event).y },
3798   -
3799   - stop: function(event) {
3800   - Event.extend(event);
3801   - event.preventDefault();
3802   - event.stopPropagation();
3803   - event.stopped = true;
3804   - }
3805   - };
3806   -})();
3807   -
3808   -Event.extend = (function() {
3809   - var methods = Object.keys(Event.Methods).inject({ }, function(m, name) {
3810   - m[name] = Event.Methods[name].methodize();
3811   - return m;
3812   - });
3813   -
3814   - if (Prototype.Browser.IE) {
3815   - Object.extend(methods, {
3816   - stopPropagation: function() { this.cancelBubble = true },
3817   - preventDefault: function() { this.returnValue = false },
3818   - inspect: function() { return "[object Event]" }
3819   - });
3820   -
3821   - return function(event) {
3822   - if (!event) return false;
3823   - if (event._extendedByPrototype) return event;
3824   -
3825   - event._extendedByPrototype = Prototype.emptyFunction;
3826   - var pointer = Event.pointer(event);
3827   - Object.extend(event, {
3828   - target: event.srcElement,
3829   - relatedTarget: Event.relatedTarget(event),
3830   - pageX: pointer.x,
3831   - pageY: pointer.y
3832   - });
3833   - return Object.extend(event, methods);
3834   - };
3835   -
3836   - } else {
3837   - Event.prototype = Event.prototype || document.createEvent("HTMLEvents").__proto__;
3838   - Object.extend(Event.prototype, methods);
3839   - return Prototype.K;
3840   - }
3841   -})();
3842   -
3843   -Object.extend(Event, (function() {
3844   - var cache = Event.cache;
3845   -
3846   - function getEventID(element) {
3847   - if (element._prototypeEventID) return element._prototypeEventID[0];
3848   - arguments.callee.id = arguments.callee.id || 1;
3849   - return element._prototypeEventID = [++arguments.callee.id];
3850   - }
3851   -
3852   - function getDOMEventName(eventName) {
3853   - if (eventName && eventName.include(':')) return "dataavailable";
3854   - return eventName;
3855   - }
3856   -
3857   - function getCacheForID(id) {
3858   - return cache[id] = cache[id] || { };
3859   - }
3860   -
3861   - function getWrappersForEventName(id, eventName) {
3862   - var c = getCacheForID(id);
3863   - return c[eventName] = c[eventName] || [];
3864   - }
3865   -
3866   - function createWrapper(element, eventName, handler) {
3867   - var id = getEventID(element);
3868   - var c = getWrappersForEventName(id, eventName);
3869   - if (c.pluck("handler").include(handler)) return false;
3870   -
3871   - var wrapper = function(event) {
3872   - if (!Event || !Event.extend ||
3873   - (event.eventName && event.eventName != eventName))
3874   - return false;
3875   -
3876   - Event.extend(event);
3877   - handler.call(element, event);
3878   - };
3879   -
3880   - wrapper.handler = handler;
3881   - c.push(wrapper);
3882   - return wrapper;
3883   - }
3884   -
3885   - function findWrapper(id, eventName, handler) {
3886   - var c = getWrappersForEventName(id, eventName);
3887   - return c.find(function(wrapper) { return wrapper.handler == handler });
3888   - }
3889   -
3890   - function destroyWrapper(id, eventName, handler) {
3891   - var c = getCacheForID(id);
3892   - if (!c[eventName]) return false;
3893   - c[eventName] = c[eventName].without(findWrapper(id, eventName, handler));
3894   - }
3895   -
3896   - function destroyCache() {
3897   - for (var id in cache)
3898   - for (var eventName in cache[id])
3899   - cache[id][eventName] = null;
3900   - }
3901   -
3902   - if (window.attachEvent) {
3903   - window.attachEvent("onunload", destroyCache);
3904   - }
3905   -
3906   - return {
3907   - observe: function(element, eventName, handler) {
3908   - element = $(element);
3909   - var name = getDOMEventName(eventName);
3910   -
3911   - var wrapper = createWrapper(element, eventName, handler);
3912   - if (!wrapper) return element;
3913   -
3914   - if (element.addEventListener) {
3915   - element.addEventListener(name, wrapper, false);
3916   - } else {
3917   - element.attachEvent("on" + name, wrapper);
3918   - }
3919   -
3920   - return element;
3921   - },
3922   -
3923   - stopObserving: function(element, eventName, handler) {
3924   - element = $(element);
3925   - var id = getEventID(element), name = getDOMEventName(eventName);
3926   -
3927   - if (!handler && eventName) {
3928   - getWrappersForEventName(id, eventName).each(function(wrapper) {
3929   - element.stopObserving(eventName, wrapper.handler);
3930   - });
3931   - return element;
3932   -
3933   - } else if (!eventName) {
3934   - Object.keys(getCacheForID(id)).each(function(eventName) {
3935   - element.stopObserving(eventName);
3936   - });
3937   - return element;
3938   - }
3939   -
3940   - var wrapper = findWrapper(id, eventName, handler);
3941   - if (!wrapper) return element;
3942   -
3943   - if (element.removeEventListener) {
3944   - element.removeEventListener(name, wrapper, false);
3945   - } else {
3946   - element.detachEvent("on" + name, wrapper);
3947   - }
3948   -
3949   - destroyWrapper(id, eventName, handler);
3950   -
3951   - return element;
3952   - },
3953   -
3954   - fire: function(element, eventName, memo) {
3955   - element = $(element);
3956   - if (element == document && document.createEvent && !element.dispatchEvent)
3957   - element = document.documentElement;
3958   -
3959   - var event;
3960   - if (document.createEvent) {
3961   - event = document.createEvent("HTMLEvents");
3962   - event.initEvent("dataavailable", true, true);
3963   - } else {
3964   - event = document.createEventObject();
3965   - event.eventType = "ondataavailable";
3966   - }
3967   -
3968   - event.eventName = eventName;
3969   - event.memo = memo || { };
3970   -
3971   - if (document.createEvent) {
3972   - element.dispatchEvent(event);
3973   - } else {
3974   - element.fireEvent(event.eventType, event);
3975   - }
3976   -
3977   - return Event.extend(event);
3978   - }
3979   - };
3980   -})());
3981   -
3982   -Object.extend(Event, Event.Methods);
3983   -
3984   -Element.addMethods({
3985   - fire: Event.fire,
3986   - observe: Event.observe,
3987   - stopObserving: Event.stopObserving
3988   -});
3989   -
3990   -Object.extend(document, {
3991   - fire: Element.Methods.fire.methodize(),
3992   - observe: Element.Methods.observe.methodize(),
3993   - stopObserving: Element.Methods.stopObserving.methodize(),
3994   - loaded: false
3995   -});
3996   -
3997   -(function() {
3998   - /* Support for the DOMContentLoaded event is based on work by Dan Webb,
3999   - Matthias Miller, Dean Edwards and John Resig. */
4000   -
4001   - var timer;
4002   -
4003   - function fireContentLoadedEvent() {
4004   - if (document.loaded) return;
4005   - if (timer) window.clearInterval(timer);
4006   - document.fire("dom:loaded");
4007   - document.loaded = true;
4008   - }
4009   -
4010   - if (document.addEventListener) {
4011   - if (Prototype.Browser.WebKit) {
4012   - timer = window.setInterval(function() {
4013   - if (/loaded|complete/.test(document.readyState))
4014   - fireContentLoadedEvent();
4015   - }, 0);
4016   -
4017   - Event.observe(window, "load", fireContentLoadedEvent);
4018   -
4019   - } else {
4020   - document.addEventListener("DOMContentLoaded",
4021   - fireContentLoadedEvent, false);
4022   - }
4023   -
4024   - } else {
4025   - document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");
4026   - $("__onDOMContentLoaded").onreadystatechange = function() {
4027   - if (this.readyState == "complete") {
4028   - this.onreadystatechange = null;
4029   - fireContentLoadedEvent();
4030   - }
4031   - };
4032   - }
4033   -})();
4034   -/*------------------------------- DEPRECATED -------------------------------*/
4035   -
4036   -Hash.toQueryString = Object.toQueryString;
4037   -
4038   -var Toggle = { display: Element.toggle };
4039   -
4040   -Element.Methods.childOf = Element.Methods.descendantOf;
4041   -
4042   -var Insertion = {
4043   - Before: function(element, content) {
4044   - return Element.insert(element, {before:content});
4045   - },
4046   -
4047   - Top: function(element, content) {
4048   - return Element.insert(element, {top:content});
4049   - },
4050   -
4051   - Bottom: function(element, content) {
4052   - return Element.insert(element, {bottom:content});
4053   - },
4054   -
4055   - After: function(element, content) {
4056   - return Element.insert(element, {after:content});
4057   - }
4058   -};
4059   -
4060   -var $continue = new Error('"throw $continue" is deprecated, use "return" instead');
4061   -
4062   -// This should be moved to script.aculo.us; notice the deprecated methods
4063   -// further below, that map to the newer Element methods.
4064   -var Position = {
4065   - // set to true if needed, warning: firefox performance problems
4066   - // NOT neeeded for page scrolling, only if draggable contained in
4067   - // scrollable elements
4068   - includeScrollOffsets: false,
4069   -
4070   - // must be called before calling withinIncludingScrolloffset, every time the
4071   - // page is scrolled
4072   - prepare: function() {
4073   - this.deltaX = window.pageXOffset
4074   - || document.documentElement.scrollLeft
4075   - || document.body.scrollLeft
4076   - || 0;
4077   - this.deltaY = window.pageYOffset
4078   - || document.documentElement.scrollTop
4079   - || document.body.scrollTop
4080   - || 0;
4081   - },
4082   -
4083   - // caches x/y coordinate pair to use with overlap
4084   - within: function(element, x, y) {
4085   - if (this.includeScrollOffsets)
4086   - return this.withinIncludingScrolloffsets(element, x, y);
4087   - this.xcomp = x;
4088   - this.ycomp = y;
4089   - this.offset = Element.cumulativeOffset(element);
4090   -
4091   - return (y >= this.offset[1] &&
4092   - y < this.offset[1] + element.offsetHeight &&
4093   - x >= this.offset[0] &&
4094   - x < this.offset[0] + element.offsetWidth);
4095   - },
4096   -
4097   - withinIncludingScrolloffsets: function(element, x, y) {
4098   - var offsetcache = Element.cumulativeScrollOffset(element);
4099   -
4100   - this.xcomp = x + offsetcache[0] - this.deltaX;
4101   - this.ycomp = y + offsetcache[1] - this.deltaY;
4102   - this.offset = Element.cumulativeOffset(element);
4103   -
4104   - return (this.ycomp >= this.offset[1] &&
4105   - this.ycomp < this.offset[1] + element.offsetHeight &&
4106   - this.xcomp >= this.offset[0] &&
4107   - this.xcomp < this.offset[0] + element.offsetWidth);
4108   - },
4109   -
4110   - // within must be called directly before
4111   - overlap: function(mode, element) {
4112   - if (!mode) return 0;
4113   - if (mode == 'vertical')
4114   - return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
4115   - element.offsetHeight;
4116   - if (mode == 'horizontal')
4117   - return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
4118   - element.offsetWidth;
4119   - },
4120   -
4121   - // Deprecation layer -- use newer Element methods now (1.5.2).
4122   -
4123   - cumulativeOffset: Element.Methods.cumulativeOffset,
4124   -
4125   - positionedOffset: Element.Methods.positionedOffset,
4126   -
4127   - absolutize: function(element) {
4128   - Position.prepare();
4129   - return Element.absolutize(element);
4130   - },
4131   -
4132   - relativize: function(element) {
4133   - Position.prepare();
4134   - return Element.relativize(element);
4135   - },
4136   -
4137   - realOffset: Element.Methods.cumulativeScrollOffset,
4138   -
4139   - offsetParent: Element.Methods.getOffsetParent,
4140   -
4141   - page: Element.Methods.viewportOffset,
4142   -
4143   - clone: function(source, target, options) {
4144   - options = options || { };
4145   - return Element.clonePosition(target, source, options);
4146   - }
4147   -};
4148   -
4149   -/*--------------------------------------------------------------------------*/
4150   -
4151   -if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){
4152   - function iter(name) {
4153   - return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]";
4154   - }
4155   -
4156   - instanceMethods.getElementsByClassName = Prototype.BrowserFeatures.XPath ?
4157   - function(element, className) {
4158   - className = className.toString().strip();
4159   - var cond = /\s/.test(className) ? $w(className).map(iter).join('') : iter(className);
4160   - return cond ? document._getElementsByXPath('.//*' + cond, element) : [];
4161   - } : function(element, className) {
4162   - className = className.toString().strip();
4163   - var elements = [], classNames = (/\s/.test(className) ? $w(className) : null);
4164   - if (!classNames && !className) return elements;
4165   -
4166   - var nodes = $(element).getElementsByTagName('*');
4167   - className = ' ' + className + ' ';
4168   -
4169   - for (var i = 0, child, cn; child = nodes[i]; i++) {
4170   - if (child.className && (cn = ' ' + child.className + ' ') && (cn.include(className) ||
4171   - (classNames && classNames.all(function(name) {
4172   - return !name.toString().blank() && cn.include(' ' + name + ' ');
4173   - }))))
4174   - elements.push(Element.extend(child));
4175   - }
4176   - return elements;
4177   - };
4178   -
4179   - return function(className, parentElement) {
4180   - return $(parentElement || document.body).getElementsByClassName(className);
4181   - };
4182   -}(Element.Methods);
4183   -
4184   -/*--------------------------------------------------------------------------*/
4185   -
4186   -Element.ClassNames = Class.create();
4187   -Element.ClassNames.prototype = {
4188   - initialize: function(element) {
4189   - this.element = $(element);
4190   - },
4191   -
4192   - _each: function(iterator) {
4193   - this.element.className.split(/\s+/).select(function(name) {
4194   - return name.length > 0;
4195   - })._each(iterator);
4196   - },
4197   -
4198   - set: function(className) {
4199   - this.element.className = className;
4200   - },
4201   -
4202   - add: function(classNameToAdd) {
4203   - if (this.include(classNameToAdd)) return;
4204   - this.set($A(this).concat(classNameToAdd).join(' '));
4205   - },
4206   -
4207   - remove: function(classNameToRemove) {
4208   - if (!this.include(classNameToRemove)) return;
4209   - this.set($A(this).without(classNameToRemove).join(' '));
4210   - },
4211   -
4212   - toString: function() {
4213   - return $A(this).join(' ');
4214   - }
4215   -};
4216   -
4217   -Object.extend(Element.ClassNames.prototype, Enumerable);
4218   -
4219   -/*--------------------------------------------------------------------------*/
4220   -
4221   -Element.addMethods();
4222 0 \ No newline at end of file
plugins/thumbnails/resources/lightbox/js/scriptaculous.js deleted
1   -// script.aculo.us scriptaculous.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
2   -
3   -// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
4   -//
5   -// Permission is hereby granted, free of charge, to any person obtaining
6   -// a copy of this software and associated documentation files (the
7   -// "Software"), to deal in the Software without restriction, including
8   -// without limitation the rights to use, copy, modify, merge, publish,
9   -// distribute, sublicense, and/or sell copies of the Software, and to
10   -// permit persons to whom the Software is furnished to do so, subject to
11   -// the following conditions:
12   -//
13   -// The above copyright notice and this permission notice shall be
14   -// included in all copies or substantial portions of the Software.
15   -//
16   -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17   -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18   -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19   -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20   -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21   -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22   -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23   -//
24   -// For details, see the script.aculo.us web site: http://script.aculo.us/
25   -
26   -var Scriptaculous = {
27   - Version: '1.8.1',
28   - require: function(libraryName) {
29   - // inserting via DOM fails in Safari 2.0, so brute force approach
30   - document.write('<script type="text/javascript" src="'+libraryName+'"><\/script>');
31   - },
32   - REQUIRED_PROTOTYPE: '1.6.0',
33   - load: function() {
34   - function convertVersionString(versionString){
35   - var r = versionString.split('.');
36   - return parseInt(r[0])*100000 + parseInt(r[1])*1000 + parseInt(r[2]);
37   - }
38   -
39   - if((typeof Prototype=='undefined') ||
40   - (typeof Element == 'undefined') ||
41   - (typeof Element.Methods=='undefined') ||
42   - (convertVersionString(Prototype.Version) <
43   - convertVersionString(Scriptaculous.REQUIRED_PROTOTYPE)))
44   - throw("script.aculo.us requires the Prototype JavaScript framework >= " +
45   - Scriptaculous.REQUIRED_PROTOTYPE);
46   -
47   - $A(document.getElementsByTagName("script")).findAll( function(s) {
48   - return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))
49   - }).each( function(s) {
50   - var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,'');
51   - var includes = s.src.match(/\?.*load=([a-z,]*)/);
52   - (includes ? includes[1] : 'builder,effects,dragdrop,controls,slider,sound').split(',').each(
53   - function(include) { Scriptaculous.require(path+include+'.js') });
54   - });
55   - }
56   -}
57   -
58   -Scriptaculous.load();
59 0 \ No newline at end of file
plugins/thumbnails/templates/thumbnail_viewlet.smarty
  1 +{literal}
  2 +<script type="text/javascript">
  3 + $(document).ready(function(){
  4 + $('#thumb a').lightBox();
  5 + });
  6 +</script>
  7 +{/literal}
1 8 <div class="thumb-shadow">
2 9 <div>
3 10 {if $url && $modal}
  11 + <div id="thumb" class="thumb">
4 12 <a href='{$url}' rel="lightbox" title="{$title}">
  13 + <img src="{$thumbnail}" {if $height}height="{$height}"{/if} class="lightbox_window"/>
  14 + </div>
5 15 {else}
6 16 <a href='{$url}' target='_blank'>
  17 + <img src="{$thumbnail}" {if $height}height="{$height}"{/if}/>
7 18 {/if}
8   - <img src="{$thumbnail}" {if $height}height="{$height}"{/if} />
  19 +
9 20 {if $url}
10 21 </a>
11 22 {/if}
12 23 </div>
13 24 -</div>
  25 +</div>
14 26 \ No newline at end of file
... ...
plugins/thumbnails/thumbnails.php
... ... @@ -280,15 +280,14 @@ class ThumbnailViewlet extends KTDocumentViewlet {
280 280 require_once KTPluginUtil::getPluginPath('instaview.processor.plugin') . 'instaViewLinkAction.php';
281 281 $ivLinkAction = new instaViewLinkAction();
282 282 $modal = $ivLinkAction->isImage($documentId);
283   - if($modal) // If it requires a modal window, it only needs the image content
  283 + if($modal) { // If it requires a modal window, it only needs the document content
284 284 $url = $ivLinkAction->getViewLink($documentId, 'document_content');
285   - else // Needs the file content
  285 + $this->loadLightBox(); // Load lightbox effects
  286 + } else { // Needs the file content
286 287 $url = $ivLinkAction->getViewLink($documentId, 'document');
  288 + }
287 289 $title = $ivLinkAction->getName($documentId);
288 290 }
289   - if($modal) {
290   - $this->loadLightBox(); // Load lightbox effects
291   - }
292 291 // Get the url to the thumbnail and render it
293 292 // Ensure url has correct slashes
294 293 $sHostPath = KTUtil::kt_url();
... ... @@ -314,15 +313,10 @@ class ThumbnailViewlet extends KTDocumentViewlet {
314 313  
315 314 function loadLightBox() {
316 315 global $main;
317   - // force forward slash, since we are ultimately treating/using the outcome this as a URL
318   - $replace = str_replace('\\', '/', KT_DIR) . '/';
319   - $dir = str_replace('\\', '/', dirname(__FILE__));
320   -
321   - $linkPath = str_replace($replace, '', $dir);
322   - $main->requireJSResource($linkPath.'/resources/lightbox/js/prototype.js');
323   - $main->requireJSResource($linkPath.'/resources/lightbox/js/scriptaculous.js');
324   - $main->requireJSResource($linkPath.'/resources/lightbox/js/lightbox.js');
325   - $main->requireCSSResource($linkPath.'/resources/lightbox/css/lightbox.css');
  316 + // jQuery and lightbox
  317 + $main->requireJSResource('resources/lightbox/js/jquery.js');
  318 + $main->requireJSResource('resources/lightbox/js/jquery.lightbox-0.5.pack.js');
  319 + $main->requireCSSResource('resources/lightbox/css/lightbox.css');
326 320 }
327 321  
328 322 // determines whether the image exists and returns the maximum aspect to display;
... ...
resources/lightbox/css/lightbox.css 0 → 100644
  1 +/**
  2 + * jQuery lightBox plugin
  3 + * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
  4 + * and adapted to me for use like a plugin from jQuery.
  5 + * @name jquery-lightbox-0.5.css
  6 + * @author Leandro Vieira Pinho - http://leandrovieira.com
  7 + * @version 0.5
  8 + * @date April 11, 2008
  9 + * @category jQuery plugin
  10 + * @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com)
  11 + * @license CC Attribution-No Derivative Works 2.5 Brazil - http://creativecommons.org/licenses/by-nd/2.5/br/deed.en_US
  12 + * @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin
  13 + */
  14 +#jquery-overlay {
  15 + position: absolute;
  16 + top: 0;
  17 + left: 0;
  18 + z-index: 90;
  19 + width: 100%;
  20 + height: 500px;
  21 +}
  22 +#jquery-lightbox {
  23 + position: absolute;
  24 + top: 0;
  25 + left: 0;
  26 + width: 100%;
  27 + z-index: 100;
  28 + text-align: center;
  29 + line-height: 0;
  30 +}
  31 +#jquery-lightbox a img { border: none; }
  32 +#lightbox-container-image-box {
  33 + position: relative;
  34 + background-color: #fff;
  35 + width: 250px;
  36 + height: 250px;
  37 + margin: 0 auto;
  38 +}
  39 +#lightbox-container-image { padding: 10px; }
  40 +#lightbox-loading {
  41 + position: absolute;
  42 + top: 40%;
  43 + left: 0%;
  44 + height: 25%;
  45 + width: 100%;
  46 + text-align: center;
  47 + line-height: 0;
  48 +}
  49 +#lightbox-nav {
  50 + position: absolute;
  51 + top: 0;
  52 + left: 0;
  53 + height: 100%;
  54 + width: 100%;
  55 + z-index: 10;
  56 +}
  57 +#lightbox-container-image-box > #lightbox-nav { left: 0; }
  58 +#lightbox-nav a { outline: none;}
  59 +#lightbox-nav-btnPrev, #lightbox-nav-btnNext {
  60 + width: 49%;
  61 + height: 100%;
  62 + zoom: 1;
  63 + display: block;
  64 +}
  65 +#lightbox-nav-btnPrev {
  66 + left: 0;
  67 + float: left;
  68 +}
  69 +#lightbox-nav-btnNext {
  70 + right: 0;
  71 + float: right;
  72 +}
  73 +#lightbox-container-image-data-box {
  74 + font: 10px Verdana, Helvetica, sans-serif;
  75 + background-color: #fff;
  76 + margin: 0 auto;
  77 + line-height: 1.4em;
  78 + overflow: auto;
  79 + width: 100%;
  80 + padding: 0 10px 0;
  81 +}
  82 +#lightbox-container-image-data {
  83 + padding: 0 10px;
  84 + color: #666;
  85 +}
  86 +#lightbox-container-image-data #lightbox-image-details {
  87 + width: 70%;
  88 + float: left;
  89 + text-align: left;
  90 +}
  91 +#lightbox-image-details-caption { font-weight: bold; }
  92 +#lightbox-image-details-currentNumber {
  93 + display: block;
  94 + clear: left;
  95 + padding-bottom: 1.0em;
  96 +}
  97 +#lightbox-secNav-btnClose {
  98 + width: 66px;
  99 + float: right;
  100 + padding-bottom: 0.7em;
  101 +}
0 102 \ No newline at end of file
... ...
resources/lightbox/images/lightbox-blank.gif 0 → 100644

43 Bytes

resources/lightbox/images/lightbox-btn-close.gif 0 → 100644

700 Bytes

resources/lightbox/images/lightbox-btn-next.gif 0 → 100644

812 Bytes

resources/lightbox/images/lightbox-btn-prev.gif 0 → 100644

832 Bytes

resources/lightbox/images/lightbox-ico-loading.gif 0 → 100644

3.9 KB

resources/lightbox/js/jquery.js 0 → 100644
  1 +/*
  2 + * jQuery 1.2.3 - New Wave Javascript
  3 + *
  4 + * Copyright (c) 2008 John Resig (jquery.com)
  5 + * Dual licensed under the MIT (MIT-LICENSE.txt)
  6 + * and GPL (GPL-LICENSE.txt) licenses.
  7 + *
  8 + * $Date: 2008-02-06 00:21:25 -0500 (Wed, 06 Feb 2008) $
  9 + * $Rev: 4663 $
  10 + */
  11 +(function(){if(window.jQuery)var _jQuery=window.jQuery;var jQuery=window.jQuery=function(selector,context){return new jQuery.prototype.init(selector,context);};if(window.$)var _$=window.$;window.$=jQuery;var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/;var isSimple=/^.[^:#\[\.]*$/;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}else if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem)if(elem.id!=match[3])return jQuery().find(selector);else{this[0]=elem;this.length=1;return this;}else
  12 +selector=[];}}else
  13 +return new jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return new jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(selector.constructor==Array&&selector||(selector.jquery||selector.length&&selector!=window&&!selector.nodeType&&selector[0]!=undefined&&selector[0].nodeType)&&jQuery.makeArray(selector)||[selector]);},jquery:"1.2.3",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;this.each(function(i){if(this==elem)ret=i;});return ret;},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value==undefined)return this.length&&jQuery[type||"attr"](this[0],name)||undefined;else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])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,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else
  14 +return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;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 ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else
  15 +selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return!selector?this:this.pushStack(jQuery.merge(this.get(),selector.constructor==String?jQuery(selector).get():selector.length!=undefined&&(!selector.nodeName||jQuery.nodeName(selector,"form"))?selector:[selector]));},is:function(selector){return selector?jQuery.multiFilter(selector,this).length>0:false;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else
  16 +return(this[0].value||"").replace(/\r/g,"");}return undefined;}return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=value.constructor==Array?value:[value];jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else
  17 +this.value=value;});},html:function(value){return value==undefined?(this.length?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value==null){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data==undefined&&this.length)data=jQuery.data(this[0],key);return data==null&&parts[1]?this.data(parts[0]):data;}else
  18 +return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script")){scripts=scripts.add(elem);}else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.prototype.init.prototype=jQuery.prototype;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else
  19 +jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==1){target=this;i=0;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){if(target===options[name])continue;if(deep&&options[name]&&typeof options[name]=="object"&&target[name]&&!options[name].nodeType)target[name]=jQuery.extend(target[name],options[name]);else if(options[name]!=undefined)target[name]=options[name];}return target;};var expando="jQuery"+(new Date()).getTime(),uuid=0,windowData={};var exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i;jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/function/i.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else
  20 +script.appendChild(document.createTextNode(data));head.appendChild(script);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!=undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){if(args){if(object.length==undefined){for(var name in object)if(callback.apply(object[name],args)===false)break;}else
  21 +for(var i=0,length=object.length;i<length;i++)if(callback.apply(object[i],args)===false)break;}else{if(object.length==undefined){for(var name in object)if(callback.call(object[name],name,object[name])===false)break;}else
  22 +for(var i=0,length=object.length,value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else
  23 +jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret;function color(elem){if(!jQuery.browser.safari)return false;var ret=document.defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(elem.style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=elem.style.outline;elem.style.outline="0 solid black";elem.style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&elem.style&&elem.style[name])ret=elem.style[name];else if(document.defaultView&&document.defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var getComputedStyle=document.defaultView.getComputedStyle(elem,null);if(getComputedStyle&&!color(elem))ret=getComputedStyle.getPropertyValue(name);else{var swap=[],stack=[];for(var a=elem;a&&color(a);a=a.parentNode)stack.unshift(a);for(var i=0;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(getComputedStyle&&getComputedStyle.getPropertyValue(name))||"";for(var i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var style=elem.style.left,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(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem=elem.toString();if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else
  24 +ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var fix=jQuery.isXMLDoc(elem)?{}:jQuery.props;if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;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;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);}else{if(name=="opacity"&&jQuery.browser.msie){if(value!=undefined){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseFloat(value).toString()=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100).toString():"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(value!=undefined)elem[name]=value;return elem[name];}},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(typeof array!="array")for(var i=0,length=array.length;i<length;i++)ret.push(array[i]);else
  25 +ret=array.slice(0);return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]==elem)return i;return-1;},merge:function(first,second){if(jQuery.browser.msie){for(var i=0;second[i];i++)if(second[i].nodeType!=8)first.push(second[i]);}else
  26 +for(var i=0;second[i];i++)first.push(second[i]);return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv&&callback(elems[i],i)||inv&&!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!==null&&value!=undefined){if(value.constructor!=Array)value=[value];ret=ret.concat(value);}}return ret;}});var userAgent=navigator.userAgent.toLowerCase();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({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",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",selectedIndex:"selectedIndex",defaultValue:"defaultValue",tagName:"tagName",nodeName:"nodeName"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"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:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,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){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false;var re=quickChild;var m=re.exec(t);if(m){nodeName=m[1].toUpperCase();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))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 merge={};nodeName=m[2].toUpperCase();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){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];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(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();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;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){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);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;}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])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-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==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}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;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval!=undefined)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=function(){return fn.apply(this,arguments);};handler.data=data;handler.guid=fn.guid;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){var val;if(typeof jQuery=="undefined"||jQuery.event.triggered)return val;val=jQuery.event.handle.apply(arguments.callee.elem,arguments);return val;});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else
  27 +for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data||[]);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event)data.unshift(this.fix({type:type,target:elem}));data[0].type=type;if(exclusive)data[0].exclusive=true;if(jQuery.isFunction(jQuery.data(elem,"handle")))val=jQuery.data(elem,"handle").apply(elem,data);if(!fn&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val;event=jQuery.event.fix(event||window.event||{});var parts=event.type.split(".");event.type=parts[0];var handlers=jQuery.data(this,"events")&&jQuery.data(this,"events")[event.type],args=Array.prototype.slice.call(arguments,1);args.unshift(event);for(var j in handlers){var handler=handlers[j];args[0].handler=handler;args[0].data=handler.data;if(!parts[1]&&!event.exclusive||handler.type==parts[1]){var ret=handler.apply(this,args);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}if(jQuery.browser.msie)event.target=event.preventDefault=event.stopPropagation=event.handler=event.data=null;return val;},fix:function(event){var originalEvent=event;event=jQuery.extend({},originalEvent);event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=originalEvent.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;arguments[0].type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;arguments[0].type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};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);return undefined;},toggle:function(){var args=arguments;return this.click(function(event){this.lastToggle=0==this.lastToggle?1:0;event.preventDefault();return args[this.lastToggle].apply(this,arguments)||false;});},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else
  28 +jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.apply(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}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,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});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(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});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();}});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){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,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){var jsonp,jsre=/=\?(&|$)/g,status,data;s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);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";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&s.type.toLowerCase()=="get"){var ts=(new Date()).getTime();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&s.type.toLowerCase()=="get"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");if((!s.url.indexOf("http")||!s.url.indexOf("//"))&&s.dataType=="script"&&s.type.toLowerCase()=="get"){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;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);return undefined;}var requestDone=false;var xml=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();xml.open(s.type,s.url,s.async,s.username,s.password);try{if(s.data)xml.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xml.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xml.setRequestHeader("X-Requested-With","XMLHttpRequest");xml.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend)s.beforeSend(xml);if(s.global)jQuery.event.trigger("ajaxSend",[xml,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xml&&(xml.readyState==4||isTimeout=="timeout")){requestDone=true;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"){try{data=jQuery.httpData(xml,s.dataType);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xml.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else
  29 +jQuery.handleError(s,xml,status);complete();if(s.async)xml=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xml){xml.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xml.send(s.data);}catch(e){jQuery.handleError(s,xml,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xml,s]);}function complete(){if(s.complete)s.complete(xml,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xml,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xml;},handleError:function(s,xml,status,e){if(s.error)s.error(xml,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xml,s,e]);},active:0,httpSuccess:function(r){try{return!r.status&&location.protocol=="file:"||(r.status>=200&&r.status<300)||r.status==304||r.status==1223||jQuery.browser.safari&&r.status==undefined;}catch(e){}return false;},httpNotModified:function(xml,url){try{var xmlRes=xml.getResponseHeader("Last-Modified");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(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else
  30 +for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else
  31 +s.push(encodeURIComponent(j)+"="+encodeURIComponent(a[j]));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||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).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");this.style.display="none";}).end();},_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 optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall);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"){opt.display=jQuery.css(this,"display");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";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else
  32 +e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){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(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(!elem)return undefined;type=type||"fx";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;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)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:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={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);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},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(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=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(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=(new Date()).getTime();if(gotoEnd||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){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";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(done&&jQuery.isFunction(this.options.complete))this.options.complete.apply(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;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);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;}};jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),fixed=jQuery.css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&jQuery.css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(jQuery.css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&jQuery.css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||jQuery.css(offsetChild,"position")=="absolute"))||(mozilla&&jQuery.css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l)||0;top+=parseInt(t)||0;}return results;};})();
0 33 \ No newline at end of file
... ...
resources/lightbox/js/jquery.lightbox-0.5.pack.js 0 → 100644
  1 +/**
  2 + * jQuery lightBox plugin
  3 + * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
  4 + * and adapted to me for use like a plugin from jQuery.
  5 + * @name jquery-lightbox-0.5.js
  6 + * @author Leandro Vieira Pinho - http://leandrovieira.com
  7 + * @version 0.5
  8 + * @date April 11, 2008
  9 + * @category jQuery plugin
  10 + * @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com)
  11 + * @license CC Attribution-No Derivative Works 2.5 Brazil - http://creativecommons.org/licenses/by-nd/2.5/br/deed.en_US
  12 + * @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin
  13 + */
  14 +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}('(6($){$.2N.3g=6(4){4=23.2H({2B:\'#34\',2g:0.8,1d:F,1M:\'18/5-33-Y.16\',1v:\'18/5-1u-2Q.16\',1E:\'18/5-1u-2L.16\',1W:\'18/5-1u-2I.16\',19:\'18/5-2F.16\',1f:10,2A:3d,2s:\'1j\',2o:\'32\',2j:\'c\',2f:\'p\',2d:\'n\',h:[],9:0},4);f I=N;6 20(){1X(N,I);u F}6 1X(1e,I){$(\'1U, 1S, 1R\').l({\'1Q\':\'2E\'});1O();4.h.B=0;4.9=0;7(I.B==1){4.h.1J(v 1m(1e.17(\'J\'),1e.17(\'2v\')))}j{36(f i=0;i<I.B;i++){4.h.1J(v 1m(I[i].17(\'J\'),I[i].17(\'2v\')))}}2n(4.h[4.9][0]!=1e.17(\'J\')){4.9++}D()}6 1O(){$(\'m\').31(\'<e g="q-13"></e><e g="q-5"><e g="5-s-b-w"><e g="5-s-b"><1w g="5-b"><e 2V="" g="5-k"><a J="#" g="5-k-V"></a><a J="#" g="5-k-X"></a></e><e g="5-Y"><a J="#" g="5-Y-29"><1w W="\'+4.1M+\'"></a></e></e></e><e g="5-s-b-T-w"><e g="5-s-b-T"><e g="5-b-A"><1i g="5-b-A-1t"></1i><1i g="5-b-A-1g"></1i></e><e g="5-1s"><a J="#" g="5-1s-22"><1w W="\'+4.1W+\'"></a></e></e></e></e>\');f z=1D();$(\'#q-13\').l({2K:4.2B,2J:4.2g,S:z[0],P:z[1]}).1V();f R=1p();$(\'#q-5\').l({1T:R[1]+(z[3]/10),1c:R[0]}).E();$(\'#q-13,#q-5\').C(6(){1a()});$(\'#5-Y-29,#5-1s-22\').C(6(){1a();u F});$(G).2G(6(){f z=1D();$(\'#q-13\').l({S:z[0],P:z[1]});f R=1p();$(\'#q-5\').l({1T:R[1]+(z[3]/10),1c:R[0]})})}6 D(){$(\'#5-Y\').E();7(4.1d){$(\'#5-b,#5-s-b-T-w,#5-b-A-1g\').1b()}j{$(\'#5-b,#5-k,#5-k-V,#5-k-X,#5-s-b-T-w,#5-b-A-1g\').1b()}f Q=v 1j();Q.1P=6(){$(\'#5-b\').2D(\'W\',4.h[4.9][0]);1N(Q.S,Q.P);Q.1P=6(){}};Q.W=4.h[4.9][0]};6 1N(1o,1r){f 1L=$(\'#5-s-b-w\').S();f 1K=$(\'#5-s-b-w\').P();f 1n=(1o+(4.1f*2));f 1y=(1r+(4.1f*2));f 1I=1L-1n;f 2z=1K-1y;$(\'#5-s-b-w\').3f({S:1n,P:1y},4.2A,6(){2y()});7((1I==0)&&(2z==0)){7($.3e.3c){1H(3b)}j{1H(3a)}}$(\'#5-s-b-T-w\').l({S:1o});$(\'#5-k-V,#5-k-X\').l({P:1r+(4.1f*2)})};6 2y(){$(\'#5-Y\').1b();$(\'#5-b\').1V(6(){2u();2t()});2r()};6 2u(){$(\'#5-s-b-T-w\').38(\'35\');$(\'#5-b-A-1t\').1b();7(4.h[4.9][1]){$(\'#5-b-A-1t\').2p(4.h[4.9][1]).E()}7(4.h.B>1){$(\'#5-b-A-1g\').2p(4.2s+\' \'+(4.9+1)+\' \'+4.2o+\' \'+4.h.B).E()}}6 2t(){$(\'#5-k\').E();$(\'#5-k-V,#5-k-X\').l({\'K\':\'1C M(\'+4.19+\') L-O\'});7(4.9!=0){7(4.1d){$(\'#5-k-V\').l({\'K\':\'M(\'+4.1v+\') 1c 15% L-O\'}).11().1k(\'C\',6(){4.9=4.9-1;D();u F})}j{$(\'#5-k-V\').11().2m(6(){$(N).l({\'K\':\'M(\'+4.1v+\') 1c 15% L-O\'})},6(){$(N).l({\'K\':\'1C M(\'+4.19+\') L-O\'})}).E().1k(\'C\',6(){4.9=4.9-1;D();u F})}}7(4.9!=(4.h.B-1)){7(4.1d){$(\'#5-k-X\').l({\'K\':\'M(\'+4.1E+\') 2l 15% L-O\'}).11().1k(\'C\',6(){4.9=4.9+1;D();u F})}j{$(\'#5-k-X\').11().2m(6(){$(N).l({\'K\':\'M(\'+4.1E+\') 2l 15% L-O\'})},6(){$(N).l({\'K\':\'1C M(\'+4.19+\') L-O\'})}).E().1k(\'C\',6(){4.9=4.9+1;D();u F})}}2k()}6 2k(){$(d).30(6(12){2i(12)})}6 1G(){$(d).11()}6 2i(12){7(12==2h){U=2Z.2e;1x=27}j{U=12.2e;1x=12.2Y}14=2X.2W(U).2U();7((14==4.2j)||(14==\'x\')||(U==1x)){1a()}7((14==4.2f)||(U==37)){7(4.9!=0){4.9=4.9-1;D();1G()}}7((14==4.2d)||(U==39)){7(4.9!=(4.h.B-1)){4.9=4.9+1;D();1G()}}}6 2r(){7((4.h.B-1)>4.9){2c=v 1j();2c.W=4.h[4.9+1][0]}7(4.9>0){2b=v 1j();2b.W=4.h[4.9-1][0]}}6 1a(){$(\'#q-5\').2a();$(\'#q-13\').2T(6(){$(\'#q-13\').2a()});$(\'1U, 1S, 1R\').l({\'1Q\':\'2S\'})}6 1D(){f o,r;7(G.1h&&G.28){o=G.26+G.2R;r=G.1h+G.28}j 7(d.m.25>d.m.24){o=d.m.2P;r=d.m.25}j{o=d.m.2O;r=d.m.24}f y,H;7(Z.1h){7(d.t.1l){y=d.t.1l}j{y=Z.26}H=Z.1h}j 7(d.t&&d.t.1A){y=d.t.1l;H=d.t.1A}j 7(d.m){y=d.m.1l;H=d.m.1A}7(r<H){1z=H}j{1z=r}7(o<y){1B=o}j{1B=y}21=v 1m(1B,1z,y,H);u 21};6 1p(){f o,r;7(Z.1Z){r=Z.1Z;o=Z.2M}j 7(d.t&&d.t.1F){r=d.t.1F;o=d.t.1Y}j 7(d.m){r=d.m.1F;o=d.m.1Y}2q=v 1m(o,r);u 2q};6 1H(2C){f 2x=v 2w();1q=2h;3h{f 1q=v 2w()}2n(1q-2x<2C)};u N.11(\'C\').C(20)}})(23);',62,204,'||||settings|lightbox|function|if||activeImage||image||document|div|var|id|imageArray||else|nav|css|body||xScroll||jquery|yScroll|container|documentElement|return|new|box||windowWidth|arrPageSizes|details|length|click|_set_image_to_view|show|false|window|windowHeight|jQueryMatchedObj|href|background|no|url|this|repeat|height|objImagePreloader|arrPageScroll|width|data|keycode|btnPrev|src|btnNext|loading|self||unbind|objEvent|overlay|key||gif|getAttribute|images|imageBlank|_finish|hide|left|fixedNavigation|objClicked|containerBorderSize|currentNumber|innerHeight|span|Image|bind|clientWidth|Array|intWidth|intImageWidth|___getPageScroll|curDate|intImageHeight|secNav|caption|btn|imageBtnPrev|img|escapeKey|intHeight|pageHeight|clientHeight|pageWidth|transparent|___getPageSize|imageBtnNext|scrollTop|_disable_keyboard_navigation|___pause|intDiffW|push|intCurrentHeight|intCurrentWidth|imageLoading|_resize_container_image_box|_set_interface|onload|visibility|select|object|top|embed|fadeIn|imageBtnClose|_start|scrollLeft|pageYOffset|_initialize|arrayPageSize|btnClose|jQuery|offsetHeight|scrollHeight|innerWidth||scrollMaxY|link|remove|objPrev|objNext|keyToNext|keyCode|keyToPrev|overlayOpacity|null|_keyboard_action|keyToClose|_enable_keyboard_navigation|right|hover|while|txtOf|html|arrayPageScroll|_preload_neighbor_images|txtImage|_set_navigation|_show_image_data|title|Date|date|_show_image|intDiffH|containerResizeSpeed|overlayBgColor|ms|attr|hidden|blank|resize|extend|close|opacity|backgroundColor|next|pageXOffset|fn|offsetWidth|scrollWidth|prev|scrollMaxX|visible|fadeOut|toLowerCase|style|fromCharCode|String|DOM_VK_ESCAPE|event|keydown|append|of|ico|000|fast|for||slideDown||100|250|msie|400|browser|animate|lightBox|do'.split('|'),0,{}))
0 15 \ No newline at end of file
... ...