slippers 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. data/LICENSE +20 -0
  2. data/README +56 -0
  3. data/Rakefile +27 -0
  4. data/VERSION.yml +4 -0
  5. data/examples/blog/README +3 -0
  6. data/examples/blog/blog.db +0 -0
  7. data/examples/blog/controller/main.rb +30 -0
  8. data/examples/blog/model/entry.rb +31 -0
  9. data/examples/blog/public/styles/blog.css +132 -0
  10. data/examples/blog/spec/blog.rb +87 -0
  11. data/examples/blog/start.rb +7 -0
  12. data/examples/blog/view/edit.st +19 -0
  13. data/examples/blog/view/edit.xhtml +17 -0
  14. data/examples/blog/view/entry.st +12 -0
  15. data/examples/blog/view/index.st +4 -0
  16. data/examples/blog/view/index.xhtml +17 -0
  17. data/examples/blog/view/layout.st +11 -0
  18. data/examples/blog/view/layout.xhtml +11 -0
  19. data/examples/blog/view/new.st +16 -0
  20. data/examples/blog/view/new.xhtml +16 -0
  21. data/examples/forms/Rakefile +22 -0
  22. data/examples/forms/controller/init.rb +12 -0
  23. data/examples/forms/controller/main.rb +20 -0
  24. data/examples/forms/controller/registration.rb +24 -0
  25. data/examples/forms/forms.db +0 -0
  26. data/examples/forms/model/core_extensions/string_extensions.rb +5 -0
  27. data/examples/forms/model/field.rb +33 -0
  28. data/examples/forms/model/form.rb +33 -0
  29. data/examples/forms/model/init.rb +18 -0
  30. data/examples/forms/model/orm/registration.rb +12 -0
  31. data/examples/forms/model/registration_form_builder.rb +7 -0
  32. data/examples/forms/model/registration_repository.rb +39 -0
  33. data/examples/forms/model/registration_rules/incorrect_email_format.rb +11 -0
  34. data/examples/forms/model/registration_rules/number_field.rb +10 -0
  35. data/examples/forms/model/registration_rules/required_field.rb +9 -0
  36. data/examples/forms/model/registration_validator.rb +17 -0
  37. data/examples/forms/public/css/ramaze_error.css +90 -0
  38. data/examples/forms/public/dispatch.fcgi +11 -0
  39. data/examples/forms/public/favicon.ico +0 -0
  40. data/examples/forms/public/js/jquery.js +3549 -0
  41. data/examples/forms/public/ramaze.png +0 -0
  42. data/examples/forms/public/web-application.js +0 -0
  43. data/examples/forms/spec/form_spec.rb +16 -0
  44. data/examples/forms/spec/main.rb +25 -0
  45. data/examples/forms/spec/registration_controller_spec.rb +0 -0
  46. data/examples/forms/spec/registration_repository_spec.rb +38 -0
  47. data/examples/forms/spec/registration_validator_spec.rb +53 -0
  48. data/examples/forms/spec/spec_helper.rb +3 -0
  49. data/examples/forms/start.rb +12 -0
  50. data/examples/forms/start.ru +16 -0
  51. data/examples/forms/view/error.xhtml +64 -0
  52. data/examples/forms/view/index.xhtml +34 -0
  53. data/examples/forms/view/page.xhtml +27 -0
  54. data/examples/forms/view/registration/index.st +26 -0
  55. data/examples/main_controller.rb +40 -0
  56. data/examples/start.rb +7 -0
  57. data/examples/todolist/README +1 -0
  58. data/examples/todolist/controller/main.rb +71 -0
  59. data/examples/todolist/layout/page.rb +31 -0
  60. data/examples/todolist/model/tasks.rb +14 -0
  61. data/examples/todolist/public/favicon.ico +0 -0
  62. data/examples/todolist/public/js/jquery.js +1923 -0
  63. data/examples/todolist/public/ramaze.png +0 -0
  64. data/examples/todolist/start.rb +11 -0
  65. data/examples/todolist/todolist.db +11 -0
  66. data/examples/todolist/view/index.st +39 -0
  67. data/examples/todolist/view/index.xhtml +17 -0
  68. data/examples/todolist/view/new.st +41 -0
  69. data/examples/todolist/view/new.xhtml +7 -0
  70. data/examples/todolist/view/tasks.st +6 -0
  71. data/examples/todolist.db +5 -0
  72. data/examples/view/index.st +11 -0
  73. data/examples/view/person/age.st +1 -0
  74. data/examples/view/person/age_renderer.rb +6 -0
  75. data/examples/view/person/index.st +2 -0
  76. data/lib/engine/binding_wrapper.rb +10 -0
  77. data/lib/engine/engine.rb +28 -0
  78. data/lib/engine/file_template.rb +12 -0
  79. data/lib/engine/slippers.treetop +169 -0
  80. data/lib/engine/slippers_nodes.rb +119 -0
  81. data/lib/engine/template.rb +17 -0
  82. data/lib/engine/template_group.rb +40 -0
  83. data/lib/engine/template_group_directory.rb +57 -0
  84. data/lib/ramazeTemplates/0001-Adding-slippers-as-a-new-template.patch +138 -0
  85. data/lib/ramazeTemplates/0002-Fixing-problem-with-using-other-renderers.patch +27 -0
  86. data/lib/ramazeTemplates/slippers.rb +22 -0
  87. data/lib/slippers.rb +14 -0
  88. data/spec/binding_wrapper.rb +19 -0
  89. data/spec/engine.rb +89 -0
  90. data/spec/file_template.rb +9 -0
  91. data/spec/parse_attributes.rb +98 -0
  92. data/spec/parse_renderers.rb +35 -0
  93. data/spec/parse_templates.rb +73 -0
  94. data/spec/person_template.st +1 -0
  95. data/spec/spec_helper.rb +14 -0
  96. data/spec/template_group.rb +52 -0
  97. data/spec/template_group_directory.rb +43 -0
  98. data/spec/views/index.st +1 -0
  99. data/spec/views/money.rb +2 -0
  100. data/spec/views/person/age.st +1 -0
  101. data/spec/views/person/date_renderer.rb +5 -0
  102. data/spec/views/person/name.st +1 -0
  103. metadata +218 -0
