1 (function(){
2 /*
3 * jQuery 1.2.6 - New Wave Javascript
4 *
5 * Copyright (c) 2008 John Resig (jquery.com)
6 * Dual licensed under the MIT (MIT-LICENSE.txt)
7 * and GPL (GPL-LICENSE.txt) licenses.
8 *
9 * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $
10 * $Rev: 5685 $
11 */
12
13
14 // Map over jQuery in case of overwrite
15 var _jQuery = window.jQuery,
16 // Map over the $ in case of overwrite
17 _$ = window.$;
18
19 var jQuery = window.jQuery = window.$ = function( selector, context ) {
20 // The jQuery object is actually just the init constructor 'enhanced'
21 return new jQuery.fn.init( selector, context );
22 };
23
24 // A simple way to check for HTML strings or ID strings
25 // (both of which we optimize for)
26 var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,
27
28 // Is it a simple selector
29 isSimple = /^.[^:#\[\.]*$/,
30
31 // Will speed up references to undefined, and allows munging its name.
32 undefined;
33
34 jQuery.fn = jQuery.prototype = {
35 init: function( selector, context ) {
36 // Make sure that a selection was provided
37 selector = selector || document;
38
39 // Handle $(DOMElement)
40 if ( selector.nodeType ) {
41 this[0] = selector;
42 this.length = 1;
43 return this;
44 }
45 // Handle HTML strings
46 if ( typeof selector == "string" ) {
47 // Are we dealing with HTML string or an ID?
48 var match = quickExpr.exec( selector );
49
50 // Verify a match, and that no context was specified for #id
51 if ( match && (match[1] || !context) ) {
52
53 // HANDLE: $(html) -> $(array)
54 if ( match[1] )
55 selector = jQuery.clean( [ match[1] ], context );
56
57 // HANDLE: $("#id")
58 else {
59 var elem = document.getElementById( match[3] );
60
61 // Make sure an element was located
62 if ( elem ){
63 // Handle the case where IE and Opera return items
64 // by name instead of ID
65 if ( elem.id != match[3] )
66 return jQuery().find( selector );
67
68 // Otherwise, we inject the element directly into the jQuery object
69 return jQuery( elem );
70 }
71 selector = [];
72 }
73
74 // HANDLE: $(expr, [context])
75 // (which is just equivalent to: $(content).find(expr)
76 } else
77 return jQuery( context ).find( selector );
78
79 // HANDLE: $(function)
80 // Shortcut for document ready
81 } else if ( jQuery.isFunction( selector ) )
82 return jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector );
83
84 return this.setArray(jQuery.makeArray(selector));
85 },
86
87 // The current version of jQuery being used
88 jquery: "1.2.6",
89
90 // The number of elements contained in the matched element set
91 size: function() {
92 return this.length;
93 },
94
95 // The number of elements contained in the matched element set
96 length: 0,
97
98 // Get the Nth element in the matched element set OR
99 // Get the whole matched element set as a clean array
100 get: function( num ) {
101 return num == undefined ?
102
103 // Return a 'clean' array
104 jQuery.makeArray( this ) :
105
106 // Return just the object
107 this[ num ];
108 },
109
110 // Take an array of elements and push it onto the stack
111 // (returning the new matched element set)
112 pushStack: function( elems ) {
113 // Build a new jQuery matched element set
114 var ret = jQuery( elems );
115
116 // Add the old object onto the stack (as a reference)
117 ret.prevObject = this;
118
119 // Return the newly-formed element set
120 return ret;
121 },
122
123 // Force the current matched set of elements to become
124 // the specified array of elements (destroying the stack in the process)
125 // You should use pushStack() in order to do this, but maintain the stack
126 setArray: function( elems ) {
127 // Resetting the length to 0, then using the native Array push
128 // is a super-fast way to populate an object with array-like properties
129 this.length = 0;
130 Array.prototype.push.apply( this, elems );
131
132 return this;
133 },
134
135 // Execute a callback for every element in the matched set.
136 // (You can seed the arguments with an array of args, but this is
137 // only used internally.)
138 each: function( callback, args ) {
139 return jQuery.each( this, callback, args );
140 },
141
142 // Determine the position of an element within
143 // the matched set of elements
144 index: function( elem ) {
145 var ret = -1;
146
147 // Locate the position of the desired element
148 return jQuery.inArray(
149 // If it receives a jQuery object, the first element is used
150 elem && elem.jquery ? elem[0] : elem
151 , this );
152 },
153
154 attr: function( name, value, type ) {
155 var options = name;
156
157 // Look for the case where we're accessing a style value
158 if ( name.constructor == String )
159 if ( value === undefined )
160 return this[0] && jQuery[ type || "attr" ]( this[0], name );
161
162 else {
163 options = {};
164 options[ name ] = value;
165 }
166
167 // Check to see if we're setting style values
168 return this.each(function(i){
169 // Set all the styles
170 for ( name in options )
171 jQuery.attr(
172 type ?
173 this.style :
174 this,
175 name, jQuery.prop( this, options[ name ], type, i, name )
176 );
177 });
178 },
179
180 css: function( key, value ) {
181 // ignore negative width and height values
182 if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 )
183 value = undefined;
184 return this.attr( key, value, "curCSS" );
185 },
186
187 text: function( text ) {
188 if ( typeof text != "object" && text != null )
189 return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
190
191 var ret = "";
192
193 jQuery.each( text || this, function(){
194 jQuery.each( this.childNodes, function(){
195 if ( this.nodeType != 8 )
196 ret += this.nodeType != 1 ?
197 this.nodeValue :
198 jQuery.fn.text( [ this ] );
199 });
200 });
201
202 return ret;
203 },
204
205 wrapAll: function( html ) {
206 if ( this[0] )
207 // The elements to wrap the target around
208 jQuery( html, this[0].ownerDocument )
209 .clone()
210 .insertBefore( this[0] )
211 .map(function(){
212 var elem = this;
213
214 while ( elem.firstChild )
215 elem = elem.firstChild;
216
217 return elem;
218 })
219 .append(this);
220
221 return this;
222 },
223
224 wrapInner: function( html ) {
225 return this.each(function(){
226 jQuery( this ).contents().wrapAll( html );
227 });
228 },
229
230 wrap: function( html ) {
231 return this.each(function(){
232 jQuery( this ).wrapAll( html );
233 });
234 },
235
236 append: function() {
237 return this.domManip(arguments, true, false, function(elem){
238 if (this.nodeType == 1)
239 this.appendChild( elem );
240 });
241 },
242
243 prepend: function() {
244 return this.domManip(arguments, true, true, function(elem){
245 if (this.nodeType == 1)
246 this.insertBefore( elem, this.firstChild );
247 });
248 },
249
250 before: function() {
251 return this.domManip(arguments, false, false, function(elem){
252 this.parentNode.insertBefore( elem, this );
253 });
254 },
255
256 after: function() {
257 return this.domManip(arguments, false, true, function(elem){
258 this.parentNode.insertBefore( elem, this.nextSibling );
259 });
260 },
261
262 end: function() {
263 return this.prevObject || jQuery( [] );
264 },
265
266 find: function( selector ) {
267 var elems = jQuery.map(this, function(elem){
268 return jQuery.find( selector, elem );
269 });
270
271 return this.pushStack( /[^+>] [^+>]/.test( selector ) || selector.indexOf("..") > -1 ?
272 jQuery.unique( elems ) :
273 elems );
274 },
275
276 clone: function( events ) {
277 // Do the clone
278 var ret = this.map(function(){
279 if ( jQuery.browser.msie && !jQuery.isXMLDoc(this) ) {
280 // IE copies events bound via attachEvent when
281 // using cloneNode. Calling detachEvent on the
282 // clone will also remove the events from the orignal
283 // In order to get around this, we use innerHTML.
284 // Unfortunately, this means some modifications to
285 // attributes in IE that are actually only stored
286 // as properties will not be copied (such as the
287 // the name attribute on an input).
288 var clone = this.cloneNode(true),
289 container = document.createElement("div");
290 container.appendChild(clone);
291 return jQuery.clean([container.innerHTML])[0];
292 } else
293 return this.cloneNode(true);
294 });
295
296 // Need to set the expando to null on the cloned set if it exists
297 // removeData doesn't work here, IE removes it from the original as well
298 // this is primarily for IE but the data expando shouldn't be copied over in any browser
299 var clone = ret.find("*").andSelf().each(function(){
300 if ( this[ expando ] != undefined )
301 this[ expando ] = null;
302 });
303
304 // Copy the events from the original to the clone
305 if ( events === true )
306 this.find("*").andSelf().each(function(i){
307 if (this.nodeType == 3)
308 return;
309 var events = jQuery.data( this, "events" );
310
311 for ( var type in events )
312 for ( var handler in events[ type ] )
313 jQuery.event.add( clone[ i ], type, events[ type ][ handler ], events[ type ][ handler ].data );
314 });
315
316 // Return the cloned set
317 return ret;
318 },
319
320 filter: function( selector ) {
321 return this.pushStack(
322 jQuery.isFunction( selector ) &&
323 jQuery.grep(this, function(elem, i){
324 return selector.call( elem, i );
325 }) ||
326
327 jQuery.multiFilter( selector, this ) );
328 },
329
330 not: function( selector ) {
331 if ( selector.constructor == String )
332 // test special case where just one selector is passed in
333 if ( isSimple.test( selector ) )
334 return this.pushStack( jQuery.multiFilter( selector, this, true ) );
335 else
336 selector = jQuery.multiFilter( selector, this );
337
338 var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;
339 return this.filter(function() {
340 return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector;
341 });
342 },
343
344 add: function( selector ) {
345 return this.pushStack( jQuery.unique( jQuery.merge(
346 this.get(),
347 typeof selector == 'string' ?
348 jQuery( selector ) :
349 jQuery.makeArray( selector )
350 )));
351 },
352
353 is: function( selector ) {
354 return !!selector && jQuery.multiFilter( selector, this ).length > 0;
355 },
356
357 hasClass: function( selector ) {
358 return this.is( "." + selector );
359 },
360
361 val: function( value ) {
362 if ( value == undefined ) {
363
364 if ( this.length ) {
365 var elem = this[0];
366
367 // We need to handle select boxes special
368 if ( jQuery.nodeName( elem, "select" ) ) {
369 var index = elem.selectedIndex,
370 values = [],
371 options = elem.options,
372 one = elem.type == "select-one";
373
374 // Nothing was selected
375 if ( index < 0 )
376 return null;
377
378 // Loop through all the selected options
379 for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
380 var option = options[ i ];
381
382 if ( option.selected ) {
383 // Get the specifc value for the option
384 value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value;
385
386 // We don't need an array for one selects
387 if ( one )
388 return value;
389
390 // Multi-Selects return an array
391 values.push( value );
392 }
393 }
394
395 return values;
396
397 // Everything else, we just grab the value
398 } else
399 return (this[0].value || "").replace(/\r/g, "");
400
401 }
402
403 return undefined;
404 }
405
406 if( value.constructor == Number )
407 value += '';
408
409 return this.each(function(){
410 if ( this.nodeType != 1 )
411 return;
412
413 if ( value.constructor == Array && /radio|checkbox/.test( this.type ) )
414 this.checked = (jQuery.inArray(this.value, value) >= 0 ||
415 jQuery.inArray(this.name, value) >= 0);
416
417 else if ( jQuery.nodeName( this, "select" ) ) {
418 var values = jQuery.makeArray(value);
419
420 jQuery( "option", this ).each(function(){
421 this.selected = (jQuery.inArray( this.value, values ) >= 0 ||
422 jQuery.inArray( this.text, values ) >= 0);
423 });
424
425 if ( !values.length )
426 this.selectedIndex = -1;
427
428 } else
429 this.value = value;
430 });
431 },
432
433 html: function( value ) {
434 return value == undefined ?
435 (this[0] ?
436 this[0].innerHTML :
437 null) :
438 this.empty().append( value );
439 },
440
441 replaceWith: function( value ) {
442 return this.after( value ).remove();
443 },
444
445 eq: function( i ) {
446 return this.slice( i, i + 1 );
447 },
448
449 slice: function() {
450 return this.pushStack( Array.prototype.slice.apply( this, arguments ) );
451 },
452
453 map: function( callback ) {
454 return this.pushStack( jQuery.map(this, function(elem, i){
455 return callback.call( elem, i, elem );
456 }));
457 },
458
459 andSelf: function() {
460 return this.add( this.prevObject );
461 },
462
463 data: function( key, value ){
464 var parts = key.split(".");
465 parts[1] = parts[1] ? "." + parts[1] : "";
466
467 if ( value === undefined ) {
468 var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
469
470 if ( data === undefined && this.length )
471 data = jQuery.data( this[0], key );
472
473 return data === undefined && parts[1] ?
474 this.data( parts[0] ) :
475 data;
476 } else
477 return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){
478 jQuery.data( this, key, value );
479 });
480 },
481
482 removeData: function( key ){
483 return this.each(function(){
484 jQuery.removeData( this, key );
485 });
486 },
487
488 domManip: function( args, table, reverse, callback ) {
489 var clone = this.length > 1, elems;
490
491 return this.each(function(){
492 if ( !elems ) {
493 elems = jQuery.clean( args, this.ownerDocument );
494
495 if ( reverse )
496 elems.reverse();
497 }
498
499 var obj = this;
500
501 if ( table && jQuery.nodeName( this, "table" ) && jQuery.nodeName( elems[0], "tr" ) )
502 obj = this.getElementsByTagName("tbody")[0] || this.appendChild( this.ownerDocument.createElement("tbody") );
503
504 var scripts = jQuery( [] );
505
506 jQuery.each(elems, function(){
507 var elem = clone ?
508 jQuery( this ).clone( true )[0] :
509 this;
510
511 // execute all scripts after the elements have been injected
512 if ( jQuery.nodeName( elem, "script" ) )
513 scripts = scripts.add( elem );
514 else {
515 // Remove any inner scripts for later evaluation
516 if ( elem.nodeType == 1 )
517 scripts = scripts.add( jQuery( "script", elem ).remove() );
518
519 // Inject the elements into the document
520 callback.call( obj, elem );
521 }
522 });
523
524 scripts.each( evalScript );
525 });
526 }
527 };
528
529 // Give the init function the jQuery prototype for later instantiation
530 jQuery.fn.init.prototype = jQuery.fn;
531
532 function evalScript( i, elem ) {
533 if ( elem.src )
534 jQuery.ajax({
535 url: elem.src,
536 async: false,
537 dataType: "script"
538 });
539
540 else
541 jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
542
543 if ( elem.parentNode )
544 elem.parentNode.removeChild( elem );
545 }
546
547 function now(){
548 return +new Date;
549 }
550
551 jQuery.extend = jQuery.fn.extend = function() {
552 // copy reference to target object
553 var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
554
555 // Handle a deep copy situation
556 if ( target.constructor&e