33e7c2a372047375c78d7067094a6cfbc3d7e36b
[Packages/TYPO3.CMS.git] / typo3 / sysext / t3editor / jslib / Mochi.js
1 /***
2
3 MochiKit.MochiKit 1.4 : PACKED VERSION
4
5 THIS FILE IS AUTOMATICALLY GENERATED. If creating patches, please
6 diff against the source tree, not this file.
7
8 See <http://mochikit.com/> for documentation, downloads, license, etc.
9
10 (c) 2005 Bob Ippolito. All rights Reserved.
11
12 ***/
13
14 if(typeof (dojo)!="undefined"){
15 dojo.provide("MochiKit.Base");
16 }
17 if(typeof (MochiKit)=="undefined"){
18 MochiKit={};
19 }
20 if(typeof (MochiKit.Base)=="undefined"){
21 MochiKit.Base={};
22 }
23 if(typeof (MochiKit.__export__)=="undefined"){
24 MochiKit.__export__=(MochiKit.__compat__||(typeof (JSAN)=="undefined"&&typeof (dojo)=="undefined"));
25 }
26 MochiKit.Base.VERSION="1.4";
27 MochiKit.Base.NAME="MochiKit.Base";
28 MochiKit.Base.update=function(_1,_2){
29 if(_1===null){
30 _1={};
31 }
32 for(var i=1;i<arguments.length;i++){
33 var o=arguments[i];
34 if(typeof (o)!="undefined"&&o!==null){
35 for(var k in o){
36 _1[k]=o[k];
37 }
38 }
39 }
40 return _1;
41 };
42 MochiKit.Base.update(MochiKit.Base,{__repr__:function(){
43 return "["+this.NAME+" "+this.VERSION+"]";
44 },toString:function(){
45 return this.__repr__();
46 },camelize:function(_6){
47 var _7=_6.split("-");
48 var cc=_7[0];
49 for(var i=1;i<_7.length;i++){
50 cc+=_7[i].charAt(0).toUpperCase()+_7[i].substring(1);
51 }
52 return cc;
53 },counter:function(n){
54 if(arguments.length===0){
55 n=1;
56 }
57 return function(){
58 return n++;
59 };
60 },clone:function(_b){
61 var me=arguments.callee;
62 if(arguments.length==1){
63 me.prototype=_b;
64 return new me();
65 }
66 },_flattenArray:function(_d,_e){
67 for(var i=0;i<_e.length;i++){
68 var o=_e[i];
69 if(o instanceof Array){
70 arguments.callee(_d,o);
71 }else{
72 _d.push(o);
73 }
74 }
75 return _d;
76 },flattenArray:function(lst){
77 return MochiKit.Base._flattenArray([],lst);
78 },flattenArguments:function(lst){
79 var res=[];
80 var m=MochiKit.Base;
81 var _15=m.extend(null,arguments);
82 while(_15.length){
83 var o=_15.shift();
84 if(o&&typeof (o)=="object"&&typeof (o.length)=="number"){
85 for(var i=o.length-1;i>=0;i--){
86 _15.unshift(o[i]);
87 }
88 }else{
89 res.push(o);
90 }
91 }
92 return res;
93 },extend:function(_18,obj,_1a){
94 if(!_1a){
95 _1a=0;
96 }
97 if(obj){
98 var l=obj.length;
99 if(typeof (l)!="number"){
100 if(typeof (MochiKit.Iter)!="undefined"){
101 obj=MochiKit.Iter.list(obj);
102 l=obj.length;
103 }else{
104 throw new TypeError("Argument not an array-like and MochiKit.Iter not present");
105 }
106 }
107 if(!_18){
108 _18=[];
109 }
110 for(var i=_1a;i<l;i++){
111 _18.push(obj[i]);
112 }
113 }
114 return _18;
115 },updatetree:function(_1d,obj){
116 if(_1d===null){
117 _1d={};
118 }
119 for(var i=1;i<arguments.length;i++){
120 var o=arguments[i];
121 if(typeof (o)!="undefined"&&o!==null){
122 for(var k in o){
123 var v=o[k];
124 if(typeof (_1d[k])=="object"&&typeof (v)=="object"){
125 arguments.callee(_1d[k],v);
126 }else{
127 _1d[k]=v;
128 }
129 }
130 }
131 }
132 return _1d;
133 },setdefault:function(_23,obj){
134 if(_23===null){
135 _23={};
136 }
137 for(var i=1;i<arguments.length;i++){
138 var o=arguments[i];
139 for(var k in o){
140 if(!(k in _23)){
141 _23[k]=o[k];
142 }
143 }
144 }
145 return _23;
146 },keys:function(obj){
147 var _29=[];
148 for(var _2a in obj){
149 _29.push(_2a);
150 }
151 return _29;
152 },values:function(obj){
153 var _2c=[];
154 for(var _2d in obj){
155 _2c.push(obj[_2d]);
156 }
157 return _2c;
158 },items:function(obj){
159 var _2f=[];
160 var e;
161 for(var _31 in obj){
162 var v;
163 try{
164 v=obj[_31];
165 }
166 catch(e){
167 continue;
168 }
169 _2f.push([_31,v]);
170 }
171 return _2f;
172 },_newNamedError:function(_33,_34,_35){
173 _35.prototype=new MochiKit.Base.NamedError(_33.NAME+"."+_34);
174 _33[_34]=_35;
175 },operator:{truth:function(a){
176 return !!a;
177 },lognot:function(a){
178 return !a;
179 },identity:function(a){
180 return a;
181 },not:function(a){
182 return ~a;
183 },neg:function(a){
184 return -a;
185 },add:function(a,b){
186 return a+b;
187 },sub:function(a,b){
188 return a-b;
189 },div:function(a,b){
190 return a/b;
191 },mod:function(a,b){
192 return a%b;
193 },mul:function(a,b){
194 return a*b;
195 },and:function(a,b){
196 return a&b;
197 },or:function(a,b){
198 return a|b;
199 },xor:function(a,b){
200 return a^b;
201 },lshift:function(a,b){
202 return a<<b;
203 },rshift:function(a,b){
204 return a>>b;
205 },zrshift:function(a,b){
206 return a>>>b;
207 },eq:function(a,b){
208 return a==b;
209 },ne:function(a,b){
210 return a!=b;
211 },gt:function(a,b){
212 return a>b;
213 },ge:function(a,b){
214 return a>=b;
215 },lt:function(a,b){
216 return a<b;
217 },le:function(a,b){
218 return a<=b;
219 },seq:function(a,b){
220 return a===b;
221 },sne:function(a,b){
222 return a!==b;
223 },ceq:function(a,b){
224 return MochiKit.Base.compare(a,b)===0;
225 },cne:function(a,b){
226 return MochiKit.Base.compare(a,b)!==0;
227 },cgt:function(a,b){
228 return MochiKit.Base.compare(a,b)==1;
229 },cge:function(a,b){
230 return MochiKit.Base.compare(a,b)!=-1;
231 },clt:function(a,b){
232 return MochiKit.Base.compare(a,b)==-1;
233 },cle:function(a,b){
234 return MochiKit.Base.compare(a,b)!=1;
235 },logand:function(a,b){
236 return a&&b;
237 },logor:function(a,b){
238 return a||b;
239 },contains:function(a,b){
240 return b in a;
241 }},forwardCall:function(_73){
242 return function(){
243 return this[_73].apply(this,arguments);
244 };
245 },itemgetter:function(_74){
246 return function(arg){
247 return arg[_74];
248 };
249 },typeMatcher:function(){
250 var _76={};
251 for(var i=0;i<arguments.length;i++){
252 var typ=arguments[i];
253 _76[typ]=typ;
254 }
255 return function(){
256 for(var i=0;i<arguments.length;i++){
257 if(!(typeof (arguments[i]) in _76)){
258 return false;
259 }
260 }
261 return true;
262 };
263 },isNull:function(){
264 for(var i=0;i<arguments.length;i++){
265 if(arguments[i]!==null){
266 return false;
267 }
268 }
269 return true;
270 },isUndefinedOrNull:function(){
271 for(var i=0;i<arguments.length;i++){
272 var o=arguments[i];
273 if(!(typeof (o)=="undefined"||o===null)){
274 return false;
275 }
276 }
277 return true;
278 },isEmpty:function(obj){
279 return !MochiKit.Base.isNotEmpty.apply(this,arguments);
280 },isNotEmpty:function(obj){
281 for(var i=0;i<arguments.length;i++){
282 var o=arguments[i];
283 if(!(o&&o.length)){
284 return false;
285 }
286 }
287 return true;
288 },isArrayLike:function(){
289 for(var i=0;i<arguments.length;i++){
290 var o=arguments[i];
291 var typ=typeof (o);
292 if((typ!="object"&&!(typ=="function"&&typeof (o.item)=="function"))||o===null||typeof (o.length)!="number"||o.nodeType===3){
293 return false;
294 }
295 }
296 return true;
297 },isDateLike:function(){
298 for(var i=0;i<arguments.length;i++){
299 var o=arguments[i];
300 if(typeof (o)!="object"||o===null||typeof (o.getTime)!="function"){
301 return false;
302 }
303 }
304 return true;
305 },xmap:function(fn){
306 if(fn===null){
307 return MochiKit.Base.extend(null,arguments,1);
308 }
309 var _87=[];
310 for(var i=1;i<arguments.length;i++){
311 _87.push(fn(arguments[i]));
312 }
313 return _87;
314 },map:function(fn,lst){
315 var m=MochiKit.Base;
316 var itr=MochiKit.Iter;
317 var _8d=m.isArrayLike;
318 if(arguments.length<=2){
319 if(!_8d(lst)){
320 if(itr){
321 lst=itr.list(lst);
322 if(fn===null){
323 return lst;
324 }
325 }else{
326 throw new TypeError("Argument not an array-like and MochiKit.Iter not present");
327 }
328 }
329 if(fn===null){
330 return m.extend(null,lst);
331 }
332 var _8e=[];
333 for(var i=0;i<lst.length;i++){
334 _8e.push(fn(lst[i]));
335 }
336 return _8e;
337 }else{
338 if(fn===null){
339 fn=Array;
340 }
341 var _90=null;
342 for(i=1;i<arguments.length;i++){
343 if(!_8d(arguments[i])){
344 if(itr){
345 return itr.list(itr.imap.apply(null,arguments));
346 }else{
347 throw new TypeError("Argument not an array-like and MochiKit.Iter not present");
348 }
349 }
350 var l=arguments[i].length;
351 if(_90===null||_90>l){
352 _90=l;
353 }
354 }
355 _8e=[];
356 for(i=0;i<_90;i++){
357 var _92=[];
358 for(var j=1;j<arguments.length;j++){
359 _92.push(arguments[j][i]);
360 }
361 _8e.push(fn.apply(this,_92));
362 }
363 return _8e;
364 }
365 },xfilter:function(fn){
366 var _95=[];
367 if(fn===null){
368 fn=MochiKit.Base.operator.truth;
369 }
370 for(var i=1;i<arguments.length;i++){
371 var o=arguments[i];
372 if(fn(o)){
373 _95.push(o);
374 }
375 }
376 return _95;
377 },filter:function(fn,lst,_9a){
378 var _9b=[];
379 var m=MochiKit.Base;
380 if(!m.isArrayLike(lst)){
381 if(MochiKit.Iter){
382 lst=MochiKit.Iter.list(lst);
383 }else{
384 throw new TypeError("Argument not an array-like and MochiKit.Iter not present");
385 }
386 }
387 if(fn===null){
388 fn=m.operator.truth;
389 }
390 if(typeof (Array.prototype.filter)=="function"){
391 return Array.prototype.filter.call(lst,fn,_9a);
392 }else{
393 if(typeof (_9a)=="undefined"||_9a===null){
394 for(var i=0;i<lst.length;i++){
395 var o=lst[i];
396 if(fn(o)){
397 _9b.push(o);
398 }
399 }
400 }else{
401 for(i=0;i<lst.length;i++){
402 o=lst[i];
403 if(fn.call(_9a,o)){
404 _9b.push(o);
405 }
406 }
407 }
408 }
409 return _9b;
410 },_wrapDumbFunction:function(_9f){
411 return function(){
412 switch(arguments.length){
413 case 0:
414 return _9f();
415 case 1:
416 return _9f(arguments[0]);
417 case 2:
418 return _9f(arguments[0],arguments[1]);
419 case 3:
420 return _9f(arguments[0],arguments[1],arguments[2]);
421 }
422 var _a0=[];
423 for(var i=0;i<arguments.length;i++){
424 _a0.push("arguments["+i+"]");
425 }
426 return eval("(func("+_a0.join(",")+"))");
427 };
428 },methodcaller:function(_a2){
429 var _a3=MochiKit.Base.extend(null,arguments,1);
430 if(typeof (_a2)=="function"){
431 return function(obj){
432 return _a2.apply(obj,_a3);
433 };
434 }else{
435 return function(obj){
436 return obj[_a2].apply(obj,_a3);
437 };
438 }
439 },method:function(_a6,_a7){
440 var m=MochiKit.Base;
441 return m.bind.apply(this,m.extend([_a7,_a6],arguments,2));
442 },compose:function(f1,f2){
443 var _ab=[];
444 var m=MochiKit.Base;
445 if(arguments.length===0){
446 throw new TypeError("compose() requires at least one argument");
447 }
448 for(var i=0;i<arguments.length;i++){
449 var fn=arguments[i];
450 if(typeof (fn)!="function"){
451 throw new TypeError(m.repr(fn)+" is not a function");
452 }
453 _ab.push(fn);
454 }
455 return function(){
456 var _af=arguments;
457 for(var i=_ab.length-1;i>=0;i--){
458 _af=[_ab[i].apply(this,_af)];
459 }
460 return _af[0];
461 };
462 },bind:function(_b1,_b2){
463 if(typeof (_b1)=="string"){
464 _b1=_b2[_b1];
465 }
466 var _b3=_b1.im_func;
467 var _b4=_b1.im_preargs;
468 var _b5=_b1.im_self;
469 var m=MochiKit.Base;
470 if(typeof (_b1)=="function"&&typeof (_b1.apply)=="undefined"){
471 _b1=m._wrapDumbFunction(_b1);
472 }
473 if(typeof (_b3)!="function"){
474 _b3=_b1;
475 }
476 if(typeof (_b2)!="undefined"){
477 _b5=_b2;
478 }
479 if(typeof (_b4)=="undefined"){
480 _b4=[];
481 }else{
482 _b4=_b4.slice();
483 }
484 m.extend(_b4,arguments,2);
485 var _b7=function(){
486 var _b8=arguments;
487 var me=arguments.callee;
488 if(me.im_preargs.length>0){
489 _b8=m.concat(me.im_preargs,_b8);
490 }
491 var _ba=me.im_self;
492 if(!_ba){
493 _ba=this;
494 }
495 return me.im_func.apply(_ba,_b8);
496 };
497 _b7.im_self=_b5;
498 _b7.im_func=_b3;
499 _b7.im_preargs=_b4;
500 return _b7;
501 },bindMethods:function(_bb){
502 var _bc=MochiKit.Base.bind;
503 for(var k in _bb){
504 var _be=_bb[k];
505 if(typeof (_be)=="function"){
506 _bb[k]=_bc(_be,_bb);
507 }
508 }
509 },registerComparator:function(_bf,_c0,_c1,_c2){
510 MochiKit.Base.comparatorRegistry.register(_bf,_c0,_c1,_c2);
511 },_primitives:{"boolean":true,"string":true,"number":true},compare:function(a,b){
512 if(a==b){
513 return 0;
514 }
515 var _c5=(typeof (a)=="undefined"||a===null);
516 var _c6=(typeof (b)=="undefined"||b===null);
517 if(_c5&&_c6){
518 return 0;
519 }else{
520 if(_c5){
521 return -1;
522 }else{
523 if(_c6){
524 return 1;
525 }
526 }
527 }
528 var m=MochiKit.Base;
529 var _c8=m._primitives;
530 if(!(typeof (a) in _c8&&typeof (b) in _c8)){
531 try{
532 return m.comparatorRegistry.match(a,b);
533 }
534 catch(e){
535 if(e!=m.NotFound){
536 throw e;
537 }
538 }
539 }
540 if(a<b){
541 return -1;
542 }else{
543 if(a>b){
544 return 1;
545 }
546 }
547 var _c9=m.repr;
548 throw new TypeError(_c9(a)+" and "+_c9(b)+" can not be compared");
549 },compareDateLike:function(a,b){
550 return MochiKit.Base.compare(a.getTime(),b.getTime());
551 },compareArrayLike:function(a,b){
552 var _ce=MochiKit.Base.compare;
553 var _cf=a.length;
554 var _d0=0;
555 if(_cf>b.length){
556 _d0=1;
557 _cf=b.length;
558 }else{
559 if(_cf<b.length){
560 _d0=-1;
561 }
562 }
563 for(var i=0;i<_cf;i++){
564 var cmp=_ce(a[i],b[i]);
565 if(cmp){
566 return cmp;
567 }
568 }
569 return _d0;
570 },registerRepr:function(_d3,_d4,_d5,_d6){
571 MochiKit.Base.reprRegistry.register(_d3,_d4,_d5,_d6);
572 },repr:function(o){
573 if(typeof (o)=="undefined"){
574 return "undefined";
575 }else{
576 if(o===null){
577 return "null";
578 }
579 }
580 try{
581 if(typeof (o.__repr__)=="function"){
582 return o.__repr__();
583 }else{
584 if(typeof (o.repr)=="function"&&o.repr!=arguments.callee){
585 return o.repr();
586 }
587 }
588 return MochiKit.Base.reprRegistry.match(o);
589 }
590 catch(e){
591 if(typeof (o.NAME)=="string"&&(o.toString==Function.prototype.toString||o.toString==Object.prototype.toString)){
592 return o.NAME;
593 }
594 }
595 try{
596 var _d8=(o+"");
597 }
598 catch(e){
599 return "["+typeof (o)+"]";
600 }
601 if(typeof (o)=="function"){
602 o=_d8.replace(/^\s+/,"");
603 var idx=o.indexOf("{");
604 if(idx!=-1){
605 o=o.substr(0,idx)+"{...}";
606 }
607 }
608 return _d8;
609 },reprArrayLike:function(o){
610 var m=MochiKit.Base;
611 return "["+m.map(m.repr,o).join(", ")+"]";
612 },reprString:function(o){
613 return ("\""+o.replace(/(["\\])/g,"\\$1")+"\"").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r");
614 },reprNumber:function(o){
615 return o+"";
616 },registerJSON:function(_de,_df,_e0,_e1){
617 MochiKit.Base.jsonRegistry.register(_de,_df,_e0,_e1);
618 },evalJSON:function(){
619 return eval("("+MochiKit.Base._filterJSON(arguments[0])+")");
620 },_filterJSON:function(s){
621 var m=s.match(/^\s*\/\*(.*)\*\/\s*$/);
622 if(m){
623 return m[1];
624 }
625 return s;
626 },serializeJSON:function(o){
627 var _e5=typeof (o);
628 if(_e5=="number"||_e5=="boolean"){
629 return o+"";
630 }else{
631 if(o===null){
632 return "null";
633 }
634 }
635 var m=MochiKit.Base;
636 var _e7=m.reprString;
637 if(_e5=="string"){
638 return _e7(o);
639 }
640 var me=arguments.callee;
641 var _e9;
642 if(typeof (o.__json__)=="function"){
643 _e9=o.__json__();
644 if(o!==_e9){
645 return me(_e9);
646 }
647 }
648 if(typeof (o.json)=="function"){
649 _e9=o.json();
650 if(o!==_e9){
651 return me(_e9);
652 }
653 }
654 if(_e5!="function"&&typeof (o.length)=="number"){
655 var res=[];
656 for(var i=0;i<o.length;i++){
657 var val=me(o[i]);
658 if(typeof (val)!="string"){
659 val="undefined";
660 }
661 res.push(val);
662 }
663 return "["+res.join(", ")+"]";
664 }
665 try{
666 _e9=m.jsonRegistry.match(o);
667 if(o!==_e9){
668 return me(_e9);
669 }
670 }
671 catch(e){
672 if(e!=m.NotFound){
673 throw e;
674 }
675 }
676 if(_e5=="undefined"){
677 throw new TypeError("undefined can not be serialized as JSON");
678 }
679 if(_e5=="function"){
680 return null;
681 }
682 res=[];
683 for(var k in o){
684 var _ee;
685 if(typeof (k)=="number"){
686 _ee="\""+k+"\"";
687 }else{
688 if(typeof (k)=="string"){
689 _ee=_e7(k);
690 }else{
691 continue;
692 }
693 }
694 val=me(o[k]);
695 if(typeof (val)!="string"){
696 continue;
697 }
698 res.push(_ee+":"+val);
699 }
700 return "{"+res.join(", ")+"}";
701 },objEqual:function(a,b){
702 return (MochiKit.Base.compare(a,b)===0);
703 },arrayEqual:function(_f1,arr){
704 if(_f1.length!=arr.length){
705 return false;
706 }
707 return (MochiKit.Base.compare(_f1,arr)===0);
708 },concat:function(){
709 var _f3=[];
710 var _f4=MochiKit.Base.extend;
711 for(var i=0;i<arguments.length;i++){
712 _f4(_f3,arguments[i]);
713 }
714 return _f3;
715 },keyComparator:function(key){
716 var m=MochiKit.Base;
717 var _f8=m.compare;
718 if(arguments.length==1){
719 return function(a,b){
720 return _f8(a[key],b[key]);
721 };
722 }
723 var _fb=m.extend(null,arguments);
724 return function(a,b){
725 var _fe=0;
726 for(var i=0;(_fe===0)&&(i<_fb.length);i++){
727 var key=_fb[i];
728 _fe=_f8(a[key],b[key]);
729 }
730 return _fe;
731 };
732 },reverseKeyComparator:function(key){
733 var _102=MochiKit.Base.keyComparator.apply(this,arguments);
734 return function(a,b){
735 return _102(b,a);
736 };
737 },partial:function(func){
738 var m=MochiKit.Base;
739 return m.bind.apply(this,m.extend([func,undefined],arguments,1));
740 },listMinMax:function(_107,lst){
741 if(lst.length===0){
742 return null;
743 }
744 var cur=lst[0];
745 var _10a=MochiKit.Base.compare;
746 for(var i=1;i<lst.length;i++){
747 var o=lst[i];
748 if(_10a(o,cur)==_107){
749 cur=o;
750 }
751 }
752 return cur;
753 },objMax:function(){
754 return MochiKit.Base.listMinMax(1,arguments);
755 },objMin:function(){
756 return MochiKit.Base.listMinMax(-1,arguments);
757 },findIdentical:function(lst,_10e,_10f,end){
758 if(typeof (end)=="undefined"||end===null){
759 end=lst.length;
760 }
761 if(typeof (_10f)=="undefined"||_10f===null){
762 _10f=0;
763 }
764 for(var i=_10f;i<end;i++){
765 if(lst[i]===_10e){
766 return i;
767 }
768 }
769 return -1;
770 },mean:function(){
771 var sum=0;
772 var m=MochiKit.Base;
773 var args=m.extend(null,arguments);
774 var _115=args.length;
775 while(args.length){
776 var o=args.shift();
777 if(o&&typeof (o)=="object"&&typeof (o.length)=="number"){
778 _115+=o.length-1;
779 for(var i=o.length-1;i>=0;i--){
780 sum+=o[i];
781 }
782 }else{
783 sum+=o;
784 }
785 }
786 if(_115<=0){
787 throw new TypeError("mean() requires at least one argument");
788 }
789 return sum/_115;
790 },median:function(){
791 var data=MochiKit.Base.flattenArguments(arguments);
792 if(data.length===0){
793 throw new TypeError("median() requires at least one argument");
794 }
795 data.sort(compare);
796 if(data.length%2==0){
797 var _119=data.length/2;
798 return (data[_119]+data[_119-1])/2;
799 }else{
800 return data[(data.length-1)/2];
801 }
802 },findValue:function(lst,_11b,_11c,end){
803 if(typeof (end)=="undefined"||end===null){
804 end=lst.length;
805 }
806 if(typeof (_11c)=="undefined"||_11c===null){
807 _11c=0;
808 }
809 var cmp=MochiKit.Base.compare;
810 for(var i=_11c;i<end;i++){
811 if(cmp(lst[i],_11b)===0){
812 return i;
813 }
814 }
815 return -1;
816 },nodeWalk:function(node,_121){
817 var _122=[node];
818 var _123=MochiKit.Base.extend;
819 while(_122.length){
820 var res=_121(_122.shift());
821 if(res){
822 _123(_122,res);
823 }
824 }
825 },nameFunctions:function(_125){
826 var base=_125.NAME;
827 if(typeof (base)=="undefined"){
828 base="";
829 }else{
830 base=base+".";
831 }
832 for(var name in _125){
833 var o=_125[name];
834 if(typeof (o)=="function"&&typeof (o.NAME)=="undefined"){
835 try{
836 o.NAME=base+name;
837 }
838 catch(e){
839 }
840 }
841 }
842 },queryString:function(_129,_12a){
843 if(typeof (MochiKit.DOM)!="undefined"&&arguments.length==1&&(typeof (_129)=="string"||(typeof (_129.nodeType)!="undefined"&&_129.nodeType>0))){
844 var kv=MochiKit.DOM.formContents(_129);
845 _129=kv[0];
846 _12a=kv[1];
847 }else{
848 if(arguments.length==1){
849 if(typeof (_129.length)=="number"&&_129.length==2){
850 return arguments.callee(_129[0],_129[1]);
851 }
852 var o=_129;
853 _129=[];
854 _12a=[];
855 for(var k in o){
856 var v=o[k];
857 if(typeof (v)=="function"){
858 continue;
859 }else{
860 if(typeof (v)!="string"&&typeof (v.length)=="number"){
861 for(var i=0;i<v.length;i++){
862 _129.push(k);
863 _12a.push(v[i]);
864 }
865 }else{
866 _129.push(k);
867 _12a.push(v);
868 }
869 }
870 }
871 }
872 }
873 var rval=[];
874 var len=Math.min(_129.length,_12a.length);
875 var _132=MochiKit.Base.urlEncode;
876 for(var i=0;i<len;i++){
877 v=_12a[i];
878 if(typeof (v)!="undefined"&&v!==null){
879 rval.push(_132(_129[i])+"="+_132(v));
880 }
881 }
882 return rval.join("&");
883 },parseQueryString:function(_133,_134){
884 var qstr=(_133.charAt(0)=="?")?_133.substring(1):_133;
885 var _136=qstr.replace(/\+/g,"%20").split(/(\&amp\;|\&\#38\;|\&#x26;|\&)/);
886 var o={};
887 var _138;
888 if(typeof (decodeURIComponent)!="undefined"){
889 _138=decodeURIComponent;
890 }else{
891 _138=unescape;
892 }
893 if(_134){
894 for(var i=0;i<_136.length;i++){
895 var pair=_136[i].split("=");
896 var name=_138(pair.shift());
897 if(!name){
898 continue;
899 }
900 var arr=o[name];
901 if(!(arr instanceof Array)){
902 arr=[];
903 o[name]=arr;
904 }
905 arr.push(_138(pair.join("=")));
906 }
907 }else{
908 for(i=0;i<_136.length;i++){
909 pair=_136[i].split("=");
910 var name=pair.shift();
911 if(!name){
912 continue;
913 }
914 o[_138(name)]=_138(pair.join("="));
915 }
916 }
917 return o;
918 }});
919 MochiKit.Base.AdapterRegistry=function(){
920 this.pairs=[];
921 };
922 MochiKit.Base.AdapterRegistry.prototype={register:function(name,_13e,wrap,_140){
923 if(_140){
924 this.pairs.unshift([name,_13e,wrap]);
925 }else{
926 this.pairs.push([name,_13e,wrap]);
927 }
928 },match:function(){
929 for(var i=0;i<this.pairs.length;i++){
930 var pair=this.pairs[i];
931 if(pair[1].apply(this,arguments)){
932 return pair[2].apply(this,arguments);
933 }
934 }
935 throw MochiKit.Base.NotFound;
936 },unregister:function(name){
937 for(var i=0;i<this.pairs.length;i++){
938 var pair=this.pairs[i];
939 if(pair[0]==name){
940 this.pairs.splice(i,1);
941 return true;
942 }
943 }
944 return false;
945 }};
946 MochiKit.Base.EXPORT=["flattenArray","noop","camelize","counter","clone","extend","update","updatetree","setdefault","keys","values","items","NamedError","operator","forwardCall","itemgetter","typeMatcher","isCallable","isUndefined","isUndefinedOrNull","isNull","isEmpty","isNotEmpty","isArrayLike","isDateLike","xmap","map","xfilter","filter","methodcaller","compose","bind","bindMethods","NotFound","AdapterRegistry","registerComparator","compare","registerRepr","repr","objEqual","arrayEqual","concat","keyComparator","reverseKeyComparator","partial","merge","listMinMax","listMax","listMin","objMax","objMin","nodeWalk","zip","urlEncode","queryString","serializeJSON","registerJSON","evalJSON","parseQueryString","findValue","findIdentical","flattenArguments","method","average","mean","median"];
947 MochiKit.Base.EXPORT_OK=["nameFunctions","comparatorRegistry","reprRegistry","jsonRegistry","compareDateLike","compareArrayLike","reprArrayLike","reprString","reprNumber"];
948 MochiKit.Base._exportSymbols=function(_146,_147){
949 if(!MochiKit.__export__){
950 return;
951 }
952 var all=_147.EXPORT_TAGS[":all"];
953 for(var i=0;i<all.length;i++){
954 _146[all[i]]=_147[all[i]];
955 }
956 };
957 MochiKit.Base.__new__=function(){
958 var m=this;
959 m.noop=m.operator.identity;
960 m.forward=m.forwardCall;
961 m.find=m.findValue;
962 if(typeof (encodeURIComponent)!="undefined"){
963 m.urlEncode=function(_14b){
964 return encodeURIComponent(_14b).replace(/\'/g,"%27");
965 };
966 }else{
967 m.urlEncode=function(_14c){
968 return escape(_14c).replace(/\+/g,"%2B").replace(/\"/g,"%22").rval.replace(/\'/g,"%27");
969 };
970 }
971 m.NamedError=function(name){
972 this.message=name;
973 this.name=name;
974 };
975 m.NamedError.prototype=new Error();
976 m.update(m.NamedError.prototype,{repr:function(){
977 if(this.message&&this.message!=this.name){
978 return this.name+"("+m.repr(this.message)+")";
979 }else{
980 return this.name+"()";
981 }
982 },toString:m.forwardCall("repr")});
983 m.NotFound=new m.NamedError("MochiKit.Base.NotFound");
984 m.listMax=m.partial(m.listMinMax,1);
985 m.listMin=m.partial(m.listMinMax,-1);
986 m.isCallable=m.typeMatcher("function");
987 m.isUndefined=m.typeMatcher("undefined");
988 m.merge=m.partial(m.update,null);
989 m.zip=m.partial(m.map,null);
990 m.average=m.mean;
991 m.comparatorRegistry=new m.AdapterRegistry();
992 m.registerComparator("dateLike",m.isDateLike,m.compareDateLike);
993 m.registerComparator("arrayLike",m.isArrayLike,m.compareArrayLike);
994 m.reprRegistry=new m.AdapterRegistry();
995 m.registerRepr("arrayLike",m.isArrayLike,m.reprArrayLike);
996 m.registerRepr("string",m.typeMatcher("string"),m.reprString);
997 m.registerRepr("numbers",m.typeMatcher("number","boolean"),m.reprNumber);
998 m.jsonRegistry=new m.AdapterRegistry();
999 var all=m.concat(m.EXPORT,m.EXPORT_OK);
1000 m.EXPORT_TAGS={":common":m.concat(m.EXPORT_OK),":all":all};
1001 m.nameFunctions(this);
1002 };
1003 MochiKit.Base.__new__();
1004 if(MochiKit.__export__){
1005 compare=MochiKit.Base.compare;
1006 compose=MochiKit.Base.compose;
1007 serializeJSON=MochiKit.Base.serializeJSON;
1008 }
1009 MochiKit.Base._exportSymbols(this,MochiKit.Base);
1010 if(typeof (dojo)!="undefined"){
1011 dojo.provide("MochiKit.DOM");
1012 dojo.require("MochiKit.Base");
1013 }
1014 if(typeof (JSAN)!="undefined"){
1015 JSAN.use("MochiKit.Base",[]);
1016 }
1017 try{
1018 if(typeof (MochiKit.Base)=="undefined"){
1019 throw "";
1020 }
1021 }
1022 catch(e){
1023 throw "MochiKit.DOM depends on MochiKit.Base!";
1024 }
1025 if(typeof (MochiKit.DOM)=="undefined"){
1026 MochiKit.DOM={};
1027 }
1028 MochiKit.DOM.NAME="MochiKit.DOM";
1029 MochiKit.DOM.VERSION="1.4";
1030 MochiKit.DOM.__repr__=function(){
1031 return "["+this.NAME+" "+this.VERSION+"]";
1032 };
1033 MochiKit.DOM.toString=function(){
1034 return this.__repr__();
1035 };
1036 MochiKit.DOM.EXPORT=["removeEmptyTextNodes","formContents","currentWindow","currentDocument","withWindow","withDocument","registerDOMConverter","coerceToDOM","createDOM","createDOMFunc","isChildNode","getNodeAttribute","removeNodeAttribute","setNodeAttribute","updateNodeAttributes","appendChildNodes","insertSiblingNodesAfter","insertSiblingNodesBefore","replaceChildNodes","removeElement","swapDOM","BUTTON","TT","PRE","H1","H2","H3","BR","CANVAS","HR","LABEL","TEXTAREA","FORM","STRONG","SELECT","OPTION","OPTGROUP","LEGEND","FIELDSET","P","UL","OL","LI","TD","TR","THEAD","TBODY","TFOOT","TABLE","TH","INPUT","SPAN","A","DIV","IMG","getElement","$","getElementsByTagAndClassName","addToCallStack","addLoadEvent","focusOnLoad","setElementClass","toggleElementClass","addElementClass","removeElementClass","swapElementClass","hasElementClass","escapeHTML","toHTML","emitHTML","scrapeText","isParent","getFirstParentByTagAndClassName","makeClipping","undoClipping","makePositioned","undoPositioned","getFirstElementByTagAndClassName"];
1037 MochiKit.DOM.EXPORT_OK=["domConverters"];
1038 MochiKit.DOM.DEPRECATED=[["computedStyle","MochiKit.Style.getStyle","1.4"],["elementDimensions","MochiKit.Style.getElementDimensions","1.4"],["elementPosition","MochiKit.Style.getElementPosition","1.4"],["hideElement","MochiKit.Style.hideElement","1.4"],["setElementDimensions","MochiKit.Style.setElementDimensions","1.4"],["setElementPosition","MochiKit.Style.setElementPosition","1.4"],["setDisplayForElement","MochiKit.Style.setDisplayForElement","1.4"],["setOpacity","MochiKit.Style.setOpacity","1.4"],["showElement","MochiKit.Style.showElement","1.4"],["Coordinates","MochiKit.Style.Coordinates","1.4"],["Dimensions","MochiKit.Style.Dimensions","1.4"]];
1039 MochiKit.DOM.getViewportDimensions=new Function(""+"if (!MochiKit[\"Style\"]) {"+" throw new Error(\"This function has been deprecated and depends on MochiKit.Style.\");"+"}"+"return MochiKit.Style.getViewportDimensions.apply(this, arguments);");
1040 MochiKit.Base.update(MochiKit.DOM,{currentWindow:function(){
1041 return MochiKit.DOM._window;
1042 },currentDocument:function(){
1043 return MochiKit.DOM._document;
1044 },withWindow:function(win,func){
1045 var self=MochiKit.DOM;
1046 var _152=self._document;
1047 var _153=self._window;
1048 var rval;
1049 try{
1050 self._window=win;
1051 self._document=win.document;
1052 rval=func();
1053 }
1054 catch(e){
1055 self._window=_153;
1056 self._document=_152;
1057 throw e;
1058 }
1059 self._window=_153;
1060 self._document=_152;
1061 return rval;
1062 },formContents:function(elem){
1063 var _156=[];
1064 var _157=[];
1065 var m=MochiKit.Base;
1066 var self=MochiKit.DOM;
1067 if(typeof (elem)=="undefined"||elem===null){
1068 elem=self._document.body;
1069 }else{
1070 elem=self.getElement(elem);
1071 }
1072 m.nodeWalk(elem,function(elem){
1073 var name=elem.name;
1074 if(m.isNotEmpty(name)){
1075 var _15c=elem.tagName.toUpperCase();
1076 if(_15c==="INPUT"&&(elem.type=="radio"||elem.type=="checkbox")&&!elem.checked){
1077 return null;
1078 }
1079 if(_15c==="SELECT"){
1080 if(elem.type=="select-one"){
1081 if(elem.selectedIndex>=0){
1082 var opt=elem.options[elem.selectedIndex];
1083 var v=opt.value;
1084 if(!v){
1085 var h=opt.outerHTML;
1086 if(h&&!h.match(/^[^>]+\svalue\s*=/i)){
1087 v=opt.text;
1088 }
1089 }
1090 _156.push(name);
1091 _157.push(v);
1092 return null;
1093 }
1094 _156.push(name);
1095 _157.push("");
1096 return null;
1097 }else{
1098 var opts=elem.options;
1099 if(!opts.length){
1100 _156.push(name);
1101 _157.push("");
1102 return null;
1103 }
1104 for(var i=0;i<opts.length;i++){
1105 var opt=opts[i];
1106 if(!opt.selected){
1107 continue;
1108 }
1109 var v=opt.value;
1110 if(!v){
1111 var h=opt.outerHTML;
1112 if(h&&!h.match(/^[^>]+\svalue\s*=/i)){
1113 v=opt.text;
1114 }
1115 }
1116 _156.push(name);
1117 _157.push(v);
1118 }
1119 return null;
1120 }
1121 }
1122 if(_15c==="FORM"||_15c==="P"||_15c==="SPAN"||_15c==="DIV"){
1123 return elem.childNodes;
1124 }
1125 _156.push(name);
1126 _157.push(elem.value||"");
1127 return null;
1128 }
1129 return elem.childNodes;
1130 });
1131 return [_156,_157];
1132 },withDocument:function(doc,func){
1133 var self=MochiKit.DOM;
1134 var _165=self._document;
1135 var rval;
1136 try{
1137 self._document=doc;
1138 rval=func();
1139 }
1140 catch(e){
1141 self._document=_165;
1142 throw e;
1143 }
1144 self._document=_165;
1145 return rval;
1146 },registerDOMConverter:function(name,_168,wrap,_16a){
1147 MochiKit.DOM.domConverters.register(name,_168,wrap,_16a);
1148 },coerceToDOM:function(node,ctx){
1149 var m=MochiKit.Base;
1150 var im=MochiKit.Iter;
1151 var self=MochiKit.DOM;
1152 if(im){
1153 var iter=im.iter;
1154 var _171=im.repeat;
1155 var map=m.map;
1156 }
1157 var _173=self.domConverters;
1158 var _174=arguments.callee;
1159 var _175=m.NotFound;
1160 while(true){
1161 if(typeof (node)=="undefined"||node===null){
1162 return null;
1163 }
1164 if(typeof (node)=="function"&&typeof (node.length)=="number"&&!(node instanceof Function)){
1165 node=im.list(node);
1166 }
1167 if(typeof (node.nodeType)!="undefined"&&node.nodeType>0){
1168 return node;
1169 }
1170 if(typeof (node)=="number"||typeof (node)=="boolean"){
1171 node=node.toString();
1172 }
1173 if(typeof (node)=="string"){
1174 return self._document.createTextNode(node);
1175 }
1176 if(typeof (node.__dom__)=="function"){
1177 node=node.__dom__(ctx);
1178 continue;
1179 }
1180 if(typeof (node.dom)=="function"){
1181 node=node.dom(ctx);
1182 continue;
1183 }
1184 if(typeof (node)=="function"){
1185 node=node.apply(ctx,[ctx]);
1186 continue;
1187 }
1188 if(im){
1189 var _176=null;
1190 try{
1191 _176=iter(node);
1192 }
1193 catch(e){
1194 }
1195 if(_176){
1196 return map(_174,_176,_171(ctx));
1197 }
1198 }
1199 try{
1200 node=_173.match(node,ctx);
1201 continue;
1202 }
1203 catch(e){
1204 if(e!=_175){
1205 throw e;
1206 }
1207 }
1208 return self._document.createTextNode(node.toString());
1209 }
1210 return undefined;
1211 },isChildNode:function(node,_178){
1212 var self=MochiKit.DOM;
1213 if(typeof (node)=="string"){
1214 node=self.getElement(node);
1215 }
1216 if(typeof (_178)=="string"){
1217 _178=self.getElement(_178);
1218 }
1219 if(node===_178){
1220 return true;
1221 }
1222 while(node&&node.tagName.toUpperCase()!="BODY"){
1223 node=node.parentNode;
1224 if(node===_178){
1225 return true;
1226 }
1227 }
1228 return false;
1229 },setNodeAttribute:function(node,attr,_17c){
1230 var o={};
1231 o[attr]=_17c;
1232 try{
1233 return MochiKit.DOM.updateNodeAttributes(node,o);
1234 }
1235 catch(e){
1236 }
1237 return null;
1238 },getNodeAttribute:function(node,attr){
1239 var self=MochiKit.DOM;
1240 var _181=self.attributeArray.renames[attr];
1241 node=self.getElement(node);
1242 try{
1243 if(_181){
1244 return node[_181];
1245 }
1246 return node.getAttribute(attr);
1247 }
1248 catch(e){
1249 }
1250 return null;
1251 },removeNodeAttribute:function(node,attr){
1252 var self=MochiKit.DOM;
1253 var _185=self.attributeArray.renames[attr];
1254 node=self.getElement(node);
1255 try{
1256 if(_185){
1257 return node[_185];
1258 }
1259 return node.removeAttribute(attr);
1260 }
1261 catch(e){
1262 }
1263 return null;
1264 },updateNodeAttributes:function(node,_187){
1265 var elem=node;
1266 var self=MochiKit.DOM;
1267 if(typeof (node)=="string"){
1268 elem=self.getElement(node);
1269 }
1270 if(_187){
1271 var _18a=MochiKit.Base.updatetree;
1272 if(self.attributeArray.compliant){
1273 for(var k in _187){
1274 var v=_187[k];
1275 if(typeof (v)=="object"&&typeof (elem[k])=="object"){
1276 if(k=="style"&&MochiKit.Style){
1277 MochiKit.Style.setStyle(elem,v);
1278 }else{
1279 _18a(elem[k],v);
1280 }
1281 }else{
1282 if(k.substring(0,2)=="on"){
1283 if(typeof (v)=="string"){
1284 v=new Function(v);
1285 }
1286 elem[k]=v;
1287 }else{
1288 elem.setAttribute(k,v);
1289 }
1290 }
1291 }
1292 }else{
1293 var _18d=self.attributeArray.renames;
1294 for(var k in _187){
1295 v=_187[k];
1296 var _18e=_18d[k];
1297 if(k=="style"&&typeof (v)=="string"){
1298 elem.style.cssText=v;
1299 }else{
1300 if(typeof (_18e)=="string"){
1301 elem[_18e]=v;
1302 }else{
1303 if(typeof (elem[k])=="object"&&typeof (v)=="object"){
1304 if(k=="style"&&MochiKit.Style){
1305 MochiKit.Style.setStyle(elem,v);
1306 }else{
1307 _18a(elem[k],v);
1308 }
1309 }else{
1310 if(k.substring(0,2)=="on"){
1311 if(typeof (v)=="string"){
1312 v=new Function(v);
1313 }
1314 elem[k]=v;
1315 }else{
1316 elem.setAttribute(k,v);
1317 }
1318 }
1319 }
1320 }
1321 }
1322 }
1323 }
1324 return elem;
1325 },appendChildNodes:function(node){
1326 var elem=node;
1327 var self=MochiKit.DOM;
1328 if(typeof (node)=="string"){
1329 elem=self.getElement(node);
1330 }
1331 var _192=[self.coerceToDOM(MochiKit.Base.extend(null,arguments,1),elem)];
1332 var _193=MochiKit.Base.concat;
1333 while(_192.length){
1334 var n=_192.shift();
1335 if(typeof (n)=="undefined"||n===null){
1336 }else{
1337 if(typeof (n.nodeType)=="number"){
1338 elem.appendChild(n);
1339 }else{
1340 _192=_193(n,_192);
1341 }
1342 }
1343 }
1344 return elem;
1345 },insertSiblingNodesBefore:function(node){
1346 var elem=node;
1347 var self=MochiKit.DOM;
1348 if(typeof (node)=="string"){
1349 elem=self.getElement(node);
1350 }
1351 var _198=[self.coerceToDOM(MochiKit.Base.extend(null,arguments,1),elem)];
1352 var _199=elem.parentNode;
1353 var _19a=MochiKit.Base.concat;
1354 while(_198.length){
1355 var n=_198.shift();
1356 if(typeof (n)=="undefined"||n===null){
1357 }else{
1358 if(typeof (n.nodeType)=="number"){
1359 _199.insertBefore(n,elem);
1360 }else{
1361 _198=_19a(n,_198);
1362 }
1363 }
1364 }
1365 return _199;
1366 },insertSiblingNodesAfter:function(node){
1367 var elem=node;
1368 var self=MochiKit.DOM;
1369 if(typeof (node)=="string"){
1370 elem=self.getElement(node);
1371 }
1372 var _19f=[self.coerceToDOM(MochiKit.Base.extend(null,arguments,1),elem)];
1373 if(elem.nextSibling){
1374 return self.insertSiblingNodesBefore(elem.nextSibling,_19f);
1375 }else{
1376 return self.appendChildNodes(elem.parentNode,_19f);
1377 }
1378 },replaceChildNodes:function(node){
1379 var elem=node;
1380 var self=MochiKit.DOM;
1381 if(typeof (node)=="string"){
1382 elem=self.getElement(node);
1383 arguments[0]=elem;
1384 }
1385 var _1a3;
1386 while((_1a3=elem.firstChild)){
1387 elem.removeChild(_1a3);
1388 }
1389 if(arguments.length<2){
1390 return elem;
1391 }else{
1392 return self.appendChildNodes.apply(this,arguments);
1393 }
1394 },createDOM:function(name,_1a5){
1395 var elem;
1396 var self=MochiKit.DOM;
1397 var m=MochiKit.Base;
1398 if(typeof (_1a5)=="string"||typeof (_1a5)=="number"){
1399 var args=m.extend([name,null],arguments,1);
1400 return arguments.callee.apply(this,args);
1401 }
1402 if(typeof (name)=="string"){
1403 var _1aa=self._xhtml;
1404 if(_1a5&&!self.attributeArray.compliant){
1405 var _1ab="";
1406 if("name" in _1a5){
1407 _1ab+=" name=\""+self.escapeHTML(_1a5.name)+"\"";
1408 }
1409 if(name=="input"&&"type" in _1a5){
1410 _1ab+=" type=\""+self.escapeHTML(_1a5.type)+"\"";
1411 }
1412 if(_1ab){
1413 name="<"+name+_1ab+">";
1414 _1aa=false;
1415 }
1416 }
1417 var d=self._document;
1418 if(_1aa&&d===document){
1419 elem=d.createElementNS("http://www.w3.org/1999/xhtml",name);
1420 }else{
1421 elem=d.createElement(name);
1422 }
1423 }else{
1424 elem=name;
1425 }
1426 if(_1a5){
1427 self.updateNodeAttributes(elem,_1a5);
1428 }
1429 if(arguments.length<=2){
1430 return elem;
1431 }else{
1432 var args=m.extend([elem],arguments,2);
1433 return self.appendChildNodes.apply(this,args);
1434 }
1435 },createDOMFunc:function(){
1436 var m=MochiKit.Base;
1437 return m.partial.apply(this,m.extend([MochiKit.DOM.createDOM],arguments));
1438 },removeElement:function(elem){
1439 var e=MochiKit.DOM.getElement(elem);
1440 e.parentNode.removeChild(e);
1441 return e;
1442 },swapDOM:function(dest,src){
1443 var self=MochiKit.DOM;
1444 dest=self.getElement(dest);
1445 var _1b3=dest.parentNode;
1446 if(src){
1447 src=self.getElement(src);
1448 _1b3.replaceChild(src,dest);
1449 }else{
1450 _1b3.removeChild(dest);
1451 }
1452 return src;
1453 },getElement:function(id){
1454 var self=MochiKit.DOM;
1455 if(arguments.length==1){
1456 return ((typeof (id)=="string")?self._document.getElementById(id):id);
1457 }else{
1458 return MochiKit.Base.map(self.getElement,arguments);
1459 }
1460 },getElementsByTagAndClassName:function(_1b6,_1b7,_1b8){
1461 var self=MochiKit.DOM;
1462 if(typeof (_1b6)=="undefined"||_1b6===null){
1463 _1b6="*";
1464 }
1465 if(typeof (_1b8)=="undefined"||_1b8===null){
1466 _1b8=self._document;
1467 }
1468 _1b8=self.getElement(_1b8);
1469 var _1ba=(_1b8.getElementsByTagName(_1b6)||self._document.all);
1470 if(typeof (_1b7)=="undefined"||_1b7===null){
1471 return MochiKit.Base.extend(null,_1ba);
1472 }
1473 var _1bb=[];
1474 for(var i=0;i<_1ba.length;i++){
1475 var _1bd=_1ba[i];
1476 var cls=_1bd.className;
1477 if(!cls){
1478 continue;
1479 }
1480 var _1bf=cls.split(" ");
1481 for(var j=0;j<_1bf.length;j++){
1482 if(_1bf[j]==_1b7){
1483 _1bb.push(_1bd);
1484 break;
1485 }
1486 }
1487 }
1488 return _1bb;
1489 },_newCallStack:function(path,once){
1490 var rval=function(){
1491 var _1c4=arguments.callee.callStack;
1492 for(var i=0;i<_1c4.length;i++){
1493 if(_1c4[i].apply(this,arguments)===false){
1494 break;
1495 }
1496 }
1497 if(once){
1498 try{
1499 this[path]=null;
1500 }
1501 catch(e){
1502 }
1503 }
1504 };
1505 rval.callStack=[];
1506 return rval;
1507 },addToCallStack:function(_1c6,path,func,once){
1508 var self=MochiKit.DOM;
1509 var _1cb=_1c6[path];
1510 var _1cc=_1cb;
1511 if(!(typeof (_1cb)=="function"&&typeof (_1cb.callStack)=="object"&&_1cb.callStack!==null)){
1512 _1cc=self._newCallStack(path,once);
1513 if(typeof (_1cb)=="function"){
1514 _1cc.callStack.push(_1cb);
1515 }
1516 _1c6[path]=_1cc;
1517 }
1518 _1cc.callStack.push(func);
1519 },addLoadEvent:function(func){
1520 var self=MochiKit.DOM;
1521 self.addToCallStack(self._window,"onload",func,true);
1522 },focusOnLoad:function(_1cf){
1523 var self=MochiKit.DOM;
1524 self.addLoadEvent(function(){
1525 _1cf=self.getElement(_1cf);
1526 if(_1cf){
1527 _1cf.focus();
1528 }
1529 });
1530 },setElementClass:function(_1d1,_1d2){
1531 var self=MochiKit.DOM;
1532 var obj=self.getElement(_1d1);
1533 if(self.attributeArray.compliant){
1534 obj.setAttribute("class",_1d2);
1535 }else{
1536 obj.setAttribute("className",_1d2);
1537 }
1538 },toggleElementClass:function(_1d5){
1539 var self=MochiKit.DOM;
1540 for(var i=1;i<arguments.length;i++){
1541 var obj=self.getElement(arguments[i]);
1542 if(!self.addElementClass(obj,_1d5)){
1543 self.removeElementClass(obj,_1d5);
1544 }
1545 }
1546 },addElementClass:function(_1d9,_1da){
1547 var self=MochiKit.DOM;
1548 var obj=self.getElement(_1d9);
1549 var cls=obj.className;
1550 if(cls==undefined||cls.length===0){
1551 self.setElementClass(obj,_1da);
1552 return true;
1553 }
1554 if(cls==_1da){
1555 return false;
1556 }
1557 var _1de=cls.split(" ");
1558 for(var i=0;i<_1de.length;i++){
1559 if(_1de[i]==_1da){
1560 return false;
1561 }
1562 }
1563 self.setElementClass(obj,cls+" "+_1da);
1564 return true;
1565 },removeElementClass:function(_1e0,_1e1){
1566 var self=MochiKit.DOM;
1567 var obj=self.getElement(_1e0);
1568 var cls=obj.className;
1569 if(cls==undefined||cls.length===0){
1570 return false;
1571 }
1572 if(cls==_1e1){
1573 self.setElementClass(obj,"");
1574 return true;
1575 }
1576 var _1e5=cls.split(" ");
1577 for(var i=0;i<_1e5.length;i++){
1578 if(_1e5[i]==_1e1){
1579 _1e5.splice(i,1);
1580 self.setElementClass(obj,_1e5.join(" "));
1581 return true;
1582 }
1583 }
1584 return false;
1585 },swapElementClass:function(_1e7,_1e8,_1e9){
1586 var obj=MochiKit.DOM.getElement(_1e7);
1587 var res=MochiKit.DOM.removeElementClass(obj,_1e8);
1588 if(res){
1589 MochiKit.DOM.addElementClass(obj,_1e9);
1590 }
1591 return res;
1592 },hasElementClass:function(_1ec,_1ed){
1593 var obj=MochiKit.DOM.getElement(_1ec);
1594 var cls=obj.className;
1595 if(!cls){
1596 return false;
1597 }
1598 var _1f0=cls.split(" ");
1599 for(var i=1;i<arguments.length;i++){
1600 var good=false;
1601 for(var j=0;j<_1f0.length;j++){
1602 if(_1f0[j]==arguments[i]){
1603 good=true;
1604 break;
1605 }
1606 }
1607 if(!good){
1608 return false;
1609 }
1610 }
1611 return true;
1612 },escapeHTML:function(s){
1613 return s.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");
1614 },toHTML:function(dom){
1615 return MochiKit.DOM.emitHTML(dom).join("");
1616 },emitHTML:function(dom,lst){
1617 if(typeof (lst)=="undefined"||lst===null){
1618 lst=[];
1619 }
1620 var _1f8=[dom];
1621 var self=MochiKit.DOM;
1622 var _1fa=self.escapeHTML;
1623 var _1fb=self.attributeArray;
1624 while(_1f8.length){
1625 dom=_1f8.pop();
1626 if(typeof (dom)=="string"){
1627 lst.push(dom);
1628 }else{
1629 if(dom.nodeType==1){
1630 lst.push("<"+dom.tagName.toLowerCase());
1631 var _1fc=[];
1632 var _1fd=_1fb(dom);
1633 for(var i=0;i<_1fd.length;i++){
1634 var a=_1fd[i];
1635 _1fc.push([" ",a.name,"=\"",_1fa(a.value),"\""]);
1636 }
1637 _1fc.sort();
1638 for(i=0;i<_1fc.length;i++){
1639 var _200=_1fc[i];
1640 for(var j=0;j<_200.length;j++){
1641 lst.push(_200[j]);
1642 }
1643 }
1644 if(dom.hasChildNodes()){
1645 lst.push(">");
1646 _1f8.push("</"+dom.tagName.toLowerCase()+">");
1647 var _202=dom.childNodes;
1648 for(i=_202.length-1;i>=0;i--){
1649 _1f8.push(_202[i]);
1650 }
1651 }else{
1652 lst.push("/>");
1653 }
1654 }else{
1655 if(dom.nodeType==3){
1656 lst.push(_1fa(dom.nodeValue));
1657 }
1658 }
1659 }
1660 }
1661 return lst;
1662 },scrapeText:function(node,_204){
1663 var rval=[];
1664 (function(node){
1665 var cn=node.childNodes;
1666 if(cn){
1667 for(var i=0;i<cn.length;i++){
1668 arguments.callee.call(this,cn[i]);
1669 }
1670 }
1671 var _209=node.nodeValue;
1672 if(typeof (_209)=="string"){
1673 rval.push(_209);
1674 }
1675 })(MochiKit.DOM.getElement(node));
1676 if(_204){
1677 return rval;
1678 }else{
1679 return rval.join("");
1680 }
1681 },removeEmptyTextNodes:function(_20a){
1682 _20a=MochiKit.DOM.getElement(_20a);
1683 for(var i=0;i<_20a.childNodes.length;i++){
1684 var node=_20a.childNodes[i];
1685 if(node.nodeType==3&&!/\S/.test(node.nodeValue)){
1686 node.parentNode.removeChild(node);
1687 }
1688 }
1689 },makeClipping:function(_20d){
1690 _20d=MochiKit.DOM.getElement(_20d);
1691 var _20e=_20d.style.overflow;
1692 if((MochiKit.Style.getStyle(_20d,"overflow")||"visible")!="hidden"){
1693 _20d.style.overflow="hidden";
1694 }
1695 return _20e;
1696 },undoClipping:function(_20f,_210){
1697 _20f=MochiKit.DOM.getElement(_20f);
1698 if(!_210){
1699 return;
1700 }
1701 _20f.style.overflow=_210;
1702 },makePositioned:function(_211){
1703 _211=MochiKit.DOM.getElement(_211);
1704 var pos=MochiKit.Style.getStyle(_211,"position");
1705 if(pos=="static"||!pos){
1706 _211.style.position="relative";
1707 if(/Opera/.test(navigator.userAgent)){
1708 _211.style.top=0;
1709 _211.style.left=0;
1710 }
1711 }
1712 },undoPositioned:function(_213){
1713 _213=MochiKit.DOM.getElement(_213);
1714 if(_213.style.position=="relative"){
1715 _213.style.position=_213.style.top=_213.style.left=_213.style.bottom=_213.style.right="";
1716 }
1717 },getFirstElementByTagAndClassName:function(_214,_215,_216){
1718 var self=MochiKit.DOM;
1719 if(typeof (_214)=="undefined"||_214===null){
1720 _214="*";
1721 }
1722 if(typeof (_216)=="undefined"||_216===null){
1723 _216=self._document;
1724 }
1725 _216=self.getElement(_216);
1726 var _218=(_216.getElementsByTagName(_214)||self._document.all);
1727 if(typeof (_215)=="undefined"||_215===null){
1728 return _218[0];
1729 }
1730 for(var i=0;i<_218.length;i++){
1731 var _21a=_218[i];
1732 var _21b=_21a.className.split(" ");
1733 for(var j=0;j<_21b.length;j++){
1734 if(_21b[j]==_215){
1735 return _21a;
1736 }
1737 }
1738 }
1739 },getFirstParentByTagAndClassName:function(elem,_21e,_21f){
1740 var self=MochiKit.DOM;
1741 elem=self.getElement(elem);
1742 if(typeof (_21e)=="undefined"||_21e===null){
1743 _21e="*";
1744 }else{
1745 _21e=_21e.toUpperCase();
1746 }
1747 if(typeof (_21f)=="undefined"||_21f===null){
1748 _21f=null;
1749 }
1750 var _221="";
1751 var _222="";
1752 while(elem&&elem.tagName){
1753 elem=elem.parentNode;
1754 if(_21e=="*"&&_21f===null){
1755 return elem;
1756 }
1757 _221=elem.className.split(" ");
1758 _222=elem.tagName.toUpperCase();
1759 if(_21f===null&&_21e==_222){
1760 return elem;
1761 }else{
1762 if(_21f!==null){
1763 for(var i=0;i<_221.length;i++){
1764 if(_21e=="*"&&_221[i]==_21f){
1765 return elem;
1766 }else{
1767 if(_21e==_222&&_221[i]==_21f){
1768 return elem;
1769 }
1770 }
1771 }
1772 }
1773 }
1774 }
1775 return elem;
1776 },isParent:function(_224,_225){
1777 if(!_224.parentNode||_224==_225){
1778 return false;
1779 }
1780 if(_224.parentNode==_225){
1781 return true;
1782 }
1783 return MochiKit.DOM.isParent(_224.parentNode,_225);
1784 },__new__:function(win){
1785 var m=MochiKit.Base;
1786 if(typeof (document)!="undefined"){
1787 this._document=document;
1788 var _228="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
1789 this._xhtml=(document.documentElement&&document.createElementNS&&document.documentElement.namespaceURI===_228);
1790 }else{
1791 if(MochiKit.MockDOM){
1792 this._document=MochiKit.MockDOM.document;
1793 }
1794 }
1795 this._window=win;
1796 this.domConverters=new m.AdapterRegistry();
1797 var _229=this._document.createElement("span");
1798 var _22a;
1799 if(_229&&_229.attributes&&_229.attributes.length>0){
1800 var _22b=m.filter;
1801 _22a=function(node){
1802 return _22b(_22a.ignoreAttrFilter,node.attributes);
1803 };
1804 _22a.ignoreAttr={};
1805 var _22d=_229.attributes;
1806 var _22e=_22a.ignoreAttr;
1807 for(var i=0;i<_22d.length;i++){
1808 var a=_22d[i];
1809 _22e[a.name]=a.value;
1810 }
1811 _22a.ignoreAttrFilter=function(a){
1812 return (_22a.ignoreAttr[a.name]!=a.value);
1813 };
1814 _22a.compliant=false;
1815 _22a.renames={"class":"className","checked":"defaultChecked","usemap":"useMap","for":"htmlFor","readonly":"readOnly","colspan":"colSpan","bgcolor":"bgColor","cellspacing":"cellSpacing","cellpadding":"cellPadding"};
1816 }else{
1817 _22a=function(node){
1818 return node.attributes;
1819 };
1820 _22a.compliant=true;
1821 _22a.renames={};
1822 }
1823 this.attributeArray=_22a;
1824 var _233=function(_234,arr){
1825 var _236=arr[1].split(".");
1826 var str="";
1827 var obj={};
1828 str+="if (!MochiKit."+_236[1]+") { throw new Error(\"";
1829 str+="This function has been deprecated and depends on MochiKit.";
1830 str+=_236[1]+".\");}";
1831 str+="return MochiKit."+_236[1]+"."+arr[0];
1832 str+=".apply(this, arguments);";
1833 obj[_236[2]]=new Function(str);
1834 MochiKit.Base.update(MochiKit[_234],obj);
1835 };
1836 for(var i;i<MochiKit.DOM.DEPRECATED.length;i++){
1837 _233("DOM",MochiKit.DOM.DEPRECATED[i]);
1838 }
1839 var _239=this.createDOMFunc;
1840 this.UL=_239("ul");
1841 this.OL=_239("ol");
1842 this.LI=_239("li");
1843 this.TD=_239("td");
1844 this.TR=_239("tr");
1845 this.TBODY=_239("tbody");
1846 this.THEAD=_239("thead");
1847 this.TFOOT=_239("tfoot");
1848 this.TABLE=_239("table");
1849 this.TH=_239("th");
1850 this.INPUT=_239("input");
1851 this.SPAN=_239("span");
1852 this.A=_239("a");
1853 this.DIV=_239("div");
1854 this.IMG=_239("img");
1855 this.BUTTON=_239("button");
1856 this.TT=_239("tt");
1857 this.PRE=_239("pre");
1858 this.H1=_239("h1");
1859 this.H2=_239("h2");
1860 this.H3=_239("h3");
1861 this.BR=_239("br");
1862 this.HR=_239("hr");
1863 this.LABEL=_239("label");
1864 this.TEXTAREA=_239("textarea");
1865 this.FORM=_239("form");
1866 this.P=_239("p");
1867 this.SELECT=_239("select");
1868 this.OPTION=_239("option");
1869 this.OPTGROUP=_239("optgroup");
1870 this.LEGEND=_239("legend");
1871 this.FIELDSET=_239("fieldset");
1872 this.STRONG=_239("strong");
1873 this.CANVAS=_239("canvas");
1874 this.$=this.getElement;
1875 this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};
1876 m.nameFunctions(this);
1877 }});
1878 MochiKit.DOM.__new__(((typeof (window)=="undefined")?this:window));
1879 if(MochiKit.__export__){
1880 withWindow=MochiKit.DOM.withWindow;
1881 withDocument=MochiKit.DOM.withDocument;
1882 }
1883 MochiKit.Base._exportSymbols(this,MochiKit.DOM);
1884 if(typeof (dojo)!="undefined"){
1885 dojo.provide("MochiKit.Style");
1886 dojo.require("MochiKit.Base");
1887 dojo.require("MochiKit.DOM");
1888 }
1889 if(typeof (JSAN)!="undefined"){
1890 JSAN.use("MochiKit.Base",[]);
1891 JSAN.use("MochiKit.DOM",[]);
1892 }
1893 try{
1894 if(typeof (MochiKit.Base)=="undefined"){
1895 throw "";
1896 }
1897 }
1898 catch(e){
1899 throw "MochiKit.Style depends on MochiKit.Base!";
1900 }
1901 try{
1902 if(typeof (MochiKit.DOM)=="undefined"){
1903 throw "";
1904 }
1905 }
1906 catch(e){
1907 throw "MochiKit.Style depends on MochiKit.DOM!";
1908 }
1909 if(typeof (MochiKit.Style)=="undefined"){
1910 MochiKit.Style={};
1911 }
1912 MochiKit.Style.NAME="MochiKit.Style";
1913 MochiKit.Style.VERSION="1.4";
1914 MochiKit.Style.__repr__=function(){
1915 return "["+this.NAME+" "+this.VERSION+"]";
1916 };
1917 MochiKit.Style.toString=function(){
1918 return this.__repr__();
1919 };
1920 MochiKit.Style.EXPORT_OK=[];
1921 MochiKit.Style.EXPORT=["setStyle","setOpacity","getStyle","getElementDimensions","elementDimensions","setElementDimensions","getElementPosition","elementPosition","setElementPosition","setDisplayForElement","hideElement","showElement","getViewportDimensions","getViewportPosition","Dimensions","Coordinates"];
1922 MochiKit.Style.Dimensions=function(w,h){
1923 this.w=w;
1924 this.h=h;
1925 };
1926 MochiKit.Style.Dimensions.prototype.__repr__=function(){
1927 var repr=MochiKit.Base.repr;
1928 return "{w: "+repr(this.w)+", h: "+repr(this.h)+"}";
1929 };
1930 MochiKit.Style.Dimensions.prototype.toString=function(){
1931 return this.__repr__();
1932 };
1933 MochiKit.Style.Coordinates=function(x,y){
1934 this.x=x;
1935 this.y=y;
1936 };
1937 MochiKit.Style.Coordinates.prototype.__repr__=function(){
1938 var repr=MochiKit.Base.repr;
1939 return "{x: "+repr(this.x)+", y: "+repr(this.y)+"}";
1940 };
1941 MochiKit.Style.Coordinates.prototype.toString=function(){
1942 return this.__repr__();
1943 };
1944 MochiKit.Base.update(MochiKit.Style,{getStyle:function(elem,_241){
1945 var dom=MochiKit.DOM;
1946 var d=dom._document;
1947 elem=dom.getElement(elem);
1948 _241=MochiKit.Base.camelize(_241);
1949 if(!elem||elem==d){
1950 return undefined;
1951 }
1952 if(_241=="opacity"&&elem.filters){
1953 var _244=(MochiKit.Style.getStyle(elem,"filter")||"").match(/alpha\(opacity=(.*)\)/);
1954 if(_244&&_244[1]){
1955 return parseFloat(_244[1])/100;
1956 }
1957 return 1;
1958 }
1959 var _245=elem.style?elem.style[_241]:null;
1960 if(!_245){
1961 if(d.defaultView&&d.defaultView.getComputedStyle){
1962 var css=d.defaultView.getComputedStyle(elem,null);
1963 _241=_241.replace(/([A-Z])/g,"-$1").toLowerCase();
1964 _245=css?css.getPropertyValue(_241):null;
1965 }else{
1966 if(elem.currentStyle){
1967 _245=elem.currentStyle[_241];
1968 }
1969 }
1970 }
1971 if(_241=="opacity"){
1972 _245=parseFloat(_245);
1973 }
1974 if(/Opera/.test(navigator.userAgent)&&(MochiKit.Base.find(["left","top","right","bottom"],_241)!=-1)){
1975 if(MochiKit.Style.getStyle(elem,"position")=="static"){
1976 _245="auto";
1977 }
1978 }
1979 return _245=="auto"?null:_245;
1980 },setStyle:function(elem,_248){
1981 elem=MochiKit.DOM.getElement(elem);
1982 for(var name in _248){
1983 if(name=="opacity"){
1984 MochiKit.Style.setOpacity(elem,_248[name]);
1985 }else{
1986 elem.style[MochiKit.Base.camelize(name)]=_248[name];
1987 }
1988 }
1989 },setOpacity:function(elem,o){
1990 elem=MochiKit.DOM.getElement(elem);
1991 var self=MochiKit.Style;
1992 if(o==1){
1993 var _24d=/Gecko/.test(navigator.userAgent)&&!(/Konqueror|AppleWebKit|KHTML/.test(navigator.userAgent));
1994 elem.style["opacity"]=_24d?0.999999:1;
1995 if(/MSIE/.test(navigator.userAgent)){
1996 elem.style["filter"]=self.getStyle(elem,"filter").replace(/alpha\([^\)]*\)/gi,"");
1997 }
1998 }else{
1999 if(o<0.00001){
2000 o=0;
2001 }
2002 elem.style["opacity"]=o;
2003 if(/MSIE/.test(navigator.userAgent)){
2004 elem.style["filter"]=self.getStyle(elem,"filter").replace(/alpha\([^\)]*\)/gi,"")+"alpha(opacity="+o*100+")";
2005 }
2006 }
2007 },getElementPosition:function(elem,_24f){
2008 var self=MochiKit.Style;
2009 var dom=MochiKit.DOM;
2010 elem=dom.getElement(elem);
2011 if(!elem||(!(elem.x&&elem.y)&&(!elem.parentNode===null||self.getStyle(elem,"display")=="none"))){
2012 return undefined;
2013 }
2014 var c=new self.Coordinates(0,0);
2015 var box=null;
2016 var _254=null;
2017 var d=MochiKit.DOM._document;
2018 var de=d.documentElement;
2019 var b=d.body;
2020 if(!elem.parentNode&&elem.x&&elem.y){
2021 c.x+=elem.x||0;
2022 c.y+=elem.y||0;
2023 }else{
2024 if(elem.getBoundingClientRect){
2025 box=elem.getBoundingClientRect();
2026 c.x+=box.left+(de.scrollLeft||b.scrollLeft)-(de.clientLeft||0);
2027 c.y+=box.top+(de.scrollTop||b.scrollTop)-(de.clientTop||0);
2028 }else{
2029 if(elem.offsetParent){
2030 c.x+=elem.offsetLeft;
2031 c.y+=elem.offsetTop;
2032 _254=elem.offsetParent;
2033 if(_254!=elem){
2034 while(_254){
2035 c.x+=_254.offsetLeft;
2036 c.y+=_254.offsetTop;
2037 _254=_254.offsetParent;
2038 }
2039 }
2040 var ua=navigator.userAgent.toLowerCase();
2041 if((typeof (opera)!="undefined"&&parseFloat(opera.version())<9)||(ua.indexOf("AppleWebKit")!=-1&&self.getStyle(elem,"position")=="absolute")){
2042 c.x-=b.offsetLeft;
2043 c.y-=b.offsetTop;
2044 }
2045 }
2046 }
2047 }
2048 if(typeof (_24f)!="undefined"){
2049 _24f=arguments.callee(_24f);
2050 if(_24f){
2051 c.x-=(_24f.x||0);
2052 c.y-=(_24f.y||0);
2053 }
2054 }
2055 if(elem.parentNode){
2056 _254=elem.parentNode;
2057 }else{
2058 _254=null;
2059 }
2060 while(_254){
2061 var _259=_254.tagName.toUpperCase();
2062 if(_259==="BODY"||_259==="HTML"){
2063 break;
2064 }
2065 var disp=self.getStyle(_254,"display");
2066 if(disp!="inline"&&disp!="table-row"){
2067 c.x-=_254.scrollLeft;
2068 c.y-=_254.scrollTop;
2069 }
2070 if(_254.parentNode){
2071 _254=_254.parentNode;
2072 }else{
2073 _254=null;
2074 }
2075 }
2076 return c;
2077 },setElementPosition:function(elem,_25c,_25d){
2078 elem=MochiKit.DOM.getElement(elem);
2079 if(typeof (_25d)=="undefined"){
2080 _25d="px";
2081 }
2082 var _25e={};
2083 var _25f=MochiKit.Base.isUndefinedOrNull;
2084 if(!_25f(_25c.x)){
2085 _25e["left"]=_25c.x+_25d;
2086 }
2087 if(!_25f(_25c.y)){
2088 _25e["top"]=_25c.y+_25d;
2089 }
2090 MochiKit.DOM.updateNodeAttributes(elem,{"style":_25e});
2091 },getElementDimensions:function(elem){
2092 var self=MochiKit.Style;
2093 var dom=MochiKit.DOM;
2094 if(typeof (elem.w)=="number"||typeof (elem.h)=="number"){
2095 return new self.Dimensions(elem.w||0,elem.h||0);
2096 }
2097 elem=dom.getElement(elem);
2098 if(!elem){
2099 return undefined;
2100 }
2101 var disp=self.getStyle(elem,"display");
2102 if(disp!="none"&&disp!==""&&typeof (disp)!="undefined"){
2103 return new self.Dimensions(elem.offsetWidth||0,elem.offsetHeight||0);
2104 }
2105 var s=elem.style;
2106 var _265=s.visibility;
2107 var _266=s.position;
2108 s.visibility="hidden";
2109 s.position="absolute";
2110 s.display="";
2111 var _267=elem.offsetWidth;
2112 var _268=elem.offsetHeight;
2113 s.display="none";
2114 s.position=_266;
2115 s.visibility=_265;
2116 return new self.Dimensions(_267,_268);
2117 },setElementDimensions:function(elem,_26a,_26b){
2118 elem=MochiKit.DOM.getElement(elem);
2119 if(typeof (_26b)=="undefined"){
2120 _26b="px";
2121 }
2122 var _26c={};
2123 var _26d=MochiKit.Base.isUndefinedOrNull;
2124 if(!_26d(_26a.w)){
2125 _26c["width"]=_26a.w+_26b;
2126 }
2127 if(!_26d(_26a.h)){
2128 _26c["height"]=_26a.h+_26b;
2129 }
2130 MochiKit.DOM.updateNodeAttributes(elem,{"style":_26c});
2131 },setDisplayForElement:function(_26e,_26f){
2132 var _270=MochiKit.Base.extend(null,arguments,1);
2133 var _271=MochiKit.DOM.getElement;
2134 for(var i=0;i<_270.length;i++){
2135 _26f=_271(_270[i]);
2136 if(_26f){
2137 _26f.style.display=_26e;
2138 }
2139 }
2140 },getViewportDimensions:function(){
2141 var d=new MochiKit.Style.Dimensions();
2142 var w=MochiKit.DOM._window;
2143 var b=MochiKit.DOM._document.body;
2144 if(w.innerWidth){
2145 d.w=w.innerWidth;
2146 d.h=w.innerHeight;
2147 }else{
2148 if(b.parentElement.clientWidth){
2149 d.w=b.parentElement.clientWidth;
2150 d.h=b.parentElement.clientHeight;
2151 }else{
2152 if(b&&b.clientWidth){
2153 d.w=b.clientWidth;
2154 d.h=b.clientHeight;
2155 }
2156 }
2157 }
2158 return d;
2159 },getViewportPosition:function(){
2160 var c=new MochiKit.Style.Coordinates(0,0);
2161 var d=MochiKit.DOM._document;
2162 var de=d.documentElement;
2163 var db=d.body;
2164 if(de&&(de.scrollTop||de.scrollLeft)){
2165 c.x=de.scrollLeft;
2166 c.y=de.scrollTop;
2167 }else{
2168 if(db){
2169 c.x=db.scrollLeft;
2170 c.y=db.scrollTop;
2171 }
2172 }
2173 return c;
2174 },__new__:function(){
2175 var m=MochiKit.Base;
2176 this.elementPosition=this.getElementPosition;
2177 this.elementDimensions=this.getElementDimensions;
2178 this.hideElement=m.partial(this.setDisplayForElement,"none");
2179 this.showElement=m.partial(this.setDisplayForElement,"block");
2180 this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};
2181 m.nameFunctions(this);
2182 }});
2183 MochiKit.Style.__new__();
2184 MochiKit.Base._exportSymbols(this,MochiKit.Style);
2185 if(typeof (dojo)!="undefined"){
2186 dojo.provide("MochiKit.Signal");
2187 dojo.require("MochiKit.Base");
2188 dojo.require("MochiKit.DOM");
2189 dojo.require("MochiKit.Style");
2190 }
2191 if(typeof (JSAN)!="undefined"){
2192 JSAN.use("MochiKit.Base",[]);
2193 JSAN.use("MochiKit.DOM",[]);
2194 JSAN.use("MochiKit.Style",[]);
2195 }
2196 try{
2197 if(typeof (MochiKit.Base)=="undefined"){
2198 throw "";
2199 }
2200 }
2201 catch(e){
2202 throw "MochiKit.Signal depends on MochiKit.Base!";
2203 }
2204 try{
2205 if(typeof (MochiKit.DOM)=="undefined"){
2206 throw "";
2207 }
2208 }
2209 catch(e){
2210 throw "MochiKit.Signal depends on MochiKit.DOM!";
2211 }
2212 try{
2213 if(typeof (MochiKit.Style)=="undefined"){
2214 throw "";
2215 }
2216 }
2217 catch(e){
2218 throw "MochiKit.Signal depends on MochiKit.Style!";
2219 }
2220 if(typeof (MochiKit.Signal)=="undefined"){
2221 MochiKit.Signal={};
2222 }
2223 MochiKit.Signal.NAME="MochiKit.Signal";
2224 MochiKit.Signal.VERSION="1.4";
2225 MochiKit.Signal._observers=[];
2226 MochiKit.Signal.Event=function(src,e){
2227 this._event=e||window.event;
2228 this._src=src;
2229 };
2230 MochiKit.Base.update(MochiKit.Signal.Event.prototype,{__repr__:function(){
2231 var repr=MochiKit.Base.repr;
2232 var str="{event(): "+repr(this.event())+", src(): "+repr(this.src())+", type(): "+repr(this.type())+", target(): "+repr(this.target());
2233 if(this.type()&&this.type().indexOf("key")===0||this.type().indexOf("mouse")===0||this.type().indexOf("click")!=-1||this.type()=="contextmenu"){
2234 str+=", modifier(): "+"{alt: "+repr(this.modifier().alt)+", ctrl: "+repr(this.modifier().ctrl)+", meta: "+repr(this.modifier().meta)+", shift: "+repr(this.modifier().shift)+", any: "+repr(this.modifier().any)+"}";
2235 }
2236 if(this.type()&&this.type().indexOf("key")===0){
2237 str+=", key(): {code: "+repr(this.key().code)+", string: "+repr(this.key().string)+"}";
2238 }
2239 if(this.type()&&(this.type().indexOf("mouse")===0||this.type().indexOf("click")!=-1||this.type()=="contextmenu")){
2240 str+=", mouse(): {page: "+repr(this.mouse().page)+", client: "+repr(this.mouse().client);
2241 if(this.type()!="mousemove"){
2242 str+=", button: {left: "+repr(this.mouse().button.left)+", middle: "+repr(this.mouse().button.middle)+", right: "+repr(this.mouse().button.right)+"}}";
2243 }else{
2244 str+="}";
2245 }
2246 }
2247 if(this.type()=="mouseover"||this.type()=="mouseout"){
2248 str+=", relatedTarget(): "+repr(this.relatedTarget());
2249 }
2250 str+="}";
2251 return str;
2252 },toString:function(){
2253 return this.__repr__();
2254 },src:function(){
2255 return this._src;
2256 },event:function(){
2257 return this._event;
2258 },type:function(){
2259 return this._event.type||undefined;
2260 },target:function(){
2261 return this._event.target||this._event.srcElement;
2262 },_relatedTarget:null,relatedTarget:function(){
2263 if(this._relatedTarget!==null){
2264 return this._relatedTarget;
2265 }
2266 var elem=null;
2267 if(this.type()=="mouseover"){
2268 elem=(this._event.relatedTarget||this._event.fromElement);
2269 }else{
2270 if(this.type()=="mouseout"){
2271 elem=(this._event.relatedTarget||this._event.toElement);
2272 }
2273 }
2274 if(elem!==null){
2275 this._relatedTarget=elem;
2276 return elem;
2277 }
2278 return undefined;
2279 },_modifier:null,modifier:function(){
2280 if(this._modifier!==null){
2281 return this._modifier;
2282 }
2283 var m={};
2284 m.alt=this._event.altKey;
2285 m.ctrl=this._event.ctrlKey;
2286 m.meta=this._event.metaKey||false;
2287 m.shift=this._event.shiftKey;
2288 m.any=m.alt||m.ctrl||m.shift||m.meta;
2289 this._modifier=m;
2290 return m;
2291 },_key:null,key:function(){
2292 if(this._key!==null){
2293 return this._key;
2294 }
2295 var k={};
2296 if(this.type()&&this.type().indexOf("key")===0){
2297 if(this.type()=="keydown"||this.type()=="keyup"){
2298 k.code=this._event.keyCode;
2299 k.string=(MochiKit.Signal._specialKeys[k.code]||"KEY_UNKNOWN");
2300 this._key=k;
2301 return k;
2302 }else{
2303 if(this.type()=="keypress"){
2304 k.code=0;
2305 k.string="";
2306 if(typeof (this._event.charCode)!="undefined"&&this._event.charCode!==0&&!MochiKit.Signal._specialMacKeys[this._event.charCode]){
2307 k.code=this._event.charCode;
2308 k.string=String.fromCharCode(k.code);
2309 }else{
2310 if(this._event.keyCode&&typeof (this._event.charCode)=="undefined"){
2311 k.code=this._event.keyCode;
2312 k.string=String.fromCharCode(k.code);
2313 }
2314 }
2315 this._key=k;
2316 return k;
2317 }
2318 }
2319 }
2320 return undefined;
2321 },_mouse:null,mouse:function(){
2322 if(this._mouse!==null){
2323 return this._mouse;
2324 }
2325 var m={};
2326 var e=this._event;
2327 if(this.type()&&(this.type().indexOf("mouse")===0||this.type().indexOf("click")!=-1||this.type()=="contextmenu")){
2328 m.client=new MochiKit.Style.Coordinates(0,0);
2329 if(e.clientX||e.clientY){
2330 m.client.x=(!e.clientX||e.clientX<0)?0:e.clientX;
2331 m.client.y=(!e.clientY||e.clientY<0)?0:e.clientY;
2332 }
2333 m.page=new MochiKit.Style.Coordinates(0,0);
2334 if(e.pageX||e.pageY){
2335 m.page.x=(!e.pageX||e.pageX<0)?0:e.pageX;
2336 m.page.y=(!e.pageY||e.pageY<0)?0:e.pageY;
2337 }else{
2338 var de=MochiKit.DOM._document.documentElement;
2339 var b=MochiKit.DOM._document.body;
2340 m.page.x=e.clientX+(de.scrollLeft||b.scrollLeft)-(de.clientLeft||0);
2341 m.page.y=e.clientY+(de.scrollTop||b.scrollTop)-(de.clientTop||0);
2342 }
2343 if(this.type()!="mousemove"){
2344 m.button={};
2345 m.button.left=false;
2346 m.button.right=false;
2347 m.button.middle=false;
2348 if(e.which){
2349 m.button.left=(e.which==1);
2350 m.button.middle=(e.which==2);
2351 m.button.right=(e.which==3);
2352 }else{
2353 m.button.left=!!(e.button&1);
2354 m.button.right=!!(e.button&2);
2355 m.button.middle=!!(e.button&4);
2356 }
2357 }
2358 this._mouse=m;
2359 return m;
2360 }
2361 return undefined;
2362 },stop:function(){
2363 this.stopPropagation();
2364 this.preventDefault();
2365 },stopPropagation:function(){
2366 if(this._event.stopPropagation){
2367 this._event.stopPropagation();
2368 }else{
2369 this._event.cancelBubble=true;
2370 }
2371 },preventDefault:function(){
2372 if(this._event.preventDefault){
2373 this._event.preventDefault();
2374 }else{
2375 if(this._confirmUnload===null){
2376 this._event.returnValue=false;
2377 }
2378 }
2379 },_confirmUnload:null,confirmUnload:function(msg){
2380 if(this.type()=="beforeunload"){
2381 this._confirmUnload=msg;
2382 this._event.returnValue=msg;
2383 }
2384 }});
2385 MochiKit.Signal._specialMacKeys={3:"KEY_ENTER",63289:"KEY_NUM_PAD_CLEAR",63276:"KEY_PAGE_UP",63277:"KEY_PAGE_DOWN",63275:"KEY_END",63273:"KEY_HOME",63234:"KEY_ARROW_LEFT",63232:"KEY_ARROW_UP",63235:"KEY_ARROW_RIGHT",63233:"KEY_ARROW_DOWN",63302:"KEY_INSERT",63272:"KEY_DELETE"};
2386 (function(){
2387 var _287=MochiKit.Signal._specialMacKeys;
2388 for(i=63236;i<=63242;i++){
2389 _287[i]="KEY_F"+(i-63236+1);
2390 }
2391 })();
2392 MochiKit.Signal._specialKeys={8:"KEY_BACKSPACE",9:"KEY_TAB",12:"KEY_NUM_PAD_CLEAR",13:"KEY_ENTER",16:"KEY_SHIFT",17:"KEY_CTRL",18:"KEY_ALT",19:"KEY_PAUSE",20:"KEY_CAPS_LOCK",27:"KEY_ESCAPE",32:"KEY_SPACEBAR",33:"KEY_PAGE_UP",34:"KEY_PAGE_DOWN",35:"KEY_END",36:"KEY_HOME",37:"KEY_ARROW_LEFT",38:"KEY_ARROW_UP",39:"KEY_ARROW_RIGHT",40:"KEY_ARROW_DOWN",44:"KEY_PRINT_SCREEN",45:"KEY_INSERT",46:"KEY_DELETE",59:"KEY_SEMICOLON",91:"KEY_WINDOWS_LEFT",92:"KEY_WINDOWS_RIGHT",93:"KEY_SELECT",106:"KEY_NUM_PAD_ASTERISK",107:"KEY_NUM_PAD_PLUS_SIGN",109:"KEY_NUM_PAD_HYPHEN-MINUS",110:"KEY_NUM_PAD_FULL_STOP",111:"KEY_NUM_PAD_SOLIDUS",144:"KEY_NUM_LOCK",145:"KEY_SCROLL_LOCK",186:"KEY_SEMICOLON",187:"KEY_EQUALS_SIGN",188:"KEY_COMMA",189:"KEY_HYPHEN-MINUS",190:"KEY_FULL_STOP",191:"KEY_SOLIDUS",192:"KEY_GRAVE_ACCENT",219:"KEY_LEFT_SQUARE_BRACKET",220:"KEY_REVERSE_SOLIDUS",221:"KEY_RIGHT_SQUARE_BRACKET",222:"KEY_APOSTROPHE"};
2393 (function(){
2394 var _288=MochiKit.Signal._specialKeys;
2395 for(var i=48;i<=57;i++){
2396 _288[i]="KEY_"+(i-48);
2397 }
2398 for(i=65;i<=90;i++){
2399 _288[i]="KEY_"+String.fromCharCode(i);
2400 }
2401 for(i=96;i<=105;i++){
2402 _288[i]="KEY_NUM_PAD_"+(i-96);
2403 }
2404 for(i=112;i<=123;i++){
2405 _288[i]="KEY_F"+(i-112+1);
2406 }
2407 })();
2408 MochiKit.Signal.Ident=function(_28a){
2409 this.source=_28a.source;
2410 this.signal=_28a.signal;
2411 this.listener=_28a.listener;
2412 this.isDOM=_28a.isDOM;
2413 this.objOrFunc=_28a.objOrFunc;
2414 this.funcOrStr=_28a.funcOrStr;
2415 this.connected=_28a.connected;
2416 };
2417 MochiKit.Signal.Ident.prototype={};
2418 MochiKit.Base.update(MochiKit.Signal,{__repr__:function(){
2419 return "["+this.NAME+" "+this.VERSION+"]";
2420 },toString:function(){
2421 return this.__repr__();
2422 },_unloadCache:function(){
2423 var self=MochiKit.Signal;
2424 var _28c=self._observers;
2425 for(var i=0;i<_28c.length;i++){
2426 if(_28c[i].signal!=="onload"&&_28c[i].signal!=="onunload"){
2427 self._disconnect(_28c[i]);
2428 }
2429 }
2430 },_listener:function(src,sig,func,obj,_292){
2431 var self=MochiKit.Signal;
2432 var E=self.Event;
2433 if(!_292){
2434 return MochiKit.Base.bind(func,obj);
2435 }
2436 obj=obj||src;
2437 if(typeof (func)=="string"){
2438 if(sig==="onload"||sig==="onunload"){
2439 return function(_295){
2440 obj[func].apply(obj,[new E(src,_295)]);
2441 var _296=new MochiKit.Signal.Ident({source:src,signal:sig,objOrFunc:obj,funcOrStr:func});
2442 MochiKit.Signal._disconnect(_296);
2443 };
2444 }else{
2445 return function(_297){
2446 obj[func].apply(obj,[new E(src,_297)]);
2447 };
2448 }
2449 }else{
2450 if(sig==="onload"||sig==="onunload"){
2451 return function(_298){
2452 func.apply(obj,[new E(src,_298)]);
2453 MochiKit.Signal.disconnect(src,sig,func);
2454 var _299=new MochiKit.Signal.Ident({source:src,signal:sig,objOrFunc:func});
2455 MochiKit.Signal._disconnect(_299);
2456 };
2457 }else{
2458 return function(_29a){
2459 func.apply(obj,[new E(src,_29a)]);
2460 };
2461 }
2462 }
2463 },_browserAlreadyHasMouseEnterAndLeave:function(){
2464 return /MSIE/.test(navigator.userAgent);
2465 },_mouseEnterListener:function(src,sig,func,obj){
2466 var E=MochiKit.Signal.Event;
2467 return function(_2a0){
2468 var e=new E(src,_2a0);
2469 try{
2470 e.relatedTarget().nodeName;
2471 }
2472 catch(err){
2473 return;
2474 }
2475 e.stop();
2476 if(MochiKit.DOM.isChildNode(e.relatedTarget(),src)){
2477 return;
2478 }
2479 e.type=function(){
2480 return sig;
2481 };
2482 if(typeof (func)=="string"){
2483 return obj[func].apply(obj,[e]);
2484 }else{
2485 return func.apply(obj,[e]);
2486 }
2487 };
2488 },_getDestPair:function(_2a2,_2a3){
2489 var obj=null;
2490 var func=null;
2491 if(typeof (_2a3)!="undefined"){
2492 obj=_2a2;
2493 func=_2a3;
2494 if(typeof (_2a3)=="string"){
2495 if(typeof (_2a2[_2a3])!="function"){
2496 throw new Error("'funcOrStr' must be a function on 'objOrFunc'");
2497 }
2498 }else{
2499 if(typeof (_2a3)!="function"){
2500 throw new Error("'funcOrStr' must be a function or string");
2501 }
2502 }
2503 }else{
2504 if(typeof (_2a2)!="function"){
2505 throw new Error("'objOrFunc' must be a function if 'funcOrStr' is not given");
2506 }else{
2507 func=_2a2;
2508 }
2509 }
2510 return [obj,func];
2511 },connect:function(src,sig,_2a8,_2a9){
2512 src=MochiKit.DOM.getElement(src);
2513 var self=MochiKit.Signal;
2514 if(typeof (sig)!="string"){
2515 throw new Error("'sig' must be a string");
2516 }
2517 var _2ab=self._getDestPair(_2a8,_2a9);
2518 var obj=_2ab[0];
2519 var func=_2ab[1];
2520 if(typeof (obj)=="undefined"||obj===null){
2521 obj=src;
2522 }
2523 var _2ae=!!(src.addEventListener||src.attachEvent);
2524 if(_2ae&&(sig==="onmouseenter"||sig==="onmouseleave")&&!self._browserAlreadyHasMouseEnterAndLeave()){
2525 var _2af=self._mouseEnterListener(src,sig.substr(2),func,obj);
2526 if(sig==="onmouseenter"){
2527 sig="onmouseover";
2528 }else{
2529 sig="onmouseout";
2530 }
2531 }else{
2532 var _2af=self._listener(src,sig,func,obj,_2ae);
2533 }
2534 if(src.addEventListener){
2535 src.addEventListener(sig.substr(2),_2af,false);
2536 }else{
2537 if(src.attachEvent){
2538 src.attachEvent(sig,_2af);
2539 }
2540 }
2541 var _2b0=new MochiKit.Signal.Ident({source:src,signal:sig,listener:_2af,isDOM:_2ae,objOrFunc:_2a8,funcOrStr:_2a9,connected:true});
2542 self._observers.push(_2b0);
2543 if(!_2ae&&typeof (src.__connect__)=="function"){
2544 var args=MochiKit.Base.extend([_2b0],arguments,1);
2545 src.__connect__.apply(src,args);
2546 }
2547 return _2b0;
2548 },_disconnect:function(_2b2){
2549 if(!_2b2.connected){
2550 return;
2551 }
2552 _2b2.connected=false;
2553 if(!_2b2.isDOM){
2554 return;
2555 }
2556 var src=_2b2.source;
2557 var sig=_2b2.signal;
2558 var _2b5=_2b2.listener;
2559 if(src.removeEventListener){
2560 src.removeEventListener(sig.substr(2),_2b5,false);
2561 }else{
2562 if(src.detachEvent){
2563 src.detachEvent(sig,_2b5);
2564 }else{
2565 throw new Error("'src' must be a DOM element");
2566 }
2567 }
2568 },disconnect:function(_2b6){
2569 var self=MochiKit.Signal;
2570 var _2b8=self._observers;
2571 var m=MochiKit.Base;
2572 if(arguments.length>1){
2573 var src=MochiKit.DOM.getElement(arguments[0]);
2574 var sig=arguments[1];
2575 var obj=arguments[2];
2576 var func=arguments[3];
2577 for(var i=_2b8.length-1;i>=0;i--){
2578 var o=_2b8[i];
2579 if(o.source===src&&o.signal===sig&&o.objOrFunc===obj&&o.funcOrStr===func){
2580 self._disconnect(o);
2581 if(!self._lock){
2582 _2b8.splice(i,1);
2583 }else{
2584 self._dirty=true;
2585 }
2586 return true;
2587 }
2588 }
2589 }else{
2590 var idx=m.findIdentical(_2b8,_2b6);
2591 if(idx>=0){
2592 self._disconnect(_2b6);
2593 if(!self._lock){
2594 _2b8.splice(idx,1);
2595 }else{
2596 self._dirty=true;
2597 }
2598 return true;
2599 }
2600 }
2601 return false;
2602 },disconnectAllTo:function(_2c1,_2c2){
2603 var self=MochiKit.Signal;
2604 var _2c4=self._observers;
2605 var _2c5=self._disconnect;
2606 var _2c6=self._lock;
2607 var _2c7=self._dirty;
2608 if(typeof (_2c2)==="undefined"){
2609 _2c2=null;
2610 }
2611 for(var i=_2c4.length-1;i>=0;i--){
2612 var _2c9=_2c4[i];
2613 if(_2c9.objOrFunc===_2c1&&(_2c2===null||_2c9.funcOrStr===_2c2)){
2614 _2c5(_2c9);
2615 if(_2c6){
2616 _2c7=true;
2617 }else{
2618 _2c4.splice(i,1);
2619 }
2620 }
2621 }
2622 self._dirty=_2c7;
2623 },disconnectAll:function(src,sig){
2624 src=MochiKit.DOM.getElement(src);
2625 var m=MochiKit.Base;
2626 var _2cd=m.flattenArguments(m.extend(null,arguments,1));
2627 var self=MochiKit.Signal;
2628 var _2cf=self._disconnect;
2629 var _2d0=self._observers;
2630 var i,_2d2;
2631 var _2d3=self._lock;
2632 var _2d4=self._dirty;
2633 if(_2cd.length===0){
2634 for(i=_2d0.length-1;i>=0;i--){
2635 _2d2=_2d0[i];
2636 if(_2d2.source===src){
2637 _2cf(_2d2);
2638 if(!_2d3){
2639 _2d0.splice(i,1);
2640 }else{
2641 _2d4=true;
2642 }
2643 }
2644 }
2645 }else{
2646 var sigs={};
2647 for(i=0;i<_2cd.length;i++){
2648 sigs[_2cd[i]]=true;
2649 }
2650 for(i=_2d0.length-1;i>=0;i--){
2651 _2d2=_2d0[i];
2652 if(_2d2.source===src&&_2d2.signal in sigs){
2653 _2cf(_2d2);
2654 if(!_2d3){
2655 _2d0.splice(i,1);
2656 }else{
2657 _2d4=true;
2658 }
2659 }
2660 }
2661 }
2662 self._dirty=_2d4;
2663 },signal:function(src,sig){
2664 var self=MochiKit.Signal;
2665 var _2d9=self._observers;
2666 src=MochiKit.DOM.getElement(src);
2667 var args=MochiKit.Base.extend(null,arguments,2);
2668 var _2db=[];
2669 self._lock=true;
2670 for(var i=0;i<_2d9.length;i++){
2671 var _2dd=_2d9[i];
2672 if(_2dd.source===src&&_2dd.signal===sig&&_2dd.connected){
2673 try{
2674 _2dd.listener.apply(src,args);
2675 }
2676 catch(e){
2677 _2db.push(e);
2678 }
2679 }
2680 }
2681 self._lock=false;
2682 if(self._dirty){
2683 self._dirty=false;
2684 for(var i=_2d9.length-1;i>=0;i--){
2685 if(!_2d9[i].connected){
2686 _2d9.splice(i,1);
2687 }
2688 }
2689 }
2690 if(_2db.length==1){
2691 throw _2db[0];
2692 }else{
2693 if(_2db.length>1){
2694 var e=new Error("Multiple errors thrown in handling 'sig', see errors property");
2695 e.errors=_2db;
2696 throw e;
2697 }
2698 }
2699 }});
2700 MochiKit.Signal.EXPORT_OK=[];
2701 MochiKit.Signal.EXPORT=["connect","disconnect","signal","disconnectAll","disconnectAllTo"];
2702 MochiKit.Signal.__new__=function(win){
2703 var m=MochiKit.Base;
2704 this._document=document;
2705 this._window=win;
2706 this._lock=false;
2707 this._dirty=false;
2708 try{
2709 this.connect(window,"onunload",this._unloadCache);
2710 }
2711 catch(e){
2712 }
2713 this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};
2714 m.nameFunctions(this);
2715 };
2716 MochiKit.Signal.__new__(this);
2717 if(MochiKit.__export__){
2718 connect=MochiKit.Signal.connect;
2719 disconnect=MochiKit.Signal.disconnect;
2720 disconnectAll=MochiKit.Signal.disconnectAll;
2721 signal=MochiKit.Signal.signal;
2722 }
2723 MochiKit.Base._exportSymbols(this,MochiKit.Signal);
2724 if(typeof (dojo)!="undefined"){
2725 dojo.provide("MochiKit.Iter");
2726 dojo.require("MochiKit.Base");
2727 }
2728 if(typeof (JSAN)!="undefined"){
2729 JSAN.use("MochiKit.Base",[]);
2730 }
2731 try{
2732 if(typeof (MochiKit.Base)=="undefined"){
2733 throw "";
2734 }
2735 }
2736 catch(e){
2737 throw "MochiKit.Iter depends on MochiKit.Base!";
2738 }
2739 if(typeof (MochiKit.Iter)=="undefined"){
2740 MochiKit.Iter={};
2741 }
2742 MochiKit.Iter.NAME="MochiKit.Iter";
2743 MochiKit.Iter.VERSION="1.4";
2744 MochiKit.Base.update(MochiKit.Iter,{__repr__:function(){
2745 return "["+this.NAME+" "+this.VERSION+"]";
2746 },toString:function(){
2747 return this.__repr__();
2748 },registerIteratorFactory:function(name,_2e2,_2e3,_2e4){
2749 MochiKit.Iter.iteratorRegistry.register(name,_2e2,_2e3,_2e4);
2750 },iter:function(_2e5,_2e6){
2751 var self=MochiKit.Iter;
2752 if(arguments.length==2){
2753 return self.takewhile(function(a){
2754 return a!=_2e6;
2755 },_2e5);
2756 }
2757 if(typeof (_2e5.next)=="function"){
2758 return _2e5;
2759 }else{
2760 if(typeof (_2e5.iter)=="function"){
2761 return _2e5.iter();
2762 }
2763 }
2764 try{
2765 return self.iteratorRegistry.match(_2e5);
2766 }
2767 catch(e){
2768 var m=MochiKit.Base;
2769 if(e==m.NotFound){
2770 e=new TypeError(typeof (_2e5)+": "+m.repr(_2e5)+" is not iterable");
2771 }
2772 throw e;
2773 }
2774 },count:function(n){
2775 if(!n){
2776 n=0;
2777 }
2778 var m=MochiKit.Base;
2779 return {repr:function(){
2780 return "count("+n+")";
2781 },toString:m.forwardCall("repr"),next:m.counter(n)};
2782 },cycle:function(p){
2783 var self=MochiKit.Iter;
2784 var m=MochiKit.Base;
2785 var lst=[];
2786 var _2f0=self.iter(p);
2787 return {repr:function(){
2788 return "cycle(...)";
2789 },toString:m.forwardCall("repr"),next:function(){
2790 try{
2791 var rval=_2f0.next();
2792 lst.push(rval);
2793 return rval;
2794 }
2795 catch(e){
2796 if(e!=self.StopIteration){
2797 throw e;
2798 }
2799 if(lst.length===0){
2800 this.next=function(){
2801 throw self.StopIteration;
2802 };
2803 }else{
2804 var i=-1;
2805 this.next=function(){
2806 i=(i+1)%lst.length;
2807 return lst[i];
2808 };
2809 }
2810 return this.next();
2811 }
2812 }};
2813 },repeat:function(elem,n){
2814 var m=MochiKit.Base;
2815 if(typeof (n)=="undefined"){
2816 return {repr:function(){
2817 return "repeat("+m.repr(elem)+")";
2818 },toString:m.forwardCall("repr"),next:function(){
2819 return elem;
2820 }};
2821 }
2822 return {repr:function(){
2823 return "repeat("+m.repr(elem)+", "+n+")";
2824 },toString:m.forwardCall("repr"),next:function(){
2825 if(n<=0){
2826 throw MochiKit.Iter.StopIteration;
2827 }
2828 n-=1;
2829 return elem;
2830 }};
2831 },next:function(_2f6){
2832 return _2f6.next();
2833 },izip:function(p,q){
2834 var m=MochiKit.Base;
2835 var self=MochiKit.Iter;
2836 var next=self.next;
2837 var _2fc=m.map(self.iter,arguments);
2838 return {repr:function(){
2839 return "izip(...)";
2840 },toString:m.forwardCall("repr"),next:function(){
2841 return m.map(next,_2fc);
2842 }};
2843 },ifilter:function(pred,seq){
2844 var m=MochiKit.Base;
2845 seq=MochiKit.Iter.iter(seq);
2846 if(pred===null){
2847 pred=m.operator.truth;
2848 }
2849 return {repr:function(){
2850 return "ifilter(...)";
2851 },toString:m.forwardCall("repr"),next:function(){
2852 while(true){
2853 var rval=seq.next();
2854 if(pred(rval)){
2855 return rval;
2856 }
2857 }
2858 return undefined;
2859 }};
2860 },ifilterfalse:function(pred,seq){
2861 var m=MochiKit.Base;
2862 seq=MochiKit.Iter.iter(seq);
2863 if(pred===null){
2864 pred=m.operator.truth;
2865 }
2866 return {repr:function(){
2867 return "ifilterfalse(...)";
2868 },toString:m.forwardCall("repr"),next:function(){
2869 while(true){
2870 var rval=seq.next();
2871 if(!pred(rval)){
2872 return rval;
2873 }
2874 }
2875 return undefined;
2876 }};
2877 },islice:function(seq){
2878 var self=MochiKit.Iter;
2879 var m=MochiKit.Base;
2880 seq=self.iter(seq);
2881 var _308=0;
2882 var stop=0;
2883 var step=1;
2884 var i=-1;
2885 if(arguments.length==2){
2886 stop=arguments[1];
2887 }else{
2888 if(arguments.length==3){
2889 _308=arguments[1];
2890 stop=arguments[2];
2891 }else{
2892 _308=arguments[1];
2893 stop=arguments[2];
2894 step=arguments[3];
2895 }
2896 }
2897 return {repr:function(){
2898 return "islice("+["...",_308,stop,step].join(", ")+")";
2899 },toString:m.forwardCall("repr"),next:function(){
2900 var rval;
2901 while(i<_308){
2902 rval=seq.next();
2903 i++;
2904 }
2905 if(_308>=stop){
2906 throw self.StopIteration;
2907 }
2908 _308+=step;
2909 return rval;
2910 }};
2911 },imap:function(fun,p,q){
2912 var m=MochiKit.Base;
2913 var self=MochiKit.Iter;
2914 var _312=m.map(self.iter,m.extend(null,arguments,1));
2915 var map=m.map;
2916 var next=self.next;
2917 return {repr:function(){
2918 return "imap(...)";
2919 },toString:m.forwardCall("repr"),next:function(){
2920 return fun.apply(this,map(next,_312));
2921 }};
2922 },applymap:function(fun,seq,self){
2923 seq=MochiKit.Iter.iter(seq);
2924 var m=MochiKit.Base;
2925 return {repr:function(){
2926 return "applymap(...)";
2927 },toString:m.forwardCall("repr"),next:function(){
2928 return fun.apply(self,seq.next());
2929 }};
2930 },chain:function(p,q){
2931 var self=MochiKit.Iter;
2932 var m=MochiKit.Base;
2933 if(arguments.length==1){
2934 return self.iter(arguments[0]);
2935 }
2936 var _31d=m.map(self.iter,arguments);
2937 return {repr:function(){
2938 return "chain(...)";
2939 },toString:m.forwardCall("repr"),next:function(){
2940 while(_31d.length>1){
2941 try{
2942 return _31d[0].next();
2943 }
2944 catch(e){
2945 if(e!=self.StopIteration){
2946 throw e;
2947 }
2948 _31d.shift();
2949 }
2950 }
2951 if(_31d.length==1){
2952 var arg=_31d.shift();
2953 this.next=m.bind("next",arg);
2954 return this.next();
2955 }
2956 throw self.StopIteration;
2957 }};
2958 },takewhile:function(pred,seq){
2959 var self=MochiKit.Iter;
2960 seq=self.iter(seq);
2961 return {repr:function(){
2962 return "takewhile(...)";
2963 },toString:MochiKit.Base.forwardCall("repr"),next:function(){
2964 var rval=seq.next();
2965 if(!pred(rval)){
2966 this.next=function(){
2967 throw self.StopIteration;
2968 };
2969 this.next();
2970 }
2971 return rval;
2972 }};
2973 },dropwhile:function(pred,seq){
2974 seq=MochiKit.Iter.iter(seq);
2975 var m=MochiKit.Base;
2976 var bind=m.bind;
2977 return {"repr":function(){
2978 return "dropwhile(...)";
2979 },"toString":m.forwardCall("repr"),"next":function(){
2980 while(true){
2981 var rval=seq.next();
2982 if(!pred(rval)){
2983 break;
2984 }
2985 }
2986 this.next=bind("next",seq);
2987 return rval;
2988 }};
2989 },_tee:function(_328,sync,_32a){
2990 sync.pos[_328]=-1;
2991 var m=MochiKit.Base;
2992 var _32c=m.listMin;
2993 return {repr:function(){
2994 return "tee("+_328+", ...)";
2995 },toString:m.forwardCall("repr"),next:function(){
2996 var rval;
2997 var i=sync.pos[_328];
2998 if(i==sync.max){
2999 rval=_32a.next();
3000 sync.deque.push(rval);
3001 sync.max+=1;
3002 sync.pos[_328]+=1;
3003 }else{
3004 rval=sync.deque[i-sync.min];
3005 sync.pos[_328]+=1;
3006 if(i==sync.min&&_32c(sync.pos)!=sync.min){
3007 sync.min+=1;
3008 sync.deque.shift();
3009 }
3010 }
3011 return rval;
3012 }};
3013 },tee:function(_32f,n){
3014 var rval=[];
3015 var sync={"pos":[],"deque":[],"max":-1,"min":-1};
3016 if(arguments.length==1||typeof (n)=="undefined"||n===null){
3017 n=2;
3018 }
3019 var self=MochiKit.Iter;
3020 _32f=self.iter(_32f);
3021 var _tee=self._tee;
3022 for(var i=0;i<n;i++){
3023 rval.push(_tee(i,sync,_32f));
3024 }
3025 return rval;
3026 },list:function(_336){
3027 var rval;
3028 if(_336 instanceof Array){
3029 return _336.slice();
3030 }
3031 if(typeof (_336)=="function"&&!(_336 instanceof Function)&&typeof (_336.length)=="number"){
3032 rval=[];
3033 for(var i=0;i<_336.length;i++){
3034 rval.push(_336[i]);
3035 }
3036 return rval;
3037 }
3038 var self=MochiKit.Iter;
3039 _336=self.iter(_336);
3040 var rval=[];
3041 try{
3042 while(true){
3043 rval.push(_336.next());
3044 }
3045 }
3046 catch(e){
3047 if(e!=self.StopIteration){
3048 throw e;
3049 }
3050 return rval;
3051 }
3052 return undefined;
3053 },reduce:function(fn,_33b,_33c){
3054 var i=0;
3055 var x=_33c;
3056 var self=MochiKit.Iter;
3057 _33b=self.iter(_33b);
3058 if(arguments.length<3){
3059 try{
3060 x=_33b.next();
3061 }
3062 catch(e){
3063 if(e==self.StopIteration){
3064 e=new TypeError("reduce() of empty sequence with no initial value");
3065 }
3066 throw e;
3067 }
3068 i++;
3069 }
3070 try{
3071 while(true){
3072 x=fn(x,_33b.next());
3073 }
3074 }
3075 catch(e){
3076 if(e!