@@ -0,0 +1,1923 @@
1
+ /* prevent execution of jQuery if included more then once */
2
+ if(typeof window.jQuery == "undefined") {
3
+ /*
4
+ * jQuery 1.0.2 - New Wave Javascript
5
+ *
6
+ * Copyright (c) 2006 John Resig (jquery.com)
7
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
8
+ * and GPL (GPL-LICENSE.txt) licenses.
9
+ *
10
+ * $Date: 2006-10-09 20:23:18 -0400 (Mon, 09 Oct 2006) $
11
+ * $Rev: 413 $
12
+ */
13
+
14
+ // Global undefined variable
15
+ window.undefined = window.undefined;
16
+ jQuery = function(a,c) {
17
+
18
+ // Shortcut for document ready (because $(document).each() is silly)
19
+ if ( a && typeof a == "function" && jQuery.fn.ready )
20
+ return jQuery(document).ready(a);
21
+
22
+ // Make sure that a selection was provided
23
+ a = a || jQuery.context || document;
24
+
25
+ // Watch for when a jQuery object is passed as the selector
26
+ if ( a.jquery )
27
+ return jQuery( jQuery.merge( a, [] ) );
28
+
29
+ // Watch for when a jQuery object is passed at the context
30
+ if ( c && c.jquery )
31
+ return jQuery( c ).find(a);
32
+
33
+ // If the context is global, return a new object
34
+ if ( window == this )
35
+ return new jQuery(a,c);
36
+
37
+ // Handle HTML strings
38
+ var m = /^[^<]*(<.+>)[^>]*$/.exec(a);
39
+ if ( m ) a = jQuery.clean( [ m[1] ] );
40
+
41
+ // Watch for when an array is passed in
42
+ this.get( a.constructor == Array || a.length && !a.nodeType && a[0] != undefined && a[0].nodeType ?
43
+ // Assume that it is an array of DOM Elements
44
+ jQuery.merge( a, [] ) :
45
+
46
+ // Find the matching elements and save them for later
47
+ jQuery.find( a, c ) );
48
+
49
+ // See if an extra function was provided
50
+ var fn = arguments[ arguments.length - 1 ];
51
+
52
+ // If so, execute it in context
53
+ if ( fn && typeof fn == "function" )
54
+ this.each(fn);
55
+ };
56
+
57
+ // Map over the $ in case of overwrite
58
+ if ( typeof $ != "undefined" )
59
+ jQuery._$ = $;
60
+
61
+ // Map the jQuery namespace to the '$' one
62
+ var $ = jQuery;
63
+
64
+ jQuery.fn = jQuery.prototype = {
65
+ jquery: "1.0.2",
66
+
67
+ size: function() {
68
+ return this.length;
69
+ },
70
+
71
+ get: function( num ) {
72
+ // Watch for when an array (of elements) is passed in
73
+ if ( num && num.constructor == Array ) {
74
+
75
+ // Use a tricky hack to make the jQuery object
76
+ // look and feel like an array
77
+ this.length = 0;
78
+ [].push.apply( this, num );
79
+
80
+ return this;
81
+ } else
82
+ return num == undefined ?
83
+
84
+ // Return a 'clean' array
85
+ jQuery.merge( this, [] ) :
86
+
87
+ // Return just the object
88
+ this[num];
89
+ },
90
+ each: function( fn, args ) {
91
+ return jQuery.each( this, fn, args );
92
+ },
93
+ index: function( obj ) {
94
+ var pos = -1;
95
+ this.each(function(i){
96
+ if ( this == obj ) pos = i;
97
+ });
98
+ return pos;
99
+ },
100
+
101
+ attr: function( key, value, type ) {
102
+ // Check to see if we're setting style values
103
+ return key.constructor != String || value != undefined ?
104
+ this.each(function(){
105
+ // See if we're setting a hash of styles
106
+ if ( value == undefined )
107
+ // Set all the styles
108
+ for ( var prop in key )
109
+ jQuery.attr(
110
+ type ? this.style : this,
111
+ prop, key[prop]
112
+ );
113
+
114
+ // See if we're setting a single key/value style
115
+ else
116
+ jQuery.attr(
117
+ type ? this.style : this,
118
+ key, value
119
+ );
120
+ }) :
121
+
122
+ // Look for the case where we're accessing a style value
123
+ jQuery[ type || "attr" ]( this[0], key );
124
+ },
125
+
126
+ css: function( key, value ) {
127
+ return this.attr( key, value, "curCSS" );
128
+ },
129
+ text: function(e) {
130
+ e = e || this;
131
+ var t = "";
132
+ for ( var j = 0; j < e.length; j++ ) {
133
+ var r = e[j].childNodes;
134
+ for ( var i = 0; i < r.length; i++ )
135
+ if ( r[i].nodeType != 8 )
136
+ t += r[i].nodeType != 1 ?
137
+ r[i].nodeValue : jQuery.fn.text([ r[i] ]);
138
+ }
139
+ return t;
140
+ },
141
+
142
+ wrap: function() {
143
+ // The elements to wrap the target around
144
+ var a = jQuery.clean(arguments);
145
+
146
+ // Wrap each of the matched elements individually
147
+ return this.each(function(){
148
+ // Clone the structure that we're using to wrap
149
+ var b = a[0].cloneNode(true);
150
+
151
+ // Insert it before the element to be wrapped
152
+ this.parentNode.insertBefore( b, this );
153
+
154
+ // Find the deepest point in the wrap structure
155
+ while ( b.firstChild )
156
+ b = b.firstChild;
157
+
158
+ // Move the matched element to within the wrap structure
159
+ b.appendChild( this );
160
+ });
161
+ },
162
+
163
+ append: function() {
164
+ return this.domManip(arguments, true, 1, function(a){
165
+ this.appendChild( a );
166
+ });
167
+ },
168
+
169
+ prepend: function() {
170
+ return this.domManip(arguments, true, -1, function(a){
171
+ this.insertBefore( a, this.firstChild );
172
+ });
173
+ },
174
+
175
+ before: function() {
176
+ return this.domManip(arguments, false, 1, function(a){
177
+ this.parentNode.insertBefore( a, this );
178
+ });
179
+ },
180
+
181
+ after: function() {
182
+ return this.domManip(arguments, false, -1, function(a){
183
+ this.parentNode.insertBefore( a, this.nextSibling );
184
+ });
185
+ },
186
+ end: function() {
187
+ return this.get( this.stack.pop() );
188
+ },
189
+ find: function(t) {
190
+ return this.pushStack( jQuery.map( this, function(a){
191
+ return jQuery.find(t,a);
192
+ }), arguments );
193
+ },
194
+ clone: function(deep) {
195
+ return this.pushStack( jQuery.map( this, function(a){
196
+ return a.cloneNode( deep != undefined ? deep : true );
197
+ }), arguments );
198
+ },
199
+
200
+ filter: function(t) {
201
+ return this.pushStack(
202
+ t.constructor == Array &&
203
+ jQuery.map(this,function(a){
204
+ for ( var i = 0; i < t.length; i++ )
205
+ if ( jQuery.filter(t[i],[a]).r.length )
206
+ return a;
207
+ }) ||
208
+
209
+ t.constructor == Boolean &&
210
+ ( t ? this.get() : [] ) ||
211
+
212
+ typeof t == "function" &&
213
+ jQuery.grep( this, t ) ||
214
+
215
+ jQuery.filter(t,this).r, arguments );
216
+ },
217
+
218
+ not: function(t) {
219
+ return this.pushStack( t.constructor == String ?
220
+ jQuery.filter(t,this,false).r :
221
+ jQuery.grep(this,function(a){ return a != t; }), arguments );
222
+ },
223
+
224
+ add: function(t) {
225
+ return this.pushStack( jQuery.merge( this, t.constructor == String ?
226
+ jQuery.find(t) : t.constructor == Array ? t : [t] ), arguments );
227
+ },
228
+ is: function(expr) {
229
+ return expr ? jQuery.filter(expr,this).r.length > 0 : false;
230
+ },
231
+ domManip: function(args, table, dir, fn){
232
+ var clone = this.size() > 1;
233
+ var a = jQuery.clean(args);
234
+
235
+ return this.each(function(){
236
+ var obj = this;
237
+
238
+ if ( table && this.nodeName.toUpperCase() == "TABLE" && a[0].nodeName.toUpperCase() != "THEAD" ) {
239
+ var tbody = this.getElementsByTagName("tbody");
240
+
241
+ if ( !tbody.length ) {
242
+ obj = document.createElement("tbody");
243
+ this.appendChild( obj );
244
+ } else
245
+ obj = tbody[0];
246
+ }
247
+
248
+ for ( var i = ( dir < 0 ? a.length - 1 : 0 );
249
+ i != ( dir < 0 ? dir : a.length ); i += dir ) {
250
+ fn.apply( obj, [ clone ? a[i].cloneNode(true) : a[i] ] );
251
+ }
252
+ });
253
+ },
254
+ pushStack: function(a,args) {
255
+ var fn = args && args[args.length-1];
256
+ var fn2 = args && args[args.length-2];
257
+
258
+ if ( fn && fn.constructor != Function ) fn = null;
259
+ if ( fn2 && fn2.constructor != Function ) fn2 = null;
260
+
261
+ if ( !fn ) {
262
+ if ( !this.stack ) this.stack = [];
263
+ this.stack.push( this.get() );
264
+ this.get( a );
265
+ } else {
266
+ var old = this.get();
267
+ this.get( a );
268
+
269
+ if ( fn2 && a.length || !fn2 )
270
+ this.each( fn2 || fn ).get( old );
271
+ else
272
+ this.get( old ).each( fn );
273
+ }
274
+
275
+ return this;
276
+ }
277
+ };
278
+
279
+ jQuery.extend = jQuery.fn.extend = function(obj,prop) {
280
+ if ( !prop ) { prop = obj; obj = this; }
281
+ for ( var i in prop ) obj[i] = prop[i];
282
+ return obj;
283
+ };
284
+
285
+ jQuery.extend({
286
+ init: function(){
287
+ jQuery.initDone = true;
288
+
289
+ jQuery.each( jQuery.macros.axis, function(i,n){
290
+ jQuery.fn[ i ] = function(a) {
291
+ var ret = jQuery.map(this,n);
292
+ if ( a && a.constructor == String )
293
+ ret = jQuery.filter(a,ret).r;
294
+ return this.pushStack( ret, arguments );
295
+ };
296
+ });
297
+
298
+ jQuery.each( jQuery.macros.to, function(i,n){
299
+ jQuery.fn[ i ] = function(){
300
+ var a = arguments;
301
+ return this.each(function(){
302
+ for ( var j = 0; j < a.length; j++ )
303
+ jQuery(a[j])[n]( this );
304
+ });
305
+ };
306
+ });
307
+
308
+ jQuery.each( jQuery.macros.each, function(i,n){
309
+ jQuery.fn[ i ] = function() {
310
+ return this.each( n, arguments );
311
+ };
312
+ });
313
+
314
+ jQuery.each( jQuery.macros.filter, function(i,n){
315
+ jQuery.fn[ n ] = function(num,fn) {
316
+ return this.filter( ":" + n + "(" + num + ")", fn );
317
+ };
318
+ });
319
+
320
+ jQuery.each( jQuery.macros.attr, function(i,n){
321
+ n = n || i;
322
+ jQuery.fn[ i ] = function(h) {
323
+ return h == undefined ?
324
+ this.length ? this[0][n] : null :
325
+ this.attr( n, h );
326
+ };
327
+ });
328
+
329
+ jQuery.each( jQuery.macros.css, function(i,n){
330
+ jQuery.fn[ n ] = function(h) {
331
+ return h == undefined ?
332
+ ( this.length ? jQuery.css( this[0], n ) : null ) :
333
+ this.css( n, h );
334
+ };
335
+ });
336
+
337
+ },
338
+ each: function( obj, fn, args ) {
339
+ if ( obj.length == undefined )
340
+ for ( var i in obj )
341
+ fn.apply( obj[i], args || [i, obj[i]] );
342
+ else
343
+ for ( var i = 0; i < obj.length; i++ )
344
+ fn.apply( obj[i], args || [i, obj[i]] );
345
+ return obj;
346
+ },
347
+
348
+ className: {
349
+ add: function(o,c){
350
+ if (jQuery.className.has(o,c)) return;
351
+ o.className += ( o.className ? " " : "" ) + c;
352
+ },
353
+ remove: function(o,c){
354
+ if( !c ) {
355
+ o.className = "";
356
+ } else {
357
+ var classes = o.className.split(" ");
358
+ for(var i=0; i<classes.length; i++) {
359
+ if(classes[i] == c) {
360
+ classes.splice(i, 1);
361
+ break;
362
+ }
363
+ }
364
+ o.className = classes.join(' ');
365
+ }
366
+ },
367
+ has: function(e,a) {
368
+ if ( e.className != undefined )
369
+ e = e.className;
370
+ return new RegExp("(^|\\s)" + a + "(\\s|$)").test(e);
371
+ }
372
+ },
373
+ swap: function(e,o,f) {
374
+ for ( var i in o ) {
375
+ e.style["old"+i] = e.style[i];
376
+ e.style[i] = o[i];
377
+ }
378
+ f.apply( e, [] );
379
+ for ( var i in o )
380
+ e.style[i] = e.style["old"+i];
381
+ },
382
+
383
+ css: function(e,p) {
384
+ if ( p == "height" || p == "width" ) {
385
+ var old = {}, oHeight, oWidth, d = ["Top","Bottom","Right","Left"];
386
+
387
+ for ( var i in d ) {
388
+ old["padding" + d[i]] = 0;
389
+ old["border" + d[i] + "Width"] = 0;
390
+ }
391
+
392
+ jQuery.swap( e, old, function() {
393
+ if (jQuery.css(e,"display") != "none") {
394
+ oHeight = e.offsetHeight;
395
+ oWidth = e.offsetWidth;
396
+ } else {
397
+ e = jQuery(e.cloneNode(true)).css({
398
+ visibility: "hidden", position: "absolute", display: "block", right: "0", left: "0"
399
+ }).appendTo(e.parentNode)[0];
400
+
401
+ var parPos = jQuery.css(e.parentNode,"position");
402
+ if ( parPos == "" || parPos == "static" )
403
+ e.parentNode.style.position = "relative";
404
+
405
+ oHeight = e.clientHeight;
406
+ oWidth = e.clientWidth;
407
+
408
+ if ( parPos == "" || parPos == "static" )
409
+ e.parentNode.style.position = "static";
410
+
411
+ e.parentNode.removeChild(e);
412
+ }
413
+ });
414
+
415
+ return p == "height" ? oHeight : oWidth;
416
+ }
417
+
418
+ return jQuery.curCSS( e, p );
419
+ },
420
+
421
+ curCSS: function(elem, prop, force) {
422
+ var ret;
423
+
424
+ if (prop == 'opacity' && jQuery.browser.msie)
425
+ return jQuery.attr(elem.style, 'opacity');
426
+
427
+ if (!force && elem.style[prop]) {
428
+
429
+ ret = elem.style[prop];
430
+
431
+ } else if (elem.currentStyle) {
432
+
433
+ var newProp = prop.replace(/\-(\w)/g,function(m,c){return c.toUpperCase();});
434
+ ret = elem.currentStyle[prop] || elem.currentStyle[newProp];
435
+
436
+ } else if (document.defaultView && document.defaultView.getComputedStyle) {
437
+
438
+ prop = prop.replace(/([A-Z])/g,"-$1").toLowerCase();
439
+ var cur = document.defaultView.getComputedStyle(elem, null);
440
+
441
+ if ( cur )
442
+ ret = cur.getPropertyValue(prop);
443
+ else if ( prop == 'display' )
444
+ ret = 'none';
445
+ else
446
+ jQuery.swap(elem, { display: 'block' }, function() {
447
+ ret = document.defaultView.getComputedStyle(this,null).getPropertyValue(prop);
448
+ });
449
+
450
+ }
451
+
452
+ return ret;
453
+ },
454
+
455
+ clean: function(a) {
456
+ var r = [];
457
+ for ( var i = 0; i < a.length; i++ ) {
458
+ if ( a[i].constructor == String ) {
459
+ // trim whitespace, otherwise indexOf won't work as expected
460
+ a[i] = jQuery.trim(a[i]);
461
+
462
+ var table = "";
463
+
464
+ if ( !a[i].indexOf("<thead") || !a[i].indexOf("<tbody") ) {
465
+ table = "thead";
466
+ a[i] = "<table>" + a[i] + "</table>";
467
+ } else if ( !a[i].indexOf("<tr") ) {
468
+ table = "tr";
469
+ a[i] = "<table>" + a[i] + "</table>";
470
+ } else if ( !a[i].indexOf("<td") || !a[i].indexOf("<th") ) {
471
+ table = "td";
472
+ a[i] = "<table><tbody><tr>" + a[i] + "</tr></tbody></table>";
473
+ }
474
+
475
+ var div = document.createElement("div");
476
+ div.innerHTML = a[i];
477
+
478
+ if ( table ) {
479
+ div = div.firstChild;
480
+ if ( table != "thead" ) div = div.firstChild;
481
+ if ( table == "td" ) div = div.firstChild;
482
+ }
483
+
484
+ for ( var j = 0; j < div.childNodes.length; j++ )
485
+ r.push( div.childNodes[j] );
486
+ } else if ( a[i].jquery || a[i].length && !a[i].nodeType )
487
+ for ( var k = 0; k < a[i].length; k++ )
488
+ r.push( a[i][k] );
489
+ else if ( a[i] !== null )
490
+ r.push( a[i].nodeType ? a[i] : document.createTextNode(a[i].toString()) );
491
+ }
492
+ return r;
493
+ },
494
+
495
+ expr: {
496
+ "": "m[2]== '*'||a.nodeName.toUpperCase()==m[2].toUpperCase()",
497
+ "#": "a.getAttribute('id')&&a.getAttribute('id')==m[2]",
498
+ ":": {
499
+ // Position Checks
500
+ lt: "i<m[3]-0",
501
+ gt: "i>m[3]-0",
502
+ nth: "m[3]-0==i",
503
+ eq: "m[3]-0==i",
504
+ first: "i==0",
505
+ last: "i==r.length-1",
506
+ even: "i%2==0",
507
+ odd: "i%2",
508
+
509
+ // Child Checks
510
+ "nth-child": "jQuery.sibling(a,m[3]).cur",
511
+ "first-child": "jQuery.sibling(a,0).cur",
512
+ "last-child": "jQuery.sibling(a,0).last",
513
+ "only-child": "jQuery.sibling(a).length==1",
514
+
515
+ // Parent Checks
516
+ parent: "a.childNodes.length",
517
+ empty: "!a.childNodes.length",
518
+
519
+ // Text Check
520
+ contains: "(a.innerText||a.innerHTML).indexOf(m[3])>=0",
521
+
522
+ // Visibility
523
+ visible: "a.type!='hidden'&&jQuery.css(a,'display')!='none'&&jQuery.css(a,'visibility')!='hidden'",
524
+ hidden: "a.type=='hidden'||jQuery.css(a,'display')=='none'||jQuery.css(a,'visibility')=='hidden'",
525
+
526
+ // Form attributes
527
+ enabled: "!a.disabled",
528
+ disabled: "a.disabled",
529
+ checked: "a.checked",
530
+ selected: "a.selected || jQuery.attr(a, 'selected')",
531
+
532
+ // Form elements
533
+ text: "a.type=='text'",
534
+ radio: "a.type=='radio'",
535
+ checkbox: "a.type=='checkbox'",
536
+ file: "a.type=='file'",
537
+ password: "a.type=='password'",
538
+ submit: "a.type=='submit'",
539
+ image: "a.type=='image'",
540
+ reset: "a.type=='reset'",
541
+ button: "a.type=='button'",
542
+ input: "a.nodeName.toLowerCase().match(/input|select|textarea|button/)"
543
+ },
544
+ ".": "jQuery.className.has(a,m[2])",
545
+ "@": {
546
+ "=": "z==m[4]",
547
+ "!=": "z!=m[4]",
548
+ "^=": "z && !z.indexOf(m[4])",
549
+ "$=": "z && z.substr(z.length - m[4].length,m[4].length)==m[4]",
550
+ "*=": "z && z.indexOf(m[4])>=0",
551
+ "": "z"
552
+ },
553
+ "[": "jQuery.find(m[2],a).length"
554
+ },
555
+
556
+ token: [
557
+ "\\.\\.|/\\.\\.", "a.parentNode",
558
+ ">|/", "jQuery.sibling(a.firstChild)",
559
+ "\\+", "jQuery.sibling(a).next",
560
+ "~", function(a){
561
+ var r = [];
562
+ var s = jQuery.sibling(a);
563
+ if ( s.n > 0 )
564
+ for ( var i = s.n; i < s.length; i++ )
565
+ r.push( s[i] );
566
+ return r;
567
+ }
568
+ ],
569
+ find: function( t, context ) {
570
+ // Make sure that the context is a DOM Element
571
+ if ( context && context.nodeType == undefined )
572
+ context = null;
573
+
574
+ // Set the correct context (if none is provided)
575
+ context = context || jQuery.context || document;
576
+
577
+ if ( t.constructor != String ) return [t];
578
+
579
+ if ( !t.indexOf("//") ) {
580
+ context = context.documentElement;
581
+ t = t.substr(2,t.length);
582
+ } else if ( !t.indexOf("/") ) {
583
+ context = context.documentElement;
584
+ t = t.substr(1,t.length);
585
+ // FIX Assume the root element is right :(
586
+ if ( t.indexOf("/") >= 1 )
587
+ t = t.substr(t.indexOf("/"),t.length);
588
+ }
589
+
590
+ var ret = [context];
591
+ var done = [];
592
+ var last = null;
593
+
594
+ while ( t.length > 0 && last != t ) {
595
+ var r = [];
596
+ last = t;
597
+
598
+ t = jQuery.trim(t).replace( /^\/\//i, "" );
599
+
600
+ var foundToken = false;
601
+
602
+ for ( var i = 0; i < jQuery.token.length; i += 2 ) {
603
+ if ( foundToken ) continue;
604
+
605
+ var re = new RegExp("^(" + jQuery.token[i] + ")");
606
+ var m = re.exec(t);
607
+
608
+ if ( m ) {
609
+ r = ret = jQuery.map( ret, jQuery.token[i+1] );
610
+ t = jQuery.trim( t.replace( re, "" ) );
611
+ foundToken = true;
612
+ }
613
+ }
614
+
615
+ if ( !foundToken ) {
616
+ if ( !t.indexOf(",") || !t.indexOf("|") ) {
617
+ if ( ret[0] == context ) ret.shift();
618
+ done = jQuery.merge( done, ret );
619
+ r = ret = [context];
620
+ t = " " + t.substr(1,t.length);
621
+ } else {
622
+ var re2 = /^([#.]?)([a-z0-9\\*_-]*)/i;
623
+ var m = re2.exec(t);
624
+
625
+ if ( m[1] == "#" ) {
626
+ // Ummm, should make this work in all XML docs
627
+ var oid = document.getElementById(m[2]);
628
+ r = ret = oid ? [oid] : [];
629
+ t = t.replace( re2, "" );
630
+ } else {
631
+ if ( !m[2] || m[1] == "." ) m[2] = "*";
632
+
633
+ for ( var i = 0; i < ret.length; i++ )
634
+ r = jQuery.merge( r,
635
+ m[2] == "*" ?
636
+ jQuery.getAll(ret[i]) :
637
+ ret[i].getElementsByTagName(m[2])
638
+ );
639
+ }
640
+ }
641
+
642
+ }
643
+
644
+ if ( t ) {
645
+ var val = jQuery.filter(t,r);
646
+ ret = r = val.r;
647
+ t = jQuery.trim(val.t);
648
+ }
649
+ }
650
+
651
+ if ( ret && ret[0] == context ) ret.shift();
652
+ done = jQuery.merge( done, ret );
653
+
654
+ return done;
655
+ },
656
+
657
+ getAll: function(o,r) {
658
+ r = r || [];
659
+ var s = o.childNodes;
660
+ for ( var i = 0; i < s.length; i++ )
661
+ if ( s[i].nodeType == 1 ) {
662
+ r.push( s[i] );
663
+ jQuery.getAll( s[i], r );
664
+ }
665
+ return r;
666
+ },
667
+
668
+ attr: function(elem, name, value){
669
+ var fix = {
670
+ "for": "htmlFor",
671
+ "class": "className",
672
+ "float": "cssFloat",
673
+ innerHTML: "innerHTML",
674
+ className: "className",
675
+ value: "value",
676
+ disabled: "disabled",
677
+ checked: "checked"
678
+ };
679
+
680
+ // IE actually uses filters for opacity ... elem is actually elem.style
681
+ if (name == "opacity" && jQuery.browser.msie && value != undefined) {
682
+ // IE has trouble with opacity if it does not have layout
683
+ // Would prefer to check element.hasLayout first but don't have access to the element here
684
+ elem['zoom'] = 1;
685
+ if (value == 1) // Remove filter to avoid more IE weirdness
686
+ return elem["filter"] = elem["filter"].replace(/alpha\([^\)]*\)/gi,"");
687
+ else
688
+ return elem["filter"] = elem["filter"].replace(/alpha\([^\)]*\)/gi,"") + "alpha(opacity=" + value * 100 + ")";
689
+ } else if (name == "opacity" && jQuery.browser.msie) {
690
+ return elem["filter"] ? parseFloat( elem["filter"].match(/alpha\(opacity=(.*)\)/)[1] )/100 : 1;
691
+ }
692
+
693
+ // Mozilla doesn't play well with opacity 1
694
+ if (name == "opacity" && jQuery.browser.mozilla && value == 1) value = 0.9999;
695
+
696
+ if ( fix[name] ) {
697
+ if ( value != undefined ) elem[fix[name]] = value;
698
+ return elem[fix[name]];
699
+ } else if( value == undefined && jQuery.browser.msie && elem.nodeName && elem.nodeName.toUpperCase() == 'FORM' && (name == 'action' || name == 'method') ) {
700
+ return elem.getAttributeNode(name).nodeValue;
701
+ } else if ( elem.getAttribute != undefined ) {
702
+ if ( value != undefined ) elem.setAttribute( name, value );
703
+ return elem.getAttribute( name, 2 );
704
+ } else {
705
+ name = name.replace(/-([a-z])/ig,function(z,b){return b.toUpperCase();});
706
+ if ( value != undefined ) elem[name] = value;
707
+ return elem[name];
708
+ }
709
+ },
710
+
711
+ // The regular expressions that power the parsing engine
712
+ parse: [
713
+ // Match: [@value='test'], [@foo]
714
+ "\\[ *(@)S *([!*$^=]*) *('?\"?)(.*?)\\4 *\\]",
715
+
716
+ // Match: [div], [div p]
717
+ "(\\[)\s*(.*?)\s*\\]",
718
+
719
+ // Match: :contains('foo')
720
+ "(:)S\\(\"?'?([^\\)]*?)\"?'?\\)",
721
+
722
+ // Match: :even, :last-chlid
723
+ "([:.#]*)S"
724
+ ],
725
+
726
+ filter: function(t,r,not) {
727
+ // Figure out if we're doing regular, or inverse, filtering
728
+ var g = not !== false ? jQuery.grep :
729
+ function(a,f) {return jQuery.grep(a,f,true);};
730
+
731
+ while ( t && /^[a-z[({<*:.#]/i.test(t) ) {
732
+
733
+ var p = jQuery.parse;
734
+
735
+ for ( var i = 0; i < p.length; i++ ) {
736
+
737
+ // Look for, and replace, string-like sequences
738
+ // and finally build a regexp out of it
739
+ var re = new RegExp(
740
+ "^" + p[i].replace("S", "([a-z*_-][a-z0-9_-]*)"), "i" );
741
+
742
+ var m = re.exec( t );
743
+
744
+ if ( m ) {
745
+ // Re-organize the first match
746
+ if ( !i )
747
+ m = ["",m[1], m[3], m[2], m[5]];
748
+
749
+ // Remove what we just matched
750
+ t = t.replace( re, "" );
751
+
752
+ break;
753
+ }
754
+ }
755
+
756
+ // :not() is a special case that can be optimized by
757
+ // keeping it out of the expression list
758
+ if ( m[1] == ":" && m[2] == "not" )
759
+ r = jQuery.filter(m[3],r,false).r;
760
+
761
+ // Otherwise, find the expression to execute
762
+ else {
763
+ var f = jQuery.expr[m[1]];
764
+ if ( f.constructor != String )
765
+ f = jQuery.expr[m[1]][m[2]];
766
+
767
+ // Build a custom macro to enclose it
768
+ eval("f = function(a,i){" +
769
+ ( m[1] == "@" ? "z=jQuery.attr(a,m[3]);" : "" ) +
770
+ "return " + f + "}");
771
+
772
+ // Execute it against the current filter
773
+ r = g( r, f );
774
+ }
775
+ }
776
+
777
+ // Return an array of filtered elements (r)
778
+ // and the modified expression string (t)
779
+ return { r: r, t: t };
780
+ },
781
+ trim: function(t){
782
+ return t.replace(/^\s+|\s+$/g, "");
783
+ },
784
+ parents: function( elem ){
785
+ var matched = [];
786
+ var cur = elem.parentNode;
787
+ while ( cur && cur != document ) {
788
+ matched.push( cur );
789
+ cur = cur.parentNode;
790
+ }
791
+ return matched;
792
+ },
793
+ sibling: function(elem, pos, not) {
794
+ var elems = [];
795
+
796
+ if(elem) {
797
+ var siblings = elem.parentNode.childNodes;
798
+ for ( var i = 0; i < siblings.length; i++ ) {
799
+ if ( not === true && siblings[i] == elem ) continue;
800
+
801
+ if ( siblings[i].nodeType == 1 )
802
+ elems.push( siblings[i] );
803
+ if ( siblings[i] == elem )
804
+ elems.n = elems.length - 1;
805
+ }
806
+ }
807
+
808
+ return jQuery.extend( elems, {
809
+ last: elems.n == elems.length - 1,
810
+ cur: pos == "even" && elems.n % 2 == 0 || pos == "odd" && elems.n % 2 || elems[pos] == elem,
811
+ prev: elems[elems.n - 1],
812
+ next: elems[elems.n + 1]
813
+ });
814
+ },
815
+ merge: function(first, second) {
816
+ var result = [];
817
+
818
+ // Move b over to the new array (this helps to avoid
819
+ // StaticNodeList instances)
820
+ for ( var k = 0; k < first.length; k++ )
821
+ result[k] = first[k];
822
+
823
+ // Now check for duplicates between a and b and only
824
+ // add the unique items
825
+ for ( var i = 0; i < second.length; i++ ) {
826
+ var noCollision = true;
827
+
828
+ // The collision-checking process
829
+ for ( var j = 0; j < first.length; j++ )
830
+ if ( second[i] == first[j] )
831
+ noCollision = false;
832
+
833
+ // If the item is unique, add it
834
+ if ( noCollision )
835
+ result.push( second[i] );
836
+ }
837
+
838
+ return result;
839
+ },
840
+ grep: function(elems, fn, inv) {
841
+ // If a string is passed in for the function, make a function
842
+ // for it (a handy shortcut)
843
+ if ( fn.constructor == String )
844
+ fn = new Function("a","i","return " + fn);
845
+
846
+ var result = [];
847
+
848
+ // Go through the array, only saving the items
849
+ // that pass the validator function
850
+ for ( var i = 0; i < elems.length; i++ )
851
+ if ( !inv && fn(elems[i],i) || inv && !fn(elems[i],i) )
852
+ result.push( elems[i] );
853
+
854
+ return result;
855
+ },
856
+ map: function(elems, fn) {
857
+ // If a string is passed in for the function, make a function
858
+ // for it (a handy shortcut)
859
+ if ( fn.constructor == String )
860
+ fn = new Function("a","return " + fn);
861
+
862
+ var result = [];
863
+
864
+ // Go through the array, translating each of the items to their
865
+ // new value (or values).
866
+ for ( var i = 0; i < elems.length; i++ ) {
867
+ var val = fn(elems[i],i);
868
+
869
+ if ( val !== null && val != undefined ) {
870
+ if ( val.constructor != Array ) val = [val];
871
+ result = jQuery.merge( result, val );
872
+ }
873
+ }
874
+
875
+ return result;
876
+ },
877
+
878
+ /*
879
+ * A number of helper functions used for managing events.
880
+ * Many of the ideas behind this code orignated from Dean Edwards' addEvent library.
881
+ */
882
+ event: {
883
+
884
+ // Bind an event to an element
885
+ // Original by Dean Edwards
886
+ add: function(element, type, handler) {
887
+ // For whatever reason, IE has trouble passing the window object
888
+ // around, causing it to be cloned in the process
889
+ if ( jQuery.browser.msie && element.setInterval != undefined )
890
+ element = window;
891
+
892
+ // Make sure that the function being executed has a unique ID
893
+ if ( !handler.guid )
894
+ handler.guid = this.guid++;
895
+
896
+ // Init the element's event structure
897
+ if (!element.events)
898
+ element.events = {};
899
+
900
+ // Get the current list of functions bound to this event
901
+ var handlers = element.events[type];
902
+
903
+ // If it hasn't been initialized yet
904
+ if (!handlers) {
905
+ // Init the event handler queue
906
+ handlers = element.events[type] = {};
907
+
908
+ // Remember an existing handler, if it's already there
909
+ if (element["on" + type])
910
+ handlers[0] = element["on" + type];
911
+ }
912
+
913
+ // Add the function to the element's handler list
914
+ handlers[handler.guid] = handler;
915
+
916
+ // And bind the global event handler to the element
917
+ element["on" + type] = this.handle;
918
+
919
+ // Remember the function in a global list (for triggering)
920
+ if (!this.global[type])
921
+ this.global[type] = [];
922
+ this.global[type].push( element );
923
+ },
924
+
925
+ guid: 1,
926
+ global: {},
927
+
928
+ // Detach an event or set of events from an element
929
+ remove: function(element, type, handler) {
930
+ if (element.events)
931
+ if (type && element.events[type])
932
+ if ( handler )
933
+ delete element.events[type][handler.guid];
934
+ else
935
+ for ( var i in element.events[type] )
936
+ delete element.events[type][i];
937
+ else
938
+ for ( var j in element.events )
939
+ this.remove( element, j );
940
+ },
941
+
942
+ trigger: function(type,data,element) {
943
+ // Touch up the incoming data
944
+ data = data || [];
945
+
946
+ // Handle a global trigger
947
+ if ( !element ) {
948
+ var g = this.global[type];
949
+ if ( g )
950
+ for ( var i = 0; i < g.length; i++ )
951
+ this.trigger( type, data, g[i] );
952
+
953
+ // Handle triggering a single element
954
+ } else if ( element["on" + type] ) {
955
+ // Pass along a fake event
956
+ data.unshift( this.fix({ type: type, target: element }) );
957
+
958
+ // Trigger the event
959
+ element["on" + type].apply( element, data );
960
+ }
961
+ },
962
+
963
+ handle: function(event) {
964
+ if ( typeof jQuery == "undefined" ) return;
965
+
966
+ event = event || jQuery.event.fix( window.event );
967
+
968
+ // If no correct event was found, fail
969
+ if ( !event ) return;
970
+
971
+ var returnValue = true;
972
+
973
+ var c = this.events[event.type];
974
+
975
+ var args = [].slice.call( arguments, 1 );
976
+ args.unshift( event );
977
+
978
+ for ( var j in c ) {
979
+ if ( c[j].apply( this, args ) === false ) {
980
+ event.preventDefault();
981
+ event.stopPropagation();
982
+ returnValue = false;
983
+ }
984
+ }
985
+
986
+ return returnValue;
987
+ },
988
+
989
+ fix: function(event) {
990
+ if ( event ) {
991
+ event.preventDefault = function() {
992
+ this.returnValue = false;
993
+ };
994
+
995
+ event.stopPropagation = function() {
996
+ this.cancelBubble = true;
997
+ };
998
+ }
999
+
1000
+ return event;
1001
+ }
1002
+
1003
+ }
1004
+ });
1005
+ new function() {
1006
+ var b = navigator.userAgent.toLowerCase();
1007
+
1008
+ // Figure out what browser is being used
1009
+ jQuery.browser = {
1010
+ safari: /webkit/.test(b),
1011
+ opera: /opera/.test(b),
1012
+ msie: /msie/.test(b) && !/opera/.test(b),
1013
+ mozilla: /mozilla/.test(b) && !/(compatible|webkit)/.test(b)
1014
+ };
1015
+
1016
+ // Check to see if the W3C box model is being used
1017
+ jQuery.boxModel = !jQuery.browser.msie || document.compatMode == "CSS1Compat";
1018
+ };
1019
+
1020
+ jQuery.macros = {
1021
+ to: {
1022
+ appendTo: "append",
1023
+ prependTo: "prepend",
1024
+ insertBefore: "before",
1025
+ insertAfter: "after"
1026
+ },
1027
+
1028
+ css: "width,height,top,left,position,float,overflow,color,background".split(","),
1029
+
1030
+ filter: [ "eq", "lt", "gt", "contains" ],
1031
+
1032
+ attr: {
1033
+
1034
+ val: "value",
1035
+
1036
+ html: "innerHTML",
1037
+
1038
+ id: null,
1039
+
1040
+ title: null,
1041
+
1042
+ name: null,
1043
+
1044
+ href: null,
1045
+
1046
+ src: null,
1047
+
1048
+ rel: null
1049
+ },
1050
+
1051
+ axis: {
1052
+
1053
+ parent: "a.parentNode",
1054
+
1055
+ ancestors: jQuery.parents,
1056
+
1057
+ parents: jQuery.parents,
1058
+
1059
+ next: "jQuery.sibling(a).next",
1060
+
1061
+ prev: "jQuery.sibling(a).prev",
1062
+
1063
+ siblings: "jQuery.sibling(a, null, true)",
1064
+
1065
+ children: "jQuery.sibling(a.firstChild)"
1066
+ },
1067
+
1068
+ each: {
1069
+ removeAttr: function( key ) {
1070
+ this.removeAttribute( key );
1071
+ },
1072
+ show: function(){
1073
+ this.style.display = this.oldblock ? this.oldblock : "";
1074
+ if ( jQuery.css(this,"display") == "none" )
1075
+ this.style.display = "block";
1076
+ },
1077
+ hide: function(){
1078
+ this.oldblock = this.oldblock || jQuery.css(this,"display");
1079
+ if ( this.oldblock == "none" )
1080
+ this.oldblock = "block";
1081
+ this.style.display = "none";
1082
+ },
1083
+ toggle: function(){
1084
+ jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ].apply( jQuery(this), arguments );
1085
+ },
1086
+ addClass: function(c){
1087
+ jQuery.className.add(this,c);
1088
+ },
1089
+ removeClass: function(c){
1090
+ jQuery.className.remove(this,c);
1091
+ },
1092
+ toggleClass: function( c ){
1093
+ jQuery.className[ jQuery.className.has(this,c) ? "remove" : "add" ](this,c);
1094
+ },
1095
+
1096
+ remove: function(a){
1097
+ if ( !a || jQuery.filter( a, [this] ).r )
1098
+ this.parentNode.removeChild( this );
1099
+ },
1100
+ empty: function(){
1101
+ while ( this.firstChild )
1102
+ this.removeChild( this.firstChild );
1103
+ },
1104
+ bind: function( type, fn ) {
1105
+ if ( fn.constructor == String )
1106
+ fn = new Function("e", ( !fn.indexOf(".") ? "jQuery(this)" : "return " ) + fn);
1107
+ jQuery.event.add( this, type, fn );
1108
+ },
1109
+
1110
+ unbind: function( type, fn ) {
1111
+ jQuery.event.remove( this, type, fn );
1112
+ },
1113
+ trigger: function( type, data ) {
1114
+ jQuery.event.trigger( type, data, this );
1115
+ }
1116
+ }
1117
+ };
1118
+
1119
+ jQuery.init();
1120
+ jQuery.fn.extend({
1121
+
1122
+ // We're overriding the old toggle function, so
1123
+ // remember it for later
1124
+ _toggle: jQuery.fn.toggle,
1125
+ toggle: function(a,b) {
1126
+ // If two functions are passed in, we're
1127
+ // toggling on a click
1128
+ return a && b && a.constructor == Function && b.constructor == Function ? this.click(function(e){
1129
+ // Figure out which function to execute
1130
+ this.last = this.last == a ? b : a;
1131
+
1132
+ // Make sure that clicks stop
1133
+ e.preventDefault();
1134
+
1135
+ // and execute the function
1136
+ return this.last.apply( this, [e] ) || false;
1137
+ }) :
1138
+
1139
+ // Otherwise, execute the old toggle function
1140
+ this._toggle.apply( this, arguments );
1141
+ },
1142
+ hover: function(f,g) {
1143
+
1144
+ // A private function for haandling mouse 'hovering'
1145
+ function handleHover(e) {
1146
+ // Check if mouse(over|out) are still within the same parent element
1147
+ var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
1148
+
1149
+ // Traverse up the tree
1150
+ while ( p && p != this ) try { p = p.parentNode } catch(e) { p = this; };
1151
+
1152
+ // If we actually just moused on to a sub-element, ignore it
1153
+ if ( p == this ) return false;
1154
+
1155
+ // Execute the right function
1156
+ return (e.type == "mouseover" ? f : g).apply(this, [e]);
1157
+ }
1158
+
1159
+ // Bind the function to the two event listeners
1160
+ return this.mouseover(handleHover).mouseout(handleHover);
1161
+ },
1162
+ ready: function(f) {
1163
+ // If the DOM is already ready
1164
+ if ( jQuery.isReady )
1165
+ // Execute the function immediately
1166
+ f.apply( document );
1167
+
1168
+ // Otherwise, remember the function for later
1169
+ else {
1170
+ // Add the function to the wait list
1171
+ jQuery.readyList.push( f );
1172
+ }
1173
+
1174
+ return this;
1175
+ }
1176
+ });
1177
+
1178
+ jQuery.extend({
1179
+ /*
1180
+ * All the code that makes DOM Ready work nicely.
1181
+ */
1182
+ isReady: false,
1183
+ readyList: [],
1184
+
1185
+ // Handle when the DOM is ready
1186
+ ready: function() {
1187
+ // Make sure that the DOM is not already loaded
1188
+ if ( !jQuery.isReady ) {
1189
+ // Remember that the DOM is ready
1190
+ jQuery.isReady = true;
1191
+
1192
+ // If there are functions bound, to execute
1193
+ if ( jQuery.readyList ) {
1194
+ // Execute all of them
1195
+ for ( var i = 0; i < jQuery.readyList.length; i++ )
1196
+ jQuery.readyList[i].apply( document );
1197
+
1198
+ // Reset the list of functions
1199
+ jQuery.readyList = null;
1200
+ }
1201
+ // Remove event lisenter to avoid memory leak
1202
+ if ( jQuery.browser.mozilla || jQuery.browser.opera )
1203
+ document.removeEventListener( "DOMContentLoaded", jQuery.ready, false );
1204
+ }
1205
+ }
1206
+ });
1207
+
1208
+ new function(){
1209
+
1210
+ var e = ("blur,focus,load,resize,scroll,unload,click,dblclick," +
1211
+ "mousedown,mouseup,mousemove,mouseover,mouseout,change,reset,select," +
1212
+ "submit,keydown,keypress,keyup,error").split(",");
1213
+
1214
+ // Go through all the event names, but make sure that
1215
+ // it is enclosed properly
1216
+ for ( var i = 0; i < e.length; i++ ) new function(){
1217
+
1218
+ var o = e[i];
1219
+
1220
+ // Handle event binding
1221
+ jQuery.fn[o] = function(f){
1222
+ return f ? this.bind(o, f) : this.trigger(o);
1223
+ };
1224
+
1225
+ // Handle event unbinding
1226
+ jQuery.fn["un"+o] = function(f){ return this.unbind(o, f); };
1227
+
1228
+ // Finally, handle events that only fire once
1229
+ jQuery.fn["one"+o] = function(f){
1230
+ // Attach the event listener
1231
+ return this.each(function(){
1232
+
1233
+ var count = 0;
1234
+
1235
+ // Add the event
1236
+ jQuery.event.add( this, o, function(e){
1237
+ // If this function has already been executed, stop
1238
+ if ( count++ ) return;
1239
+
1240
+ // And execute the bound function
1241
+ return f.apply(this, [e]);
1242
+ });
1243
+ });
1244
+ };
1245
+
1246
+ };
1247
+
1248
+ // If Mozilla is used
1249
+ if ( jQuery.browser.mozilla || jQuery.browser.opera ) {
1250
+ // Use the handy event callback
1251
+ document.addEventListener( "DOMContentLoaded", jQuery.ready, false );
1252
+
1253
+ // If IE is used, use the excellent hack by Matthias Miller
1254
+ // http://www.outofhanwell.com/blog/index.php?title=the_window_onload_problem_revisited
1255
+ } else if ( jQuery.browser.msie ) {
1256
+
1257
+ // Only works if you document.write() it
1258
+ document.write("<scr" + "ipt id=__ie_init defer=true " +
1259
+ "src=//:><\/script>");
1260
+
1261
+ // Use the defer script hack
1262
+ var script = document.getElementById("__ie_init");
1263
+ script.onreadystatechange = function() {
1264
+ if ( this.readyState != "complete" ) return;
1265
+ this.parentNode.removeChild( this );
1266
+ jQuery.ready();
1267
+ };
1268
+
1269
+ // Clear from memory
1270
+ script = null;
1271
+
1272
+ // If Safari is used
1273
+ } else if ( jQuery.browser.safari ) {
1274
+ // Continually check to see if the document.readyState is valid
1275
+ jQuery.safariTimer = setInterval(function(){
1276
+ // loaded and complete are both valid states
1277
+ if ( document.readyState == "loaded" ||
1278
+ document.readyState == "complete" ) {
1279
+
1280
+ // If either one are found, remove the timer
1281
+ clearInterval( jQuery.safariTimer );
1282
+ jQuery.safariTimer = null;
1283
+
1284
+ // and execute any waiting functions
1285
+ jQuery.ready();
1286
+ }
1287
+ }, 10);
1288
+ }
1289
+
1290
+ // A fallback to window.onload, that will always work
1291
+ jQuery.event.add( window, "load", jQuery.ready );
1292
+
1293
+ };
1294
+
1295
+ // Clean up after IE to avoid memory leaks
1296
+ if (jQuery.browser.msie) jQuery(window).unload(function() {
1297
+ var event = jQuery.event, global = event.global;
1298
+ for (var type in global) {
1299
+ var els = global[type], i = els.length;
1300
+ if (i>0) do if (type != 'unload') event.remove(els[i-1], type); while (--i);
1301
+ }
1302
+ });
1303
+ jQuery.fn.extend({
1304
+
1305
+ // overwrite the old show method
1306
+ _show: jQuery.fn.show,
1307
+
1308
+ show: function(speed,callback){
1309
+ return speed ? this.animate({
1310
+ height: "show", width: "show", opacity: "show"
1311
+ }, speed, callback) : this._show();
1312
+ },
1313
+
1314
+ // Overwrite the old hide method
1315
+ _hide: jQuery.fn.hide,
1316
+
1317
+ hide: function(speed,callback){
1318
+ return speed ? this.animate({
1319
+ height: "hide", width: "hide", opacity: "hide"
1320
+ }, speed, callback) : this._hide();
1321
+ },
1322
+
1323
+ slideDown: function(speed,callback){
1324
+ return this.animate({height: "show"}, speed, callback);
1325
+ },
1326
+
1327
+ slideUp: function(speed,callback){
1328
+ return this.animate({height: "hide"}, speed, callback);
1329
+ },
1330
+
1331
+ slideToggle: function(speed,callback){
1332
+ return this.each(function(){
1333
+ var state = jQuery(this).is(":hidden") ? "show" : "hide";
1334
+ jQuery(this).animate({height: state}, speed, callback);
1335
+ });
1336
+ },
1337
+
1338
+ fadeIn: function(speed,callback){
1339
+ return this.animate({opacity: "show"}, speed, callback);
1340
+ },
1341
+
1342
+ fadeOut: function(speed,callback){
1343
+ return this.animate({opacity: "hide"}, speed, callback);
1344
+ },
1345
+
1346
+ fadeTo: function(speed,to,callback){
1347
+ return this.animate({opacity: to}, speed, callback);
1348
+ },
1349
+ animate: function(prop,speed,callback) {
1350
+ return this.queue(function(){
1351
+
1352
+ this.curAnim = prop;
1353
+
1354
+ for ( var p in prop ) {
1355
+ var e = new jQuery.fx( this, jQuery.speed(speed,callback), p );
1356
+ if ( prop[p].constructor == Number )
1357
+ e.custom( e.cur(), prop[p] );
1358
+ else
1359
+ e[ prop[p] ]( prop );
1360
+ }
1361
+
1362
+ });
1363
+ },
1364
+ queue: function(type,fn){
1365
+ if ( !fn ) {
1366
+ fn = type;
1367
+ type = "fx";
1368
+ }
1369
+
1370
+ return this.each(function(){
1371
+ if ( !this.queue )
1372
+ this.queue = {};
1373
+
1374
+ if ( !this.queue[type] )
1375
+ this.queue[type] = [];
1376
+
1377
+ this.queue[type].push( fn );
1378
+
1379
+ if ( this.queue[type].length == 1 )
1380
+ fn.apply(this);
1381
+ });
1382
+ }
1383
+
1384
+ });
1385
+
1386
+ jQuery.extend({
1387
+
1388
+ setAuto: function(e,p) {
1389
+ if ( e.notAuto ) return;
1390
+
1391
+ if ( p == "height" && e.scrollHeight != parseInt(jQuery.curCSS(e,p)) ) return;
1392
+ if ( p == "width" && e.scrollWidth != parseInt(jQuery.curCSS(e,p)) ) return;
1393
+
1394
+ // Remember the original height
1395
+ var a = e.style[p];
1396
+
1397
+ // Figure out the size of the height right now
1398
+ var o = jQuery.curCSS(e,p,1);
1399
+
1400
+ if ( p == "height" && e.scrollHeight != o ||
1401
+ p == "width" && e.scrollWidth != o ) return;
1402
+
1403
+ // Set the height to auto
1404
+ e.style[p] = e.currentStyle ? "" : "auto";
1405
+
1406
+ // See what the size of "auto" is
1407
+ var n = jQuery.curCSS(e,p,1);
1408
+
1409
+ // Revert back to the original size
1410
+ if ( o != n && n != "auto" ) {
1411
+ e.style[p] = a;
1412
+ e.notAuto = true;
1413
+ }
1414
+ },
1415
+
1416
+ speed: function(s,o) {
1417
+ o = o || {};
1418
+
1419
+ if ( o.constructor == Function )
1420
+ o = { complete: o };
1421
+
1422
+ var ss = { slow: 600, fast: 200 };
1423
+ o.duration = (s && s.constructor == Number ? s : ss[s]) || 400;
1424
+
1425
+ // Queueing
1426
+ o.oldComplete = o.complete;
1427
+ o.complete = function(){
1428
+ jQuery.dequeue(this, "fx");
1429
+ if ( o.oldComplete && o.oldComplete.constructor == Function )
1430
+ o.oldComplete.apply( this );
1431
+ };
1432
+
1433
+ return o;
1434
+ },
1435
+
1436
+ queue: {},
1437
+
1438
+ dequeue: function(elem,type){
1439
+ type = type || "fx";
1440
+
1441
+ if ( elem.queue && elem.queue[type] ) {
1442
+ // Remove self
1443
+ elem.queue[type].shift();
1444
+
1445
+ // Get next function
1446
+ var f = elem.queue[type][0];
1447
+
1448
+ if ( f ) f.apply( elem );
1449
+ }
1450
+ },
1451
+
1452
+ /*
1453
+ * I originally wrote fx() as a clone of moo.fx and in the process
1454
+ * of making it small in size the code became illegible to sane
1455
+ * people. You've been warned.
1456
+ */
1457
+
1458
+ fx: function( elem, options, prop ){
1459
+
1460
+ var z = this;
1461
+
1462
+ // The users options
1463
+ z.o = {
1464
+ duration: options.duration || 400,
1465
+ complete: options.complete,
1466
+ step: options.step
1467
+ };
1468
+
1469
+ // The element
1470
+ z.el = elem;
1471
+
1472
+ // The styles
1473
+ var y = z.el.style;
1474
+
1475
+ // Simple function for setting a style value
1476
+ z.a = function(){
1477
+ if ( options.step )
1478
+ options.step.apply( elem, [ z.now ] );
1479
+
1480
+ if ( prop == "opacity" )
1481
+ jQuery.attr(y, "opacity", z.now); // Let attr handle opacity
1482
+ else if ( parseInt(z.now) ) // My hate for IE will never die
1483
+ y[prop] = parseInt(z.now) + "px";
1484
+
1485
+ y.display = "block";
1486
+ };
1487
+
1488
+ // Figure out the maximum number to run to
1489
+ z.max = function(){
1490
+ return parseFloat( jQuery.css(z.el,prop) );
1491
+ };
1492
+
1493
+ // Get the current size
1494
+ z.cur = function(){
1495
+ var r = parseFloat( jQuery.curCSS(z.el, prop) );
1496
+ return r && r > -10000 ? r : z.max();
1497
+ };
1498
+
1499
+ // Start an animation from one number to another
1500
+ z.custom = function(from,to){
1501
+ z.startTime = (new Date()).getTime();
1502
+ z.now = from;
1503
+ z.a();
1504
+
1505
+ z.timer = setInterval(function(){
1506
+ z.step(from, to);
1507
+ }, 13);
1508
+ };
1509
+
1510
+ // Simple 'show' function
1511
+ z.show = function( p ){
1512
+ if ( !z.el.orig ) z.el.orig = {};
1513
+
1514
+ // Remember where we started, so that we can go back to it later
1515
+ z.el.orig[prop] = this.cur();
1516
+
1517
+ // Begin the animation
1518
+ if (prop == "opacity")
1519
+ z.custom(z.el.orig[prop], 1);
1520
+ else
1521
+ z.custom(0, z.el.orig[prop]);
1522
+
1523
+ // Stupid IE, look what you made me do
1524
+ if ( prop != "opacity" )
1525
+ y[prop] = "1px";
1526
+ };
1527
+
1528
+ // Simple 'hide' function
1529
+ z.hide = function(){
1530
+ if ( !z.el.orig ) z.el.orig = {};
1531
+
1532
+ // Remember where we started, so that we can go back to it later
1533
+ z.el.orig[prop] = this.cur();
1534
+
1535
+ z.o.hide = true;
1536
+
1537
+ // Begin the animation
1538
+ z.custom(z.el.orig[prop], 0);
1539
+ };
1540
+
1541
+ // Remember the overflow of the element
1542
+ if ( !z.el.oldOverlay )
1543
+ z.el.oldOverflow = jQuery.css( z.el, "overflow" );
1544
+
1545
+ // Make sure that nothing sneaks out
1546
+ y.overflow = "hidden";
1547
+
1548
+ // Each step of an animation
1549
+ z.step = function(firstNum, lastNum){
1550
+ var t = (new Date()).getTime();
1551
+
1552
+ if (t > z.o.duration + z.startTime) {
1553
+ // Stop the timer
1554
+ clearInterval(z.timer);
1555
+ z.timer = null;
1556
+
1557
+ z.now = lastNum;
1558
+ z.a();
1559
+
1560
+ z.el.curAnim[ prop ] = true;
1561
+
1562
+ var done = true;
1563
+ for ( var i in z.el.curAnim )
1564
+ if ( z.el.curAnim[i] !== true )
1565
+ done = false;
1566
+
1567
+ if ( done ) {
1568
+ // Reset the overflow
1569
+ y.overflow = z.el.oldOverflow;
1570
+
1571
+ // Hide the element if the "hide" operation was done
1572
+ if ( z.o.hide )
1573
+ y.display = 'none';
1574
+
1575
+ // Reset the property, if the item has been hidden
1576
+ if ( z.o.hide ) {
1577
+ for ( var p in z.el.curAnim ) {
1578
+ if (p == "opacity" && jQuery.browser.msie)
1579
+ jQuery.attr(y, p, z.el.orig[p]);
1580
+ else
1581
+ y[ p ] = z.el.orig[p] + "px";
1582
+
1583
+ // set its height and/or width to auto
1584
+ if ( p == 'height' || p == 'width' )
1585
+ jQuery.setAuto( z.el, p );
1586
+ }
1587
+ }
1588
+ }
1589
+
1590
+ // If a callback was provided, execute it
1591
+ if( done && z.o.complete && z.o.complete.constructor == Function )
1592
+ // Execute the complete function
1593
+ z.o.complete.apply( z.el );
1594
+ } else {
1595
+ // Figure out where in the animation we are and set the number
1596
+ var p = (t - this.startTime) / z.o.duration;
1597
+ z.now = ((-Math.cos(p*Math.PI)/2) + 0.5) * (lastNum-firstNum) + firstNum;
1598
+
1599
+ // Perform the next step of the animation
1600
+ z.a();
1601
+ }
1602
+ };
1603
+
1604
+ }
1605
+
1606
+ });
1607
+ jQuery.fn.extend({
1608
+ loadIfModified: function( url, params, callback ) {
1609
+ this.load( url, params, callback, 1 );
1610
+ },
1611
+ load: function( url, params, callback, ifModified ) {
1612
+ if ( url.constructor == Function )
1613
+ return this.bind("load", url);
1614
+
1615
+ callback = callback || function(){};
1616
+
1617
+ // Default to a GET request
1618
+ var type = "GET";
1619
+
1620
+ // If the second parameter was provided
1621
+ if ( params ) {
1622
+ // If it's a function
1623
+ if ( params.constructor == Function ) {
1624
+ // We assume that it's the callback
1625
+ callback = params;
1626
+ params = null;
1627
+
1628
+ // Otherwise, build a param string
1629
+ } else {
1630
+ params = jQuery.param( params );
1631
+ type = "POST";
1632
+ }
1633
+ }
1634
+
1635
+ var self = this;
1636
+
1637
+ // Request the remote document
1638
+ jQuery.ajax( type, url, params,function(res, status){
1639
+
1640
+ if ( status == "success" || !ifModified && status == "notmodified" ) {
1641
+ // Inject the HTML into all the matched elements
1642
+ self.html(res.responseText).each( callback, [res.responseText, status] );
1643
+
1644
+ // Execute all the scripts inside of the newly-injected HTML
1645
+ jQuery("script", self).each(function(){
1646
+ if ( this.src )
1647
+ jQuery.getScript( this.src );
1648
+ else
1649
+ eval.call( window, this.text || this.textContent || this.innerHTML || "" );
1650
+ });
1651
+ } else
1652
+ callback.apply( self, [res.responseText, status] );
1653
+
1654
+ }, ifModified);
1655
+
1656
+ return this;
1657
+ },
1658
+ serialize: function() {
1659
+ return jQuery.param( this );
1660
+ }
1661
+
1662
+ });
1663
+
1664
+ // If IE is used, create a wrapper for the XMLHttpRequest object
1665
+ if ( jQuery.browser.msie && typeof XMLHttpRequest == "undefined" )
1666
+ XMLHttpRequest = function(){
1667
+ return new ActiveXObject(
1668
+ navigator.userAgent.indexOf("MSIE 5") >= 0 ?
1669
+ "Microsoft.XMLHTTP" : "Msxml2.XMLHTTP"
1670
+ );
1671
+ };
1672
+
1673
+ // Attach a bunch of functions for handling common AJAX events
1674
+
1675
+
1676
+
1677
+ new function(){
1678
+ var e = "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess".split(",");
1679
+
1680
+ for ( var i = 0; i < e.length; i++ ) new function(){
1681
+ var o = e[i];
1682
+ jQuery.fn[o] = function(f){
1683
+ return this.bind(o, f);
1684
+ };
1685
+ };
1686
+ };
1687
+
1688
+ jQuery.extend({
1689
+ get: function( url, data, callback, type, ifModified ) {
1690
+ if ( data.constructor == Function ) {
1691
+ type = callback;
1692
+ callback = data;
1693
+ data = null;
1694
+ }
1695
+
1696
+ // append ? + data or & + data, in case there are already params
1697
+ if ( data ) url += ((url.indexOf("?") > -1) ? "&" : "?") + jQuery.param(data);
1698
+
1699
+ // Build and start the HTTP Request
1700
+ jQuery.ajax( "GET", url, null, function(r, status) {
1701
+ if ( callback ) callback( jQuery.httpData(r,type), status );
1702
+ }, ifModified);
1703
+ },
1704
+ getIfModified: function( url, data, callback, type ) {
1705
+ jQuery.get(url, data, callback, type, 1);
1706
+ },
1707
+ getScript: function( url, callback ) {
1708
+ jQuery.get(url, callback, "script");
1709
+ },
1710
+ getJSON: function( url, data, callback ) {
1711
+ if(callback)
1712
+ jQuery.get(url, data, callback, "json");
1713
+ else {
1714
+ jQuery.get(url, data, "json");
1715
+ }
1716
+ },
1717
+ post: function( url, data, callback, type ) {
1718
+ // Build and start the HTTP Request
1719
+ jQuery.ajax( "POST", url, jQuery.param(data), function(r, status) {
1720
+ if ( callback ) callback( jQuery.httpData(r,type), status );
1721
+ });
1722
+ },
1723
+
1724
+ // timeout (ms)
1725
+ timeout: 0,
1726
+ ajaxTimeout: function(timeout) {
1727
+ jQuery.timeout = timeout;
1728
+ },
1729
+
1730
+ // Last-Modified header cache for next request
1731
+ lastModified: {},
1732
+ ajax: function( type, url, data, ret, ifModified ) {
1733
+ // If only a single argument was passed in,
1734
+ // assume that it is a object of key/value pairs
1735
+ if ( !url ) {
1736
+ ret = type.complete;
1737
+ var success = type.success;
1738
+ var error = type.error;
1739
+ var dataType = type.dataType;
1740
+ var global = typeof type.global == "boolean" ? type.global : true;
1741
+ var timeout = typeof type.timeout == "number" ? type.timeout : jQuery.timeout;
1742
+ var ifModified = type.ifModified || false;
1743
+ data = type.data;
1744
+ url = type.url;
1745
+ type = type.type;
1746
+ }
1747
+
1748
+ // Watch for a new set of requests
1749
+ if ( global && ! jQuery.active++ )
1750
+ jQuery.event.trigger( "ajaxStart" );
1751
+
1752
+ var requestDone = false;
1753
+
1754
+ // Create the request object
1755
+ var xml = new XMLHttpRequest();
1756
+
1757
+ // Open the socket
1758
+ xml.open(type || "GET", url, true);
1759
+
1760
+ // Set the correct header, if data is being sent
1761
+ if ( data )
1762
+ xml.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
1763
+
1764
+ // Set the If-Modified-Since header, if ifModified mode.
1765
+ if ( ifModified )
1766
+ xml.setRequestHeader("If-Modified-Since",
1767
+ jQuery.lastModified[url] || "Thu, 01 Jan 1970 00:00:00 GMT" );
1768
+
1769
+ // Set header so the called script knows that it's an XMLHttpRequest
1770
+ xml.setRequestHeader("X-Requested-With", "XMLHttpRequest");
1771
+
1772
+ // Make sure the browser sends the right content length
1773
+ if ( xml.overrideMimeType )
1774
+ xml.setRequestHeader("Connection", "close");
1775
+
1776
+ // Wait for a response to come back
1777
+ var onreadystatechange = function(istimeout){
1778
+ // The transfer is complete and the data is available, or the request timed out
1779
+ if ( xml && (xml.readyState == 4 || istimeout == "timeout") ) {
1780
+ requestDone = true;
1781
+
1782
+ var status = jQuery.httpSuccess( xml ) && istimeout != "timeout" ?
1783
+ ifModified && jQuery.httpNotModified( xml, url ) ? "notmodified" : "success" : "error";
1784
+
1785
+ // Make sure that the request was successful or notmodified
1786
+ if ( status != "error" ) {
1787
+ // Cache Last-Modified header, if ifModified mode.
1788
+ var modRes;
1789
+ try {
1790
+ modRes = xml.getResponseHeader("Last-Modified");
1791
+ } catch(e) {} // swallow exception thrown by FF if header is not available
1792
+
1793
+ if ( ifModified && modRes )
1794
+ jQuery.lastModified[url] = modRes;
1795
+
1796
+ // If a local callback was specified, fire it
1797
+ if ( success )
1798
+ success( jQuery.httpData( xml, dataType ), status );
1799
+
1800
+ // Fire the global callback
1801
+ if( global )
1802
+ jQuery.event.trigger( "ajaxSuccess" );
1803
+
1804
+ // Otherwise, the request was not successful
1805
+ } else {
1806
+ // If a local callback was specified, fire it
1807
+ if ( error ) error( xml, status );
1808
+
1809
+ // Fire the global callback
1810
+ if( global )
1811
+ jQuery.event.trigger( "ajaxError" );
1812
+ }
1813
+
1814
+ // The request was completed
1815
+ if( global )
1816
+ jQuery.event.trigger( "ajaxComplete" );
1817
+
1818
+ // Handle the global AJAX counter
1819
+ if ( global && ! --jQuery.active )
1820
+ jQuery.event.trigger( "ajaxStop" );
1821
+
1822
+ // Process result
1823
+ if ( ret ) ret(xml, status);
1824
+
1825
+ // Stop memory leaks
1826
+ xml.onreadystatechange = function(){};
1827
+ xml = null;
1828
+
1829
+ }
1830
+ };
1831
+ xml.onreadystatechange = onreadystatechange;
1832
+
1833
+ // Timeout checker
1834
+ if(timeout > 0)
1835
+ setTimeout(function(){
1836
+ // Check to see if the request is still happening
1837
+ if (xml) {
1838
+ // Cancel the request
1839
+ xml.abort();
1840
+
1841
+ if ( !requestDone ) onreadystatechange( "timeout" );
1842
+
1843
+ // Clear from memory
1844
+ xml = null;
1845
+ }
1846
+ }, timeout);
1847
+
1848
+ // Send the data
1849
+ xml.send(data);
1850
+ },
1851
+
1852
+ // Counter for holding the number of active queries
1853
+ active: 0,
1854
+
1855
+ // Determines if an XMLHttpRequest was successful or not
1856
+ httpSuccess: function(r) {
1857
+ try {
1858
+ return !r.status && location.protocol == "file:" ||
1859
+ ( r.status >= 200 && r.status < 300 ) || r.status == 304 ||
1860
+ jQuery.browser.safari && r.status == undefined;
1861
+ } catch(e){}
1862
+
1863
+ return false;
1864
+ },
1865
+
1866
+ // Determines if an XMLHttpRequest returns NotModified
1867
+ httpNotModified: function(xml, url) {
1868
+ try {
1869
+ var xmlRes = xml.getResponseHeader("Last-Modified");
1870
+
1871
+ // Firefox always returns 200. check Last-Modified date
1872
+ return xml.status == 304 || xmlRes == jQuery.lastModified[url] ||
1873
+ jQuery.browser.safari && xml.status == undefined;
1874
+ } catch(e){}
1875
+
1876
+ return false;
1877
+ },
1878
+
1879
+ /* Get the data out of an XMLHttpRequest.
1880
+ * Return parsed XML if content-type header is "xml" and type is "xml" or omitted,
1881
+ * otherwise return plain text.
1882
+ * (String) data - The type of data that you're expecting back,
1883
+ * (e.g. "xml", "html", "script")
1884
+ */
1885
+ httpData: function(r,type) {
1886
+ var ct = r.getResponseHeader("content-type");
1887
+ var data = !type && ct && ct.indexOf("xml") >= 0;
1888
+ data = type == "xml" || data ? r.responseXML : r.responseText;
1889
+
1890
+ // If the type is "script", eval it
1891
+ if ( type == "script" ) eval.call( window, data );
1892
+
1893
+ // Get the JavaScript object, if JSON is used.
1894
+ if ( type == "json" ) eval( "data = " + data );
1895
+
1896
+ return data;
1897
+ },
1898
+
1899
+ // Serialize an array of form elements or a set of
1900
+ // key/values into a query string
1901
+ param: function(a) {
1902
+ var s = [];
1903
+
1904
+ // If an array was passed in, assume that it is an array
1905
+ // of form elements
1906
+ if ( a.constructor == Array || a.jquery ) {
1907
+ // Serialize the form elements
1908
+ for ( var i = 0; i < a.length; i++ )
1909
+ s.push( a[i].name + "=" + encodeURIComponent( a[i].value ) );
1910
+
1911
+ // Otherwise, assume that it's an object of key/value pairs
1912
+ } else {
1913
+ // Serialize the key/values
1914
+ for ( var j in a )
1915
+ s.push( j + "=" + encodeURIComponent( a[j] ) );
1916
+ }
1917
+
1918
+ // Return the resulting serialization
1919
+ return s.join("&");
1920
+ }
1921
+
1922
+ });
1923
+ } // close: if(typeof window.jQuery == "undefined") {