Merge branch 'master' into plotter
[dygraphs.git] / dygraph-combined.js
CommitLineData
6a1aa64f
DV
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
14if(typeof (dojo)!="undefined"){
15dojo.provide("MochiKit.Base");
16}
17if(typeof (MochiKit)=="undefined"){
18MochiKit={};
19}
20if(typeof (MochiKit.Base)=="undefined"){
21MochiKit.Base={};
22}
23if(typeof (MochiKit.__export__)=="undefined"){
24MochiKit.__export__=(MochiKit.__compat__||(typeof (JSAN)=="undefined"&&typeof (dojo)=="undefined"));
25}
26MochiKit.Base.VERSION="1.4";
27MochiKit.Base.NAME="MochiKit.Base";
28MochiKit.Base.update=function(_1,_2){
29if(_1===null){
30_1={};
31}
32for(var i=1;i<arguments.length;i++){
33var o=arguments[i];
34if(typeof (o)!="undefined"&&o!==null){
35for(var k in o){
36_1[k]=o[k];
37}
38}
39}
40return _1;
41};
42MochiKit.Base.update(MochiKit.Base,{__repr__:function(){
43return "["+this.NAME+" "+this.VERSION+"]";
44},toString:function(){
45return this.__repr__();
46},camelize:function(_6){
47var _7=_6.split("-");
48var cc=_7[0];
49for(var i=1;i<_7.length;i++){
50cc+=_7[i].charAt(0).toUpperCase()+_7[i].substring(1);
51}
52return cc;
53},counter:function(n){
54if(arguments.length===0){
55n=1;
56}
57return function(){
58return n++;
59};
60},clone:function(_b){
61var me=arguments.callee;
62if(arguments.length==1){
63me.prototype=_b;
64return new me();
65}
66},_flattenArray:function(_d,_e){
67for(var i=0;i<_e.length;i++){
68var o=_e[i];
69if(o instanceof Array){
70arguments.callee(_d,o);
71}else{
72_d.push(o);
73}
74}
75return _d;
76},flattenArray:function(lst){
77return MochiKit.Base._flattenArray([],lst);
78},flattenArguments:function(lst){
79var res=[];
80var m=MochiKit.Base;
81var _15=m.extend(null,arguments);
82while(_15.length){
83var o=_15.shift();
84if(o&&typeof (o)=="object"&&typeof (o.length)=="number"){
85for(var i=o.length-1;i>=0;i--){
86_15.unshift(o[i]);
87}
88}else{
89res.push(o);
90}
91}
92return res;
93},extend:function(_18,obj,_1a){
94if(!_1a){
95_1a=0;
96}
97if(obj){
98var l=obj.length;
99if(typeof (l)!="number"){
100if(typeof (MochiKit.Iter)!="undefined"){
101obj=MochiKit.Iter.list(obj);
102l=obj.length;
103}else{
104throw new TypeError("Argument not an array-like and MochiKit.Iter not present");
105}
106}
107if(!_18){
108_18=[];
109}
110for(var i=_1a;i<l;i++){
111_18.push(obj[i]);
112}
113}
114return _18;
115},updatetree:function(_1d,obj){
116if(_1d===null){
117_1d={};
118}
119for(var i=1;i<arguments.length;i++){
120var o=arguments[i];
121if(typeof (o)!="undefined"&&o!==null){
122for(var k in o){
123var v=o[k];
124if(typeof (_1d[k])=="object"&&typeof (v)=="object"){
125arguments.callee(_1d[k],v);
126}else{
127_1d[k]=v;
128}
129}
130}
131}
132return _1d;
133},setdefault:function(_23,obj){
134if(_23===null){
135_23={};
136}
137for(var i=1;i<arguments.length;i++){
138var o=arguments[i];
139for(var k in o){
140if(!(k in _23)){
141_23[k]=o[k];
142}
143}
144}
145return _23;
146},keys:function(obj){
147var _29=[];
148for(var _2a in obj){
149_29.push(_2a);
150}
151return _29;
152},values:function(obj){
153var _2c=[];
154for(var _2d in obj){
155_2c.push(obj[_2d]);
156}
157return _2c;
158},items:function(obj){
159var _2f=[];
160var e;
161for(var _31 in obj){
162var v;
163try{
164v=obj[_31];
165}
166catch(e){
167continue;
168}
169_2f.push([_31,v]);
170}
171return _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){
176return !!a;
177},lognot:function(a){
178return !a;
179},identity:function(a){
180return a;
181},not:function(a){
182return ~a;
183},neg:function(a){
184return -a;
185},add:function(a,b){
186return a+b;
187},sub:function(a,b){
188return a-b;
189},div:function(a,b){
190return a/b;
191},mod:function(a,b){
192return a%b;
193},mul:function(a,b){
194return a*b;
195},and:function(a,b){
196return a&b;
197},or:function(a,b){
198return a|b;
199},xor:function(a,b){
200return a^b;
201},lshift:function(a,b){
202return a<<b;
203},rshift:function(a,b){
204return a>>b;
205},zrshift:function(a,b){
206return a>>>b;
207},eq:function(a,b){
208return a==b;
209},ne:function(a,b){
210return a!=b;
211},gt:function(a,b){
212return a>b;
213},ge:function(a,b){
214return a>=b;
215},lt:function(a,b){
216return a<b;
217},le:function(a,b){
218return a<=b;
219},seq:function(a,b){
220return a===b;
221},sne:function(a,b){
222return a!==b;
223},ceq:function(a,b){
224return MochiKit.Base.compare(a,b)===0;
225},cne:function(a,b){
226return MochiKit.Base.compare(a,b)!==0;
227},cgt:function(a,b){
228return MochiKit.Base.compare(a,b)==1;
229},cge:function(a,b){
230return MochiKit.Base.compare(a,b)!=-1;
231},clt:function(a,b){
232return MochiKit.Base.compare(a,b)==-1;
233},cle:function(a,b){
234return MochiKit.Base.compare(a,b)!=1;
235},logand:function(a,b){
236return a&&b;
237},logor:function(a,b){
238return a||b;
239},contains:function(a,b){
240return b in a;
241}},forwardCall:function(_73){
242return function(){
243return this[_73].apply(this,arguments);
244};
245},itemgetter:function(_74){
246return function(arg){
247return arg[_74];
248};
249},typeMatcher:function(){
250var _76={};
251for(var i=0;i<arguments.length;i++){
252var typ=arguments[i];
253_76[typ]=typ;
254}
255return function(){
256for(var i=0;i<arguments.length;i++){
257if(!(typeof (arguments[i]) in _76)){
258return false;
259}
260}
261return true;
262};
263},isNull:function(){
264for(var i=0;i<arguments.length;i++){
265if(arguments[i]!==null){
266return false;
267}
268}
269return true;
270},isUndefinedOrNull:function(){
271for(var i=0;i<arguments.length;i++){
272var o=arguments[i];
273if(!(typeof (o)=="undefined"||o===null)){
274return false;
275}
276}
277return true;
278},isEmpty:function(obj){
279return !MochiKit.Base.isNotEmpty.apply(this,arguments);
280},isNotEmpty:function(obj){
281for(var i=0;i<arguments.length;i++){
282var o=arguments[i];
283if(!(o&&o.length)){
284return false;
285}
286}
287return true;
288},isArrayLike:function(){
289for(var i=0;i<arguments.length;i++){
290var o=arguments[i];
291var typ=typeof (o);
292if((typ!="object"&&!(typ=="function"&&typeof (o.item)=="function"))||o===null||typeof (o.length)!="number"||o.nodeType===3){
293return false;
294}
295}
296return true;
297},isDateLike:function(){
298for(var i=0;i<arguments.length;i++){
299var o=arguments[i];
300if(typeof (o)!="object"||o===null||typeof (o.getTime)!="function"){
301return false;
302}
303}
304return true;
305},xmap:function(fn){
306if(fn===null){
307return MochiKit.Base.extend(null,arguments,1);
308}
309var _87=[];
310for(var i=1;i<arguments.length;i++){
311_87.push(fn(arguments[i]));
312}
313return _87;
314},map:function(fn,lst){
315var m=MochiKit.Base;
316var itr=MochiKit.Iter;
317var _8d=m.isArrayLike;
318if(arguments.length<=2){
319if(!_8d(lst)){
320if(itr){
321lst=itr.list(lst);
322if(fn===null){
323return lst;
324}
325}else{
326throw new TypeError("Argument not an array-like and MochiKit.Iter not present");
327}
328}
329if(fn===null){
330return m.extend(null,lst);
331}
332var _8e=[];
333for(var i=0;i<lst.length;i++){
334_8e.push(fn(lst[i]));
335}
336return _8e;
337}else{
338if(fn===null){
339fn=Array;
340}
341var _90=null;
342for(i=1;i<arguments.length;i++){
343if(!_8d(arguments[i])){
344if(itr){
345return itr.list(itr.imap.apply(null,arguments));
346}else{
347throw new TypeError("Argument not an array-like and MochiKit.Iter not present");
348}
349}
350var l=arguments[i].length;
351if(_90===null||_90>l){
352_90=l;
353}
354}
355_8e=[];
356for(i=0;i<_90;i++){
357var _92=[];
358for(var j=1;j<arguments.length;j++){
359_92.push(arguments[j][i]);
360}
361_8e.push(fn.apply(this,_92));
362}
363return _8e;
364}
365},xfilter:function(fn){
366var _95=[];
367if(fn===null){
368fn=MochiKit.Base.operator.truth;
369}
370for(var i=1;i<arguments.length;i++){
371var o=arguments[i];
372if(fn(o)){
373_95.push(o);
374}
375}
376return _95;
377},filter:function(fn,lst,_9a){
378var _9b=[];
379var m=MochiKit.Base;
380if(!m.isArrayLike(lst)){
381if(MochiKit.Iter){
382lst=MochiKit.Iter.list(lst);
383}else{
384throw new TypeError("Argument not an array-like and MochiKit.Iter not present");
385}
386}
387if(fn===null){
388fn=m.operator.truth;
389}
390if(typeof (Array.prototype.filter)=="function"){
391return Array.prototype.filter.call(lst,fn,_9a);
392}else{
393if(typeof (_9a)=="undefined"||_9a===null){
394for(var i=0;i<lst.length;i++){
395var o=lst[i];
396if(fn(o)){
397_9b.push(o);
398}
399}
400}else{
401for(i=0;i<lst.length;i++){
402o=lst[i];
403if(fn.call(_9a,o)){
404_9b.push(o);
405}
406}
407}
408}
409return _9b;
410},_wrapDumbFunction:function(_9f){
411return function(){
412switch(arguments.length){
413case 0:
414return _9f();
415case 1:
416return _9f(arguments[0]);
417case 2:
418return _9f(arguments[0],arguments[1]);
419case 3:
420return _9f(arguments[0],arguments[1],arguments[2]);
421}
422var _a0=[];
423for(var i=0;i<arguments.length;i++){
424_a0.push("arguments["+i+"]");
425}
426return eval("(func("+_a0.join(",")+"))");
427};
428},methodcaller:function(_a2){
429var _a3=MochiKit.Base.extend(null,arguments,1);
430if(typeof (_a2)=="function"){
431return function(obj){
432return _a2.apply(obj,_a3);
433};
434}else{
435return function(obj){
436return obj[_a2].apply(obj,_a3);
437};
438}
439},method:function(_a6,_a7){
440var m=MochiKit.Base;
441return m.bind.apply(this,m.extend([_a7,_a6],arguments,2));
442},compose:function(f1,f2){
443var _ab=[];
444var m=MochiKit.Base;
445if(arguments.length===0){
446throw new TypeError("compose() requires at least one argument");
447}
448for(var i=0;i<arguments.length;i++){
449var fn=arguments[i];
450if(typeof (fn)!="function"){
451throw new TypeError(m.repr(fn)+" is not a function");
452}
453_ab.push(fn);
454}
455return function(){
456var _af=arguments;
457for(var i=_ab.length-1;i>=0;i--){
458_af=[_ab[i].apply(this,_af)];
459}
460return _af[0];
461};
462},bind:function(_b1,_b2){
463if(typeof (_b1)=="string"){
464_b1=_b2[_b1];
465}
466var _b3=_b1.im_func;
467var _b4=_b1.im_preargs;
468var _b5=_b1.im_self;
469var m=MochiKit.Base;
470if(typeof (_b1)=="function"&&typeof (_b1.apply)=="undefined"){
471_b1=m._wrapDumbFunction(_b1);
472}
473if(typeof (_b3)!="function"){
474_b3=_b1;
475}
476if(typeof (_b2)!="undefined"){
477_b5=_b2;
478}
479if(typeof (_b4)=="undefined"){
480_b4=[];
481}else{
482_b4=_b4.slice();
483}
484m.extend(_b4,arguments,2);
485var _b7=function(){
486var _b8=arguments;
487var me=arguments.callee;
488if(me.im_preargs.length>0){
489_b8=m.concat(me.im_preargs,_b8);
490}
491var _ba=me.im_self;
492if(!_ba){
493_ba=this;
494}
495return me.im_func.apply(_ba,_b8);
496};
497_b7.im_self=_b5;
498_b7.im_func=_b3;
499_b7.im_preargs=_b4;
500return _b7;
501},bindMethods:function(_bb){
502var _bc=MochiKit.Base.bind;
503for(var k in _bb){
504var _be=_bb[k];
505if(typeof (_be)=="function"){
506_bb[k]=_bc(_be,_bb);
507}
508}
509},registerComparator:function(_bf,_c0,_c1,_c2){
510MochiKit.Base.comparatorRegistry.register(_bf,_c0,_c1,_c2);
511},_primitives:{"boolean":true,"string":true,"number":true},compare:function(a,b){
512if(a==b){
513return 0;
514}
515var _c5=(typeof (a)=="undefined"||a===null);
516var _c6=(typeof (b)=="undefined"||b===null);
517if(_c5&&_c6){
518return 0;
519}else{
520if(_c5){
521return -1;
522}else{
523if(_c6){
524return 1;
525}
526}
527}
528var m=MochiKit.Base;
529var _c8=m._primitives;
530if(!(typeof (a) in _c8&&typeof (b) in _c8)){
531try{
532return m.comparatorRegistry.match(a,b);
533}
534catch(e){
535if(e!=m.NotFound){
536throw e;
537}
538}
539}
540if(a<b){
541return -1;
542}else{
543if(a>b){
544return 1;
545}
546}
547var _c9=m.repr;
548throw new TypeError(_c9(a)+" and "+_c9(b)+" can not be compared");
549},compareDateLike:function(a,b){
550return MochiKit.Base.compare(a.getTime(),b.getTime());
551},compareArrayLike:function(a,b){
552var _ce=MochiKit.Base.compare;
553var _cf=a.length;
554var _d0=0;
555if(_cf>b.length){
556_d0=1;
557_cf=b.length;
558}else{
559if(_cf<b.length){
560_d0=-1;
561}
562}
563for(var i=0;i<_cf;i++){
564var cmp=_ce(a[i],b[i]);
565if(cmp){
566return cmp;
567}
568}
569return _d0;
570},registerRepr:function(_d3,_d4,_d5,_d6){
571MochiKit.Base.reprRegistry.register(_d3,_d4,_d5,_d6);
572},repr:function(o){
573if(typeof (o)=="undefined"){
574return "undefined";
575}else{
576if(o===null){
577return "null";
578}
579}
580try{
581if(typeof (o.__repr__)=="function"){
582return o.__repr__();
583}else{
584if(typeof (o.repr)=="function"&&o.repr!=arguments.callee){
585return o.repr();
586}
587}
588return MochiKit.Base.reprRegistry.match(o);
589}
590catch(e){
591if(typeof (o.NAME)=="string"&&(o.toString==Function.prototype.toString||o.toString==Object.prototype.toString)){
592return o.NAME;
593}
594}
595try{
596var _d8=(o+"");
597}
598catch(e){
599return "["+typeof (o)+"]";
600}
601if(typeof (o)=="function"){
602o=_d8.replace(/^\s+/,"");
603var idx=o.indexOf("{");
604if(idx!=-1){
605o=o.substr(0,idx)+"{...}";
606}
607}
608return _d8;
609},reprArrayLike:function(o){
610var m=MochiKit.Base;
611return "["+m.map(m.repr,o).join(", ")+"]";
612},reprString:function(o){
613return ("\""+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){
615return o+"";
616},registerJSON:function(_de,_df,_e0,_e1){
617MochiKit.Base.jsonRegistry.register(_de,_df,_e0,_e1);
618},evalJSON:function(){
619return eval("("+arguments[0]+")");
620},serializeJSON:function(o){
621var _e3=typeof (o);
622if(_e3=="number"||_e3=="boolean"){
623return o+"";
624}else{
625if(o===null){
626return "null";
627}
628}
629var m=MochiKit.Base;
630var _e5=m.reprString;
631if(_e3=="string"){
632return _e5(o);
633}
634var me=arguments.callee;
635var _e7;
636if(typeof (o.__json__)=="function"){
637_e7=o.__json__();
638if(o!==_e7){
639return me(_e7);
640}
641}
642if(typeof (o.json)=="function"){
643_e7=o.json();
644if(o!==_e7){
645return me(_e7);
646}
647}
648if(_e3!="function"&&typeof (o.length)=="number"){
649var res=[];
650for(var i=0;i<o.length;i++){
651var val=me(o[i]);
652if(typeof (val)!="string"){
653val="undefined";
654}
655res.push(val);
656}
657return "["+res.join(", ")+"]";
658}
659try{
660_e7=m.jsonRegistry.match(o);
661if(o!==_e7){
662return me(_e7);
663}
664}
665catch(e){
666if(e!=m.NotFound){
667throw e;
668}
669}
670if(_e3=="undefined"){
671throw new TypeError("undefined can not be serialized as JSON");
672}
673if(_e3=="function"){
674return null;
675}
676res=[];
677for(var k in o){
678var _ec;
679if(typeof (k)=="number"){
680_ec="\""+k+"\"";
681}else{
682if(typeof (k)=="string"){
683_ec=_e5(k);
684}else{
685continue;
686}
687}
688val=me(o[k]);
689if(typeof (val)!="string"){
690continue;
691}
692res.push(_ec+":"+val);
693}
694return "{"+res.join(", ")+"}";
695},objEqual:function(a,b){
696return (MochiKit.Base.compare(a,b)===0);
697},arrayEqual:function(_ef,arr){
698if(_ef.length!=arr.length){
699return false;
700}
701return (MochiKit.Base.compare(_ef,arr)===0);
702},concat:function(){
703var _f1=[];
704var _f2=MochiKit.Base.extend;
705for(var i=0;i<arguments.length;i++){
706_f2(_f1,arguments[i]);
707}
708return _f1;
709},keyComparator:function(key){
710var m=MochiKit.Base;
711var _f6=m.compare;
712if(arguments.length==1){
713return function(a,b){
714return _f6(a[key],b[key]);
715};
716}
717var _f9=m.extend(null,arguments);
718return function(a,b){
719var _fc=0;
720for(var i=0;(_fc===0)&&(i<_f9.length);i++){
721var key=_f9[i];
722_fc=_f6(a[key],b[key]);
723}
724return _fc;
725};
726},reverseKeyComparator:function(key){
727var _100=MochiKit.Base.keyComparator.apply(this,arguments);
728return function(a,b){
729return _100(b,a);
730};
731},partial:function(func){
732var m=MochiKit.Base;
733return m.bind.apply(this,m.extend([func,undefined],arguments,1));
734},listMinMax:function(_105,lst){
735if(lst.length===0){
736return null;
737}
738var cur=lst[0];
739var _108=MochiKit.Base.compare;
740for(var i=1;i<lst.length;i++){
741var o=lst[i];
742if(_108(o,cur)==_105){
743cur=o;
744}
745}
746return cur;
747},objMax:function(){
748return MochiKit.Base.listMinMax(1,arguments);
749},objMin:function(){
750return MochiKit.Base.listMinMax(-1,arguments);
751},findIdentical:function(lst,_10c,_10d,end){
752if(typeof (end)=="undefined"||end===null){
753end=lst.length;
754}
755if(typeof (_10d)=="undefined"||_10d===null){
756_10d=0;
757}
758for(var i=_10d;i<end;i++){
759if(lst[i]===_10c){
760return i;
761}
762}
763return -1;
764},mean:function(){
765var sum=0;
766var m=MochiKit.Base;
767var args=m.extend(null,arguments);
768var _113=args.length;
769while(args.length){
770var o=args.shift();
771if(o&&typeof (o)=="object"&&typeof (o.length)=="number"){
772_113+=o.length-1;
773for(var i=o.length-1;i>=0;i--){
774sum+=o[i];
775}
776}else{
777sum+=o;
778}
779}
780if(_113<=0){
781throw new TypeError("mean() requires at least one argument");
782}
783return sum/_113;
784},median:function(){
785var data=MochiKit.Base.flattenArguments(arguments);
786if(data.length===0){
787throw new TypeError("median() requires at least one argument");
788}
789data.sort(compare);
790if(data.length%2==0){
791var _117=data.length/2;
792return (data[_117]+data[_117-1])/2;
793}else{
794return data[(data.length-1)/2];
795}
796},findValue:function(lst,_119,_11a,end){
797if(typeof (end)=="undefined"||end===null){
798end=lst.length;
799}
800if(typeof (_11a)=="undefined"||_11a===null){
801_11a=0;
802}
803var cmp=MochiKit.Base.compare;
804for(var i=_11a;i<end;i++){
805if(cmp(lst[i],_119)===0){
806return i;
807}
808}
809return -1;
810},nodeWalk:function(node,_11f){
811var _120=[node];
812var _121=MochiKit.Base.extend;
813while(_120.length){
814var res=_11f(_120.shift());
815if(res){
816_121(_120,res);
817}
818}
819},nameFunctions:function(_123){
820var base=_123.NAME;
821if(typeof (base)=="undefined"){
822base="";
823}else{
824base=base+".";
825}
826for(var name in _123){
827var o=_123[name];
828if(typeof (o)=="function"&&typeof (o.NAME)=="undefined"){
829try{
830o.NAME=base+name;
831}
832catch(e){
833}
834}
835}
836},queryString:function(_127,_128){
837if(typeof (MochiKit.DOM)!="undefined"&&arguments.length==1&&(typeof (_127)=="string"||(typeof (_127.nodeType)!="undefined"&&_127.nodeType>0))){
838var kv=MochiKit.DOM.formContents(_127);
839_127=kv[0];
840_128=kv[1];
841}else{
842if(arguments.length==1){
843if(typeof (_127.length)=="number"&&_127.length==2){
844return arguments.callee(_127[0],_127[1]);
845}
846var o=_127;
847_127=[];
848_128=[];
849for(var k in o){
850var v=o[k];
851if(typeof (v)=="function"){
852continue;
853}else{
854if(typeof (v)!="string"&&typeof (v.length)=="number"){
855for(var i=0;i<v.length;i++){
856_127.push(k);
857_128.push(v[i]);
858}
859}else{
860_127.push(k);
861_128.push(v);
862}
863}
864}
865}
866}
867var rval=[];
868var len=Math.min(_127.length,_128.length);
869var _130=MochiKit.Base.urlEncode;
870for(var i=0;i<len;i++){
871v=_128[i];
872if(typeof (v)!="undefined"&&v!==null){
873rval.push(_130(_127[i])+"="+_130(v));
874}
875}
876return rval.join("&");
877},parseQueryString:function(_131,_132){
878var qstr=(_131.charAt(0)=="?")?_131.substring(1):_131;
879var _134=qstr.replace(/\+/g,"%20").split(/(\&amp\;|\&\#38\;|\&#x26;|\&)/);
880var o={};
881var _136;
882if(typeof (decodeURIComponent)!="undefined"){
883_136=decodeURIComponent;
884}else{
885_136=unescape;
886}
887if(_132){
888for(var i=0;i<_134.length;i++){
889var pair=_134[i].split("=");
890var name=_136(pair.shift());
891if(!name){
892continue;
893}
894var arr=o[name];
895if(!(arr instanceof Array)){
896arr=[];
897o[name]=arr;
898}
899arr.push(_136(pair.join("=")));
900}
901}else{
902for(i=0;i<_134.length;i++){
903pair=_134[i].split("=");
904var name=pair.shift();
905if(!name){
906continue;
907}
908o[_136(name)]=_136(pair.join("="));
909}
910}
911return o;
912}});
913MochiKit.Base.AdapterRegistry=function(){
914this.pairs=[];
915};
916MochiKit.Base.AdapterRegistry.prototype={register:function(name,_13c,wrap,_13e){
917if(_13e){
918this.pairs.unshift([name,_13c,wrap]);
919}else{
920this.pairs.push([name,_13c,wrap]);
921}
922},match:function(){
923for(var i=0;i<this.pairs.length;i++){
924var pair=this.pairs[i];
925if(pair[1].apply(this,arguments)){
926return pair[2].apply(this,arguments);
927}
928}
929throw MochiKit.Base.NotFound;
930},unregister:function(name){
931for(var i=0;i<this.pairs.length;i++){
932var pair=this.pairs[i];
933if(pair[0]==name){
934this.pairs.splice(i,1);
935return true;
936}
937}
938return false;
939}};
940MochiKit.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"];
941MochiKit.Base.EXPORT_OK=["nameFunctions","comparatorRegistry","reprRegistry","jsonRegistry","compareDateLike","compareArrayLike","reprArrayLike","reprString","reprNumber"];
942MochiKit.Base._exportSymbols=function(_144,_145){
943if(!MochiKit.__export__){
944return;
945}
946var all=_145.EXPORT_TAGS[":all"];
947for(var i=0;i<all.length;i++){
948_144[all[i]]=_145[all[i]];
949}
950};
951MochiKit.Base.__new__=function(){
952var m=this;
953m.noop=m.operator.identity;
954m.forward=m.forwardCall;
955m.find=m.findValue;
956if(typeof (encodeURIComponent)!="undefined"){
957m.urlEncode=function(_149){
958return encodeURIComponent(_149).replace(/\'/g,"%27");
959};
960}else{
961m.urlEncode=function(_14a){
962return escape(_14a).replace(/\+/g,"%2B").replace(/\"/g,"%22").rval.replace(/\'/g,"%27");
963};
964}
965m.NamedError=function(name){
966this.message=name;
967this.name=name;
968};
969m.NamedError.prototype=new Error();
970m.update(m.NamedError.prototype,{repr:function(){
971if(this.message&&this.message!=this.name){
972return this.name+"("+m.repr(this.message)+")";
973}else{
974return this.name+"()";
975}
976},toString:m.forwardCall("repr")});
977m.NotFound=new m.NamedError("MochiKit.Base.NotFound");
978m.listMax=m.partial(m.listMinMax,1);
979m.listMin=m.partial(m.listMinMax,-1);
980m.isCallable=m.typeMatcher("function");
981m.isUndefined=m.typeMatcher("undefined");
982m.merge=m.partial(m.update,null);
983m.zip=m.partial(m.map,null);
984m.average=m.mean;
985m.comparatorRegistry=new m.AdapterRegistry();
986m.registerComparator("dateLike",m.isDateLike,m.compareDateLike);
987m.registerComparator("arrayLike",m.isArrayLike,m.compareArrayLike);
988m.reprRegistry=new m.AdapterRegistry();
989m.registerRepr("arrayLike",m.isArrayLike,m.reprArrayLike);
990m.registerRepr("string",m.typeMatcher("string"),m.reprString);
991m.registerRepr("numbers",m.typeMatcher("number","boolean"),m.reprNumber);
992m.jsonRegistry=new m.AdapterRegistry();
993var all=m.concat(m.EXPORT,m.EXPORT_OK);
994m.EXPORT_TAGS={":common":m.concat(m.EXPORT_OK),":all":all};
995m.nameFunctions(this);
996};
997MochiKit.Base.__new__();
998if(MochiKit.__export__){
999compare=MochiKit.Base.compare;
1000compose=MochiKit.Base.compose;
1001serializeJSON=MochiKit.Base.serializeJSON;
1002}
1003MochiKit.Base._exportSymbols(this,MochiKit.Base);
1004if(typeof (dojo)!="undefined"){
165759fa
DV
1005dojo.provide("MochiKit.Iter");
1006dojo.require("MochiKit.Base");
1007}
1008if(typeof (JSAN)!="undefined"){
1009JSAN.use("MochiKit.Base",[]);
1010}
1011try{
1012if(typeof (MochiKit.Base)=="undefined"){
1013throw "";
1014}
1015}
1016catch(e){
1017throw "MochiKit.Iter depends on MochiKit.Base!";
1018}
1019if(typeof (MochiKit.Iter)=="undefined"){
1020MochiKit.Iter={};
1021}
1022MochiKit.Iter.NAME="MochiKit.Iter";
1023MochiKit.Iter.VERSION="1.4";
1024MochiKit.Base.update(MochiKit.Iter,{__repr__:function(){
1025return "["+this.NAME+" "+this.VERSION+"]";
1026},toString:function(){
1027return this.__repr__();
1028},registerIteratorFactory:function(name,_14e,_14f,_150){
1029MochiKit.Iter.iteratorRegistry.register(name,_14e,_14f,_150);
1030},iter:function(_151,_152){
1031var self=MochiKit.Iter;
1032if(arguments.length==2){
1033return self.takewhile(function(a){
1034return a!=_152;
1035},_151);
1036}
1037if(typeof (_151.next)=="function"){
1038return _151;
1039}else{
1040if(typeof (_151.iter)=="function"){
1041return _151.iter();
1042}
1043}
1044try{
1045return self.iteratorRegistry.match(_151);
1046}
1047catch(e){
1048var m=MochiKit.Base;
1049if(e==m.NotFound){
1050e=new TypeError(typeof (_151)+": "+m.repr(_151)+" is not iterable");
1051}
1052throw e;
1053}
1054},count:function(n){
1055if(!n){
1056n=0;
1057}
1058var m=MochiKit.Base;
1059return {repr:function(){
1060return "count("+n+")";
1061},toString:m.forwardCall("repr"),next:m.counter(n)};
1062},cycle:function(p){
1063var self=MochiKit.Iter;
1064var m=MochiKit.Base;
1065var lst=[];
1066var _15c=self.iter(p);
1067return {repr:function(){
1068return "cycle(...)";
1069},toString:m.forwardCall("repr"),next:function(){
1070try{
1071var rval=_15c.next();
1072lst.push(rval);
1073return rval;
1074}
1075catch(e){
1076if(e!=self.StopIteration){
1077throw e;
1078}
1079if(lst.length===0){
1080this.next=function(){
1081throw self.StopIteration;
1082};
1083}else{
1084var i=-1;
1085this.next=function(){
1086i=(i+1)%lst.length;
1087return lst[i];
1088};
1089}
1090return this.next();
1091}
1092}};
1093},repeat:function(elem,n){
1094var m=MochiKit.Base;
1095if(typeof (n)=="undefined"){
1096return {repr:function(){
1097return "repeat("+m.repr(elem)+")";
1098},toString:m.forwardCall("repr"),next:function(){
1099return elem;
1100}};
1101}
1102return {repr:function(){
1103return "repeat("+m.repr(elem)+", "+n+")";
1104},toString:m.forwardCall("repr"),next:function(){
1105if(n<=0){
1106throw MochiKit.Iter.StopIteration;
1107}
1108n-=1;
1109return elem;
1110}};
1111},next:function(_162){
1112return _162.next();
1113},izip:function(p,q){
1114var m=MochiKit.Base;
1115var self=MochiKit.Iter;
1116var next=self.next;
1117var _168=m.map(self.iter,arguments);
1118return {repr:function(){
1119return "izip(...)";
1120},toString:m.forwardCall("repr"),next:function(){
1121return m.map(next,_168);
1122}};
1123},ifilter:function(pred,seq){
1124var m=MochiKit.Base;
1125seq=MochiKit.Iter.iter(seq);
1126if(pred===null){
1127pred=m.operator.truth;
1128}
1129return {repr:function(){
1130return "ifilter(...)";
1131},toString:m.forwardCall("repr"),next:function(){
1132while(true){
1133var rval=seq.next();
1134if(pred(rval)){
1135return rval;
1136}
1137}
1138return undefined;
1139}};
1140},ifilterfalse:function(pred,seq){
1141var m=MochiKit.Base;
1142seq=MochiKit.Iter.iter(seq);
1143if(pred===null){
1144pred=m.operator.truth;
1145}
1146return {repr:function(){
1147return "ifilterfalse(...)";
1148},toString:m.forwardCall("repr"),next:function(){
1149while(true){
1150var rval=seq.next();
1151if(!pred(rval)){
1152return rval;
1153}
1154}
1155return undefined;
1156}};
1157},islice:function(seq){
1158var self=MochiKit.Iter;
1159var m=MochiKit.Base;
1160seq=self.iter(seq);
1161var _174=0;
1162var stop=0;
1163var step=1;
1164var i=-1;
1165if(arguments.length==2){
1166stop=arguments[1];
1167}else{
1168if(arguments.length==3){
1169_174=arguments[1];
1170stop=arguments[2];
1171}else{
1172_174=arguments[1];
1173stop=arguments[2];
1174step=arguments[3];
1175}
1176}
1177return {repr:function(){
1178return "islice("+["...",_174,stop,step].join(", ")+")";
1179},toString:m.forwardCall("repr"),next:function(){
1180var rval;
1181while(i<_174){
1182rval=seq.next();
1183i++;
1184}
1185if(_174>=stop){
1186throw self.StopIteration;
1187}
1188_174+=step;
1189return rval;
1190}};
1191},imap:function(fun,p,q){
1192var m=MochiKit.Base;
1193var self=MochiKit.Iter;
1194var _17e=m.map(self.iter,m.extend(null,arguments,1));
1195var map=m.map;
1196var next=self.next;
1197return {repr:function(){
1198return "imap(...)";
1199},toString:m.forwardCall("repr"),next:function(){
1200return fun.apply(this,map(next,_17e));
1201}};
1202},applymap:function(fun,seq,self){
1203seq=MochiKit.Iter.iter(seq);
1204var m=MochiKit.Base;
1205return {repr:function(){
1206return "applymap(...)";
1207},toString:m.forwardCall("repr"),next:function(){
1208return fun.apply(self,seq.next());
1209}};
1210},chain:function(p,q){
1211var self=MochiKit.Iter;
1212var m=MochiKit.Base;
1213if(arguments.length==1){
1214return self.iter(arguments[0]);
1215}
1216var _189=m.map(self.iter,arguments);
1217return {repr:function(){
1218return "chain(...)";
1219},toString:m.forwardCall("repr"),next:function(){
1220while(_189.length>1){
1221try{
1222return _189[0].next();
1223}
1224catch(e){
1225if(e!=self.StopIteration){
1226throw e;
1227}
1228_189.shift();
1229}
1230}
1231if(_189.length==1){
1232var arg=_189.shift();
1233this.next=m.bind("next",arg);
1234return this.next();
1235}
1236throw self.StopIteration;
1237}};
1238},takewhile:function(pred,seq){
1239var self=MochiKit.Iter;
1240seq=self.iter(seq);
1241return {repr:function(){
1242return "takewhile(...)";
1243},toString:MochiKit.Base.forwardCall("repr"),next:function(){
1244var rval=seq.next();
1245if(!pred(rval)){
1246this.next=function(){
1247throw self.StopIteration;
1248};
1249this.next();
1250}
1251return rval;
1252}};
1253},dropwhile:function(pred,seq){
1254seq=MochiKit.Iter.iter(seq);
1255var m=MochiKit.Base;
1256var bind=m.bind;
1257return {"repr":function(){
1258return "dropwhile(...)";
1259},"toString":m.forwardCall("repr"),"next":function(){
1260while(true){
1261var rval=seq.next();
1262if(!pred(rval)){
1263break;
1264}
1265}
1266this.next=bind("next",seq);
1267return rval;
1268}};
1269},_tee:function(_194,sync,_196){
1270sync.pos[_194]=-1;
1271var m=MochiKit.Base;
1272var _198=m.listMin;
1273return {repr:function(){
1274return "tee("+_194+", ...)";
1275},toString:m.forwardCall("repr"),next:function(){
1276var rval;
1277var i=sync.pos[_194];
1278if(i==sync.max){
1279rval=_196.next();
1280sync.deque.push(rval);
1281sync.max+=1;
1282sync.pos[_194]+=1;
1283}else{
1284rval=sync.deque[i-sync.min];
1285sync.pos[_194]+=1;
1286if(i==sync.min&&_198(sync.pos)!=sync.min){
1287sync.min+=1;
1288sync.deque.shift();
1289}
1290}
1291return rval;
1292}};
1293},tee:function(_19b,n){
1294var rval=[];
1295var sync={"pos":[],"deque":[],"max":-1,"min":-1};
1296if(arguments.length==1||typeof (n)=="undefined"||n===null){
1297n=2;
1298}
1299var self=MochiKit.Iter;
1300_19b=self.iter(_19b);
1301var _tee=self._tee;
1302for(var i=0;i<n;i++){
1303rval.push(_tee(i,sync,_19b));
1304}
1305return rval;
1306},list:function(_1a2){
1307var rval;
1308if(_1a2 instanceof Array){
1309return _1a2.slice();
1310}
1311if(typeof (_1a2)=="function"&&!(_1a2 instanceof Function)&&typeof (_1a2.length)=="number"){
1312rval=[];
1313for(var i=0;i<_1a2.length;i++){
1314rval.push(_1a2[i]);
1315}
1316return rval;
1317}
1318var self=MochiKit.Iter;
1319_1a2=self.iter(_1a2);
1320var rval=[];
1321try{
1322while(true){
1323rval.push(_1a2.next());
1324}
1325}
1326catch(e){
1327if(e!=self.StopIteration){
1328throw e;
1329}
1330return rval;
1331}
1332return undefined;
1333},reduce:function(fn,_1a7,_1a8){
1334var i=0;
1335var x=_1a8;
1336var self=MochiKit.Iter;
1337_1a7=self.iter(_1a7);
1338if(arguments.length<3){
1339try{
1340x=_1a7.next();
1341}
1342catch(e){
1343if(e==self.StopIteration){
1344e=new TypeError("reduce() of empty sequence with no initial value");
1345}
1346throw e;
1347}
1348i++;
1349}
1350try{
1351while(true){
1352x=fn(x,_1a7.next());
1353}
1354}
1355catch(e){
1356if(e!=self.StopIteration){
1357throw e;
1358}
1359}
1360return x;
1361},range:function(){
1362var _1ac=0;
1363var stop=0;
1364var step=1;
1365if(arguments.length==1){
1366stop=arguments[0];
1367}else{
1368if(arguments.length==2){
1369_1ac=arguments[0];
1370stop=arguments[1];
1371}else{
1372if(arguments.length==3){
1373_1ac=arguments[0];
1374stop=arguments[1];
1375step=arguments[2];
1376}else{
1377throw new TypeError("range() takes 1, 2, or 3 arguments!");
1378}
1379}
1380}
1381if(step===0){
1382throw new TypeError("range() step must not be 0");
1383}
1384return {next:function(){
1385if((step>0&&_1ac>=stop)||(step<0&&_1ac<=stop)){
1386throw MochiKit.Iter.StopIteration;
1387}
1388var rval=_1ac;
1389_1ac+=step;
1390return rval;
1391},repr:function(){
1392return "range("+[_1ac,stop,step].join(", ")+")";
1393},toString:MochiKit.Base.forwardCall("repr")};
1394},sum:function(_1b0,_1b1){
1395if(typeof (_1b1)=="undefined"||_1b1===null){
1396_1b1=0;
1397}
1398var x=_1b1;
1399var self=MochiKit.Iter;
1400_1b0=self.iter(_1b0);
1401try{
1402while(true){
1403x+=_1b0.next();
1404}
1405}
1406catch(e){
1407if(e!=self.StopIteration){
1408throw e;
1409}
1410}
1411return x;
1412},exhaust:function(_1b4){
1413var self=MochiKit.Iter;
1414_1b4=self.iter(_1b4);
1415try{
1416while(true){
1417_1b4.next();
1418}
1419}
1420catch(e){
1421if(e!=self.StopIteration){
1422throw e;
1423}
1424}
1425},forEach:function(_1b6,func,self){
1426var m=MochiKit.Base;
1427if(arguments.length>2){
1428func=m.bind(func,self);
1429}
1430if(m.isArrayLike(_1b6)){
1431try{
1432for(var i=0;i<_1b6.length;i++){
1433func(_1b6[i]);
1434}
1435}
1436catch(e){
1437if(e!=MochiKit.Iter.StopIteration){
1438throw e;
1439}
1440}
1441}else{
1442self=MochiKit.Iter;
1443self.exhaust(self.imap(func,_1b6));
1444}
1445},every:function(_1bb,func){
1446var self=MochiKit.Iter;
1447try{
1448self.ifilterfalse(func,_1bb).next();
1449return false;
1450}
1451catch(e){
1452if(e!=self.StopIteration){
1453throw e;
1454}
1455return true;
1456}
1457},sorted:function(_1be,cmp){
1458var rval=MochiKit.Iter.list(_1be);
1459if(arguments.length==1){
1460cmp=MochiKit.Base.compare;
1461}
1462rval.sort(cmp);
1463return rval;
1464},reversed:function(_1c1){
1465var rval=MochiKit.Iter.list(_1c1);
1466rval.reverse();
1467return rval;
1468},some:function(_1c3,func){
1469var self=MochiKit.Iter;
1470try{
1471self.ifilter(func,_1c3).next();
1472return true;
1473}
1474catch(e){
1475if(e!=self.StopIteration){
1476throw e;
1477}
1478return false;
1479}
1480},iextend:function(lst,_1c7){
1481if(MochiKit.Base.isArrayLike(_1c7)){
1482for(var i=0;i<_1c7.length;i++){
1483lst.push(_1c7[i]);
1484}
1485}else{
1486var self=MochiKit.Iter;
1487_1c7=self.iter(_1c7);
1488try{
1489while(true){
1490lst.push(_1c7.next());
1491}
1492}
1493catch(e){
1494if(e!=self.StopIteration){
1495throw e;
1496}
1497}
1498}
1499return lst;
1500},groupby:function(_1ca,_1cb){
1501var m=MochiKit.Base;
1502var self=MochiKit.Iter;
1503if(arguments.length<2){
1504_1cb=m.operator.identity;
1505}
1506_1ca=self.iter(_1ca);
1507var pk=undefined;
1508var k=undefined;
1509var v;
1510function fetch(){
1511v=_1ca.next();
1512k=_1cb(v);
1513}
1514function eat(){
1515var ret=v;
1516v=undefined;
1517return ret;
1518}
1519var _1d2=true;
1520var _1d3=m.compare;
1521return {repr:function(){
1522return "groupby(...)";
1523},next:function(){
1524while(_1d3(k,pk)===0){
1525fetch();
1526if(_1d2){
1527_1d2=false;
1528break;
1529}
1530}
1531pk=k;
1532return [k,{next:function(){
1533if(v==undefined){
1534fetch();
1535}
1536if(_1d3(k,pk)!==0){
1537throw self.StopIteration;
1538}
1539return eat();
1540}}];
1541}};
1542},groupby_as_array:function(_1d4,_1d5){
1543var m=MochiKit.Base;
1544var self=MochiKit.Iter;
1545if(arguments.length<2){
1546_1d5=m.operator.identity;
1547}
1548_1d4=self.iter(_1d4);
1549var _1d8=[];
1550var _1d9=true;
1551var _1da;
1552var _1db=m.compare;
1553while(true){
1554try{
1555var _1dc=_1d4.next();
1556var key=_1d5(_1dc);
1557}
1558catch(e){
1559if(e==self.StopIteration){
1560break;
1561}
1562throw e;
1563}
1564if(_1d9||_1db(key,_1da)!==0){
1565var _1de=[];
1566_1d8.push([key,_1de]);
1567}
1568_1de.push(_1dc);
1569_1d9=false;
1570_1da=key;
1571}
1572return _1d8;
1573},arrayLikeIter:function(_1df){
1574var i=0;
1575return {repr:function(){
1576return "arrayLikeIter(...)";
1577},toString:MochiKit.Base.forwardCall("repr"),next:function(){
1578if(i>=_1df.length){
1579throw MochiKit.Iter.StopIteration;
1580}
1581return _1df[i++];
1582}};
1583},hasIterateNext:function(_1e1){
1584return (_1e1&&typeof (_1e1.iterateNext)=="function");
1585},iterateNextIter:function(_1e2){
1586return {repr:function(){
1587return "iterateNextIter(...)";
1588},toString:MochiKit.Base.forwardCall("repr"),next:function(){
1589var rval=_1e2.iterateNext();
1590if(rval===null||rval===undefined){
1591throw MochiKit.Iter.StopIteration;
1592}
1593return rval;
1594}};
1595}});
285a6bda 1596MochiKit.Iter.EXPORT_OK=["iteratorRegistry","arrayLikeIter","hasIterateNext","iterateNextIter"];
165759fa
DV
1597MochiKit.Iter.EXPORT=["StopIteration","registerIteratorFactory","iter","count","cycle","repeat","next","izip","ifilter","ifilterfalse","islice","imap","applymap","chain","takewhile","dropwhile","tee","list","reduce","range","sum","exhaust","forEach","every","sorted","reversed","some","iextend","groupby","groupby_as_array"];
1598MochiKit.Iter.__new__=function(){
1599var m=MochiKit.Base;
1600if(typeof (StopIteration)!="undefined"){
1601this.StopIteration=StopIteration;
1602}else{
1603this.StopIteration=new m.NamedError("StopIteration");
1604}
1605this.iteratorRegistry=new m.AdapterRegistry();
1606this.registerIteratorFactory("arrayLike",m.isArrayLike,this.arrayLikeIter);
1607this.registerIteratorFactory("iterateNext",this.hasIterateNext,this.iterateNextIter);
1608this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};
1609m.nameFunctions(this);
1610};
1611MochiKit.Iter.__new__();
1612if(MochiKit.__export__){
1613reduce=MochiKit.Iter.reduce;
1614}
1615MochiKit.Base._exportSymbols(this,MochiKit.Iter);
1616if(typeof (dojo)!="undefined"){
79f17b42
DV
1617dojo.provide("MochiKit.DOM");
1618dojo.require("MochiKit.Base");
6a1aa64f 1619}
79f17b42
DV
1620if(typeof (JSAN)!="undefined"){
1621JSAN.use("MochiKit.Base",[]);
6a1aa64f 1622}
6a1aa64f 1623try{
79f17b42
DV
1624if(typeof (MochiKit.Base)=="undefined"){
1625throw "";
6a1aa64f
DV
1626}
1627}
1628catch(e){
79f17b42 1629throw "MochiKit.DOM depends on MochiKit.Base!";
6a1aa64f 1630}
79f17b42
DV
1631if(typeof (MochiKit.DOM)=="undefined"){
1632MochiKit.DOM={};
6a1aa64f 1633}
79f17b42
DV
1634MochiKit.DOM.NAME="MochiKit.DOM";
1635MochiKit.DOM.VERSION="1.4";
1636MochiKit.DOM.__repr__=function(){
1637return "["+this.NAME+" "+this.VERSION+"]";
1638};
1639MochiKit.DOM.toString=function(){
1640return this.__repr__();
1641};
1642MochiKit.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"];
1643MochiKit.DOM.EXPORT_OK=["domConverters"];
1644MochiKit.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"]];
1645MochiKit.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);");
1646MochiKit.Base.update(MochiKit.DOM,{currentWindow:function(){
1647return MochiKit.DOM._window;
1648},currentDocument:function(){
1649return MochiKit.DOM._document;
1650},withWindow:function(win,func){
1651var self=MochiKit.DOM;
223ddf66
DV
1652var _1e8=self._document;
1653var _1e9=self._window;
79f17b42 1654var rval;
6a1aa64f 1655try{
79f17b42
DV
1656self._window=win;
1657self._document=win.document;
1658rval=func();
6a1aa64f
DV
1659}
1660catch(e){
223ddf66
DV
1661self._window=_1e9;
1662self._document=_1e8;
6a1aa64f
DV
1663throw e;
1664}
223ddf66
DV
1665self._window=_1e9;
1666self._document=_1e8;
79f17b42
DV
1667return rval;
1668},formContents:function(elem){
223ddf66
DV
1669var _1ec=[];
1670var _1ed=[];
6a1aa64f 1671var m=MochiKit.Base;
79f17b42
DV
1672var self=MochiKit.DOM;
1673if(typeof (elem)=="undefined"||elem===null){
1674elem=self._document.body;
1675}else{
1676elem=self.getElement(elem);
6a1aa64f 1677}
79f17b42
DV
1678m.nodeWalk(elem,function(elem){
1679var name=elem.name;
1680if(m.isNotEmpty(name)){
223ddf66
DV
1681var _1f2=elem.tagName.toUpperCase();
1682if(_1f2==="INPUT"&&(elem.type=="radio"||elem.type=="checkbox")&&!elem.checked){
79f17b42 1683return null;
6a1aa64f 1684}
223ddf66 1685if(_1f2==="SELECT"){
79f17b42
DV
1686if(elem.type=="select-one"){
1687if(elem.selectedIndex>=0){
1688var opt=elem.options[elem.selectedIndex];
1689var v=opt.value;
1690if(!v){
1691var h=opt.outerHTML;
1692if(h&&!h.match(/^[^>]+\svalue\s*=/i)){
1693v=opt.text;
6a1aa64f 1694}
6a1aa64f 1695}
223ddf66
DV
1696_1ec.push(name);
1697_1ed.push(v);
79f17b42 1698return null;
6a1aa64f 1699}
223ddf66
DV
1700_1ec.push(name);
1701_1ed.push("");
79f17b42 1702return null;
6a1aa64f 1703}else{
79f17b42
DV
1704var opts=elem.options;
1705if(!opts.length){
223ddf66
DV
1706_1ec.push(name);
1707_1ed.push("");
79f17b42 1708return null;
6a1aa64f 1709}
79f17b42
DV
1710for(var i=0;i<opts.length;i++){
1711var opt=opts[i];
1712if(!opt.selected){
1713continue;
6a1aa64f 1714}
79f17b42
DV
1715var v=opt.value;
1716if(!v){
1717var h=opt.outerHTML;
1718if(h&&!h.match(/^[^>]+\svalue\s*=/i)){
1719v=opt.text;
6a1aa64f 1720}
6a1aa64f 1721}
223ddf66
DV
1722_1ec.push(name);
1723_1ed.push(v);
6a1aa64f 1724}
79f17b42 1725return null;
6a1aa64f 1726}
6a1aa64f 1727}
223ddf66 1728if(_1f2==="FORM"||_1f2==="P"||_1f2==="SPAN"||_1f2==="DIV"){
79f17b42 1729return elem.childNodes;
6a1aa64f 1730}
223ddf66
DV
1731_1ec.push(name);
1732_1ed.push(elem.value||"");
79f17b42 1733return null;
6a1aa64f 1734}
79f17b42
DV
1735return elem.childNodes;
1736});
223ddf66 1737return [_1ec,_1ed];
79f17b42
DV
1738},withDocument:function(doc,func){
1739var self=MochiKit.DOM;
223ddf66 1740var _1fb=self._document;
79f17b42 1741var rval;
6a1aa64f 1742try{
79f17b42
DV
1743self._document=doc;
1744rval=func();
6a1aa64f
DV
1745}
1746catch(e){
223ddf66 1747self._document=_1fb;
6a1aa64f
DV
1748throw e;
1749}
223ddf66 1750self._document=_1fb;
79f17b42 1751return rval;
223ddf66
DV
1752},registerDOMConverter:function(name,_1fe,wrap,_200){
1753MochiKit.DOM.domConverters.register(name,_1fe,wrap,_200);
79f17b42
DV
1754},coerceToDOM:function(node,ctx){
1755var m=MochiKit.Base;
1756var im=MochiKit.Iter;
1757var self=MochiKit.DOM;
1758if(im){
1759var iter=im.iter;
223ddf66 1760var _207=im.repeat;
79f17b42
DV
1761var map=m.map;
1762}
223ddf66
DV
1763var _209=self.domConverters;
1764var _20a=arguments.callee;
1765var _20b=m.NotFound;
79f17b42
DV
1766while(true){
1767if(typeof (node)=="undefined"||node===null){
1768return null;
6a1aa64f 1769}
79f17b42
DV
1770if(typeof (node)=="function"&&typeof (node.length)=="number"&&!(node instanceof Function)){
1771node=im.list(node);
6a1aa64f 1772}
79f17b42
DV
1773if(typeof (node.nodeType)!="undefined"&&node.nodeType>0){
1774return node;
6a1aa64f 1775}
79f17b42
DV
1776if(typeof (node)=="number"||typeof (node)=="boolean"){
1777node=node.toString();
6a1aa64f 1778}
79f17b42
DV
1779if(typeof (node)=="string"){
1780return self._document.createTextNode(node);
6a1aa64f 1781}
79f17b42
DV
1782if(typeof (node.__dom__)=="function"){
1783node=node.__dom__(ctx);
1784continue;
6a1aa64f 1785}
79f17b42
DV
1786if(typeof (node.dom)=="function"){
1787node=node.dom(ctx);
1788continue;
6a1aa64f 1789}
79f17b42
DV
1790if(typeof (node)=="function"){
1791node=node.apply(ctx,[ctx]);
1792continue;
6a1aa64f 1793}
79f17b42 1794if(im){
223ddf66 1795var _20c=null;
6a1aa64f 1796try{
223ddf66 1797_20c=iter(node);
6a1aa64f
DV
1798}
1799catch(e){
6a1aa64f 1800}
223ddf66
DV
1801if(_20c){
1802return map(_20a,_20c,_207(ctx));
79f17b42
DV
1803}
1804}
1805try{
223ddf66 1806node=_209.match(node,ctx);
79f17b42
DV
1807continue;
1808}
1809catch(e){
223ddf66 1810if(e!=_20b){
6a1aa64f
DV
1811throw e;
1812}
6a1aa64f 1813}
79f17b42 1814return self._document.createTextNode(node.toString());
6a1aa64f 1815}
79f17b42 1816return undefined;
223ddf66 1817},isChildNode:function(node,_20e){
79f17b42
DV
1818var self=MochiKit.DOM;
1819if(typeof (node)=="string"){
1820node=self.getElement(node);
6a1aa64f 1821}
223ddf66
DV
1822if(typeof (_20e)=="string"){
1823_20e=self.getElement(_20e);
6a1aa64f 1824}
223ddf66 1825if(node===_20e){
79f17b42 1826return true;
6a1aa64f 1827}
79f17b42
DV
1828while(node&&node.tagName.toUpperCase()!="BODY"){
1829node=node.parentNode;
223ddf66 1830if(node===_20e){
79f17b42 1831return true;
6a1aa64f 1832}
6a1aa64f 1833}
79f17b42 1834return false;
223ddf66 1835},setNodeAttribute:function(node,attr,_212){
79f17b42 1836var o={};
223ddf66 1837o[attr]=_212;
79f17b42
DV
1838try{
1839return MochiKit.DOM.updateNodeAttributes(node,o);
6a1aa64f 1840}
79f17b42
DV
1841catch(e){
1842}
1843return null;
1844},getNodeAttribute:function(node,attr){
1845var self=MochiKit.DOM;
223ddf66 1846var _217=self.attributeArray.renames[attr];
79f17b42 1847node=self.getElement(node);
6a1aa64f 1848try{
223ddf66
DV
1849if(_217){
1850return node[_217];
6a1aa64f 1851}
79f17b42 1852return node.getAttribute(attr);
6a1aa64f
DV
1853}
1854catch(e){
6a1aa64f 1855}
79f17b42
DV
1856return null;
1857},removeNodeAttribute:function(node,attr){
1858var self=MochiKit.DOM;
223ddf66 1859var _21b=self.attributeArray.renames[attr];
79f17b42
DV
1860node=self.getElement(node);
1861try{
223ddf66
DV
1862if(_21b){
1863return node[_21b];
6a1aa64f 1864}
79f17b42 1865return node.removeAttribute(attr);
6a1aa64f 1866}
79f17b42 1867catch(e){
6a1aa64f 1868}
79f17b42 1869return null;
223ddf66 1870},updateNodeAttributes:function(node,_21d){
79f17b42
DV
1871var elem=node;
1872var self=MochiKit.DOM;
1873if(typeof (node)=="string"){
1874elem=self.getElement(node);
1875}
223ddf66
DV
1876if(_21d){
1877var _220=MochiKit.Base.updatetree;
79f17b42 1878if(self.attributeArray.compliant){
223ddf66
DV
1879for(var k in _21d){
1880var v=_21d[k];
79f17b42
DV
1881if(typeof (v)=="object"&&typeof (elem[k])=="object"){
1882if(k=="style"&&MochiKit.Style){
1883MochiKit.Style.setStyle(elem,v);
6a1aa64f 1884}else{
223ddf66 1885_220(elem[k],v);
79f17b42 1886}
6a1aa64f 1887}else{
79f17b42
DV
1888if(k.substring(0,2)=="on"){
1889if(typeof (v)=="string"){
1890v=new Function(v);
1891}
1892elem[k]=v;
6a1aa64f 1893}else{
79f17b42 1894elem.setAttribute(k,v);
6a1aa64f
DV
1895}
1896}
1897}
79f17b42 1898}else{
223ddf66
DV
1899var _223=self.attributeArray.renames;
1900for(var k in _21d){
1901v=_21d[k];
1902var _224=_223[k];
79f17b42
DV
1903if(k=="style"&&typeof (v)=="string"){
1904elem.style.cssText=v;
1905}else{
223ddf66
DV
1906if(typeof (_224)=="string"){
1907elem[_224]=v;
79f17b42
DV
1908}else{
1909if(typeof (elem[k])=="object"&&typeof (v)=="object"){
1910if(k=="style"&&MochiKit.Style){
1911MochiKit.Style.setStyle(elem,v);
1912}else{
223ddf66 1913_220(elem[k],v);
6a1aa64f 1914}
79f17b42
DV
1915}else{
1916if(k.substring(0,2)=="on"){
1917if(typeof (v)=="string"){
1918v=new Function(v);
6a1aa64f 1919}
79f17b42
DV
1920elem[k]=v;
1921}else{
1922elem.setAttribute(k,v);
6a1aa64f 1923}
6a1aa64f 1924}
6a1aa64f 1925}
6a1aa64f 1926}
6a1aa64f 1927}
6a1aa64f 1928}
6a1aa64f 1929}
79f17b42
DV
1930return elem;
1931},appendChildNodes:function(node){
1932var elem=node;
1933var self=MochiKit.DOM;
1934if(typeof (node)=="string"){
1935elem=self.getElement(node);
6a1aa64f 1936}
223ddf66
DV
1937var _228=[self.coerceToDOM(MochiKit.Base.extend(null,arguments,1),elem)];
1938var _229=MochiKit.Base.concat;
1939while(_228.length){
1940var n=_228.shift();
79f17b42
DV
1941if(typeof (n)=="undefined"||n===null){
1942}else{
1943if(typeof (n.nodeType)=="number"){
1944elem.appendChild(n);
1945}else{
223ddf66 1946_228=_229(n,_228);
6a1aa64f 1947}
6a1aa64f 1948}
6a1aa64f 1949}
79f17b42
DV
1950return elem;
1951},insertSiblingNodesBefore:function(node){
1952var elem=node;
1953var self=MochiKit.DOM;
1954if(typeof (node)=="string"){
1955elem=self.getElement(node);
6a1aa64f 1956}
223ddf66
DV
1957var _22e=[self.coerceToDOM(MochiKit.Base.extend(null,arguments,1),elem)];
1958var _22f=elem.parentNode;
1959var _230=MochiKit.Base.concat;
1960while(_22e.length){
1961var n=_22e.shift();
79f17b42 1962if(typeof (n)=="undefined"||n===null){
6a1aa64f 1963}else{
79f17b42 1964if(typeof (n.nodeType)=="number"){
223ddf66 1965_22f.insertBefore(n,elem);
79f17b42 1966}else{
223ddf66 1967_22e=_230(n,_22e);
6a1aa64f 1968}
6a1aa64f 1969}
6a1aa64f 1970}
223ddf66 1971return _22f;
79f17b42
DV
1972},insertSiblingNodesAfter:function(node){
1973var elem=node;
1974var self=MochiKit.DOM;
1975if(typeof (node)=="string"){
1976elem=self.getElement(node);
6a1aa64f 1977}
223ddf66 1978var _235=[self.coerceToDOM(MochiKit.Base.extend(null,arguments,1),elem)];
79f17b42 1979if(elem.nextSibling){
223ddf66 1980return self.insertSiblingNodesBefore(elem.nextSibling,_235);
6a1aa64f 1981}else{
223ddf66 1982return self.appendChildNodes(elem.parentNode,_235);
6a1aa64f 1983}
79f17b42
DV
1984},replaceChildNodes:function(node){
1985var elem=node;
1986var self=MochiKit.DOM;
1987if(typeof (node)=="string"){
1988elem=self.getElement(node);
1989arguments[0]=elem;
6a1aa64f 1990}
223ddf66
DV
1991var _239;
1992while((_239=elem.firstChild)){
1993elem.removeChild(_239);
6a1aa64f 1994}
79f17b42
DV
1995if(arguments.length<2){
1996return elem;
1997}else{
1998return self.appendChildNodes.apply(this,arguments);
6a1aa64f 1999}
223ddf66 2000},createDOM:function(name,_23b){
79f17b42
DV
2001var elem;
2002var self=MochiKit.DOM;
2003var m=MochiKit.Base;
223ddf66 2004if(typeof (_23b)=="string"||typeof (_23b)=="number"){
79f17b42
DV
2005var args=m.extend([name,null],arguments,1);
2006return arguments.callee.apply(this,args);
6a1aa64f 2007}
79f17b42 2008if(typeof (name)=="string"){
223ddf66
DV
2009var _240=self._xhtml;
2010if(_23b&&!self.attributeArray.compliant){
2011var _241="";
2012if("name" in _23b){
2013_241+=" name=\""+self.escapeHTML(_23b.name)+"\"";
6a1aa64f 2014}
223ddf66
DV
2015if(name=="input"&&"type" in _23b){
2016_241+=" type=\""+self.escapeHTML(_23b.type)+"\"";
6a1aa64f 2017}
223ddf66
DV
2018if(_241){
2019name="<"+name+_241+">";
2020_240=false;
6a1aa64f 2021}
6a1aa64f 2022}
79f17b42 2023var d=self._document;
223ddf66 2024if(_240&&d===document){
79f17b42
DV
2025elem=d.createElementNS("http://www.w3.org/1999/xhtml",name);
2026}else{
2027elem=d.createElement(name);
6a1aa64f 2028}
79f17b42
DV
2029}else{
2030elem=name;
6a1aa64f 2031}
223ddf66
DV
2032if(_23b){
2033self.updateNodeAttributes(elem,_23b);
6a1aa64f 2034}
79f17b42
DV
2035if(arguments.length<=2){
2036return elem;
6a1aa64f 2037}else{
79f17b42
DV
2038var args=m.extend([elem],arguments,2);
2039return self.appendChildNodes.apply(this,args);
6a1aa64f 2040}
79f17b42
DV
2041},createDOMFunc:function(){
2042var m=MochiKit.Base;
2043return m.partial.apply(this,m.extend([MochiKit.DOM.createDOM],arguments));
2044},removeElement:function(elem){
2045var e=MochiKit.DOM.getElement(elem);
2046e.parentNode.removeChild(e);
2047return e;
2048},swapDOM:function(dest,src){
2049var self=MochiKit.DOM;
2050dest=self.getElement(dest);
223ddf66 2051var _249=dest.parentNode;
79f17b42
DV
2052if(src){
2053src=self.getElement(src);
223ddf66 2054_249.replaceChild(src,dest);
79f17b42 2055}else{
223ddf66 2056_249.removeChild(dest);
6a1aa64f 2057}
79f17b42
DV
2058return src;
2059},getElement:function(id){
2060var self=MochiKit.DOM;
2061if(arguments.length==1){
2062return ((typeof (id)=="string")?self._document.getElementById(id):id);
2063}else{
2064return MochiKit.Base.map(self.getElement,arguments);
6a1aa64f 2065}
223ddf66 2066},getElementsByTagAndClassName:function(_24c,_24d,_24e){
79f17b42 2067var self=MochiKit.DOM;
223ddf66
DV
2068if(typeof (_24c)=="undefined"||_24c===null){
2069_24c="*";
6a1aa64f 2070}
223ddf66
DV
2071if(typeof (_24e)=="undefined"||_24e===null){
2072_24e=self._document;
6a1aa64f 2073}
223ddf66
DV
2074_24e=self.getElement(_24e);
2075var _250=(_24e.getElementsByTagName(_24c)||self._document.all);
2076if(typeof (_24d)=="undefined"||_24d===null){
2077return MochiKit.Base.extend(null,_250);
6a1aa64f 2078}
223ddf66
DV
2079var _251=[];
2080for(var i=0;i<_250.length;i++){
2081var _253=_250[i];
2082var cls=_253.className;
79f17b42
DV
2083if(!cls){
2084continue;
6a1aa64f 2085}
223ddf66
DV
2086var _255=cls.split(" ");
2087for(var j=0;j<_255.length;j++){
2088if(_255[j]==_24d){
2089_251.push(_253);
79f17b42 2090break;
6a1aa64f 2091}
6a1aa64f 2092}
6a1aa64f 2093}
223ddf66 2094return _251;
79f17b42
DV
2095},_newCallStack:function(path,once){
2096var rval=function(){
223ddf66
DV
2097var _25a=arguments.callee.callStack;
2098for(var i=0;i<_25a.length;i++){
2099if(_25a[i].apply(this,arguments)===false){
79f17b42 2100break;
6a1aa64f
DV
2101}
2102}
79f17b42
DV
2103if(once){
2104try{
2105this[path]=null;
6a1aa64f 2106}
79f17b42 2107catch(e){
6a1aa64f 2108}
6a1aa64f 2109}
79f17b42
DV
2110};
2111rval.callStack=[];
2112return rval;
223ddf66 2113},addToCallStack:function(_25c,path,func,once){
79f17b42 2114var self=MochiKit.DOM;
223ddf66
DV
2115var _261=_25c[path];
2116var _262=_261;
2117if(!(typeof (_261)=="function"&&typeof (_261.callStack)=="object"&&_261.callStack!==null)){
2118_262=self._newCallStack(path,once);
2119if(typeof (_261)=="function"){
2120_262.callStack.push(_261);
6a1aa64f 2121}
223ddf66 2122_25c[path]=_262;
6a1aa64f 2123}
223ddf66 2124_262.callStack.push(func);
79f17b42
DV
2125},addLoadEvent:function(func){
2126var self=MochiKit.DOM;
2127self.addToCallStack(self._window,"onload",func,true);
223ddf66 2128},focusOnLoad:function(_265){
79f17b42
DV
2129var self=MochiKit.DOM;
2130self.addLoadEvent(function(){
223ddf66
DV
2131_265=self.getElement(_265);
2132if(_265){
2133_265.focus();
6a1aa64f 2134}
79f17b42 2135});
223ddf66 2136},setElementClass:function(_267,_268){
79f17b42 2137var self=MochiKit.DOM;
223ddf66 2138var obj=self.getElement(_267);
79f17b42 2139if(self.attributeArray.compliant){
223ddf66 2140obj.setAttribute("class",_268);
6a1aa64f 2141}else{
223ddf66 2142obj.setAttribute("className",_268);
6a1aa64f 2143}
223ddf66 2144},toggleElementClass:function(_26b){
79f17b42
DV
2145var self=MochiKit.DOM;
2146for(var i=1;i<arguments.length;i++){
2147var obj=self.getElement(arguments[i]);
223ddf66
DV
2148if(!self.addElementClass(obj,_26b)){
2149self.removeElementClass(obj,_26b);
6a1aa64f 2150}
6a1aa64f 2151}
223ddf66 2152},addElementClass:function(_26f,_270){
79f17b42 2153var self=MochiKit.DOM;
223ddf66 2154var obj=self.getElement(_26f);
79f17b42
DV
2155var cls=obj.className;
2156if(cls==undefined||cls.length===0){
223ddf66 2157self.setElementClass(obj,_270);
79f17b42 2158return true;
6a1aa64f 2159}
223ddf66 2160if(cls==_270){
79f17b42 2161return false;
6a1aa64f 2162}
223ddf66
DV
2163var _274=cls.split(" ");
2164for(var i=0;i<_274.length;i++){
2165if(_274[i]==_270){
79f17b42 2166return false;
6a1aa64f 2167}
6a1aa64f 2168}
223ddf66 2169self.setElementClass(obj,cls+" "+_270);
79f17b42 2170return true;
223ddf66 2171},removeElementClass:function(_276,_277){
79f17b42 2172var self=MochiKit.DOM;
223ddf66 2173var obj=self.getElement(_276);
79f17b42
DV
2174var cls=obj.className;
2175if(cls==undefined||cls.length===0){
2176return false;
6a1aa64f 2177}
223ddf66 2178if(cls==_277){
79f17b42
DV
2179self.setElementClass(obj,"");
2180return true;
6a1aa64f 2181}
223ddf66
DV
2182var _27b=cls.split(" ");
2183for(var i=0;i<_27b.length;i++){
2184if(_27b[i]==_277){
2185_27b.splice(i,1);
2186self.setElementClass(obj,_27b.join(" "));
79f17b42 2187return true;
6a1aa64f
DV
2188}
2189}
79f17b42 2190return false;
223ddf66
DV
2191},swapElementClass:function(_27d,_27e,_27f){
2192var obj=MochiKit.DOM.getElement(_27d);
2193var res=MochiKit.DOM.removeElementClass(obj,_27e);
79f17b42 2194if(res){
223ddf66 2195MochiKit.DOM.addElementClass(obj,_27f);
6a1aa64f 2196}
79f17b42 2197return res;
223ddf66
DV
2198},hasElementClass:function(_282,_283){
2199var obj=MochiKit.DOM.getElement(_282);
79f17b42
DV
2200var cls=obj.className;
2201if(!cls){
2202return false;
6a1aa64f 2203}
223ddf66 2204var _286=cls.split(" ");
79f17b42
DV
2205for(var i=1;i<arguments.length;i++){
2206var good=false;
223ddf66
DV
2207for(var j=0;j<_286.length;j++){
2208if(_286[j]==arguments[i]){
79f17b42
DV
2209good=true;
2210break;
6a1aa64f 2211}
6a1aa64f 2212}
79f17b42
DV
2213if(!good){
2214return false;
6a1aa64f 2215}
6a1aa64f 2216}
79f17b42
DV
2217return true;
2218},escapeHTML:function(s){
2219return s.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");
2220},toHTML:function(dom){
2221return MochiKit.DOM.emitHTML(dom).join("");
2222},emitHTML:function(dom,lst){
2223if(typeof (lst)=="undefined"||lst===null){
2224lst=[];
6a1aa64f 2225}
223ddf66 2226var _28e=[dom];
79f17b42 2227var self=MochiKit.DOM;
223ddf66
DV
2228var _290=self.escapeHTML;
2229var _291=self.attributeArray;
2230while(_28e.length){
2231dom=_28e.pop();
79f17b42
DV
2232if(typeof (dom)=="string"){
2233lst.push(dom);
2234}else{
2235if(dom.nodeType==1){
2236lst.push("<"+dom.tagName.toLowerCase());
223ddf66
DV
2237var _292=[];
2238var _293=_291(dom);
2239for(var i=0;i<_293.length;i++){
2240var a=_293[i];
2241_292.push([" ",a.name,"=\"",_290(a.value),"\""]);
6a1aa64f 2242}
223ddf66
DV
2243_292.sort();
2244for(i=0;i<_292.length;i++){
2245var _296=_292[i];
2246for(var j=0;j<_296.length;j++){
2247lst.push(_296[j]);
6a1aa64f
DV
2248}
2249}
79f17b42
DV
2250if(dom.hasChildNodes()){
2251lst.push(">");
223ddf66
DV
2252_28e.push("</"+dom.tagName.toLowerCase()+">");
2253var _298=dom.childNodes;
2254for(i=_298.length-1;i>=0;i--){
2255_28e.push(_298[i]);
6a1aa64f 2256}
6a1aa64f 2257}else{
79f17b42 2258lst.push("/>");
6a1aa64f 2259}
79f17b42
DV
2260}else{
2261if(dom.nodeType==3){
223ddf66 2262lst.push(_290(dom.nodeValue));
6a1aa64f 2263}
6a1aa64f 2264}
6a1aa64f 2265}
6a1aa64f 2266}
79f17b42 2267return lst;
223ddf66 2268},scrapeText:function(node,_29a){
79f17b42
DV
2269var rval=[];
2270(function(node){
2271var cn=node.childNodes;
2272if(cn){
2273for(var i=0;i<cn.length;i++){
2274arguments.callee.call(this,cn[i]);
6a1aa64f 2275}
6a1aa64f 2276}
223ddf66
DV
2277var _29f=node.nodeValue;
2278if(typeof (_29f)=="string"){
2279rval.push(_29f);
6a1aa64f 2280}
79f17b42 2281})(MochiKit.DOM.getElement(node));
223ddf66 2282if(_29a){
79f17b42 2283return rval;
6a1aa64f 2284}else{
79f17b42 2285return rval.join("");
6a1aa64f 2286}
223ddf66
DV
2287},removeEmptyTextNodes:function(_2a0){
2288_2a0=MochiKit.DOM.getElement(_2a0);
2289for(var i=0;i<_2a0.childNodes.length;i++){
2290var node=_2a0.childNodes[i];
79f17b42
DV
2291if(node.nodeType==3&&!/\S/.test(node.nodeValue)){
2292node.parentNode.removeChild(node);
6a1aa64f 2293}
6a1aa64f 2294}
223ddf66
DV
2295},makeClipping:function(_2a3){
2296_2a3=MochiKit.DOM.getElement(_2a3);
2297var _2a4=_2a3.style.overflow;
2298if((MochiKit.Style.getStyle(_2a3,"overflow")||"visible")!="hidden"){
2299_2a3.style.overflow="hidden";
6a1aa64f 2300}
223ddf66
DV
2301return _2a4;
2302},undoClipping:function(_2a5,_2a6){
2303_2a5=MochiKit.DOM.getElement(_2a5);
2304if(!_2a6){
79f17b42 2305return;
6a1aa64f 2306}
223ddf66
DV
2307_2a5.style.overflow=_2a6;
2308},makePositioned:function(_2a7){
2309_2a7=MochiKit.DOM.getElement(_2a7);
2310var pos=MochiKit.Style.getStyle(_2a7,"position");
79f17b42 2311if(pos=="static"||!pos){
223ddf66 2312_2a7.style.position="relative";
79f17b42 2313if(/Opera/.test(navigator.userAgent)){
223ddf66
DV
2314_2a7.style.top=0;
2315_2a7.style.left=0;
6a1aa64f 2316}
6a1aa64f 2317}
223ddf66
DV
2318},undoPositioned:function(_2a9){
2319_2a9=MochiKit.DOM.getElement(_2a9);
2320if(_2a9.style.position=="relative"){
2321_2a9.style.position=_2a9.style.top=_2a9.style.left=_2a9.style.bottom=_2a9.style.right="";
6a1aa64f 2322}
223ddf66 2323},getFirstElementByTagAndClassName:function(_2aa,_2ab,_2ac){
79f17b42 2324var self=MochiKit.DOM;
223ddf66
DV
2325if(typeof (_2aa)=="undefined"||_2aa===null){
2326_2aa="*";
6a1aa64f 2327}
223ddf66
DV
2328if(typeof (_2ac)=="undefined"||_2ac===null){
2329_2ac=self._document;
6a1aa64f 2330}
223ddf66
DV
2331_2ac=self.getElement(_2ac);
2332var _2ae=(_2ac.getElementsByTagName(_2aa)||self._document.all);
2333if(typeof (_2ab)=="undefined"||_2ab===null){
2334return _2ae[0];
6a1aa64f 2335}
223ddf66
DV
2336for(var i=0;i<_2ae.length;i++){
2337var _2b0=_2ae[i];
2338var _2b1=_2b0.className.split(" ");
2339for(var j=0;j<_2b1.length;j++){
2340if(_2b1[j]==_2ab){
2341return _2b0;
6a1aa64f 2342}
6a1aa64f 2343}
6a1aa64f 2344}
223ddf66 2345},getFirstParentByTagAndClassName:function(elem,_2b4,_2b5){
79f17b42
DV
2346var self=MochiKit.DOM;
2347elem=self.getElement(elem);
223ddf66
DV
2348if(typeof (_2b4)=="undefined"||_2b4===null){
2349_2b4="*";
79f17b42 2350}else{
223ddf66 2351_2b4=_2b4.toUpperCase();
6a1aa64f 2352}
223ddf66
DV
2353if(typeof (_2b5)=="undefined"||_2b5===null){
2354_2b5=null;
6a1aa64f 2355}
223ddf66
DV
2356var _2b7="";
2357var _2b8="";
79f17b42
DV
2358while(elem&&elem.tagName){
2359elem=elem.parentNode;
223ddf66 2360if(_2b4=="*"&&_2b5===null){
79f17b42 2361return elem;
6a1aa64f 2362}
223ddf66
DV
2363_2b7=elem.className.split(" ");
2364_2b8=elem.tagName.toUpperCase();
2365if(_2b5===null&&_2b4==_2b8){
79f17b42
DV
2366return elem;
2367}else{
223ddf66
DV
2368if(_2b5!==null){
2369for(var i=0;i<_2b7.length;i++){
2370if(_2b4=="*"&&_2b7[i]==_2b5){
79f17b42
DV
2371return elem;
2372}else{
223ddf66 2373if(_2b4==_2b8&&_2b7[i]==_2b5){
79f17b42 2374return elem;
6a1aa64f 2375}
6a1aa64f
DV
2376}
2377}
6a1aa64f 2378}
6a1aa64f 2379}
6a1aa64f 2380}
79f17b42 2381return elem;
223ddf66
DV
2382},isParent:function(_2ba,_2bb){
2383if(!_2ba.parentNode||_2ba==_2bb){
79f17b42 2384return false;
6a1aa64f 2385}
223ddf66 2386if(_2ba.parentNode==_2bb){
79f17b42 2387return true;
6a1aa64f 2388}
223ddf66 2389return MochiKit.DOM.isParent(_2ba.parentNode,_2bb);
79f17b42 2390},__new__:function(win){
6a1aa64f 2391var m=MochiKit.Base;
79f17b42
DV
2392if(typeof (document)!="undefined"){
2393this._document=document;
223ddf66
DV
2394var _2be="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
2395this._xhtml=(document.documentElement&&document.createElementNS&&document.documentElement.namespaceURI===_2be);
79f17b42
DV
2396}else{
2397if(MochiKit.MockDOM){
2398this._document=MochiKit.MockDOM.document;
2399}
2400}
2401this._window=win;
2402this.domConverters=new m.AdapterRegistry();
223ddf66
DV
2403var _2bf=this._document.createElement("span");
2404var _2c0;
2405if(_2bf&&_2bf.attributes&&_2bf.attributes.length>0){
2406var _2c1=m.filter;
2407_2c0=function(node){
2408return _2c1(_2c0.ignoreAttrFilter,node.attributes);
165759fa 2409};
223ddf66
DV
2410_2c0.ignoreAttr={};
2411var _2c3=_2bf.attributes;
2412var _2c4=_2c0.ignoreAttr;
2413for(var i=0;i<_2c3.length;i++){
2414var a=_2c3[i];
2415_2c4[a.name]=a.value;
2416}
2417_2c0.ignoreAttrFilter=function(a){
2418return (_2c0.ignoreAttr[a.name]!=a.value);
165759fa 2419};
223ddf66
DV
2420_2c0.compliant=false;
2421_2c0.renames={"class":"className","checked":"defaultChecked","usemap":"useMap","for":"htmlFor","readonly":"readOnly","colspan":"colSpan","bgcolor":"bgColor","cellspacing":"cellSpacing","cellpadding":"cellPadding"};
165759fa 2422}else{
223ddf66 2423_2c0=function(node){
79f17b42
DV
2424return node.attributes;
2425};
223ddf66
DV
2426_2c0.compliant=true;
2427_2c0.renames={};
79f17b42 2428}
223ddf66
DV
2429this.attributeArray=_2c0;
2430var _2c9=function(_2ca,arr){
2431var _2cc=arr[1].split(".");
79f17b42
DV
2432var str="";
2433var obj={};
223ddf66 2434str+="if (!MochiKit."+_2cc[1]+") { throw new Error(\"";
79f17b42 2435str+="This function has been deprecated and depends on MochiKit.";
223ddf66
DV
2436str+=_2cc[1]+".\");}";
2437str+="return MochiKit."+_2cc[1]+"."+arr[0];
79f17b42 2438str+=".apply(this, arguments);";
223ddf66
DV
2439obj[_2cc[2]]=new Function(str);
2440MochiKit.Base.update(MochiKit[_2ca],obj);
79f17b42
DV
2441};
2442for(var i;i<MochiKit.DOM.DEPRECATED.length;i++){
223ddf66
DV
2443_2c9("DOM",MochiKit.DOM.DEPRECATED[i]);
2444}
2445var _2cf=this.createDOMFunc;
2446this.UL=_2cf("ul");
2447this.OL=_2cf("ol");
2448this.LI=_2cf("li");
2449this.TD=_2cf("td");
2450this.TR=_2cf("tr");
2451this.TBODY=_2cf("tbody");
2452this.THEAD=_2cf("thead");
2453this.TFOOT=_2cf("tfoot");
2454this.TABLE=_2cf("table");
2455this.TH=_2cf("th");
2456this.INPUT=_2cf("input");
2457this.SPAN=_2cf("span");
2458this.A=_2cf("a");
2459this.DIV=_2cf("div");
2460this.IMG=_2cf("img");
2461this.BUTTON=_2cf("button");
2462this.TT=_2cf("tt");
2463this.PRE=_2cf("pre");
2464this.H1=_2cf("h1");
2465this.H2=_2cf("h2");
2466this.H3=_2cf("h3");
2467this.BR=_2cf("br");
2468this.HR=_2cf("hr");
2469this.LABEL=_2cf("label");
2470this.TEXTAREA=_2cf("textarea");
2471this.FORM=_2cf("form");
2472this.P=_2cf("p");
2473this.SELECT=_2cf("select");
2474this.OPTION=_2cf("option");
2475this.OPTGROUP=_2cf("optgroup");
2476this.LEGEND=_2cf("legend");
2477this.FIELDSET=_2cf("fieldset");
2478this.STRONG=_2cf("strong");
2479this.CANVAS=_2cf("canvas");
79f17b42
DV
2480this.$=this.getElement;
2481this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};
2482m.nameFunctions(this);
2483}});
2484MochiKit.DOM.__new__(((typeof (window)=="undefined")?this:window));
2485if(MochiKit.__export__){
2486withWindow=MochiKit.DOM.withWindow;
2487withDocument=MochiKit.DOM.withDocument;
2488}
2489MochiKit.Base._exportSymbols(this,MochiKit.DOM);
2490if(typeof (dojo)!="undefined"){
2491dojo.provide("MochiKit.Style");
2492dojo.require("MochiKit.Base");
2493dojo.require("MochiKit.DOM");
2494}
2495if(typeof (JSAN)!="undefined"){
2496JSAN.use("MochiKit.Base",[]);
2497JSAN.use("MochiKit.DOM",[]);
2498}
6a1aa64f 2499try{
79f17b42
DV
2500if(typeof (MochiKit.Base)=="undefined"){
2501throw "";
2502}
6a1aa64f
DV
2503}
2504catch(e){
79f17b42
DV
2505throw "MochiKit.Style depends on MochiKit.Base!";
2506}
6a1aa64f 2507try{
79f17b42
DV
2508if(typeof (MochiKit.DOM)=="undefined"){
2509throw "";
2510}
6a1aa64f
DV
2511}
2512catch(e){
79f17b42 2513throw "MochiKit.Style depends on MochiKit.DOM!";
6a1aa64f 2514}
79f17b42
DV
2515if(typeof (MochiKit.Style)=="undefined"){
2516MochiKit.Style={};
6a1aa64f 2517}
79f17b42
DV
2518MochiKit.Style.NAME="MochiKit.Style";
2519MochiKit.Style.VERSION="1.4";
2520MochiKit.Style.__repr__=function(){
2521return "["+this.NAME+" "+this.VERSION+"]";
2522};
2523MochiKit.Style.toString=function(){
2524return this.__repr__();
2525};
2526MochiKit.Style.EXPORT_OK=[];
2527MochiKit.Style.EXPORT=["setStyle","setOpacity","getStyle","getElementDimensions","elementDimensions","setElementDimensions","getElementPosition","elementPosition","setElementPosition","setDisplayForElement","hideElement","showElement","getViewportDimensions","getViewportPosition","Dimensions","Coordinates"];
2528MochiKit.Style.Dimensions=function(w,h){
2529this.w=w;
2530this.h=h;
2531};
2532MochiKit.Style.Dimensions.prototype.__repr__=function(){
2533var repr=MochiKit.Base.repr;
2534return "{w: "+repr(this.w)+", h: "+repr(this.h)+"}";
2535};
2536MochiKit.Style.Dimensions.prototype.toString=function(){
2537return this.__repr__();
2538};
2539MochiKit.Style.Coordinates=function(x,y){
2540this.x=x;
2541this.y=y;
2542};
2543MochiKit.Style.Coordinates.prototype.__repr__=function(){
2544var repr=MochiKit.Base.repr;
2545return "{x: "+repr(this.x)+", y: "+repr(this.y)+"}";
2546};
2547MochiKit.Style.Coordinates.prototype.toString=function(){
2548return this.__repr__();
2549};
223ddf66 2550MochiKit.Base.update(MochiKit.Style,{getStyle:function(elem,_2d7){
79f17b42
DV
2551var dom=MochiKit.DOM;
2552var d=dom._document;
2553elem=dom.getElement(elem);
223ddf66 2554_2d7=MochiKit.Base.camelize(_2d7);
79f17b42
DV
2555if(!elem||elem==d){
2556return undefined;
6a1aa64f 2557}
223ddf66
DV
2558if(_2d7=="opacity"&&elem.filters){
2559var _2da=(MochiKit.Style.getStyle(elem,"filter")||"").match(/alpha\(opacity=(.*)\)/);
2560if(_2da&&_2da[1]){
2561return parseFloat(_2da[1])/100;
6a1aa64f 2562}
79f17b42 2563return 1;
6a1aa64f 2564}
223ddf66
DV
2565var _2db=elem.style?elem.style[_2d7]:null;
2566if(!_2db){
79f17b42
DV
2567if(d.defaultView&&d.defaultView.getComputedStyle){
2568var css=d.defaultView.getComputedStyle(elem,null);
223ddf66
DV
2569_2d7=_2d7.replace(/([A-Z])/g,"-$1").toLowerCase();
2570_2db=css?css.getPropertyValue(_2d7):null;
6a1aa64f 2571}else{
79f17b42 2572if(elem.currentStyle){
223ddf66 2573_2db=elem.currentStyle[_2d7];
6a1aa64f
DV
2574}
2575}
6a1aa64f 2576}
223ddf66
DV
2577if(_2d7=="opacity"){
2578_2db=parseFloat(_2db);
6a1aa64f 2579}
223ddf66 2580if(/Opera/.test(navigator.userAgent)&&(MochiKit.Base.find(["left","top","right","bottom"],_2d7)!=-1)){
79f17b42 2581if(MochiKit.Style.getStyle(elem,"position")=="static"){
223ddf66 2582_2db="auto";
6a1aa64f
DV
2583}
2584}
223ddf66
DV
2585return _2db=="auto"?null:_2db;
2586},setStyle:function(elem,_2de){
79f17b42 2587elem=MochiKit.DOM.getElement(elem);
223ddf66 2588for(var name in _2de){
79f17b42 2589if(name=="opacity"){
223ddf66 2590MochiKit.Style.setOpacity(elem,_2de[name]);
79f17b42 2591}else{
223ddf66 2592elem.style[MochiKit.Base.camelize(name)]=_2de[name];
6a1aa64f 2593}
6a1aa64f 2594}
79f17b42
DV
2595},setOpacity:function(elem,o){
2596elem=MochiKit.DOM.getElement(elem);
2597var self=MochiKit.Style;
2598if(o==1){
223ddf66
DV
2599var _2e3=/Gecko/.test(navigator.userAgent)&&!(/Konqueror|AppleWebKit|KHTML/.test(navigator.userAgent));
2600elem.style["opacity"]=_2e3?0.999999:1;
79f17b42
DV
2601if(/MSIE/.test(navigator.userAgent)){
2602elem.style["filter"]=self.getStyle(elem,"filter").replace(/alpha\([^\)]*\)/gi,"");
6a1aa64f 2603}
79f17b42
DV
2604}else{
2605if(o<0.00001){
2606o=0;
6a1aa64f 2607}
79f17b42
DV
2608elem.style["opacity"]=o;
2609if(/MSIE/.test(navigator.userAgent)){
2610elem.style["filter"]=self.getStyle(elem,"filter").replace(/alpha\([^\)]*\)/gi,"")+"alpha(opacity="+o*100+")";
6a1aa64f 2611}
6a1aa64f 2612}
223ddf66 2613},getElementPosition:function(elem,_2e5){
79f17b42
DV
2614var self=MochiKit.Style;
2615var dom=MochiKit.DOM;
2616elem=dom.getElement(elem);
2617if(!elem||(!(elem.x&&elem.y)&&(!elem.parentNode===null||self.getStyle(elem,"display")=="none"))){
2618return undefined;
6a1aa64f 2619}
79f17b42
DV
2620var c=new self.Coordinates(0,0);
2621var box=null;
223ddf66 2622var _2ea=null;
79f17b42
DV
2623var d=MochiKit.DOM._document;
2624var de=d.documentElement;
2625var b=d.body;
2626if(!elem.parentNode&&elem.x&&elem.y){
2627c.x+=elem.x||0;
2628c.y+=elem.y||0;
2629}else{
2630if(elem.getBoundingClientRect){
2631box=elem.getBoundingClientRect();
2632c.x+=box.left+(de.scrollLeft||b.scrollLeft)-(de.clientLeft||0);
2633c.y+=box.top+(de.scrollTop||b.scrollTop)-(de.clientTop||0);
6a1aa64f 2634}else{
79f17b42
DV
2635if(elem.offsetParent){
2636c.x+=elem.offsetLeft;
2637c.y+=elem.offsetTop;
223ddf66
DV
2638_2ea=elem.offsetParent;
2639if(_2ea!=elem){
2640while(_2ea){
2641c.x+=_2ea.offsetLeft;
2642c.y+=_2ea.offsetTop;
2643_2ea=_2ea.offsetParent;
6a1aa64f 2644}
6a1aa64f 2645}
79f17b42
DV
2646var ua=navigator.userAgent.toLowerCase();
2647if((typeof (opera)!="undefined"&&parseFloat(opera.version())<9)||(ua.indexOf("AppleWebKit")!=-1&&self.getStyle(elem,"position")=="absolute")){
2648c.x-=b.offsetLeft;
2649c.y-=b.offsetTop;
6a1aa64f 2650}
6a1aa64f
DV
2651}
2652}
6a1aa64f 2653}
223ddf66
DV
2654if(typeof (_2e5)!="undefined"){
2655_2e5=arguments.callee(_2e5);
2656if(_2e5){
2657c.x-=(_2e5.x||0);
2658c.y-=(_2e5.y||0);
6a1aa64f 2659}
6a1aa64f 2660}
79f17b42 2661if(elem.parentNode){
223ddf66 2662_2ea=elem.parentNode;
6a1aa64f 2663}else{
223ddf66 2664_2ea=null;
6a1aa64f 2665}
223ddf66
DV
2666while(_2ea){
2667var _2ef=_2ea.tagName.toUpperCase();
2668if(_2ef==="BODY"||_2ef==="HTML"){
79f17b42 2669break;
6a1aa64f 2670}
223ddf66 2671var disp=self.getStyle(_2ea,"display");
79f17b42 2672if(disp!="inline"&&disp!="table-row"){
223ddf66
DV
2673c.x-=_2ea.scrollLeft;
2674c.y-=_2ea.scrollTop;
6a1aa64f 2675}
223ddf66
DV
2676if(_2ea.parentNode){
2677_2ea=_2ea.parentNode;
79f17b42 2678}else{
223ddf66 2679_2ea=null;
6a1aa64f
DV
2680}
2681}
79f17b42 2682return c;
223ddf66 2683},setElementPosition:function(elem,_2f2,_2f3){
79f17b42 2684elem=MochiKit.DOM.getElement(elem);
223ddf66
DV
2685if(typeof (_2f3)=="undefined"){
2686_2f3="px";
6a1aa64f 2687}
223ddf66
DV
2688var _2f4={};
2689var _2f5=MochiKit.Base.isUndefinedOrNull;
2690if(!_2f5(_2f2.x)){
2691_2f4["left"]=_2f2.x+_2f3;
6a1aa64f 2692}
223ddf66
DV
2693if(!_2f5(_2f2.y)){
2694_2f4["top"]=_2f2.y+_2f3;
6a1aa64f 2695}
223ddf66 2696MochiKit.DOM.updateNodeAttributes(elem,{"style":_2f4});
79f17b42
DV
2697},getElementDimensions:function(elem){
2698var self=MochiKit.Style;
2699var dom=MochiKit.DOM;
2700if(typeof (elem.w)=="number"||typeof (elem.h)=="number"){
2701return new self.Dimensions(elem.w||0,elem.h||0);
6a1aa64f 2702}
79f17b42
DV
2703elem=dom.getElement(elem);
2704if(!elem){
2705return undefined;
6a1aa64f 2706}
79f17b42
DV
2707var disp=self.getStyle(elem,"display");
2708if(disp!="none"&&disp!==""&&typeof (disp)!="undefined"){
2709return new self.Dimensions(elem.offsetWidth||0,elem.offsetHeight||0);
6a1aa64f 2710}
79f17b42 2711var s=elem.style;
223ddf66
DV
2712var _2fb=s.visibility;
2713var _2fc=s.position;
79f17b42
DV
2714s.visibility="hidden";
2715s.position="absolute";
2716s.display="";
223ddf66
DV
2717var _2fd=elem.offsetWidth;
2718var _2fe=elem.offsetHeight;
79f17b42 2719s.display="none";
223ddf66
DV
2720s.position=_2fc;
2721s.visibility=_2fb;
2722return new self.Dimensions(_2fd,_2fe);
2723},setElementDimensions:function(elem,_300,_301){
79f17b42 2724elem=MochiKit.DOM.getElement(elem);
223ddf66
DV
2725if(typeof (_301)=="undefined"){
2726_301="px";
6a1aa64f 2727}
223ddf66
DV
2728var _302={};
2729var _303=MochiKit.Base.isUndefinedOrNull;
2730if(!_303(_300.w)){
2731_302["width"]=_300.w+_301;
6a1aa64f 2732}
223ddf66
DV
2733if(!_303(_300.h)){
2734_302["height"]=_300.h+_301;
6a1aa64f 2735}
223ddf66
DV
2736MochiKit.DOM.updateNodeAttributes(elem,{"style":_302});
2737},setDisplayForElement:function(_304,_305){
2738var _306=MochiKit.Base.extend(null,arguments,1);
2739var _307=MochiKit.DOM.getElement;
2740for(var i=0;i<_306.length;i++){
2741_305=_307(_306[i]);
2742if(_305){
2743_305.style.display=_304;
6a1aa64f 2744}
6a1aa64f 2745}
79f17b42
DV
2746},getViewportDimensions:function(){
2747var d=new MochiKit.Style.Dimensions();
2748var w=MochiKit.DOM._window;
2749var b=MochiKit.DOM._document.body;
2750if(w.innerWidth){
2751d.w=w.innerWidth;
2752d.h=w.innerHeight;
2753}else{
2754if(b.parentElement.clientWidth){
2755d.w=b.parentElement.clientWidth;
2756d.h=b.parentElement.clientHeight;
2757}else{
2758if(b&&b.clientWidth){
2759d.w=b.clientWidth;
2760d.h=b.clientHeight;
6a1aa64f 2761}
6a1aa64f 2762}
6a1aa64f 2763}
79f17b42
DV
2764return d;
2765},getViewportPosition:function(){
2766var c=new MochiKit.Style.Coordinates(0,0);
2767var d=MochiKit.DOM._document;
2768var de=d.documentElement;
2769var db=d.body;
2770if(de&&(de.scrollTop||de.scrollLeft)){
2771c.x=de.scrollLeft;
2772c.y=de.scrollTop;
6a1aa64f 2773}else{
79f17b42
DV
2774if(db){
2775c.x=db.scrollLeft;
2776c.y=db.scrollTop;
6a1aa64f
DV
2777}
2778}
79f17b42
DV
2779return c;
2780},__new__:function(){
2781var m=MochiKit.Base;
2782this.elementPosition=this.getElementPosition;
2783this.elementDimensions=this.getElementDimensions;
2784this.hideElement=m.partial(this.setDisplayForElement,"none");
2785this.showElement=m.partial(this.setDisplayForElement,"block");
6a1aa64f 2786this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};
79f17b42 2787m.nameFunctions(this);
6a1aa64f 2788}});
79f17b42
DV
2789MochiKit.Style.__new__();
2790MochiKit.Base._exportSymbols(this,MochiKit.Style);
6a1aa64f 2791if(typeof (dojo)!="undefined"){
79f17b42 2792dojo.provide("MochiKit.Color");
6a1aa64f
DV
2793dojo.require("MochiKit.Base");
2794dojo.require("MochiKit.DOM");
2795dojo.require("MochiKit.Style");
2796}
2797if(typeof (JSAN)!="undefined"){
2798JSAN.use("MochiKit.Base",[]);
2799JSAN.use("MochiKit.DOM",[]);
2800JSAN.use("MochiKit.Style",[]);
2801}
2802try{
2803if(typeof (MochiKit.Base)=="undefined"){
2804throw "";
2805}
2806}
2807catch(e){
79f17b42 2808throw "MochiKit.Color depends on MochiKit.Base";
6a1aa64f
DV
2809}
2810try{
2811if(typeof (MochiKit.DOM)=="undefined"){
2812throw "";
2813}
2814}
2815catch(e){
79f17b42 2816throw "MochiKit.Color depends on MochiKit.DOM";
6a1aa64f
DV
2817}
2818try{
2819if(typeof (MochiKit.Style)=="undefined"){
2820throw "";
2821}
2822}
2823catch(e){
79f17b42 2824throw "MochiKit.Color depends on MochiKit.Style";
6a1aa64f 2825}
79f17b42
DV
2826if(typeof (MochiKit.Color)=="undefined"){
2827MochiKit.Color={};
6a1aa64f 2828}
79f17b42
DV
2829MochiKit.Color.NAME="MochiKit.Color";
2830MochiKit.Color.VERSION="1.4";
2831MochiKit.Color.__repr__=function(){
2832return "["+this.NAME+" "+this.VERSION+"]";
6a1aa64f 2833};
79f17b42 2834MochiKit.Color.toString=function(){
6a1aa64f 2835return this.__repr__();
79f17b42 2836};
223ddf66
DV
2837MochiKit.Color.Color=function(red,_312,blue,_314){
2838if(typeof (_314)=="undefined"||_314===null){
2839_314=1;
6a1aa64f 2840}
223ddf66 2841this.rgb={r:red,g:_312,b:blue,a:_314};
79f17b42 2842};
223ddf66 2843MochiKit.Color.Color.prototype={__class__:MochiKit.Color.Color,colorWithAlpha:function(_315){
79f17b42
DV
2844var rgb=this.rgb;
2845var m=MochiKit.Color;
223ddf66 2846return m.Color.fromRGB(rgb.r,rgb.g,rgb.b,_315);
79f17b42
DV
2847},colorWithHue:function(hue){
2848var hsl=this.asHSL();
2849hsl.h=hue;
2850var m=MochiKit.Color;
2851return m.Color.fromHSL(hsl);
223ddf66 2852},colorWithSaturation:function(_31b){
79f17b42 2853var hsl=this.asHSL();
223ddf66 2854hsl.s=_31b;
79f17b42
DV
2855var m=MochiKit.Color;
2856return m.Color.fromHSL(hsl);
223ddf66 2857},colorWithLightness:function(_31e){
79f17b42 2858var hsl=this.asHSL();
223ddf66 2859hsl.l=_31e;
79f17b42
DV
2860var m=MochiKit.Color;
2861return m.Color.fromHSL(hsl);
223ddf66 2862},darkerColorWithLevel:function(_321){
79f17b42 2863var hsl=this.asHSL();
223ddf66 2864hsl.l=Math.max(hsl.l-_321,0);
79f17b42
DV
2865var m=MochiKit.Color;
2866return m.Color.fromHSL(hsl);
223ddf66 2867},lighterColorWithLevel:function(_324){
79f17b42 2868var hsl=this.asHSL();
223ddf66 2869hsl.l=Math.min(hsl.l+_324,1);
79f17b42
DV
2870var m=MochiKit.Color;
2871return m.Color.fromHSL(hsl);
223ddf66
DV
2872},blendedColor:function(_327,_328){
2873if(typeof (_328)=="undefined"||_328===null){
2874_328=0.5;
6a1aa64f 2875}
223ddf66 2876var sf=1-_328;
79f17b42 2877var s=this.rgb;
223ddf66
DV
2878var d=_327.rgb;
2879var df=_328;
79f17b42 2880return MochiKit.Color.Color.fromRGB((s.r*sf)+(d.r*df),(s.g*sf)+(d.g*df),(s.b*sf)+(d.b*df),(s.a*sf)+(d.a*df));
223ddf66 2881},compareRGB:function(_32d){
79f17b42 2882var a=this.asRGB();
223ddf66 2883var b=_32d.asRGB();
79f17b42
DV
2884return MochiKit.Base.compare([a.r,a.g,a.b,a.a],[b.r,b.g,b.b,b.a]);
2885},isLight:function(){
2886return this.asHSL().b>0.5;
2887},isDark:function(){
2888return (!this.isLight());
2889},toHSLString:function(){
2890var c=this.asHSL();
2891var ccc=MochiKit.Color.clampColorComponent;
2892var rval=this._hslString;
2893if(!rval){
2894var mid=(ccc(c.h,360).toFixed(0)+","+ccc(c.s,100).toPrecision(4)+"%"+","+ccc(c.l,100).toPrecision(4)+"%");
2895var a=c.a;
2896if(a>=1){
2897a=1;
2898rval="hsl("+mid+")";
6a1aa64f 2899}else{
79f17b42
DV
2900if(a<=0){
2901a=0;
6a1aa64f 2902}
79f17b42 2903rval="hsla("+mid+","+a+")";
6a1aa64f 2904}
79f17b42 2905this._hslString=rval;
6a1aa64f 2906}
79f17b42
DV
2907return rval;
2908},toRGBString:function(){
2909var c=this.rgb;
2910var ccc=MochiKit.Color.clampColorComponent;
2911var rval=this._rgbString;
2912if(!rval){
2913var mid=(ccc(c.r,255).toFixed(0)+","+ccc(c.g,255).toFixed(0)+","+ccc(c.b,255).toFixed(0));
2914if(c.a!=1){
2915rval="rgba("+mid+","+c.a+")";
6a1aa64f 2916}else{
79f17b42 2917rval="rgb("+mid+")";
6a1aa64f 2918}
79f17b42 2919this._rgbString=rval;
6a1aa64f 2920}
79f17b42
DV
2921return rval;
2922},asRGB:function(){
2923return MochiKit.Base.clone(this.rgb);
2924},toHexString:function(){
2925var m=MochiKit.Color;
2926var c=this.rgb;
2927var ccc=MochiKit.Color.clampColorComponent;
2928var rval=this._hexString;
2929if(!rval){
2930rval=("#"+m.toColorPart(ccc(c.r,255))+m.toColorPart(ccc(c.g,255))+m.toColorPart(ccc(c.b,255)));
2931this._hexString=rval;
6a1aa64f 2932}
79f17b42
DV
2933return rval;
2934},asHSV:function(){
2935var hsv=this.hsv;
2936var c=this.rgb;
2937if(typeof (hsv)=="undefined"||hsv===null){
2938hsv=MochiKit.Color.rgbToHSV(this.rgb);
2939this.hsv=hsv;
6a1aa64f 2940}
79f17b42
DV
2941return MochiKit.Base.clone(hsv);
2942},asHSL:function(){
2943var hsl=this.hsl;
2944var c=this.rgb;
2945if(typeof (hsl)=="undefined"||hsl===null){
2946hsl=MochiKit.Color.rgbToHSL(this.rgb);
2947this.hsl=hsl;
6a1aa64f 2948}
79f17b42 2949return MochiKit.Base.clone(hsl);
6a1aa64f 2950},toString:function(){
79f17b42
DV
2951return this.toRGBString();
2952},repr:function(){
2953var c=this.rgb;
2954var col=[c.r,c.g,c.b,c.a];
2955return this.__class__.NAME+"("+col.join(", ")+")";
2956}};
223ddf66
DV
2957MochiKit.Base.update(MochiKit.Color.Color,{fromRGB:function(red,_344,blue,_346){
2958var _347=MochiKit.Color.Color;
79f17b42
DV
2959if(arguments.length==1){
2960var rgb=red;
2961red=rgb.r;
223ddf66 2962_344=rgb.g;
79f17b42
DV
2963blue=rgb.b;
2964if(typeof (rgb.a)=="undefined"){
223ddf66 2965_346=undefined;
79f17b42 2966}else{
223ddf66 2967_346=rgb.a;
6a1aa64f
DV
2968}
2969}
223ddf66
DV
2970return new _347(red,_344,blue,_346);
2971},fromHSL:function(hue,_34a,_34b,_34c){
79f17b42
DV
2972var m=MochiKit.Color;
2973return m.Color.fromRGB(m.hslToRGB.apply(m,arguments));
223ddf66 2974},fromHSV:function(hue,_34f,_350,_351){
79f17b42
DV
2975var m=MochiKit.Color;
2976return m.Color.fromRGB(m.hsvToRGB.apply(m,arguments));
2977},fromName:function(name){
223ddf66 2978var _354=MochiKit.Color.Color;
79f17b42
DV
2979if(name.charAt(0)=="\""){
2980name=name.substr(1,name.length-2);
6a1aa64f 2981}
223ddf66
DV
2982var _355=_354._namedColors[name.toLowerCase()];
2983if(typeof (_355)=="string"){
2984return _354.fromHexString(_355);
6a1aa64f 2985}else{
79f17b42 2986if(name=="transparent"){
223ddf66 2987return _354.transparentColor();
6a1aa64f 2988}
79f17b42
DV
2989}
2990return null;
223ddf66 2991},fromString:function(_356){
79f17b42 2992var self=MochiKit.Color.Color;
223ddf66
DV
2993var _358=_356.substr(0,3);
2994if(_358=="rgb"){
2995return self.fromRGBString(_356);
6a1aa64f 2996}else{
223ddf66
DV
2997if(_358=="hsl"){
2998return self.fromHSLString(_356);
6a1aa64f 2999}else{
223ddf66
DV
3000if(_356.charAt(0)=="#"){
3001return self.fromHexString(_356);
6a1aa64f
DV
3002}
3003}
6a1aa64f 3004}
223ddf66
DV
3005return self.fromName(_356);
3006},fromHexString:function(_359){
3007if(_359.charAt(0)=="#"){
3008_359=_359.substring(1);
6a1aa64f 3009}
223ddf66 3010var _35a=[];
79f17b42 3011var i,hex;
223ddf66 3012if(_359.length==3){
79f17b42 3013for(i=0;i<3;i++){
223ddf66
DV
3014hex=_359.substr(i,1);
3015_35a.push(parseInt(hex+hex,16)/255);
6a1aa64f 3016}
6a1aa64f 3017}else{
79f17b42 3018for(i=0;i<6;i+=2){
223ddf66
DV
3019hex=_359.substr(i,2);
3020_35a.push(parseInt(hex,16)/255);
6a1aa64f 3021}
6a1aa64f 3022}
223ddf66
DV
3023var _35d=MochiKit.Color.Color;
3024return _35d.fromRGB.apply(_35d,_35a);
3025},_fromColorString:function(pre,_35f,_360,_361){
3026if(_361.indexOf(pre)===0){
3027_361=_361.substring(_361.indexOf("(",3)+1,_361.length-1);
6a1aa64f 3028}
223ddf66
DV
3029var _362=_361.split(/\s*,\s*/);
3030var _363=[];
3031for(var i=0;i<_362.length;i++){
3032var c=_362[i];
79f17b42 3033var val;
223ddf66 3034var _367=c.substring(c.length-3);
79f17b42
DV
3035if(c.charAt(c.length-1)=="%"){
3036val=0.01*parseFloat(c.substring(0,c.length-1));
6a1aa64f 3037}else{
223ddf66 3038if(_367=="deg"){
79f17b42 3039val=parseFloat(c)/360;
6a1aa64f 3040}else{
223ddf66 3041if(_367=="rad"){
79f17b42 3042val=parseFloat(c)/(Math.PI*2);
6a1aa64f 3043}else{
223ddf66 3044val=_360[i]*parseFloat(c);
6a1aa64f 3045}
6a1aa64f 3046}
6a1aa64f 3047}
223ddf66 3048_363.push(val);
6a1aa64f 3049}
223ddf66
DV
3050return this[_35f].apply(this,_363);
3051},fromComputedStyle:function(elem,_369){
79f17b42
DV
3052var d=MochiKit.DOM;
3053var cls=MochiKit.Color.Color;
3054for(elem=d.getElement(elem);elem;elem=elem.parentNode){
223ddf66
DV
3055var _36c=MochiKit.Style.getStyle.apply(d,arguments);
3056if(!_36c){
79f17b42 3057continue;
6a1aa64f 3058}
223ddf66
DV
3059var _36d=cls.fromString(_36c);
3060if(!_36d){
79f17b42 3061break;
6a1aa64f 3062}
223ddf66
DV
3063if(_36d.asRGB().a>0){
3064return _36d;
6a1aa64f 3065}
79f17b42
DV
3066}
3067return null;
3068},fromBackground:function(elem){
3069var cls=MochiKit.Color.Color;
3070return cls.fromComputedStyle(elem,"backgroundColor","background-color")||cls.whiteColor();
3071},fromText:function(elem){
3072var cls=MochiKit.Color.Color;
3073return cls.fromComputedStyle(elem,"color","color")||cls.blackColor();
3074},namedColors:function(){
3075return MochiKit.Base.clone(MochiKit.Color.Color._namedColors);
3076}});
223ddf66
DV
3077MochiKit.Base.update(MochiKit.Color,{clampColorComponent:function(v,_373){
3078v*=_373;
79f17b42
DV
3079if(v<0){
3080return 0;
6a1aa64f 3081}else{
223ddf66
DV
3082if(v>_373){
3083return _373;
6a1aa64f 3084}else{
79f17b42 3085return v;
6a1aa64f
DV
3086}
3087}
79f17b42
DV
3088},_hslValue:function(n1,n2,hue){
3089if(hue>6){
3090hue-=6;
6a1aa64f 3091}else{
79f17b42
DV
3092if(hue<0){
3093hue+=6;
6a1aa64f
DV
3094}
3095}
79f17b42
DV
3096var val;
3097if(hue<1){
3098val=n1+(n2-n1)*hue;
6a1aa64f 3099}else{
79f17b42
DV
3100if(hue<3){
3101val=n2;
6a1aa64f 3102}else{
79f17b42
DV
3103if(hue<4){
3104val=n1+(n2-n1)*(4-hue);
3105}else{
3106val=n1;
6a1aa64f 3107}
6a1aa64f
DV
3108}
3109}
79f17b42 3110return val;
223ddf66 3111},hsvToRGB:function(hue,_379,_37a,_37b){
79f17b42
DV
3112if(arguments.length==1){
3113var hsv=hue;
3114hue=hsv.h;
223ddf66
DV
3115_379=hsv.s;
3116_37a=hsv.v;
3117_37b=hsv.a;
6a1aa64f 3118}
79f17b42 3119var red;
223ddf66 3120var _37e;
79f17b42 3121var blue;
223ddf66
DV
3122if(_379===0){
3123red=_37a;
3124_37e=_37a;
3125blue=_37a;
6a1aa64f 3126}else{
79f17b42
DV
3127var i=Math.floor(hue*6);
3128var f=(hue*6)-i;
223ddf66
DV
3129var p=_37a*(1-_379);
3130var q=_37a*(1-(_379*f));
3131var t=_37a*(1-(_379*(1-f)));
79f17b42
DV
3132switch(i){
3133case 1:
3134red=q;
223ddf66 3135_37e=_37a;
79f17b42
DV
3136blue=p;
3137break;
3138case 2:
3139red=p;
223ddf66 3140_37e=_37a;
79f17b42
DV
3141blue=t;
3142break;
3143case 3:
3144red=p;
223ddf66
DV
3145_37e=q;
3146blue=_37a;
79f17b42
DV
3147break;
3148case 4:
3149red=t;
223ddf66
DV
3150_37e=p;
3151blue=_37a;
79f17b42
DV
3152break;
3153case 5:
223ddf66
DV
3154red=_37a;
3155_37e=p;
79f17b42
DV
3156blue=q;
3157break;
3158case 6:
3159case 0:
223ddf66
DV
3160red=_37a;
3161_37e=t;
79f17b42
DV
3162blue=p;
3163break;
6a1aa64f
DV
3164}
3165}
223ddf66
DV
3166return {r:red,g:_37e,b:blue,a:_37b};
3167},hslToRGB:function(hue,_386,_387,_388){
79f17b42
DV
3168if(arguments.length==1){
3169var hsl=hue;
3170hue=hsl.h;
223ddf66
DV
3171_386=hsl.s;
3172_387=hsl.l;
3173_388=hsl.a;
6a1aa64f 3174}
79f17b42 3175var red;
223ddf66 3176var _38b;
79f17b42 3177var blue;
223ddf66
DV
3178if(_386===0){
3179red=_387;
3180_38b=_387;
3181blue=_387;
79f17b42
DV
3182}else{
3183var m2;
223ddf66
DV
3184if(_387<=0.5){
3185m2=_387*(1+_386);
6a1aa64f 3186}else{
223ddf66 3187m2=_387+_386-(_387*_386);
6a1aa64f 3188}
223ddf66 3189var m1=(2*_387)-m2;
79f17b42
DV
3190var f=MochiKit.Color._hslValue;
3191var h6=hue*6;
3192red=f(m1,m2,h6+2);
223ddf66 3193_38b=f(m1,m2,h6);
79f17b42 3194blue=f(m1,m2,h6-2);
6a1aa64f 3195}
223ddf66
DV
3196return {r:red,g:_38b,b:blue,a:_388};
3197},rgbToHSV:function(red,_392,blue,_394){
79f17b42
DV
3198if(arguments.length==1){
3199var rgb=red;
3200red=rgb.r;
223ddf66 3201_392=rgb.g;
79f17b42 3202blue=rgb.b;
223ddf66 3203_394=rgb.a;
6a1aa64f 3204}
223ddf66
DV
3205var max=Math.max(Math.max(red,_392),blue);
3206var min=Math.min(Math.min(red,_392),blue);
79f17b42 3207var hue;
223ddf66
DV
3208var _399;
3209var _39a=max;
79f17b42
DV
3210if(min==max){
3211hue=0;
223ddf66 3212_399=0;
6a1aa64f 3213}else{
223ddf66
DV
3214var _39b=(max-min);
3215_399=_39b/max;
79f17b42 3216if(red==max){
223ddf66 3217hue=(_392-blue)/_39b;
79f17b42 3218}else{
223ddf66
DV
3219if(_392==max){
3220hue=2+((blue-red)/_39b);
6a1aa64f 3221}else{
223ddf66 3222hue=4+((red-_392)/_39b);
6a1aa64f
DV
3223}
3224}
79f17b42
DV
3225hue/=6;
3226if(hue<0){
3227hue+=1;
6a1aa64f 3228}
79f17b42
DV
3229if(hue>1){
3230hue-=1;
6a1aa64f 3231}
6a1aa64f 3232}
223ddf66
DV
3233return {h:hue,s:_399,v:_39a,a:_394};
3234},rgbToHSL:function(red,_39d,blue,_39f){
79f17b42
DV
3235if(arguments.length==1){
3236var rgb=red;
3237red=rgb.r;
223ddf66 3238_39d=rgb.g;
79f17b42 3239blue=rgb.b;
223ddf66 3240_39f=rgb.a;
6a1aa64f 3241}
223ddf66
DV
3242var max=Math.max(red,Math.max(_39d,blue));
3243var min=Math.min(red,Math.min(_39d,blue));
79f17b42 3244var hue;
223ddf66
DV
3245var _3a4;
3246var _3a5=(max+min)/2;
3247var _3a6=max-min;
3248if(_3a6===0){
79f17b42 3249hue=0;
223ddf66 3250_3a4=0;
79f17b42 3251}else{
223ddf66
DV
3252if(_3a5<=0.5){
3253_3a4=_3a6/(max+min);
79f17b42 3254}else{
223ddf66 3255_3a4=_3a6/(2-max-min);
6a1aa64f 3256}
79f17b42 3257if(red==max){
223ddf66 3258hue=(_39d-blue)/_3a6;
79f17b42 3259}else{
223ddf66
DV
3260if(_39d==max){
3261hue=2+((blue-red)/_3a6);
79f17b42 3262}else{
223ddf66 3263hue=4+((red-_39d)/_3a6);
6a1aa64f 3264}
6a1aa64f 3265}
79f17b42
DV
3266hue/=6;
3267if(hue<0){
3268hue+=1;
6a1aa64f 3269}
79f17b42
DV
3270if(hue>1){
3271hue-=1;
6a1aa64f 3272}
6a1aa64f 3273}
223ddf66 3274return {h:hue,s:_3a4,l:_3a5,a:_39f};
79f17b42
DV
3275},toColorPart:function(num){
3276num=Math.round(num);
223ddf66 3277var _3a8=num.toString(16);
79f17b42 3278if(num<16){
223ddf66 3279return "0"+_3a8;
6a1aa64f 3280}
223ddf66 3281return _3a8;
79f17b42 3282},__new__:function(){
6a1aa64f 3283var m=MochiKit.Base;
79f17b42
DV
3284this.Color.fromRGBString=m.bind(this.Color._fromColorString,this.Color,"rgb","fromRGB",[1/255,1/255,1/255,1]);
3285this.Color.fromHSLString=m.bind(this.Color._fromColorString,this.Color,"hsl","fromHSL",[1/360,0.01,0.01,1]);
223ddf66
DV
3286var _3aa=1/3;
3287var _3ab={black:[0,0,0],blue:[0,0,1],brown:[0.6,0.4,0.2],cyan:[0,1,1],darkGray:[_3aa,_3aa,_3aa],gray:[0.5,0.5,0.5],green:[0,1,0],lightGray:[2*_3aa,2*_3aa,2*_3aa],magenta:[1,0,1],orange:[1,0.5,0],purple:[0.5,0,0.5],red:[1,0,0],transparent:[0,0,0,0],white:[1,1,1],yellow:[1,1,0]};
3288var _3ac=function(name,r,g,b,a){
79f17b42
DV
3289var rval=this.fromRGB(r,g,b,a);
3290this[name]=function(){
3291return rval;
3292};
3293return rval;
3294};
223ddf66 3295for(var k in _3ab){
79f17b42 3296var name=k+"Color";
223ddf66
DV
3297var _3b5=m.concat([_3ac,this.Color,name],_3ab[k]);
3298this.Color[name]=m.bind.apply(null,_3b5);
6a1aa64f 3299}
223ddf66 3300var _3b6=function(){
79f17b42
DV
3301for(var i=0;i<arguments.length;i++){
3302if(!(arguments[i] instanceof Color)){
3303return false;
6a1aa64f 3304}
6a1aa64f 3305}
79f17b42
DV
3306return true;
3307};
223ddf66 3308var _3b8=function(a,b){
79f17b42
DV
3309return a.compareRGB(b);
3310};
3311m.nameFunctions(this);
223ddf66 3312m.registerComparator(this.Color.NAME,_3b6,_3b8);
79f17b42
DV
3313this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};
3314}});
3315MochiKit.Color.EXPORT=["Color"];
3316MochiKit.Color.EXPORT_OK=["clampColorComponent","rgbToHSL","hslToRGB","rgbToHSV","hsvToRGB","toColorPart"];
3317MochiKit.Color.__new__();
3318MochiKit.Base._exportSymbols(this,MochiKit.Color);
3319MochiKit.Color.Color._namedColors={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};
6a1aa64f 3320if(typeof (dojo)!="undefined"){
79f17b42 3321dojo.provide("MochiKit.Signal");
6a1aa64f
DV
3322dojo.require("MochiKit.Base");
3323dojo.require("MochiKit.DOM");
3324dojo.require("MochiKit.Style");
3325}
3326if(typeof (JSAN)!="undefined"){
3327JSAN.use("MochiKit.Base",[]);
3328JSAN.use("MochiKit.DOM",[]);
3329JSAN.use("MochiKit.Style",[]);
3330}
3331try{
79f17b42 3332if(typeof (MochiKit.Base)=="undefined"){
6a1aa64f
DV
3333throw "";
3334}
3335}
3336catch(e){
79f17b42 3337throw "MochiKit.Signal depends on MochiKit.Base!";
6a1aa64f 3338}
79f17b42
DV
3339try{
3340if(typeof (MochiKit.DOM)=="undefined"){
3341throw "";
6a1aa64f 3342}
6a1aa64f 3343}
79f17b42
DV
3344catch(e){
3345throw "MochiKit.Signal depends on MochiKit.DOM!";
6a1aa64f 3346}
79f17b42
DV
3347try{
3348if(typeof (MochiKit.Style)=="undefined"){
3349throw "";
6a1aa64f
DV
3350}
3351}
79f17b42
DV
3352catch(e){
3353throw "MochiKit.Signal depends on MochiKit.Style!";
6a1aa64f 3354}
79f17b42
DV
3355if(typeof (MochiKit.Signal)=="undefined"){
3356MochiKit.Signal={};
6a1aa64f 3357}
79f17b42
DV
3358MochiKit.Signal.NAME="MochiKit.Signal";
3359MochiKit.Signal.VERSION="1.4";
3360MochiKit.Signal._observers=[];
3361MochiKit.Signal.Event=function(src,e){
3362this._event=e||window.event;
3363this._src=src;
6a1aa64f 3364};
79f17b42
DV
3365MochiKit.Base.update(MochiKit.Signal.Event.prototype,{__repr__:function(){
3366var repr=MochiKit.Base.repr;
3367var str="{event(): "+repr(this.event())+", src(): "+repr(this.src())+", type(): "+repr(this.type())+", target(): "+repr(this.target());
3368if(this.type()&&this.type().indexOf("key")===0||this.type().indexOf("mouse")===0||this.type().indexOf("click")!=-1||this.type()=="contextmenu"){
3369str+=", 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)+"}";
6a1aa64f 3370}
79f17b42
DV
3371if(this.type()&&this.type().indexOf("key")===0){
3372str+=", key(): {code: "+repr(this.key().code)+", string: "+repr(this.key().string)+"}";
6a1aa64f 3373}
79f17b42
DV
3374if(this.type()&&(this.type().indexOf("mouse")===0||this.type().indexOf("click")!=-1||this.type()=="contextmenu")){
3375str+=", mouse(): {page: "+repr(this.mouse().page)+", client: "+repr(this.mouse().client);
3376if(this.type()!="mousemove"){
3377str+=", button: {left: "+repr(this.mouse().button.left)+", middle: "+repr(this.mouse().button.middle)+", right: "+repr(this.mouse().button.right)+"}}";
3378}else{
3379str+="}";
6a1aa64f 3380}
6a1aa64f 3381}
79f17b42
DV
3382if(this.type()=="mouseover"||this.type()=="mouseout"){
3383str+=", relatedTarget(): "+repr(this.relatedTarget());
6a1aa64f 3384}
79f17b42
DV
3385str+="}";
3386return str;
3387},toString:function(){
6a1aa64f 3388return this.__repr__();
79f17b42
DV
3389},src:function(){
3390return this._src;
3391},event:function(){
3392return this._event;
3393},type:function(){
3394return this._event.type||undefined;
3395},target:function(){
3396return this._event.target||this._event.srcElement;
3397},_relatedTarget:null,relatedTarget:function(){
3398if(this._relatedTarget!==null){
3399return this._relatedTarget;
6a1aa64f 3400}
79f17b42
DV
3401var elem=null;
3402if(this.type()=="mouseover"){
3403elem=(this._event.relatedTarget||this._event.fromElement);
6a1aa64f 3404}else{
79f17b42
DV
3405if(this.type()=="mouseout"){
3406elem=(this._event.relatedTarget||this._event.toElement);
3407}
3408}
3409if(elem!==null){
3410this._relatedTarget=elem;
3411return elem;
3412}
3413return undefined;
3414},_modifier:null,modifier:function(){
3415if(this._modifier!==null){
3416return this._modifier;
6a1aa64f 3417}
79f17b42
DV
3418var m={};
3419m.alt=this._event.altKey;
3420m.ctrl=this._event.ctrlKey;
3421m.meta=this._event.metaKey||false;
3422m.shift=this._event.shiftKey;
3423m.any=m.alt||m.ctrl||m.shift||m.meta;
3424this._modifier=m;
3425return m;
3426},_key:null,key:function(){
3427if(this._key!==null){
3428return this._key;
6a1aa64f 3429}
79f17b42
DV
3430var k={};
3431if(this.type()&&this.type().indexOf("key")===0){
3432if(this.type()=="keydown"||this.type()=="keyup"){
3433k.code=this._event.keyCode;
3434k.string=(MochiKit.Signal._specialKeys[k.code]||"KEY_UNKNOWN");
3435this._key=k;
3436return k;
3437}else{
3438if(this.type()=="keypress"){
3439k.code=0;
3440k.string="";
3441if(typeof (this._event.charCode)!="undefined"&&this._event.charCode!==0&&!MochiKit.Signal._specialMacKeys[this._event.charCode]){
3442k.code=this._event.charCode;
3443k.string=String.fromCharCode(k.code);
6a1aa64f 3444}else{
79f17b42
DV
3445if(this._event.keyCode&&typeof (this._event.charCode)=="undefined"){
3446k.code=this._event.keyCode;
3447k.string=String.fromCharCode(k.code);
6a1aa64f
DV
3448}
3449}
79f17b42
DV
3450this._key=k;
3451return k;
6a1aa64f 3452}
6a1aa64f
DV
3453}
3454}
79f17b42
DV
3455return undefined;
3456},_mouse:null,mouse:function(){
3457if(this._mouse!==null){
3458return this._mouse;
6a1aa64f 3459}
79f17b42
DV
3460var m={};
3461var e=this._event;
3462if(this.type()&&(this.type().indexOf("mouse")===0||this.type().indexOf("click")!=-1||this.type()=="contextmenu")){
3463m.client=new MochiKit.Style.Coordinates(0,0);
3464if(e.clientX||e.clientY){
3465m.client.x=(!e.clientX||e.clientX<0)?0:e.clientX;
3466m.client.y=(!e.clientY||e.clientY<0)?0:e.clientY;
3467}
3468m.page=new MochiKit.Style.Coordinates(0,0);
3469if(e.pageX||e.pageY){
3470m.page.x=(!e.pageX||e.pageX<0)?0:e.pageX;
3471m.page.y=(!e.pageY||e.pageY<0)?0:e.pageY;
6a1aa64f 3472}else{
79f17b42
DV
3473var de=MochiKit.DOM._document.documentElement;
3474var b=MochiKit.DOM._document.body;
3475m.page.x=e.clientX+(de.scrollLeft||b.scrollLeft)-(de.clientLeft||0);
3476m.page.y=e.clientY+(de.scrollTop||b.scrollTop)-(de.clientTop||0);
3477}
3478if(this.type()!="mousemove"){
3479m.button={};
3480m.button.left=false;
3481m.button.right=false;
3482m.button.middle=false;
3483if(e.which){
3484m.button.left=(e.which==1);
3485m.button.middle=(e.which==2);
3486m.button.right=(e.which==3);
6a1aa64f 3487}else{
79f17b42
DV
3488m.button.left=!!(e.button&1);
3489m.button.right=!!(e.button&2);
3490m.button.middle=!!(e.button&4);
6a1aa64f
DV
3491}
3492}
79f17b42
DV
3493this._mouse=m;
3494return m;
6a1aa64f 3495}
79f17b42
DV
3496return undefined;
3497},stop:function(){
3498this.stopPropagation();
3499this.preventDefault();
3500},stopPropagation:function(){
3501if(this._event.stopPropagation){
3502this._event.stopPropagation();
6a1aa64f 3503}else{
79f17b42
DV
3504this._event.cancelBubble=true;
3505}
3506},preventDefault:function(){
3507if(this._event.preventDefault){
3508this._event.preventDefault();
6a1aa64f 3509}else{
79f17b42
DV
3510if(this._confirmUnload===null){
3511this._event.returnValue=false;
3512}
6a1aa64f 3513}
79f17b42
DV
3514},_confirmUnload:null,confirmUnload:function(msg){
3515if(this.type()=="beforeunload"){
3516this._confirmUnload=msg;
3517this._event.returnValue=msg;
6a1aa64f 3518}
79f17b42
DV
3519}});
3520MochiKit.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"};
3521(function(){
223ddf66 3522var _3c7=MochiKit.Signal._specialMacKeys;
79f17b42 3523for(i=63236;i<=63242;i++){
223ddf66 3524_3c7[i]="KEY_F"+(i-63236+1);
6a1aa64f 3525}
79f17b42
DV
3526})();
3527MochiKit.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"};
3528(function(){
223ddf66 3529var _3c8=MochiKit.Signal._specialKeys;
79f17b42 3530for(var i=48;i<=57;i++){
223ddf66 3531_3c8[i]="KEY_"+(i-48);
6a1aa64f 3532}
79f17b42 3533for(i=65;i<=90;i++){
223ddf66 3534_3c8[i]="KEY_"+String.fromCharCode(i);
6a1aa64f 3535}
79f17b42 3536for(i=96;i<=105;i++){
223ddf66 3537_3c8[i]="KEY_NUM_PAD_"+(i-96);
6a1aa64f 3538}
79f17b42 3539for(i=112;i<=123;i++){
223ddf66 3540_3c8[i]="KEY_F"+(i-112+1);
6a1aa64f 3541}
79f17b42 3542})();
223ddf66
DV
3543MochiKit.Signal.Ident=function(_3ca){
3544this.source=_3ca.source;
3545this.signal=_3ca.signal;
3546this.listener=_3ca.listener;
3547this.isDOM=_3ca.isDOM;
3548this.objOrFunc=_3ca.objOrFunc;
3549this.funcOrStr=_3ca.funcOrStr;
3550this.connected=_3ca.connected;
6a1aa64f 3551};
79f17b42
DV
3552MochiKit.Signal.Ident.prototype={};
3553MochiKit.Base.update(MochiKit.Signal,{__repr__:function(){
3554return "["+this.NAME+" "+this.VERSION+"]";
3555},toString:function(){
3556return this.__repr__();
3557},_unloadCache:function(){
3558var self=MochiKit.Signal;
223ddf66
DV
3559var _3cc=self._observers;
3560for(var i=0;i<_3cc.length;i++){
3561if(_3cc[i].signal!=="onload"&&_3cc[i].signal!=="onunload"){
3562self._disconnect(_3cc[i]);
6a1aa64f 3563}
6a1aa64f 3564}
223ddf66 3565},_listener:function(src,sig,func,obj,_3d2){
79f17b42
DV
3566var self=MochiKit.Signal;
3567var E=self.Event;
223ddf66 3568if(!_3d2){
79f17b42 3569return MochiKit.Base.bind(func,obj);
6a1aa64f 3570}
79f17b42
DV
3571obj=obj||src;
3572if(typeof (func)=="string"){
3573if(sig==="onload"||sig==="onunload"){
223ddf66
DV
3574return function(_3d5){
3575obj[func].apply(obj,[new E(src,_3d5)]);
3576var _3d6=new MochiKit.Signal.Ident({source:src,signal:sig,objOrFunc:obj,funcOrStr:func});
3577MochiKit.Signal._disconnect(_3d6);
6a1aa64f 3578};
79f17b42 3579}else{
223ddf66
DV
3580return function(_3d7){
3581obj[func].apply(obj,[new E(src,_3d7)]);
6a1aa64f 3582};
6a1aa64f 3583}
79f17b42
DV
3584}else{
3585if(sig==="onload"||sig==="onunload"){
223ddf66
DV
3586return function(_3d8){
3587func.apply(obj,[new E(src,_3d8)]);
79f17b42 3588MochiKit.Signal.disconnect(src,sig,func);
223ddf66
DV
3589var _3d9=new MochiKit.Signal.Ident({source:src,signal:sig,objOrFunc:func});
3590MochiKit.Signal._disconnect(_3d9);
6a1aa64f 3591};
79f17b42 3592}else{
223ddf66
DV
3593return function(_3da){
3594func.apply(obj,[new E(src,_3da)]);
6a1aa64f 3595};
6a1aa64f 3596}
6a1aa64f 3597}
79f17b42
DV
3598},_browserAlreadyHasMouseEnterAndLeave:function(){
3599return /MSIE/.test(navigator.userAgent);
3600},_mouseEnterListener:function(src,sig,func,obj){
3601var E=MochiKit.Signal.Event;
223ddf66
DV
3602return function(_3e0){
3603var e=new E(src,_3e0);
79f17b42
DV
3604try{
3605e.relatedTarget().nodeName;
6a1aa64f 3606}
79f17b42
DV
3607catch(err){
3608return;
6a1aa64f 3609}
79f17b42
DV
3610e.stop();
3611if(MochiKit.DOM.isChildNode(e.relatedTarget(),src)){
3612return;
6a1aa64f 3613}
79f17b42
DV
3614e.type=function(){
3615return sig;
6a1aa64f 3616};
79f17b42
DV
3617if(typeof (func)=="string"){
3618return obj[func].apply(obj,[e]);
3619}else{
3620return func.apply(obj,[e]);
6a1aa64f 3621}
6a1aa64f 3622};
223ddf66 3623},_getDestPair:function(_3e2,_3e3){
79f17b42
DV
3624var obj=null;
3625var func=null;
223ddf66
DV
3626if(typeof (_3e3)!="undefined"){
3627obj=_3e2;
3628func=_3e3;
3629if(typeof (_3e3)=="string"){
3630if(typeof (_3e2[_3e3])!="function"){
79f17b42 3631throw new Error("'funcOrStr' must be a function on 'objOrFunc'");
6a1aa64f 3632}
79f17b42 3633}else{
223ddf66 3634if(typeof (_3e3)!="function"){
79f17b42 3635throw new Error("'funcOrStr' must be a function or string");
6a1aa64f 3636}
6a1aa64f 3637}
79f17b42 3638}else{
223ddf66 3639if(typeof (_3e2)!="function"){
79f17b42
DV
3640throw new Error("'objOrFunc' must be a function if 'funcOrStr' is not given");
3641}else{
223ddf66 3642func=_3e2;
6a1aa64f 3643}
6a1aa64f 3644}
79f17b42 3645return [obj,func];
223ddf66 3646},connect:function(src,sig,_3e8,_3e9){
79f17b42
DV
3647src=MochiKit.DOM.getElement(src);
3648var self=MochiKit.Signal;
3649if(typeof (sig)!="string"){
3650throw new Error("'sig' must be a string");
6a1aa64f 3651}
223ddf66
DV
3652var _3eb=self._getDestPair(_3e8,_3e9);
3653var obj=_3eb[0];
3654var func=_3eb[1];
79f17b42
DV
3655if(typeof (obj)=="undefined"||obj===null){
3656obj=src;
6a1aa64f 3657}
223ddf66
DV
3658var _3ee=!!(src.addEventListener||src.attachEvent);
3659if(_3ee&&(sig==="onmouseenter"||sig==="onmouseleave")&&!self._browserAlreadyHasMouseEnterAndLeave()){
3660var _3ef=self._mouseEnterListener(src,sig.substr(2),func,obj);
79f17b42
DV
3661if(sig==="onmouseenter"){
3662sig="onmouseover";
3663}else{
3664sig="onmouseout";
6a1aa64f
DV
3665}
3666}else{
223ddf66 3667var _3ef=self._listener(src,sig,func,obj,_3ee);
6a1aa64f 3668}
79f17b42 3669if(src.addEventListener){
223ddf66 3670src.addEventListener(sig.substr(2),_3ef,false);
79f17b42
DV
3671}else{
3672if(src.attachEvent){
223ddf66 3673src.attachEvent(sig,_3ef);
6a1aa64f
DV
3674}
3675}
223ddf66
DV
3676var _3f0=new MochiKit.Signal.Ident({source:src,signal:sig,listener:_3ef,isDOM:_3ee,objOrFunc:_3e8,funcOrStr:_3e9,connected:true});
3677self._observers.push(_3f0);
3678if(!_3ee&&typeof (src.__connect__)=="function"){
3679var args=MochiKit.Base.extend([_3f0],arguments,1);
79f17b42 3680src.__connect__.apply(src,args);
6a1aa64f 3681}
223ddf66
DV
3682return _3f0;
3683},_disconnect:function(_3f2){
3684if(!_3f2.connected){
79f17b42 3685return;
6a1aa64f 3686}
223ddf66
DV
3687_3f2.connected=false;
3688if(!_3f2.isDOM){
6a1aa64f
DV
3689return;
3690}
223ddf66
DV
3691var src=_3f2.source;
3692var sig=_3f2.signal;
3693var _3f5=_3f2.listener;
79f17b42 3694if(src.removeEventListener){
223ddf66 3695src.removeEventListener(sig.substr(2),_3f5,false);
79f17b42
DV
3696}else{
3697if(src.detachEvent){
223ddf66 3698src.detachEvent(sig,_3f5);
79f17b42
DV
3699}else{
3700throw new Error("'src' must be a DOM element");
6a1aa64f 3701}
6a1aa64f 3702}
223ddf66 3703},disconnect:function(_3f6){
79f17b42 3704var self=MochiKit.Signal;
223ddf66 3705var _3f8=self._observers;
79f17b42
DV
3706var m=MochiKit.Base;
3707if(arguments.length>1){
3708var src=MochiKit.DOM.getElement(arguments[0]);
3709var sig=arguments[1];
3710var obj=arguments[2];
3711var func=arguments[3];
223ddf66
DV
3712for(var i=_3f8.length-1;i>=0;i--){
3713var o=_3f8[i];
79f17b42
DV
3714if(o.source===src&&o.signal===sig&&o.objOrFunc===obj&&o.funcOrStr===func){
3715self._disconnect(o);
3716if(!self._lock){
223ddf66 3717_3f8.splice(i,1);
79f17b42
DV
3718}else{
3719self._dirty=true;
6a1aa64f 3720}
79f17b42 3721return true;
6a1aa64f 3722}
6a1aa64f 3723}
6a1aa64f 3724}else{
223ddf66 3725var idx=m.findIdentical(_3f8,_3f6);
79f17b42 3726if(idx>=0){
223ddf66 3727self._disconnect(_3f6);
79f17b42 3728if(!self._lock){
223ddf66 3729_3f8.splice(idx,1);
79f17b42
DV
3730}else{
3731self._dirty=true;
6a1aa64f 3732}
79f17b42 3733return true;
6a1aa64f 3734}
6a1aa64f 3735}
79f17b42 3736return false;
223ddf66 3737},disconnectAllTo:function(_401,_402){
79f17b42 3738var self=MochiKit.Signal;
223ddf66
DV
3739var _404=self._observers;
3740var _405=self._disconnect;
3741var _406=self._lock;
3742var _407=self._dirty;
3743if(typeof (_402)==="undefined"){
3744_402=null;
79f17b42 3745}
223ddf66
DV
3746for(var i=_404.length-1;i>=0;i--){
3747var _409=_404[i];
3748if(_409.objOrFunc===_401&&(_402===null||_409.funcOrStr===_402)){
3749_405(_409);
3750if(_406){
3751_407=true;
79f17b42 3752}else{
223ddf66 3753_404.splice(i,1);
79f17b42
DV
3754}
3755}
3756}
223ddf66 3757self._dirty=_407;
79f17b42
DV
3758},disconnectAll:function(src,sig){
3759src=MochiKit.DOM.getElement(src);
6a1aa64f 3760var m=MochiKit.Base;
223ddf66 3761var _40d=m.flattenArguments(m.extend(null,arguments,1));
79f17b42 3762var self=MochiKit.Signal;
223ddf66
DV
3763var _40f=self._disconnect;
3764var _410=self._observers;
3765var i,_412;
3766var _413=self._lock;
3767var _414=self._dirty;
3768if(_40d.length===0){
3769for(i=_410.length-1;i>=0;i--){
3770_412=_410[i];
3771if(_412.source===src){
3772_40f(_412);
3773if(!_413){
3774_410.splice(i,1);
79f17b42 3775}else{
223ddf66 3776_414=true;
6a1aa64f 3777}
6a1aa64f 3778}
6a1aa64f 3779}
79f17b42
DV
3780}else{
3781var sigs={};
223ddf66
DV
3782for(i=0;i<_40d.length;i++){
3783sigs[_40d[i]]=true;
6a1aa64f 3784}
223ddf66
DV
3785for(i=_410.length-1;i>=0;i--){
3786_412=_410[i];
3787if(_412.source===src&&_412.signal in sigs){
3788_40f(_412);
3789if(!_413){
3790_410.splice(i,1);
79f17b42 3791}else{
223ddf66 3792_414=true;
6a1aa64f 3793}
6a1aa64f 3794}
6a1aa64f 3795}
6a1aa64f 3796}
223ddf66 3797self._dirty=_414;
79f17b42
DV
3798},signal:function(src,sig){
3799var self=MochiKit.Signal;
223ddf66 3800var _419=self._observers;
79f17b42
DV
3801src=MochiKit.DOM.getElement(src);
3802var args=MochiKit.Base.extend(null,arguments,2);
223ddf66 3803var _41b=[];
79f17b42 3804self._lock=true;
223ddf66
DV
3805for(var i=0;i<_419.length;i++){
3806var _41d=_419[i];
3807if(_41d.source===src&&_41d.signal===sig){
79f17b42 3808try{
223ddf66 3809_41d.listener.apply(src,args);
6a1aa64f 3810}
79f17b42 3811catch(e){
223ddf66 3812_41b.push(e);
6a1aa64f 3813}
6a1aa64f 3814}
6a1aa64f 3815}
79f17b42
DV
3816self._lock=false;
3817if(self._dirty){
3818self._dirty=false;
223ddf66
DV
3819for(var i=_419.length-1;i>=0;i--){
3820if(!_419[i].connected){
3821_419.splice(i,1);
79f17b42 3822}
6a1aa64f 3823}
79f17b42 3824}
223ddf66
DV
3825if(_41b.length==1){
3826throw _41b[0];
6a1aa64f 3827}else{
223ddf66 3828if(_41b.length>1){
79f17b42 3829var e=new Error("Multiple errors thrown in handling 'sig', see errors property");
223ddf66 3830e.errors=_41b;
79f17b42 3831throw e;
6a1aa64f
DV
3832}
3833}
79f17b42
DV
3834}});
3835MochiKit.Signal.EXPORT_OK=[];
3836MochiKit.Signal.EXPORT=["connect","disconnect","signal","disconnectAll","disconnectAllTo"];
3837MochiKit.Signal.__new__=function(win){
3838var m=MochiKit.Base;
3839this._document=document;
3840this._window=win;
3841this._lock=false;
3842this._dirty=false;
3843try{
3844this.connect(window,"onunload",this._unloadCache);
3845}
3846catch(e){
3847}
3848this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};
3849m.nameFunctions(this);
3850};
3851MochiKit.Signal.__new__(this);
3852if(MochiKit.__export__){
3853connect=MochiKit.Signal.connect;
3854disconnect=MochiKit.Signal.disconnect;
3855disconnectAll=MochiKit.Signal.disconnectAll;
3856signal=MochiKit.Signal.signal;
6a1aa64f 3857}
79f17b42 3858MochiKit.Base._exportSymbols(this,MochiKit.Signal);
6a1aa64f
DV
3859
3860
3861/***
3862
3863 PlotKit.PlotKit 0.9.1 : PACKED VERSION
3864
3865 THIS FILE IS AUTOMATICALLY GENERATED. If creating patches, please
3866 diff against the source tree, not this file.
3867
3868 For more information, <http://www.liquidx.net/plotkit/>.
3869
3870 Copyright (c) 2006. Alastair Tse.
3871
3872***/
3873
3874try{
223ddf66 3875if(typeof (MochiKit.Base)=="undefined"||typeof (MochiKit.DOM)=="undefined"||typeof (MochiKit.Color)=="undefined"){
6a1aa64f
DV
3876throw "";
3877}
3878}
3879catch(e){
223ddf66 3880throw "PlotKit depends on MochiKit.{Base,Color,DOM}";
6a1aa64f
DV
3881}
3882MochiKit.Base.update(MochiKit.Color.Color.prototype,{asFillColor:function(){
3883return this.lighterColorWithLevel(0.3);
3884},asStrokeColor:function(){
3885return this.darkerColorWithLevel(0.1);
3886},asPointColor:function(){
3887return this.lighterColorWithLevel(0.1);
3888}});
3889if(typeof (PlotKit)=="undefined"){
3890PlotKit={};
3891}
3892PlotKit.NAME="PlotKit";
3893PlotKit.VERSION="0.8";
3894PlotKit.__repr__=function(){
3895return "["+this.NAME+" "+this.VERSION+"]";
3896};
3897PlotKit.toString=function(){
3898return this.__repr__();
3899};
3900if(typeof (PlotKit.Base)=="undefined"){
3901PlotKit.Base={};
3902}
3903PlotKit.Base.NAME="PlotKit.Base";
3904PlotKit.Base.VERSION=PlotKit.VERSION;
3905PlotKit.Base.__repr__=function(){
3906return "["+this.NAME+" "+this.VERSION+"]";
3907};
3908PlotKit.Base.toString=function(){
3909return this.__repr__();
3910};
3911PlotKit.Base.usingPrototype=function(){
3912try{
3913return (typeof (Object.extend)=="function");
3914}
3915catch(e){
3916return false;
3917}
3918};
223ddf66 3919MochiKit.Base.update(PlotKit.Base,{collapse:function(_1){
6a1aa64f 3920var m=MochiKit.Base;
223ddf66
DV
3921var _3=new Array();
3922for(var i=0;i<_1.length;i++){
3923_3=m.concat(_3,_1[i]);
6a1aa64f
DV
3924}
3925if(PlotKit.Base.usingPrototype()){
223ddf66
DV
3926delete _3.extend;
3927delete _3.from;
3928delete _3.inspect;
6a1aa64f 3929}
223ddf66
DV
3930return _3;
3931},uniq:function(_5){
6a1aa64f 3932var m=MochiKit.Base;
223ddf66 3933if(!m.isArrayLike(_5)||(_5.length<1)){
6a1aa64f
DV
3934return new Array();
3935}
223ddf66
DV
3936var _6=new Array();
3937var _7=_5[0];
3938_6.push(_5[0]);
3939for(var i=1;i<_5.length;i++){
3940if(m.compare(_5[i],_7)!=0){
3941_7=_5[i];
3942_6.push(_5[i]);
6a1aa64f
DV
3943}
3944}
223ddf66
DV
3945return _6;
3946},palette:function(_8,_9,_10,_11){
3947var _12=MochiKit.Base.isUndefinedOrNull;
3948var _13=new Array();
3949if(_12(_11)){
3950_11=0.1;
9148174b 3951}
223ddf66
DV
3952if(_12(_10)){
3953_10=0.4;
9148174b 3954}
223ddf66
DV
3955if(_12(_9)){
3956_9=-0.2;
9148174b 3957}
223ddf66
DV
3958var _14=_9;
3959while(_14<=_10){
3960_13.push(_14);
3961_14+=_11;
9148174b 3962}
223ddf66
DV
3963var _15=function(_16,_17){
3964return _16.lighterColorWithLevel(_17);
6a1aa64f 3965};
223ddf66 3966return MochiKit.Base.map(partial(_15,_8),_13);
6a1aa64f
DV
3967},excanvasSupported:function(){
3968if(/MSIE/.test(navigator.userAgent)&&!window.opera){
3969return true;
3970}
3971return false;
3972},findPosX:function(obj){
223ddf66 3973var _19=0;
6a1aa64f
DV
3974if(obj.offsetParent){
3975while(obj.offsetParent){
223ddf66 3976_19+=obj.offsetLeft;
6a1aa64f
DV
3977obj=obj.offsetParent;
3978}
3979}else{
3980if(obj.x){
223ddf66 3981_19+=obj.x;
6a1aa64f
DV
3982}
3983}
223ddf66 3984return _19;
6a1aa64f 3985},findPosY:function(obj){
223ddf66 3986var _20=0;
6a1aa64f
DV
3987if(obj.offsetParent){
3988while(obj.offsetParent){
223ddf66 3989_20+=obj.offsetTop;
6a1aa64f
DV
3990obj=obj.offsetParent;
3991}
3992}else{
3993if(obj.y){
223ddf66 3994_20+=obj.y;
6a1aa64f
DV
3995}
3996}
223ddf66 3997return _20;
6a1aa64f
DV
3998},isFuncLike:function(obj){
3999return (typeof (obj)=="function");
4000}});
4001PlotKit.Base.map=function(fn,lst){
4002if(PlotKit.Base.usingPrototype()){
223ddf66 4003var _23=[];
6a1aa64f
DV
4004for(var x in lst){
4005if(typeof (lst[x])=="function"){
4006continue;
4007}
223ddf66 4008_23.push(fn(lst[x]));
6a1aa64f 4009}
223ddf66 4010return _23;
6a1aa64f
DV
4011}else{
4012return MochiKit.Base.map(fn,lst);
4013}
4014};
4015PlotKit.Base.items=function(lst){
4016if(PlotKit.Base.usingPrototype()){
223ddf66 4017var _25=[];
6a1aa64f
DV
4018for(var x in lst){
4019if(typeof (lst[x])=="function"){
4020continue;
4021}
223ddf66 4022_25.push([x,lst[x]]);
6a1aa64f 4023}
223ddf66 4024return _25;
6a1aa64f
DV
4025}else{
4026return MochiKit.Base.items(lst);
4027}
4028};
4029PlotKit.Base.keys=function(lst){
4030if(PlotKit.Base.usingPrototype()){
223ddf66 4031var _26=[];
6a1aa64f
DV
4032for(var x in lst){
4033if(typeof (lst[x])=="function"){
4034continue;
4035}
223ddf66 4036_26.push(x);
6a1aa64f 4037}
223ddf66 4038return _26;
6a1aa64f
DV
4039}else{
4040return MochiKit.Base.keys(lst);
4041}
4042};
4043PlotKit.Base.baseColors=function(){
223ddf66
DV
4044var _27=MochiKit.Color.Color.fromHexString;
4045return [_27("#476fb2"),_27("#be2c2b"),_27("#85b730"),_27("#734a99"),_27("#26a1c5"),_27("#fb8707"),_27("#000000")];
6a1aa64f 4046};
223ddf66 4047PlotKit.Base.EXPORT=["baseColors","collapse","findPosX","findPosY","uniq","isFuncLike","excanvasSupported"];
6a1aa64f
DV
4048PlotKit.Base.EXPORT_OK=[];
4049PlotKit.Base.__new__=function(){
4050var m=MochiKit.Base;
4051m.nameFunctions(this);
4052this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};
4053};
4054PlotKit.Base.__new__();
4055MochiKit.Base._exportSymbols(this,PlotKit.Base);
4056try{
4057if(typeof (PlotKit.Base)=="undefined"){
4058throw "";
4059}
4060}
4061catch(e){
4062throw "PlotKit.Layout depends on MochiKit.{Base,Color,DOM,Format} and PlotKit.Base";
4063}
4064if(typeof (PlotKit.Layout)=="undefined"){
4065PlotKit.Layout={};
4066}
4067PlotKit.Layout.NAME="PlotKit.Layout";
4068PlotKit.Layout.VERSION=PlotKit.VERSION;
4069PlotKit.Layout.__repr__=function(){
4070return "["+this.NAME+" "+this.VERSION+"]";
4071};
4072PlotKit.Layout.toString=function(){
4073return this.__repr__();
4074};
4075PlotKit.Layout.valid_styles=["bar","line","pie","point"];
223ddf66 4076PlotKit.Layout=function(_28,_29){
6a1aa64f 4077this.options={"barWidthFillFraction":0.75,"barOrientation":"vertical","xOriginIsZero":true,"yOriginIsZero":true,"xAxis":null,"yAxis":null,"xTicks":null,"yTicks":null,"xNumberOfTicks":10,"yNumberOfTicks":5,"xTickPrecision":1,"yTickPrecision":1,"pieRadius":0.4};
223ddf66
DV
4078this.style=_28;
4079MochiKit.Base.update(this.options,_29?_29:{});
6a1aa64f
DV
4080if(!MochiKit.Base.isUndefinedOrNull(this.options.xAxis)){
4081this.minxval=this.options.xAxis[0];
4082this.maxxval=this.options.xAxis[1];
4083this.xscale=this.maxxval-this.minxval;
4084}else{
4085this.minxval=0;
4086this.maxxval=null;
4087this.xscale=null;
4088}
4089if(!MochiKit.Base.isUndefinedOrNull(this.options.yAxis)){
4090this.minyval=this.options.yAxis[0];
4091this.maxyval=this.options.yAxis[1];
4092this.yscale=this.maxyval-this.minyval;
4093}else{
4094this.minyval=0;
4095this.maxyval=null;
4096this.yscale=null;
4097}
4098this.bars=new Array();
4099this.points=new Array();
4100this.slices=new Array();
4101this.xticks=new Array();
4102this.yticks=new Array();
4103this.datasets=new Array();
4104this.minxdelta=0;
4105this.xrange=1;
4106this.yrange=1;
4107this.hitTestCache={x2maxy:null};
4108};
223ddf66
DV
4109PlotKit.Layout.prototype.addDataset=function(_30,_31){
4110this.datasets[_30]=_31;
6a1aa64f 4111};
223ddf66
DV
4112PlotKit.Layout.prototype.removeDataset=function(_32,_33){
4113delete this.datasets[_32];
6a1aa64f
DV
4114};
4115PlotKit.Layout.prototype.evaluate=function(){
4116this._evaluateLimits();
4117this._evaluateScales();
6a1aa64f
DV
4118if(this.style=="line"){
4119this._evaluateLineCharts();
4120this._evaluateLineTicks();
6a1aa64f
DV
4121}
4122};
6a1aa64f
DV
4123PlotKit.Layout.prototype._evaluateLimits=function(){
4124var map=PlotKit.Base.map;
223ddf66
DV
4125var _35=PlotKit.Base.items;
4126var _36=MochiKit.Base.itemgetter;
4127var _37=PlotKit.Base.collapse;
4128var _38=MochiKit.Base.listMin;
4129var _39=MochiKit.Base.listMax;
4130var _40=MochiKit.Base.isUndefinedOrNull;
4131var all=_37(map(_36(1),_35(this.datasets)));
4132if(_40(this.options.xAxis)){
6a1aa64f
DV
4133if(this.options.xOriginIsZero){
4134this.minxval=0;
4135}else{
223ddf66 4136this.minxval=_38(map(parseFloat,map(_36(0),all)));
6a1aa64f 4137}
223ddf66 4138this.maxxval=_39(map(parseFloat,map(_36(0),all)));
6a1aa64f
DV
4139}else{
4140this.minxval=this.options.xAxis[0];
4141this.maxxval=this.options.xAxis[1];
4142this.xscale=this.maxval-this.minxval;
4143}
223ddf66 4144if(_40(this.options.yAxis)){
6a1aa64f
DV
4145if(this.options.yOriginIsZero){
4146this.minyval=0;
4147}else{
223ddf66 4148this.minyval=_38(map(parseFloat,map(_36(1),all)));
6a1aa64f 4149}
223ddf66 4150this.maxyval=_39(map(parseFloat,map(_36(1),all)));
6a1aa64f
DV
4151}else{
4152this.minyval=this.options.yAxis[0];
4153this.maxyval=this.options.yAxis[1];
4154this.yscale=this.maxyval-this.minyval;
4155}
4156};
4157PlotKit.Layout.prototype._evaluateScales=function(){
223ddf66 4158var _42=MochiKit.Base.isUndefinedOrNull;
6a1aa64f
DV
4159this.xrange=this.maxxval-this.minxval;
4160if(this.xrange==0){
4161this.xscale=1;
4162}else{
4163this.xscale=1/this.xrange;
4164}
4165this.yrange=this.maxyval-this.minyval;
4166if(this.yrange==0){
4167this.yscale=1;
4168}else{
4169this.yscale=1/this.yrange;
4170}
4171};
4172PlotKit.Layout.prototype._uniqueXValues=function(){
223ddf66 4173var _43=PlotKit.Base.collapse;
6a1aa64f 4174var map=PlotKit.Base.map;
223ddf66
DV
4175var _44=PlotKit.Base.uniq;
4176var _45=MochiKit.Base.itemgetter;
4177var _46=PlotKit.Base.items;
4178var _47=map(parseFloat,map(_45(0),_43(map(_45(1),_46(this.datasets)))));
4179_47.sort(MochiKit.Base.compare);
4180return _44(_47);
6a1aa64f
DV
4181};
4182PlotKit.Layout.prototype._evaluateLineCharts=function(){
223ddf66
DV
4183var _48=PlotKit.Base.items;
4184var _49=_48(this.datasets).length;
6a1aa64f
DV
4185this.points=new Array();
4186var i=0;
223ddf66
DV
4187for(var _50 in this.datasets){
4188var _51=this.datasets[_50];
4189if(PlotKit.Base.isFuncLike(_51)){
6a1aa64f
DV
4190continue;
4191}
223ddf66 4192_51.sort(function(a,b){
6a1aa64f
DV
4193return compare(parseFloat(a[0]),parseFloat(b[0]));
4194});
223ddf66
DV
4195for(var j=0;j<_51.length;j++){
4196var _55=_51[j];
4197var _56={x:((parseFloat(_55[0])-this.minxval)*this.xscale),y:1-((parseFloat(_55[1])-this.minyval)*this.yscale),xval:parseFloat(_55[0]),yval:parseFloat(_55[1]),name:_50};
4198if(_56.y<=0){
4199_56.y=0;
6a1aa64f 4200}
223ddf66
DV
4201if(_56.y>=1){
4202_56.y=1;
6a1aa64f 4203}
223ddf66
DV
4204if((_56.x>=0)&&(_56.x<=1)){
4205this.points.push(_56);
6a1aa64f
DV
4206}
4207}
4208i++;
4209}
4210};
6a1aa64f 4211PlotKit.Layout.prototype._evaluateLineTicksForXAxis=function(){
223ddf66 4212var _57=MochiKit.Base.isUndefinedOrNull;
6a1aa64f
DV
4213if(this.options.xTicks){
4214this.xticks=new Array();
223ddf66
DV
4215var _58=function(_59){
4216var _60=_59.label;
4217if(_57(_60)){
4218_60=_59.v.toString();
6a1aa64f 4219}
223ddf66 4220var pos=this.xscale*(_59.v-this.minxval);
6a1aa64f 4221if((pos>=0)&&(pos<=1)){
223ddf66 4222this.xticks.push([pos,_60]);
6a1aa64f
DV
4223}
4224};
223ddf66 4225MochiKit.Iter.forEach(this.options.xTicks,bind(_58,this));
6a1aa64f
DV
4226}else{
4227if(this.options.xNumberOfTicks){
223ddf66
DV
4228var _62=this._uniqueXValues();
4229var _63=this.xrange/this.options.xNumberOfTicks;
4230var _64=0;
6a1aa64f 4231this.xticks=new Array();
223ddf66
DV
4232for(var i=0;i<=_62.length;i++){
4233if((_62[i]-this.minxval)>=(_64*_63)){
4234var pos=this.xscale*(_62[i]-this.minxval);
6a1aa64f
DV
4235if((pos>1)||(pos<0)){
4236continue;
4237}
223ddf66
DV
4238this.xticks.push([pos,_62[i]]);
4239_64++;
6a1aa64f 4240}
223ddf66 4241if(_64>this.options.xNumberOfTicks){
6a1aa64f
DV
4242break;
4243}
4244}
4245}
4246}
4247};
4248PlotKit.Layout.prototype._evaluateLineTicksForYAxis=function(){
223ddf66 4249var _65=MochiKit.Base.isUndefinedOrNull;
6a1aa64f
DV
4250if(this.options.yTicks){
4251this.yticks=new Array();
223ddf66
DV
4252var _66=function(_67){
4253var _68=_67.label;
4254if(_65(_68)){
4255_68=_67.v.toString();
6a1aa64f 4256}
223ddf66 4257var pos=1-(this.yscale*(_67.v-this.minyval));
6a1aa64f 4258if((pos>=0)&&(pos<=1)){
223ddf66 4259this.yticks.push([pos,_68]);
6a1aa64f
DV
4260}
4261};
223ddf66 4262MochiKit.Iter.forEach(this.options.yTicks,bind(_66,this));
6a1aa64f
DV
4263}
4264};
4265PlotKit.Layout.prototype._evaluateLineTicks=function(){
4266this._evaluateLineTicksForXAxis();
4267this._evaluateLineTicksForYAxis();
4268};
6a1aa64f
DV
4269PlotKit.LayoutModule={};
4270PlotKit.LayoutModule.Layout=PlotKit.Layout;
4271PlotKit.LayoutModule.EXPORT=["Layout"];
4272PlotKit.LayoutModule.EXPORT_OK=[];
4273PlotKit.LayoutModule.__new__=function(){
4274var m=MochiKit.Base;
4275m.nameFunctions(this);
4276this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};
4277};
4278PlotKit.LayoutModule.__new__();
4279MochiKit.Base._exportSymbols(this,PlotKit.LayoutModule);
4280try{
4281if((typeof (PlotKit.Base)=="undefined")||(typeof (PlotKit.Layout)=="undefined")){
4282throw "";
4283}
4284}
4285catch(e){
4286throw "PlotKit.Layout depends on MochiKit.{Base,Color,DOM,Format} and PlotKit.{Base,Layout}";
4287}
4288if(typeof (PlotKit.CanvasRenderer)=="undefined"){
4289PlotKit.CanvasRenderer={};
4290}
4291PlotKit.CanvasRenderer.NAME="PlotKit.CanvasRenderer";
4292PlotKit.CanvasRenderer.VERSION=PlotKit.VERSION;
4293PlotKit.CanvasRenderer.__repr__=function(){
4294return "["+this.NAME+" "+this.VERSION+"]";
4295};
4296PlotKit.CanvasRenderer.toString=function(){
4297return this.__repr__();
4298};
223ddf66 4299PlotKit.CanvasRenderer=function(_69,_70,_71){
6a1aa64f 4300if(arguments.length>0){
223ddf66 4301this.__init__(_69,_70,_71);
6a1aa64f
DV
4302}
4303};
223ddf66
DV
4304PlotKit.CanvasRenderer.prototype.__init__=function(_72,_73,_74){
4305var _75=MochiKit.Base.isUndefinedOrNull;
4306var _76=MochiKit.Color.Color;
8846615a 4307this.options={"drawBackground":true,"backgroundColor":_76.whiteColor(),"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[0]),"strokeColor":_76.whiteColor(),"strokeColorTransform":"asStrokeColor","strokeWidth":0.5,"shouldFill":true,"shouldStroke":true,"drawXAxis":true,"drawYAxis":true,"axisLineColor":_76.blackColor(),"axisLineWidth":0.5,"axisTickSize":3,"axisLabelColor":_76.blackColor(),"axisLabelFont":"Arial","axisLabelFontSize":9,"axisLabelWidth":50,"pieRadius":0.4,"enableEvents":true};
223ddf66
DV
4308MochiKit.Base.update(this.options,_74?_74:{});
4309this.layout=_73;
4310this.element=MochiKit.DOM.getElement(_72);
6a1aa64f
DV
4311this.container=this.element.parentNode;
4312this.isIE=PlotKit.Base.excanvasSupported();
223ddf66 4313if(this.isIE&&!_75(G_vmlCanvasManager)){
6a1aa64f
DV
4314this.IEDelay=0.5;
4315this.maxTries=5;
4316this.renderDelay=null;
4317this.clearDelay=null;
4318this.element=G_vmlCanvasManager.initElement(this.element);
4319}
4320this.height=this.element.height;
4321this.width=this.element.width;
223ddf66 4322if(_75(this.element)){
6a1aa64f
DV
4323throw "CanvasRenderer() - passed canvas is not found";
4324}
4325if(!this.isIE&&!(PlotKit.CanvasRenderer.isSupported(this.element))){
4326throw "CanvasRenderer() - Canvas is not supported.";
4327}
223ddf66 4328if(_75(this.container)||(this.container.nodeName.toLowerCase()!="div")){
6a1aa64f
DV
4329throw "CanvasRenderer() - <canvas> needs to be enclosed in <div>";
4330}
4331this.xlabels=new Array();
4332this.ylabels=new Array();
4333this.isFirstRender=true;
8846615a
DV
4334this.area={x:this.options.yAxisLabelWidth+2*this.options.axisTickSize,y:0};
4335this.area.w=this.width-this.area.x-this.options.rightGap;
4336this.area.h=this.height-this.options.axisLabelFontSize-2*this.options.axisTickSize;
6a1aa64f
DV
4337MochiKit.DOM.updateNodeAttributes(this.container,{"style":{"position":"relative","width":this.width+"px"}});
4338};
4339PlotKit.CanvasRenderer.prototype.render=function(){
4340if(this.isIE){
4341try{
4342if(this.renderDelay){
4343this.renderDelay.cancel();
4344this.renderDelay=null;
4345}
223ddf66 4346var _77=this.element.getContext("2d");
6a1aa64f
DV
4347}
4348catch(e){
4349this.isFirstRender=false;
4350if(this.maxTries-->0){
4351this.renderDelay=MochiKit.Async.wait(this.IEDelay);
4352this.renderDelay.addCallback(bind(this.render,this));
4353}
4354return;
4355}
4356}
4357if(this.options.drawBackground){
4358this._renderBackground();
4359}
6a1aa64f
DV
4360if(this.layout.style=="line"){
4361this._renderLineChart();
4362this._renderLineAxis();
4363}
6a1aa64f
DV
4364};
4365PlotKit.CanvasRenderer.prototype._renderLineChart=function(){
223ddf66
DV
4366var _78=this.element.getContext("2d");
4367var _79=this.options.colorScheme.length;
4368var _80=this.options.colorScheme;
4369var _81=MochiKit.Base.keys(this.layout.datasets);
4370var _82=_81.length;
4371var _83=MochiKit.Base.bind;
4372var _84=MochiKit.Base.partial;
4373for(var i=0;i<_82;i++){
4374var _85=_81[i];
4375var _86=_80[i%_79];
4376var _87=this.options.strokeColorTransform;
4377_78.save();
4378_78.fillStyle=_86.toRGBString();
6a1aa64f 4379if(this.options.strokeColor){
223ddf66 4380_78.strokeStyle=this.options.strokeColor.toRGBString();
6a1aa64f
DV
4381}else{
4382if(this.options.strokeColorTransform){
223ddf66 4383_78.strokeStyle=_86[_87]().toRGBString();
6a1aa64f
DV
4384}
4385}
223ddf66
DV
4386_78.lineWidth=this.options.strokeWidth;
4387var _88=function(ctx){
6a1aa64f
DV
4388ctx.beginPath();
4389ctx.moveTo(this.area.x,this.area.y+this.area.h);
223ddf66
DV
4390var _90=function(_91,_92){
4391if(_92.name==_85){
4392_91.lineTo(this.area.w*_92.x+this.area.x,this.area.h*_92.y+this.area.y);
6a1aa64f
DV
4393}
4394};
223ddf66 4395MochiKit.Iter.forEach(this.layout.points,_84(_90,ctx),this);
6a1aa64f
DV
4396ctx.lineTo(this.area.w+this.area.x,this.area.h+this.area.y);
4397ctx.lineTo(this.area.x,this.area.y+this.area.h);
4398ctx.closePath();
4399};
4400if(this.options.shouldFill){
223ddf66
DV
4401_83(_88,this)(_78);
4402_78.fill();
6a1aa64f
DV
4403}
4404if(this.options.shouldStroke){
223ddf66
DV
4405_83(_88,this)(_78);
4406_78.stroke();
6a1aa64f 4407}
223ddf66 4408_78.restore();
6a1aa64f
DV
4409}
4410};
6a1aa64f
DV
4411PlotKit.CanvasRenderer.prototype._renderLineAxis=function(){
4412this._renderAxis();
4413};
4414PlotKit.CanvasRenderer.prototype._renderAxis=function(){
4415if(!this.options.drawXAxis&&!this.options.drawYAxis){
4416return;
4417}
223ddf66
DV
4418var _93=this.element.getContext("2d");
4419var _94={"style":{"position":"absolute","fontSize":this.options.axisLabelFontSize+"px","zIndex":10,"color":this.options.axisLabelColor.toRGBString(),"width":this.options.axisLabelWidth+"px","overflow":"hidden"}};
4420_93.save();
4421_93.strokeStyle=this.options.axisLineColor.toRGBString();
4422_93.lineWidth=this.options.axisLineWidth;
6a1aa64f
DV
4423if(this.options.drawYAxis){
4424if(this.layout.yticks){
223ddf66
DV
4425var _95=function(_96){
4426if(typeof (_96)=="function"){
6a1aa64f
DV
4427return;
4428}
4429var x=this.area.x;
223ddf66
DV
4430var y=this.area.y+_96[0]*this.area.h;
4431_93.beginPath();
4432_93.moveTo(x,y);
4433_93.lineTo(x-this.options.axisTickSize,y);
4434_93.closePath();
4435_93.stroke();
4436var _98=DIV(_94,_96[1]);
8846615a
DV
4437var top=(y-this.options.axisLabelFontSize/2);
4438if(top<0){
4439top=0;
4440}
4441if(top+this.options.axisLabelFontSize+3>this.height){
4442_98.style.bottom="0px";
4443}else{
4444_98.style.top=top+"px";
4445}
4446_98.style.left="0px";
223ddf66 4447_98.style.textAlign="right";
8846615a 4448_98.style.width=this.options.yAxisLabelWidth+"px";
223ddf66
DV
4449MochiKit.DOM.appendChildNodes(this.container,_98);
4450this.ylabels.push(_98);
9148174b 4451};
223ddf66 4452MochiKit.Iter.forEach(this.layout.yticks,bind(_95,this));
8846615a
DV
4453var _100=this.ylabels[0];
4454var _101=this.options.axisLabelFontSize;
4455var _102=parseInt(_100.style.top)+_101;
4456if(_102>this.height-_101){
4457_100.style.top=(parseInt(_100.style.top)-_101/2)+"px";
4458}
9148174b 4459}
223ddf66
DV
4460_93.beginPath();
4461_93.moveTo(this.area.x,this.area.y);
4462_93.lineTo(this.area.x,this.area.y+this.area.h);
4463_93.closePath();
4464_93.stroke();
6a1aa64f
DV
4465}
4466if(this.options.drawXAxis){
4467if(this.layout.xticks){
8846615a 4468var _95=function(tick){
6a1aa64f
DV
4469if(typeof (dataset)=="function"){
4470return;
4471}
8846615a 4472var x=this.area.x+tick[0]*this.area.w;
6a1aa64f 4473var y=this.area.y+this.area.h;
223ddf66
DV
4474_93.beginPath();
4475_93.moveTo(x,y);
4476_93.lineTo(x,y+this.options.axisTickSize);
4477_93.closePath();
4478_93.stroke();
8846615a
DV
4479var _104=DIV(_94,tick[1]);
4480_104.style.textAlign="center";
4481_104.style.bottom="0px";
4482var left=(x-this.options.axisLabelWidth/2);
4483if(left+this.options.axisLabelWidth>this.width){
4484left=this.width-this.options.xAxisLabelWidth;
4485_104.style.textAlign="right";
4486}
4487if(left<0){
4488left=0;
4489_104.style.textAlign="left";
4490}
4491_104.style.left=left+"px";
8846615a
DV
4492_104.style.width=this.options.xAxisLabelWidth+"px";
4493MochiKit.DOM.appendChildNodes(this.container,_104);
4494this.xlabels.push(_104);
9148174b 4495};
223ddf66 4496MochiKit.Iter.forEach(this.layout.xticks,bind(_95,this));
9148174b 4497}
223ddf66
DV
4498_93.beginPath();
4499_93.moveTo(this.area.x,this.area.y+this.area.h);
4500_93.lineTo(this.area.x+this.area.w,this.area.y+this.area.h);
4501_93.closePath();
4502_93.stroke();
9148174b 4503}
223ddf66 4504_93.restore();
6a1aa64f
DV
4505};
4506PlotKit.CanvasRenderer.prototype._renderBackground=function(){
8846615a
DV
4507var _106=this.element.getContext("2d");
4508_106.save();
4509_106.fillStyle=this.options.backgroundColor.toRGBString();
4510_106.fillRect(0,0,this.width,this.height);
4511_106.restore();
6a1aa64f
DV
4512};
4513PlotKit.CanvasRenderer.prototype.clear=function(){
4514if(this.isIE){
4515try{
4516if(this.clearDelay){
4517this.clearDelay.cancel();
4518this.clearDelay=null;
4519}
8846615a 4520var _107=this.element.getContext("2d");
6a1aa64f
DV
4521}
4522catch(e){
4523this.isFirstRender=false;
4524this.clearDelay=MochiKit.Async.wait(this.IEDelay);
4525this.clearDelay.addCallback(bind(this.clear,this));
4526return;
4527}
4528}
8846615a
DV
4529var _107=this.element.getContext("2d");
4530_107.clearRect(0,0,this.width,this.height);
6a1aa64f
DV
4531MochiKit.Iter.forEach(this.xlabels,MochiKit.DOM.removeElement);
4532MochiKit.Iter.forEach(this.ylabels,MochiKit.DOM.removeElement);
4533this.xlabels=new Array();
4534this.ylabels=new Array();
4535};
4536PlotKit.CanvasRenderer.prototype._initialiseEvents=function(){
8846615a 4537var _108=MochiKit.Signal.connect;
6a1aa64f 4538var bind=MochiKit.Base.bind;
8846615a 4539_108(this.element,"onclick",bind(this.onclick,this));
6a1aa64f
DV
4540};
4541PlotKit.CanvasRenderer.prototype._resolveObject=function(e){
4542var x=(e.mouse().page.x-PlotKit.Base.findPosX(this.element)-this.area.x)/this.area.w;
4543var y=(e.mouse().page.y-PlotKit.Base.findPosY(this.element)-this.area.y)/this.area.h;
8846615a
DV
4544var _111=this.layout.hitTest(x,y);
4545if(_111){
4546return _111;
6a1aa64f
DV
4547}
4548return null;
4549};
8846615a
DV
4550PlotKit.CanvasRenderer.prototype._createEventObject=function(_112,e){
4551if(_112==null){
6a1aa64f
DV
4552return null;
4553}
8846615a 4554e.chart=_112;
6a1aa64f
DV
4555return e;
4556};
4557PlotKit.CanvasRenderer.prototype.onclick=function(e){
8846615a
DV
4558var _113=this._resolveObject(e);
4559var _114=this._createEventObject(_113,e);
4560if(_114!=null){
4561MochiKit.Signal.signal(this,"onclick",_114);
6a1aa64f
DV
4562}
4563};
4564PlotKit.CanvasRenderer.prototype.onmouseover=function(e){
8846615a
DV
4565var _115=this._resolveObject(e);
4566var _116=this._createEventObject(_115,e);
4567if(_116!=null){
4568signal(this,"onmouseover",_116);
6a1aa64f
DV
4569}
4570};
4571PlotKit.CanvasRenderer.prototype.onmouseout=function(e){
8846615a
DV
4572var _117=this._resolveObject(e);
4573var _118=this._createEventObject(_117,e);
4574if(_118==null){
6a1aa64f
DV
4575signal(this,"onmouseout",e);
4576}else{
8846615a 4577signal(this,"onmouseout",_118);
6a1aa64f
DV
4578}
4579};
4580PlotKit.CanvasRenderer.prototype.onmousemove=function(e){
8846615a
DV
4581var _119=this._resolveObject(e);
4582var _120=this._createEventObject(_119,e);
4583if((_119==null)&&(this.event_isinside==null)){
6a1aa64f
DV
4584return;
4585}
8846615a
DV
4586if((_119!=null)&&(this.event_isinside==null)){
4587signal(this,"onmouseover",_120);
6a1aa64f 4588}
8846615a
DV
4589if((_119==null)&&(this.event_isinside!=null)){
4590signal(this,"onmouseout",_120);
6a1aa64f 4591}
8846615a
DV
4592if((_119!=null)&&(this.event_isinside!=null)){
4593signal(this,"onmousemove",_120);
6a1aa64f 4594}
8846615a 4595this.event_isinside=_119;
6a1aa64f 4596};
8846615a
DV
4597PlotKit.CanvasRenderer.isSupported=function(_121){
4598var _122=null;
6a1aa64f 4599try{
8846615a
DV
4600if(MochiKit.Base.isUndefinedOrNull(_121)){
4601_122=MochiKit.DOM.CANVAS({});
6a1aa64f 4602}else{
8846615a 4603_122=MochiKit.DOM.getElement(_121);
6a1aa64f 4604}
8846615a 4605var _123=_122.getContext("2d");
6a1aa64f
DV
4606}
4607catch(e){
4608var ie=navigator.appVersion.match(/MSIE (\d\.\d)/);
8846615a
DV
4609var _125=(navigator.userAgent.toLowerCase().indexOf("opera")!=-1);
4610if((!ie)||(ie[1]<6)||(_125)){
6a1aa64f
DV
4611return false;
4612}
4613return true;
4614}
4615return true;
4616};
4617PlotKit.Canvas={};
4618PlotKit.Canvas.CanvasRenderer=PlotKit.CanvasRenderer;
4619PlotKit.Canvas.EXPORT=["CanvasRenderer"];
4620PlotKit.Canvas.EXPORT_OK=["CanvasRenderer"];
4621PlotKit.Canvas.__new__=function(){
4622var m=MochiKit.Base;
4623m.nameFunctions(this);
4624this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};
4625};
4626PlotKit.Canvas.__new__();
4627MochiKit.Base._exportSymbols(this,PlotKit.Canvas);
6a1aa64f
DV
4628
4629
6219c9d6 4630Date.ext={};Date.ext.util={};Date.ext.util.xPad=function(x,pad,r){if(typeof (r)=="undefined"){r=10}for(;parseInt(x,10)<r&&r>1;r/=10){x=pad.toString()+x}return x.toString()};Date.prototype.locale="en-GB";if(document.getElementsByTagName("html")&&document.getElementsByTagName("html")[0].lang){Date.prototype.locale=document.getElementsByTagName("html")[0].lang}Date.ext.locales={};Date.ext.locales.en={a:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],A:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],B:["January","February","March","April","May","June","July","August","September","October","November","December"],c:"%a %d %b %Y %T %Z",p:["AM","PM"],P:["am","pm"],x:"%d/%m/%y",X:"%T"};Date.ext.locales["en-US"]=Date.ext.locales.en;Date.ext.locales["en-US"].c="%a %d %b %Y %r %Z";Date.ext.locales["en-US"].x="%D";Date.ext.locales["en-US"].X="%r";Date.ext.locales["en-GB"]=Date.ext.locales.en;Date.ext.locales["en-AU"]=Date.ext.locales["en-GB"];Date.ext.formats={a:function(d){return Date.ext.locales[d.locale].a[d.getDay()]},A:function(d){return Date.ext.locales[d.locale].A[d.getDay()]},b:function(d){return Date.ext.locales[d.locale].b[d.getMonth()]},B:function(d){return Date.ext.locales[d.locale].B[d.getMonth()]},c:"toLocaleString",C:function(d){return Date.ext.util.xPad(parseInt(d.getFullYear()/100,10),0)},d:["getDate","0"],e:["getDate"," "],g:function(d){return Date.ext.util.xPad(parseInt(Date.ext.util.G(d)/100,10),0)},G:function(d){var y=d.getFullYear();var V=parseInt(Date.ext.formats.V(d),10);var W=parseInt(Date.ext.formats.W(d),10);if(W>V){y++}else{if(W===0&&V>=52){y--}}return y},H:["getHours","0"],I:function(d){var I=d.getHours()%12;return Date.ext.util.xPad(I===0?12:I,0)},j:function(d){var ms=d-new Date(""+d.getFullYear()+"/1/1 GMT");ms+=d.getTimezoneOffset()*60000;var doy=parseInt(ms/60000/60/24,10)+1;return Date.ext.util.xPad(doy,0,100)},m:function(d){return Date.ext.util.xPad(d.getMonth()+1,0)},M:["getMinutes","0"],p:function(d){return Date.ext.locales[d.locale].p[d.getHours()>=12?1:0]},P:function(d){return Date.ext.locales[d.locale].P[d.getHours()>=12?1:0]},S:["getSeconds","0"],u:function(d){var dow=d.getDay();return dow===0?7:dow},U:function(d){var doy=parseInt(Date.ext.formats.j(d),10);var rdow=6-d.getDay();var woy=parseInt((doy+rdow)/7,10);return Date.ext.util.xPad(woy,0)},V:function(d){var woy=parseInt(Date.ext.formats.W(d),10);var dow1_1=(new Date(""+d.getFullYear()+"/1/1")).getDay();var idow=woy+(dow1_1>4||dow1_1<=1?0:1);if(idow==53&&(new Date(""+d.getFullYear()+"/12/31")).getDay()<4){idow=1}else{if(idow===0){idow=Date.ext.formats.V(new Date(""+(d.getFullYear()-1)+"/12/31"))}}return Date.ext.util.xPad(idow,0)},w:"getDay",W:function(d){var doy=parseInt(Date.ext.formats.j(d),10);var rdow=7-Date.ext.formats.u(d);var woy=parseInt((doy+rdow)/7,10);return Date.ext.util.xPad(woy,0,10)},y:function(d){return Date.ext.util.xPad(d.getFullYear()%100,0)},Y:"getFullYear",z:function(d){var o=d.getTimezoneOffset();var H=Date.ext.util.xPad(parseInt(Math.abs(o/60),10),0);var M=Date.ext.util.xPad(o%60,0);return(o>0?"-":"+")+H+M},Z:function(d){return d.toString().replace(/^.*\(([^)]+)\)$/,"$1")},"%":function(d){return"%"}};Date.ext.aggregates={c:"locale",D:"%m/%d/%y",h:"%b",n:"\n",r:"%I:%M:%S %p",R:"%H:%M",t:"\t",T:"%H:%M:%S",x:"locale",X:"locale"};Date.ext.aggregates.z=Date.ext.formats.z(new Date());Date.ext.aggregates.Z=Date.ext.formats.Z(new Date());Date.ext.unsupported={};Date.prototype.strftime=function(fmt){if(!(this.locale in Date.ext.locales)){if(this.locale.replace(/-[a-zA-Z]+$/,"") in Date.ext.locales){this.locale=this.locale.replace(/-[a-zA-Z]+$/,"")}else{this.locale="en-GB"}}var d=this;while(fmt.match(/%[cDhnrRtTxXzZ]/)){fmt=fmt.replace(/%([cDhnrRtTxXzZ])/g,function(m0,m1){var f=Date.ext.aggregates[m1];return(f=="locale"?Date.ext.locales[d.locale][m1]:f)})}var str=fmt.replace(/%([aAbBCdegGHIjmMpPSuUVwWyY%])/g,function(m0,m1){var f=Date.ext.formats[m1];if(typeof (f)=="string"){return d[f]()}else{if(typeof (f)=="function"){return f.call(d,d)}else{if(typeof (f)=="object"&&typeof (f[0])=="string"){return Date.ext.util.xPad(d[f[0]](),f[1])}else{return m1}}}});d=null;return str};
285a6bda 4631DygraphLayout=function(_1){
b2a516b8 4632PlotKit.Layout.call(this,"line",_1);
6a1aa64f 4633};
285a6bda
DV
4634DygraphLayout.prototype=new PlotKit.Layout();
4635DygraphLayout.prototype.evaluateWithError=function(){
b2a516b8
DV
4636this.evaluate();
4637if(!this.options.errorBars){
4638return;
4639}
4640var i=0;
4641for(var _3 in this.datasets){
4642var j=0;
4643var _5=this.datasets[_3];
4644if(PlotKit.Base.isFuncLike(_5)){
4645continue;
4646}
4647for(var j=0;j<_5.length;j++,i++){
4648var _6=_5[j];
4649var xv=parseFloat(_6[0]);
4650var yv=parseFloat(_6[1]);
4651if(xv==this.points[i].xval&&yv==this.points[i].yval){
4652this.points[i].errorMinus=parseFloat(_6[2]);
4653this.points[i].errorPlus=parseFloat(_6[3]);
4654}
4655}
4656}
6a1aa64f 4657};
285a6bda 4658DygraphLayout.prototype.removeAllDatasets=function(){
b2a516b8
DV
4659delete this.datasets;
4660this.datasets=new Array();
6a1aa64f 4661};
285a6bda 4662DygraphLayout.prototype.updateOptions=function(_9){
b2a516b8
DV
4663MochiKit.Base.update(this.options,_9?_9:{});
4664};
285a6bda 4665DygraphCanvasRenderer=function(_10,_11,_12){
b2a516b8
DV
4666PlotKit.CanvasRenderer.call(this,_10,_11,_12);
4667this.options.shouldFill=false;
4668this.options.shouldStroke=true;
4669this.options.drawYGrid=true;
4670this.options.drawXGrid=true;
4671this.options.gridLineColor=MochiKit.Color.Color.grayColor();
4672MochiKit.Base.update(this.options,_12);
4673this.options.drawBackground=false;
4674};
285a6bda
DV
4675DygraphCanvasRenderer.prototype=new PlotKit.CanvasRenderer();
4676DygraphCanvasRenderer.prototype.render=function(){
b2a516b8
DV
4677var ctx=this.element.getContext("2d");
4678if(this.options.drawYGrid){
4679var _14=this.layout.yticks;
4680ctx.save();
4681ctx.strokeStyle=this.options.gridLineColor.toRGBString();
4682ctx.lineWidth=this.options.axisLineWidth;
4683for(var i=0;i<_14.length;i++){
4684var x=this.area.x;
4685var y=this.area.y+_14[i][0]*this.area.h;
4686ctx.beginPath();
4687ctx.moveTo(x,y);
4688ctx.lineTo(x+this.area.w,y);
4689ctx.closePath();
4690ctx.stroke();
4691}
4692}
4693if(this.options.drawXGrid){
4694var _14=this.layout.xticks;
4695ctx.save();
4696ctx.strokeStyle=this.options.gridLineColor.toRGBString();
4697ctx.lineWidth=this.options.axisLineWidth;
4698for(var i=0;i<_14.length;i++){
4699var x=this.area.x+_14[i][0]*this.area.w;
4700var y=this.area.y+this.area.h;
4701ctx.beginPath();
4702ctx.moveTo(x,y);
4703ctx.lineTo(x,this.area.y);
4704ctx.closePath();
4705ctx.stroke();
4706}
4707}
2ce09b19
DV
4708this._renderLineChart();
4709this._renderLineAxis();
b2a516b8 4710};
285a6bda 4711DygraphCanvasRenderer.prototype._renderLineChart=function(){
b2a516b8
DV
4712var _17=this.element.getContext("2d");
4713var _18=this.options.colorScheme.length;
4714var _19=this.options.colorScheme;
4715var _20=MochiKit.Base.keys(this.layout.datasets);
4716var _21=this.layout.options.errorBars;
4717var _22=_20.length;
4718var _23=MochiKit.Base.bind;
4719var _24=MochiKit.Base.partial;
4720var _25=function(_26){
4721_26.canvasx=this.area.w*_26.x+this.area.x;
4722_26.canvasy=this.area.h*_26.y+this.area.y;
4723};
4724MochiKit.Iter.forEach(this.layout.points,_25,this);
4725var _27=function(ctx){
4726for(var i=0;i<_22;i++){
4727var _28=_20[i];
4728var _29=_19[i%_18];
4729var _30=this.options.strokeColorTransform;
4730_17.save();
4731_17.strokeStyle=_29.toRGBString();
4732_17.lineWidth=this.options.strokeWidth;
4733ctx.beginPath();
4734var _31=this.layout.points[0];
4735var _32=true;
4736var _33=function(_34,_31){
4737if(_31.name==_28){
4738if(_32){
4739_34.moveTo(_31.canvasx,_31.canvasy);
4740}else{
4741_34.lineTo(_31.canvasx,_31.canvasy);
4742}
4743_32=false;
4744}
4745};
4746MochiKit.Iter.forEach(this.layout.points,_24(_33,ctx),this);
4747ctx.stroke();
4748}
4749};
4750var _35=function(ctx){
4751for(var i=0;i<_22;i++){
4752var _36=_20[i];
4753var _37=_19[i%_18];
4754var _38=this.options.strokeColorTransform;
4755_17.save();
4756_17.strokeStyle=_37.toRGBString();
4757_17.lineWidth=this.options.strokeWidth;
4758var _39=-1;
4759var _40=[-1,-1];
4760var _41=0;
4761var _42=this.layout.yscale;
4762var _43=function(_44,_45){
4763_41++;
4764if(_45.name==_36){
4765var _46=[_45.y-_45.errorPlus*_42,_45.y+_45.errorMinus*_42];
4766_46[0]=this.area.h*_46[0]+this.area.y;
4767_46[1]=this.area.h*_46[1]+this.area.y;
4768if(_39>=0){
4769_44.moveTo(_39,_40[0]);
4770_44.lineTo(_45.canvasx,_46[0]);
4771_44.lineTo(_45.canvasx,_46[1]);
4772_44.lineTo(_39,_40[1]);
4773_44.closePath();
4774}
4775_40[0]=_46[0];
4776_40[1]=_46[1];
4777_39=_45.canvasx;
4778}
4779};
4780var _47=_37.colorWithAlpha(0.15);
4781ctx.fillStyle=_47.toRGBString();
4782ctx.beginPath();
4783MochiKit.Iter.forEach(this.layout.points,_24(_43,ctx),this);
4784ctx.fill();
4785}
6a1aa64f 4786};
b2a516b8
DV
4787if(_21){
4788_23(_35,this)(_17);
4789}
4790_23(_27,this)(_17);
4791_17.restore();
6a1aa64f 4792};
285a6bda 4793Dygraph=function(div,_49,_50){
b2a516b8 4794if(arguments.length>0){
285a6bda
DV
4795if(arguments.length==4){
4796this.warn("Using deprecated four-argument dygraph constructor");
4797this.__old_init__(div,_49,arguments[2],arguments[3]);
4798}else{
4799this.__init__(div,_49,_50);
4800}
b2a516b8 4801}
6a1aa64f 4802};
285a6bda
DV
4803Dygraph.NAME="Dygraph";
4804Dygraph.VERSION="1.2";
4805Dygraph.__repr__=function(){
b2a516b8 4806return "["+this.NAME+" "+this.VERSION+"]";
6a1aa64f 4807};
285a6bda 4808Dygraph.toString=function(){
b2a516b8 4809return this.__repr__();
6a1aa64f 4810};
285a6bda
DV
4811Dygraph.DEFAULT_ROLL_PERIOD=1;
4812Dygraph.DEFAULT_WIDTH=480;
4813Dygraph.DEFAULT_HEIGHT=320;
4814Dygraph.AXIS_LINE_WIDTH=0.3;
8846615a 4815Dygraph.DEFAULT_ATTRS={highlightCircleSize:3,pixelsPerXLabel:60,pixelsPerYLabel:30,labelsDivWidth:250,labelsDivStyles:{},labelsSeparateLines:false,labelsKMB:false,strokeWidth:1,axisTickSize:3,axisLabelFontSize:14,xAxisLabelWidth:50,yAxisLabelWidth:50,rightGap:5,showRoller:false,xValueFormatter:Dygraph.dateString_,xValueParser:Dygraph.dateParser,xTicker:Dygraph.dateTicker,sigma:2,errorBars:false,fractions:false,wilsonInterval:true,customBars:false};
285a6bda
DV
4816Dygraph.DEBUG=1;
4817Dygraph.INFO=2;
4818Dygraph.WARNING=3;
4819Dygraph.ERROR=3;
4820Dygraph.prototype.__old_init__=function(div,_51,_52,_53){
4821if(_52!=null){
4822var _54=["Date"];
4823for(var i=0;i<_52.length;i++){
4824_54.push(_52[i]);
4825}
4826MochiKit.Base.update(_53,{"labels":_54});
4827}
4828this.__init__(div,_51,_53);
4829};
4830Dygraph.prototype.__init__=function(div,_55,_56){
4831if(_56==null){
4832_56={};
4833}
b2a516b8 4834this.maindiv_=div;
285a6bda
DV
4835this.file_=_55;
4836this.rollPeriod_=_56.rollPeriod||Dygraph.DEFAULT_ROLL_PERIOD;
b2a516b8 4837this.previousVerticalX_=-1;
285a6bda
DV
4838this.fractions_=_56.fractions||false;
4839this.dateWindow_=_56.dateWindow||null;
4840this.valueRange_=_56.valueRange||null;
4841this.wilsonInterval_=_56.wilsonInterval||true;
4842this.customBars_=_56.customBars||false;
caf49918 4843div.innerHTML="";
285a6bda
DV
4844if(div.style.width==""){
4845div.style.width=Dygraph.DEFAULT_WIDTH+"px";
4846}
4847if(div.style.height==""){
4848div.style.height=Dygraph.DEFAULT_HEIGHT+"px";
4849}
b2a516b8
DV
4850this.width_=parseInt(div.style.width,10);
4851this.height_=parseInt(div.style.height,10);
285a6bda
DV
4852this.user_attrs_={};
4853MochiKit.Base.update(this.user_attrs_,_56);
b8339f6e 4854this.attrs_={};
285a6bda
DV
4855MochiKit.Base.update(this.attrs_,Dygraph.DEFAULT_ATTRS);
4856this.labelsFromCSV_=(this.attr_("labels")==null);
b2a516b8 4857this.createInterface_();
285a6bda
DV
4858this.layoutOptions_={"errorBars":(this.attr_("errorBars")||this.customBars_),"xOriginIsZero":false};
4859MochiKit.Base.update(this.layoutOptions_,this.attrs_);
4860MochiKit.Base.update(this.layoutOptions_,this.user_attrs_);
4861this.layout_=new DygraphLayout(this.layoutOptions_);
8846615a 4862this.renderOptions_={colorScheme:this.colors_,strokeColor:null,axisLineWidth:Dygraph.AXIS_LINE_WIDTH};
285a6bda
DV
4863MochiKit.Base.update(this.renderOptions_,this.attrs_);
4864MochiKit.Base.update(this.renderOptions_,this.user_attrs_);
4865this.plotter_=new DygraphCanvasRenderer(this.hidden_,this.layout_,this.renderOptions_);
b2a516b8
DV
4866this.createStatusMessage_();
4867this.createRollInterface_();
4868this.createDragInterface_();
b2a516b8 4869this.start_();
6a1aa64f 4870};
285a6bda
DV
4871Dygraph.prototype.attr_=function(_57){
4872if(typeof (this.user_attrs_[_57])!="undefined"){
4873return this.user_attrs_[_57];
4874}else{
4875if(typeof (this.attrs_[_57])!="undefined"){
4876return this.attrs_[_57];
4877}else{
4878return null;
4879}
4880}
4881};
4882Dygraph.prototype.log=function(_58,_59){
4883if(typeof (console)!="undefined"){
4884switch(_58){
4885case Dygraph.DEBUG:
4886console.debug("dygraphs: "+_59);
4887break;
4888case Dygraph.INFO:
4889console.info("dygraphs: "+_59);
4890break;
4891case Dygraph.WARNING:
4892console.warn("dygraphs: "+_59);
4893break;
4894case Dygraph.ERROR:
4895console.error("dygraphs: "+_59);
4896break;
4897}
4898}
4899};
4900Dygraph.prototype.info=function(_60){
4901this.log(Dygraph.INFO,_60);
4902};
4903Dygraph.prototype.warn=function(_61){
4904this.log(Dygraph.WARNING,_61);
4905};
4906Dygraph.prototype.error=function(_62){
4907this.log(Dygraph.ERROR,_62);
4908};
4909Dygraph.prototype.rollPeriod=function(){
b2a516b8
DV
4910return this.rollPeriod_;
4911};
285a6bda
DV
4912Dygraph.prototype.createInterface_=function(){
4913var _63=this.maindiv_;
b2a516b8 4914this.graphDiv=MochiKit.DOM.DIV({style:{"width":this.width_+"px","height":this.height_+"px"}});
285a6bda
DV
4915appendChildNodes(_63,this.graphDiv);
4916var _64=MochiKit.DOM.CANVAS;
4917this.canvas_=_64({style:{"position":"absolute"},width:this.width_,height:this.height_});
b2a516b8
DV
4918appendChildNodes(this.graphDiv,this.canvas_);
4919this.hidden_=this.createPlotKitCanvas_(this.canvas_);
4920connect(this.hidden_,"onmousemove",this,function(e){
4921this.mouseMove_(e);
4922});
4923connect(this.hidden_,"onmouseout",this,function(e){
4924this.mouseOut_(e);
4925});
6a1aa64f 4926};
285a6bda 4927Dygraph.prototype.createPlotKitCanvas_=function(_66){
b2a516b8
DV
4928var h=document.createElement("canvas");
4929h.style.position="absolute";
285a6bda
DV
4930h.style.top=_66.style.top;
4931h.style.left=_66.style.left;
b2a516b8
DV
4932h.width=this.width_;
4933h.height=this.height_;
4934MochiKit.DOM.appendChildNodes(this.graphDiv,h);
4935return h;
4936};
285a6bda
DV
4937Dygraph.prototype.setColors_=function(){
4938var num=this.attr_("labels").length-1;
b2a516b8 4939this.colors_=[];
285a6bda
DV
4940var _69=this.attr_("colors");
4941if(!_69){
4942var sat=this.attr_("colorSaturation")||1;
4943var val=this.attr_("colorValue")||0.5;
b2a516b8
DV
4944for(var i=1;i<=num;i++){
4945var hue=(1*i/(1+num));
4946this.colors_.push(MochiKit.Color.Color.fromHSV(hue,sat,val));
4947}
4948}else{
4949for(var i=0;i<num;i++){
285a6bda
DV
4950var _73=_69[i%_69.length];
4951this.colors_.push(MochiKit.Color.Color.fromString(_73));
b2a516b8 4952}
b2a516b8 4953}
285a6bda
DV
4954this.renderOptions_.colorScheme=this.colors_;
4955MochiKit.Base.update(this.plotter_.options,this.renderOptions_);
4956MochiKit.Base.update(this.layoutOptions_,this.user_attrs_);
4957MochiKit.Base.update(this.layoutOptions_,this.attrs_);
b2a516b8 4958};
285a6bda
DV
4959Dygraph.prototype.createStatusMessage_=function(){
4960if(!this.attr_("labelsDiv")){
4961var _74=this.attr_("labelsDivWidth");
8846615a 4962var _75={"style":{"position":"absolute","fontSize":"14px","zIndex":10,"width":_74+"px","top":"0px","left":(this.width_-_74-2)+"px","background":"white","textAlign":"left","overflow":"hidden"}};
285a6bda
DV
4963MochiKit.Base.update(_75["style"],this.attr_("labelsDivStyles"));
4964var div=MochiKit.DOM.DIV(_75);
4965MochiKit.DOM.appendChildNodes(this.graphDiv,div);
4966this.attrs_.labelsDiv=div;
4967}
4968};
4969Dygraph.prototype.createRollInterface_=function(){
8846615a
DV
4970var _76=this.attr_("showRoller")?"block":"none";
4971var _77={"type":"text","size":"2","value":this.rollPeriod_,"style":{"position":"absolute","zIndex":10,"top":(this.plotter_.area.h-25)+"px","left":(this.plotter_.area.x+1)+"px","display":_76}};
4972var _78=MochiKit.DOM.INPUT(_77);
b2a516b8 4973var pa=this.graphDiv;
8846615a
DV
4974MochiKit.DOM.appendChildNodes(pa,_78);
4975connect(_78,"onchange",this,function(){
4976this.adjustRoll(_78.value);
b2a516b8 4977});
8846615a 4978return _78;
285a6bda
DV
4979};
4980Dygraph.prototype.createDragInterface_=function(){
8846615a
DV
4981var _80=this;
4982var _81=false;
4983var _82=null;
285a6bda
DV
4984var _83=null;
4985var _84=null;
4986var _85=null;
4987var _86=null;
353a0294
DV
4988var px=0;
4989var py=0;
8846615a 4990var _89=function(e){
b2a516b8
DV
4991return e.mouse().page.x-px;
4992};
8846615a 4993var _90=function(e){
b2a516b8
DV
4994return e.mouse().page.y-py;
4995};
8846615a
DV
4996connect(this.hidden_,"onmousemove",function(_91){
4997if(_81){
4998_84=_89(_91);
4999_85=_90(_91);
5000_80.drawZoomRect_(_82,_84,_86);
5001_86=_84;
6a1aa64f 5002}
b2a516b8 5003});
8846615a
DV
5004connect(this.hidden_,"onmousedown",function(_92){
5005_81=true;
5006px=PlotKit.Base.findPosX(_80.canvas_);
5007py=PlotKit.Base.findPosY(_80.canvas_);
5008_82=_89(_92);
5009_83=_90(_92);
b2a516b8 5010});
8846615a
DV
5011connect(document,"onmouseup",this,function(_93){
5012if(_81){
5013_81=false;
5014_82=null;
285a6bda 5015_83=null;
6a1aa64f 5016}
b2a516b8 5017});
8846615a
DV
5018connect(this.hidden_,"onmouseout",this,function(_94){
5019if(_81){
5020_84=null;
285a6bda 5021_85=null;
6a1aa64f 5022}
b2a516b8 5023});
8846615a
DV
5024connect(this.hidden_,"onmouseup",this,function(_95){
5025if(_81){
5026_81=false;
5027_84=_89(_95);
5028_85=_90(_95);
5029var _96=Math.abs(_84-_82);
285a6bda 5030var _97=Math.abs(_85-_83);
8846615a
DV
5031if(_96<2&&_97<2&&_80.attr_("clickCallback")!=null&&_80.lastx_!=undefined){
5032_80.attr_("clickCallback")(_95,new Date(_80.lastx_));
6a1aa64f 5033}
8846615a
DV
5034if(_96>=10){
5035_80.doZoom_(Math.min(_82,_84),Math.max(_82,_84));
b2a516b8 5036}else{
8846615a 5037_80.canvas_.getContext("2d").clearRect(0,0,_80.canvas_.width,_80.canvas_.height);
b2a516b8 5038}
8846615a 5039_82=null;
285a6bda 5040_83=null;
b2a516b8
DV
5041}
5042});
8846615a
DV
5043connect(this.hidden_,"ondblclick",this,function(_98){
5044_80.dateWindow_=null;
5045_80.drawGraph_(_80.rawData_);
5046var _99=_80.rawData_[0][0];
5047var _100=_80.rawData_[_80.rawData_.length-1][0];
5048if(_80.attr_("zoomCallback")){
5049_80.attr_("zoomCallback")(_99,_100);
67e650dc 5050}
b2a516b8 5051});
6a1aa64f 5052};
8846615a 5053Dygraph.prototype.drawZoomRect_=function(_101,endX,_103){
b2a516b8 5054var ctx=this.canvas_.getContext("2d");
8846615a
DV
5055if(_103){
5056ctx.clearRect(Math.min(_101,_103),0,Math.abs(_101-_103),this.height_);
b2a516b8 5057}
8846615a 5058if(endX&&_101){
b2a516b8 5059ctx.fillStyle="rgba(128,128,128,0.33)";
8846615a 5060ctx.fillRect(Math.min(_101,endX),0,Math.abs(endX-_101),this.height_);
b2a516b8
DV
5061}
5062};
8846615a
DV
5063Dygraph.prototype.doZoom_=function(lowX,_105){
5064var _106=this.layout_.points;
5065var _107=null;
285a6bda 5066var _108=null;
8846615a
DV
5067for(var i=0;i<_106.length;i++){
5068var cx=_106[i].canvasx;
5069var x=_106[i].xval;
5070if(cx<lowX&&(_107==null||x>_107)){
5071_107=x;
5072}
5073if(cx>_105&&(_108==null||x<_108)){
285a6bda 5074_108=x;
b2a516b8
DV
5075}
5076}
8846615a
DV
5077if(_107==null){
5078_107=_106[0].xval;
b2a516b8 5079}
285a6bda 5080if(_108==null){
8846615a 5081_108=_106[_106.length-1].xval;
b2a516b8 5082}
8846615a 5083this.dateWindow_=[_107,_108];
b2a516b8 5084this.drawGraph_(this.rawData_);
285a6bda 5085if(this.attr_("zoomCallback")){
8846615a 5086this.attr_("zoomCallback")(_107,_108);
67e650dc 5087}
b2a516b8 5088};
8846615a
DV
5089Dygraph.prototype.mouseMove_=function(_110){
5090var _111=_110.mouse().page.x-PlotKit.Base.findPosX(this.hidden_);
5091var _112=this.layout_.points;
5092var _113=-1;
285a6bda 5093var _114=-1;
8846615a 5094var _115=1e+100;
b2a516b8 5095var idx=-1;
8846615a
DV
5096for(var i=0;i<_112.length;i++){
5097var dist=Math.abs(_112[i].canvasx-_111);
5098if(dist>_115){
b2a516b8
DV
5099break;
5100}
8846615a 5101_115=dist;
b2a516b8
DV
5102idx=i;
5103}
5104if(idx>=0){
8846615a 5105_113=_112[idx].xval;
b2a516b8 5106}
8846615a
DV
5107if(_111>_112[_112.length-1].canvasx){
5108_113=_112[_112.length-1].xval;
b2a516b8 5109}
8846615a
DV
5110var _118=[];
5111for(var i=0;i<_112.length;i++){
5112if(_112[i].xval==_113){
5113_118.push(_112[i]);
b2a516b8
DV
5114}
5115}
8846615a 5116var _119=this.attr_("highlightCircleSize");
b2a516b8
DV
5117var ctx=this.canvas_.getContext("2d");
5118if(this.previousVerticalX_>=0){
5119var px=this.previousVerticalX_;
8846615a 5120ctx.clearRect(px-_119-1,0,2*_119+2,this.height_);
b2a516b8 5121}
8846615a
DV
5122if(_118.length>0){
5123var _111=_118[0].canvasx;
5124var _120=this.attr_("xValueFormatter")(_113,this)+":";
b2a516b8 5125var clen=this.colors_.length;
8846615a 5126for(var i=0;i<_118.length;i++){
285a6bda 5127if(this.attr_("labelsSeparateLines")){
8846615a 5128_120+="<br/>";
b2a516b8 5129}
8846615a
DV
5130var _122=_118[i];
5131_120+=" <b><font color='"+this.colors_[i%clen].toHexString()+"'>"+_122.name+"</font></b>:"+this.round_(_122.yval,2);
b2a516b8 5132}
8846615a
DV
5133this.attr_("labelsDiv").innerHTML=_120;
5134this.lastx_=_113;
b2a516b8 5135ctx.save();
8846615a 5136for(var i=0;i<_118.length;i++){
b2a516b8
DV
5137ctx.beginPath();
5138ctx.fillStyle=this.colors_[i%clen].toRGBString();
8846615a 5139ctx.arc(_111,_118[i%clen].canvasy,_119,0,360,false);
b2a516b8
DV
5140ctx.fill();
5141}
5142ctx.restore();
8846615a 5143this.previousVerticalX_=_111;
b2a516b8 5144}
6a1aa64f 5145};
8846615a 5146Dygraph.prototype.mouseOut_=function(_123){
b2a516b8
DV
5147var ctx=this.canvas_.getContext("2d");
5148ctx.clearRect(0,0,this.width_,this.height_);
285a6bda 5149this.attr_("labelsDiv").innerHTML="";
6a1aa64f 5150};
285a6bda 5151Dygraph.zeropad=function(x){
6372d433
DV
5152if(x<10){
5153return "0"+x;
5154}else{
5155return ""+x;
5156}
5157};
285a6bda 5158Dygraph.prototype.hmsString_=function(date){
8846615a 5159var _125=Dygraph.zeropad;
6372d433
DV
5160var d=new Date(date);
5161if(d.getSeconds()){
8846615a 5162return _125(d.getHours())+":"+_125(d.getMinutes())+":"+_125(d.getSeconds());
6372d433
DV
5163}else{
5164if(d.getMinutes()){
8846615a 5165return _125(d.getHours())+":"+_125(d.getMinutes());
6372d433 5166}else{
8846615a 5167return _125(d.getHours());
6372d433
DV
5168}
5169}
5170};
285a6bda 5171Dygraph.dateString_=function(date,self){
8846615a 5172var _128=Dygraph.zeropad;
b2a516b8
DV
5173var d=new Date(date);
5174var year=""+d.getFullYear();
8846615a
DV
5175var _130=_128(d.getMonth()+1);
5176var day=_128(d.getDate());
6372d433
DV
5177var ret="";
5178var frac=d.getHours()*3600+d.getMinutes()*60+d.getSeconds();
5179if(frac){
285a6bda 5180ret=" "+self.hmsString_(date);
b2a516b8 5181}
8846615a 5182return year+"/"+_130+"/"+day+ret;
6a1aa64f 5183};
8846615a
DV
5184Dygraph.prototype.round_=function(num,_134){
5185var _135=Math.pow(10,_134);
5186return Math.round(num*_135)/_135;
6a1aa64f 5187};
285a6bda 5188Dygraph.prototype.loadedEvent_=function(data){
b2a516b8
DV
5189this.rawData_=this.parseCSV_(data);
5190this.drawGraph_(this.rawData_);
6a1aa64f 5191};
285a6bda
DV
5192Dygraph.prototype.months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
5193Dygraph.prototype.quarters=["Jan","Apr","Jul","Oct"];
5194Dygraph.prototype.addXTicks_=function(){
8846615a 5195var _137,endDate;
b2a516b8 5196if(this.dateWindow_){
8846615a 5197_137=this.dateWindow_[0];
b2a516b8
DV
5198endDate=this.dateWindow_[1];
5199}else{
8846615a 5200_137=this.rawData_[0][0];
b2a516b8
DV
5201endDate=this.rawData_[this.rawData_.length-1][0];
5202}
8846615a
DV
5203var _138=this.attr_("xTicker")(_137,endDate,this);
5204this.layout_.updateOptions({xTicks:_138});
285a6bda
DV
5205};
5206Dygraph.SECONDLY=0;
5207Dygraph.TEN_SECONDLY=1;
5208Dygraph.THIRTY_SECONDLY=2;
5209Dygraph.MINUTELY=3;
5210Dygraph.TEN_MINUTELY=4;
5211Dygraph.THIRTY_MINUTELY=5;
5212Dygraph.HOURLY=6;
5213Dygraph.SIX_HOURLY=7;
5214Dygraph.DAILY=8;
5215Dygraph.WEEKLY=9;
5216Dygraph.MONTHLY=10;
5217Dygraph.QUARTERLY=11;
5218Dygraph.BIANNUAL=12;
5219Dygraph.ANNUAL=13;
5220Dygraph.DECADAL=14;
5221Dygraph.NUM_GRANULARITIES=15;
5222Dygraph.SHORT_SPACINGS=[];
5223Dygraph.SHORT_SPACINGS[Dygraph.SECONDLY]=1000*1;
5224Dygraph.SHORT_SPACINGS[Dygraph.TEN_SECONDLY]=1000*10;
5225Dygraph.SHORT_SPACINGS[Dygraph.THIRTY_SECONDLY]=1000*30;
5226Dygraph.SHORT_SPACINGS[Dygraph.MINUTELY]=1000*60;
5227Dygraph.SHORT_SPACINGS[Dygraph.TEN_MINUTELY]=1000*60*10;
5228Dygraph.SHORT_SPACINGS[Dygraph.THIRTY_MINUTELY]=1000*60*30;
5229Dygraph.SHORT_SPACINGS[Dygraph.HOURLY]=1000*3600;
5230Dygraph.SHORT_SPACINGS[Dygraph.HOURLY]=1000*3600*6;
5231Dygraph.SHORT_SPACINGS[Dygraph.DAILY]=1000*86400;
5232Dygraph.SHORT_SPACINGS[Dygraph.WEEKLY]=1000*604800;
8846615a
DV
5233Dygraph.prototype.NumXTicks=function(_139,_140,_141){
5234if(_141<Dygraph.MONTHLY){
5235var _142=Dygraph.SHORT_SPACINGS[_141];
5236return Math.floor(0.5+1*(_140-_139)/_142);
285a6bda 5237}else{
8846615a
DV
5238var _143=1;
5239var _144=12;
5240if(_141==Dygraph.QUARTERLY){
5241_144=3;
285a6bda 5242}
8846615a
DV
5243if(_141==Dygraph.BIANNUAL){
5244_144=2;
285a6bda 5245}
8846615a
DV
5246if(_141==Dygraph.ANNUAL){
5247_144=1;
285a6bda 5248}
8846615a
DV
5249if(_141==Dygraph.DECADAL){
5250_144=1;
5251_143=10;
285a6bda 5252}
8846615a
DV
5253var _145=365.2524*24*3600*1000;
5254var _146=1*(_140-_139)/_145;
5255return Math.floor(0.5+1*_146*_144/_143);
285a6bda
DV
5256}
5257};
8846615a
DV
5258Dygraph.prototype.GetXAxis=function(_147,_148,_149){
5259var _150=[];
5260if(_149<Dygraph.MONTHLY){
5261var _151=Dygraph.SHORT_SPACINGS[_149];
5262var _152="%d%b";
5263if(_149<Dygraph.HOURLY){
5264_147=_151*Math.floor(0.5+_147/_151);
285a6bda 5265}
8846615a 5266for(var t=_147;t<=_148;t+=_151){
36615faf
DV
5267var d=new Date(t);
5268var frac=d.getHours()*3600+d.getMinutes()*60+d.getSeconds();
8846615a
DV
5269if(frac==0||_149>=Dygraph.DAILY){
5270_150.push({v:t,label:new Date(t+3600*1000).strftime(_152)});
b2a516b8 5271}else{
8846615a 5272_150.push({v:t,label:this.hmsString_(t)});
36615faf
DV
5273}
5274}
b2a516b8 5275}else{
8846615a
DV
5276var _154;
5277var _155=1;
5278if(_149==Dygraph.MONTHLY){
5279_154=[0,1,2,3,4,5,6,7,8,9,10,11,12];
b2a516b8 5280}else{
8846615a
DV
5281if(_149==Dygraph.QUARTERLY){
5282_154=[0,3,6,9];
b2a516b8 5283}else{
8846615a
DV
5284if(_149==Dygraph.BIANNUAL){
5285_154=[0,6];
b2a516b8 5286}else{
8846615a
DV
5287if(_149==Dygraph.ANNUAL){
5288_154=[0];
6372d433 5289}else{
8846615a
DV
5290if(_149==Dygraph.DECADAL){
5291_154=[0];
5292_155=10;
b2a516b8
DV
5293}
5294}
5295}
5296}
6372d433 5297}
8846615a 5298var _156=new Date(_147).getFullYear();
285a6bda 5299var _157=new Date(_148).getFullYear();
8846615a
DV
5300var _158=Dygraph.zeropad;
5301for(var i=_156;i<=_157;i++){
5302if(i%_155!=0){
36615faf 5303continue;
6372d433 5304}
8846615a
DV
5305for(var j=0;j<_154.length;j++){
5306var _159=i+"/"+_158(1+_154[j])+"/01";
5307var t=Date.parse(_159);
5308if(t<_147||t>_148){
b2a516b8
DV
5309continue;
5310}
8846615a 5311_150.push({v:t,label:new Date(t).strftime("%b %y")});
b2a516b8
DV
5312}
5313}
b2a516b8 5314}
8846615a 5315return _150;
36615faf 5316};
8846615a
DV
5317Dygraph.dateTicker=function(_160,_161,self){
5318var _162=-1;
285a6bda 5319for(var i=0;i<Dygraph.NUM_GRANULARITIES;i++){
8846615a
DV
5320var _163=self.NumXTicks(_160,_161,i);
5321if(self.width_/_163>=self.attr_("pixelsPerXLabel")){
5322_162=i;
36615faf
DV
5323break;
5324}
b2a516b8 5325}
8846615a
DV
5326if(_162>=0){
5327return self.GetXAxis(_160,_161,_162);
36615faf 5328}else{
6372d433 5329}
6a1aa64f 5330};
285a6bda 5331Dygraph.numericTicks=function(minV,maxV,self){
8846615a
DV
5332var _166=[1,2,5];
5333var _167,low_val,high_val,nTicks;
5334var _168=self.attr_("pixelsPerYLabel");
2ce09b19 5335for(var i=-10;i<50;i++){
8846615a
DV
5336var _169=Math.pow(10,i);
5337for(var j=0;j<_166.length;j++){
5338_167=_169*_166[j];
5339low_val=Math.floor(minV/_167)*_167;
5340high_val=Math.ceil(maxV/_167)*_167;
5341nTicks=(high_val-low_val)/_167;
5342var _170=self.height_/nTicks;
5343if(_170>_168){
2ce09b19 5344break;
6a1aa64f 5345}
b2a516b8 5346}
8846615a 5347if(_170>_168){
2ce09b19 5348break;
b2a516b8 5349}
2ce09b19 5350}
8846615a 5351var _171=[];
2ce09b19 5352for(var i=0;i<nTicks;i++){
8846615a
DV
5353var _172=low_val+i*_167;
5354var _173=self.round_(_172,2);
285a6bda 5355if(self.attr_("labelsKMB")){
b2a516b8 5356var k=1000;
8846615a
DV
5357if(_172>=k*k*k){
5358_173=self.round_(_172/(k*k*k),1)+"B";
b2a516b8 5359}else{
8846615a
DV
5360if(_172>=k*k){
5361_173=self.round_(_172/(k*k),1)+"M";
b2a516b8 5362}else{
8846615a
DV
5363if(_172>=k){
5364_173=self.round_(_172/k,1)+"K";
b2a516b8
DV
5365}
5366}
5367}
5368}
8846615a 5369_171.push({label:_173,v:_172});
b2a516b8 5370}
8846615a 5371return _171;
6a1aa64f 5372};
285a6bda 5373Dygraph.prototype.addYTicks_=function(minY,maxY){
8846615a
DV
5374var _177=Dygraph.numericTicks(minY,maxY,this);
5375this.layout_.updateOptions({yAxis:[minY,maxY],yTicks:_177});
6a1aa64f 5376};
285a6bda 5377Dygraph.prototype.drawGraph_=function(data){
b2a516b8
DV
5378var maxY=null;
5379this.layout_.removeAllDatasets();
285a6bda 5380this.setColors_();
b2a516b8 5381for(var i=1;i<data[0].length;i++){
8846615a 5382var _178=[];
b2a516b8
DV
5383for(var j=0;j<data.length;j++){
5384var date=data[j][0];
8846615a 5385_178[j]=[date,data[j][i]];
b2a516b8 5386}
8846615a 5387_178=this.rollingAverage(_178,this.rollPeriod_);
285a6bda 5388var bars=this.attr_("errorBars")||this.customBars_;
b2a516b8
DV
5389if(this.dateWindow_){
5390var low=this.dateWindow_[0];
5391var high=this.dateWindow_[1];
8846615a
DV
5392var _182=[];
5393for(var k=0;k<_178.length;k++){
5394if(_178[k][0]>=low&&_178[k][0]<=high){
5395_182.push(_178[k]);
5396var y=bars?_178[k][1][0]:_178[k][1];
b2a516b8
DV
5397if(maxY==null||y>maxY){
5398maxY=y;
5399}
5400}
5401}
8846615a 5402_178=_182;
285a6bda
DV
5403}else{
5404if(!this.customBars_){
8846615a
DV
5405for(var j=0;j<_178.length;j++){
5406var y=bars?_178[j][1][0]:_178[j][1];
285a6bda 5407if(maxY==null||y>maxY){
8846615a 5408maxY=bars?y+_178[j][1][1]:y;
285a6bda
DV
5409}
5410}
b2a516b8 5411}else{
8846615a
DV
5412for(var j=0;j<_178.length;j++){
5413var y=_178[j][1][0];
5414var high=_178[j][1][2];
285a6bda
DV
5415if(high>y){
5416y=high;
5417}
b2a516b8 5418if(maxY==null||y>maxY){
285a6bda
DV
5419maxY=y;
5420}
b2a516b8
DV
5421}
5422}
5423}
5424if(bars){
5425var vals=[];
8846615a
DV
5426for(var j=0;j<_178.length;j++){
5427vals[j]=[_178[j][0],_178[j][1][0],_178[j][1][1],_178[j][1][2]];
b2a516b8 5428}
285a6bda 5429this.layout_.addDataset(this.attr_("labels")[i],vals);
b2a516b8 5430}else{
8846615a 5431this.layout_.addDataset(this.attr_("labels")[i],_178);
b2a516b8
DV
5432}
5433}
5434if(this.valueRange_!=null){
5435this.addYTicks_(this.valueRange_[0],this.valueRange_[1]);
5436}else{
5437maxY*=1.1;
5438if(maxY<=0){
5439maxY=1;
b2a516b8
DV
5440}
5441this.addYTicks_(0,maxY);
5442}
5443this.addXTicks_();
5444this.layout_.evaluateWithError();
5445this.plotter_.clear();
5446this.plotter_.render();
5447this.canvas_.getContext("2d").clearRect(0,0,this.canvas_.width,this.canvas_.height);
6a1aa64f 5448};
8846615a
DV
5449Dygraph.prototype.rollingAverage=function(_184,_185){
5450if(_184.length<2){
5451return _184;
b2a516b8 5452}
8846615a
DV
5453var _185=Math.min(_185,_184.length-1);
5454var _186=[];
5455var _187=this.attr_("sigma");
b2a516b8
DV
5456if(this.fractions_){
5457var num=0;
5458var den=0;
5459var mult=100;
8846615a
DV
5460for(var i=0;i<_184.length;i++){
5461num+=_184[i][1][0];
5462den+=_184[i][1][1];
5463if(i-_185>=0){
5464num-=_184[i-_185][1][0];
5465den-=_184[i-_185][1][1];
5466}
5467var date=_184[i][0];
5468var _190=den?num/den:0;
285a6bda 5469if(this.attr_("errorBars")){
b2a516b8
DV
5470if(this.wilsonInterval_){
5471if(den){
8846615a
DV
5472var p=_190<0?0:_190,n=den;
5473var pm=_187*Math.sqrt(p*(1-p)/n+_187*_187/(4*n*n));
5474var _193=1+_187*_187/den;
5475var low=(p+_187*_187/(2*den)-pm)/_193;
5476var high=(p+_187*_187/(2*den)+pm)/_193;
5477_186[i]=[date,[p*mult,(p-low)*mult,(high-p)*mult]];
b2a516b8 5478}else{
8846615a 5479_186[i]=[date,[0,0,0]];
b2a516b8
DV
5480}
5481}else{
8846615a
DV
5482var _194=den?_187*Math.sqrt(_190*(1-_190)/den):1;
5483_186[i]=[date,[mult*_190,mult*_194,mult*_194]];
b2a516b8
DV
5484}
5485}else{
8846615a 5486_186[i]=[date,mult*_190];
b2a516b8
DV
5487}
5488}
5489}else{
5490if(this.customBars_){
6372d433
DV
5491var low=0;
5492var mid=0;
5493var high=0;
8846615a
DV
5494var _196=0;
5495for(var i=0;i<_184.length;i++){
5496var data=_184[i][1];
b2a516b8 5497var y=data[1];
8846615a 5498_186[i]=[_184[i][0],[y,y-data[0],data[2]-y]];
6372d433
DV
5499low+=data[0];
5500mid+=y;
5501high+=data[2];
8846615a
DV
5502_196+=1;
5503if(i-_185>=0){
5504var prev=_184[i-_185];
6372d433
DV
5505low-=prev[1][0];
5506mid-=prev[1][1];
5507high-=prev[1][2];
8846615a 5508_196-=1;
6372d433 5509}
8846615a 5510_186[i]=[_184[i][0],[1*mid/_196,1*(mid-low)/_196,1*(high-mid)/_196]];
6372d433
DV
5511}
5512}else{
8846615a 5513var _198=Math.min(_185-1,_184.length-2);
285a6bda 5514if(!this.attr_("errorBars")){
8846615a 5515for(var i=0;i<_198;i++){
b2a516b8
DV
5516var sum=0;
5517for(var j=0;j<i+1;j++){
8846615a 5518sum+=_184[j][1];
b2a516b8 5519}
8846615a 5520_186[i]=[_184[i][0],sum/(i+1)];
b2a516b8 5521}
8846615a 5522for(var i=Math.min(_185-1,_184.length-2);i<_184.length;i++){
b2a516b8 5523var sum=0;
8846615a
DV
5524for(var j=i-_185+1;j<i+1;j++){
5525sum+=_184[j][1];
b2a516b8 5526}
8846615a 5527_186[i]=[_184[i][0],sum/_185];
b2a516b8
DV
5528}
5529}else{
8846615a 5530for(var i=0;i<_198;i++){
b2a516b8 5531var sum=0;
8846615a 5532var _200=0;
b2a516b8 5533for(var j=0;j<i+1;j++){
8846615a
DV
5534sum+=_184[j][1][0];
5535_200+=Math.pow(_184[j][1][1],2);
b2a516b8 5536}
8846615a
DV
5537var _194=Math.sqrt(_200)/(i+1);
5538_186[i]=[_184[i][0],[sum/(i+1),_187*_194,_187*_194]];
b2a516b8 5539}
8846615a 5540for(var i=Math.min(_185-1,_184.length-2);i<_184.length;i++){
b2a516b8 5541var sum=0;
8846615a
DV
5542var _200=0;
5543for(var j=i-_185+1;j<i+1;j++){
5544sum+=_184[j][1][0];
5545_200+=Math.pow(_184[j][1][1],2);
b2a516b8 5546}
8846615a
DV
5547var _194=Math.sqrt(_200)/_185;
5548_186[i]=[_184[i][0],[sum/_185,_187*_194,_187*_194]];
b2a516b8
DV
5549}
5550}
5551}
5552}
8846615a 5553return _186;
6a1aa64f 5554};
8846615a
DV
5555Dygraph.dateParser=function(_201,self){
5556var _202;
285a6bda 5557var d;
8846615a
DV
5558if(_201.length==10&&_201.search("-")!=-1){
5559_202=_201.replace("-","/","g");
5560while(_202.search("-")!=-1){
5561_202=_202.replace("-","/");
353a0294 5562}
8846615a 5563d=Date.parse(_202);
b2a516b8 5564}else{
8846615a
DV
5565if(_201.length==8){
5566_202=_201.substr(0,4)+"/"+_201.substr(4,2)+"/"+_201.substr(6,2);
285a6bda 5567d=Date.parse(_202);
8846615a
DV
5568}else{
5569d=Date.parse(_201);
285a6bda 5570}
b2a516b8 5571}
285a6bda 5572if(!d||isNaN(d)){
8846615a 5573self.error("Couldn't parse "+_201+" as a date");
b2a516b8 5574}
285a6bda 5575return d;
6a1aa64f 5576};
285a6bda 5577Dygraph.prototype.detectTypeFromString_=function(str){
8846615a 5578var _204=false;
285a6bda 5579if(str.indexOf("-")>=0||str.indexOf("/")>=0||isNaN(parseFloat(str))){
8846615a 5580_204=true;
285a6bda
DV
5581}else{
5582if(str.length==8&&str>"19700101"&&str<"20371231"){
8846615a 5583_204=true;
285a6bda
DV
5584}
5585}
8846615a 5586if(_204){
285a6bda
DV
5587this.attrs_.xValueFormatter=Dygraph.dateString_;
5588this.attrs_.xValueParser=Dygraph.dateParser;
5589this.attrs_.xTicker=Dygraph.dateTicker;
5590}else{
5591this.attrs_.xValueFormatter=function(x){
5592return x;
5593};
5594this.attrs_.xValueParser=function(x){
5595return parseFloat(x);
5596};
5597this.attrs_.xTicker=Dygraph.numericTicks;
5598}
5599};
5600Dygraph.prototype.parseCSV_=function(data){
b2a516b8 5601var ret=[];
8846615a
DV
5602var _205=data.split("\n");
5603var _206=0;
b2a516b8 5604if(this.labelsFromCSV_){
8846615a
DV
5605_206=1;
5606this.attrs_.labels=_205[0].split(",");
5607}
5608var _207;
5609var _208=false;
5610var _209=this.attr_("labels").length;
5611for(var i=_206;i<_205.length;i++){
5612var line=_205[i];
b2a516b8
DV
5613if(line.length==0){
5614continue;
5615}
8846615a
DV
5616var _211=line.split(",");
5617if(_211.length<2){
b2a516b8
DV
5618continue;
5619}
8846615a
DV
5620var _212=[];
5621if(!_208){
5622this.detectTypeFromString_(_211[0]);
5623_207=this.attr_("xValueParser");
5624_208=true;
285a6bda 5625}
8846615a 5626_212[0]=_207(_211[0],this);
b2a516b8 5627if(this.fractions_){
8846615a
DV
5628for(var j=1;j<_211.length;j++){
5629var vals=_211[j].split("/");
5630_212[j]=[parseFloat(vals[0]),parseFloat(vals[1])];
b2a516b8
DV
5631}
5632}else{
285a6bda 5633if(this.attr_("errorBars")){
8846615a
DV
5634for(var j=1;j<_211.length;j+=2){
5635_212[(j+1)/2]=[parseFloat(_211[j]),parseFloat(_211[j+1])];
b2a516b8
DV
5636}
5637}else{
5638if(this.customBars_){
8846615a
DV
5639for(var j=1;j<_211.length;j++){
5640var vals=_211[j].split(";");
5641_212[j]=[parseFloat(vals[0]),parseFloat(vals[1]),parseFloat(vals[2])];
b2a516b8
DV
5642}
5643}else{
8846615a
DV
5644for(var j=1;j<_211.length;j++){
5645_212[j]=parseFloat(_211[j]);
285a6bda 5646}
b2a516b8
DV
5647}
5648}
5649}
8846615a
DV
5650ret.push(_212);
5651if(_212.length!=_209){
5652this.error("Number of columns in line "+i+" ("+_212.length+") does not agree with number of labels ("+_209+") "+line);
b2a516b8 5653}
b2a516b8
DV
5654}
5655return ret;
6a1aa64f 5656};
285a6bda
DV
5657Dygraph.prototype.parseArray_=function(data){
5658if(data.length==0){
5659this.error("Can't plot empty data set");
5660return null;
5661}
5662if(data[0].length==0){
5663this.error("Data set cannot contain an empty row");
5664return null;
5665}
5666if(this.attr_("labels")==null){
5667this.warn("Using default labels. Set labels explicitly via 'labels' "+"in the options parameter");
5668this.attrs_.labels=["X"];
5669for(var i=1;i<data[0].length;i++){
5670this.attrs_.labels.push("Y"+i);
5671}
5672}
5673if(MochiKit.Base.isDateLike(data[0][0])){
5674this.attrs_.xValueFormatter=Dygraph.dateString_;
5675this.attrs_.xTicker=Dygraph.dateTicker;
8846615a 5676var _213=MochiKit.Base.clone(data);
285a6bda 5677for(var i=0;i<data.length;i++){
8846615a 5678if(_213[i].length==0){
285a6bda
DV
5679this.error("Row "<<(1+i)<<" of data is empty");
5680return null;
5681}
8846615a 5682if(_213[i][0]==null||typeof (_213[i][0].getTime)!="function"){
285a6bda
DV
5683this.error("x value in row "<<(1+i)<<" is not a Date");
5684return null;
5685}
8846615a 5686_213[i][0]=_213[i][0].getTime();
285a6bda 5687}
8846615a 5688return _213;
285a6bda
DV
5689}else{
5690this.attrs_.xValueFormatter=function(x){
5691return x;
5692};
5693this.attrs_.xTicker=Dygraph.numericTicks;
5694return data;
5695}
5696};
5697Dygraph.prototype.parseDataTable_=function(data){
6219c9d6
DV
5698var cols=data.getNumberOfColumns();
5699var rows=data.getNumberOfRows();
8846615a 5700var _216=[];
6219c9d6 5701for(var i=0;i<cols;i++){
8846615a 5702_216.push(data.getColumnLabel(i));
6219c9d6 5703}
8846615a
DV
5704this.attrs_.labels=_216;
5705var _217=data.getColumnType(0);
5706if(_217=="date"){
285a6bda
DV
5707this.attrs_.xValueFormatter=Dygraph.dateString_;
5708this.attrs_.xValueParser=Dygraph.dateParser;
5709this.attrs_.xTicker=Dygraph.dateTicker;
5710}else{
33127159 5711if(_217=="number"){
285a6bda
DV
5712this.attrs_.xValueFormatter=function(x){
5713return x;
5714};
5715this.attrs_.xValueParser=function(x){
5716return parseFloat(x);
5717};
5718this.attrs_.xTicker=Dygraph.numericTicks;
5719}else{
33127159 5720this.error("only 'date' and 'number' types are supported for column 1 "+"of DataTable input (Got '"+_217+"')");
6219c9d6
DV
5721return null;
5722}
285a6bda 5723}
6219c9d6
DV
5724var ret=[];
5725for(var i=0;i<rows;i++){
5726var row=[];
b3b20e24
DV
5727if(!data.getValue(i,0)){
5728continue;
5729}
8846615a 5730if(_217=="date"){
6219c9d6 5731row.push(data.getValue(i,0).getTime());
36615faf
DV
5732}else{
5733row.push(data.getValue(i,0));
5734}
b3b20e24 5735var _219=false;
6219c9d6
DV
5736for(var j=1;j<cols;j++){
5737row.push(data.getValue(i,j));
b3b20e24
DV
5738if(data.getValue(i,j)){
5739_219=true;
6219c9d6 5740}
b3b20e24
DV
5741}
5742if(_219){
6219c9d6
DV
5743ret.push(row);
5744}
b3b20e24 5745}
6219c9d6
DV
5746return ret;
5747};
285a6bda 5748Dygraph.prototype.start_=function(){
b2a516b8
DV
5749if(typeof this.file_=="function"){
5750this.loadedEvent_(this.file_());
5751}else{
285a6bda
DV
5752if(MochiKit.Base.isArrayLike(this.file_)){
5753this.rawData_=this.parseArray_(this.file_);
5754this.drawGraph_(this.rawData_);
5755}else{
6219c9d6
DV
5756if(typeof this.file_=="object"&&typeof this.file_.getColumnRange=="function"){
5757this.rawData_=this.parseDataTable_(this.file_);
5758this.drawGraph_(this.rawData_);
5759}else{
285a6bda
DV
5760if(typeof this.file_=="string"){
5761if(this.file_.indexOf("\n")>=0){
5762this.loadedEvent_(this.file_);
5763}else{
b2a516b8 5764var req=new XMLHttpRequest();
b3b20e24 5765var _221=this;
b2a516b8
DV
5766req.onreadystatechange=function(){
5767if(req.readyState==4){
5768if(req.status==200){
b3b20e24 5769_221.loadedEvent_(req.responseText);
b2a516b8
DV
5770}
5771}
6a1aa64f 5772};
b2a516b8
DV
5773req.open("GET",this.file_,true);
5774req.send(null);
5775}
285a6bda
DV
5776}else{
5777this.error("Unknown data format: "+(typeof this.file_));
6219c9d6 5778}
b2a516b8 5779}
b2a516b8 5780}
b2a516b8 5781}
285a6bda 5782};
b3b20e24
DV
5783Dygraph.prototype.updateOptions=function(_222){
5784if(_222.customBars){
5785this.customBars_=_222.customBars;
b2a516b8 5786}
b3b20e24
DV
5787if(_222.rollPeriod){
5788this.rollPeriod_=_222.rollPeriod;
b2a516b8 5789}
b3b20e24
DV
5790if(_222.dateWindow){
5791this.dateWindow_=_222.dateWindow;
b2a516b8 5792}
b3b20e24
DV
5793if(_222.valueRange){
5794this.valueRange_=_222.valueRange;
b2a516b8 5795}
b3b20e24 5796MochiKit.Base.update(this.user_attrs_,_222);
285a6bda
DV
5797this.labelsFromCSV_=(this.attr_("labels")==null);
5798this.layout_.updateOptions({"errorBars":this.attr_("errorBars")});
b3b20e24
DV
5799if(_222["file"]&&_222["file"]!=this.file_){
5800this.file_=_222["file"];
b2a516b8
DV
5801this.start_();
5802}else{
5803this.drawGraph_(this.rawData_);
5804}
6a1aa64f 5805};
b3b20e24
DV
5806Dygraph.prototype.adjustRoll=function(_223){
5807this.rollPeriod_=_223;
b2a516b8 5808this.drawGraph_(this.rawData_);
6a1aa64f 5809};
b3b20e24
DV
5810Dygraph.GVizChart=function(_224){
5811this.container=_224;
6219c9d6 5812};
b3b20e24 5813Dygraph.GVizChart.prototype.draw=function(data,_225){
6219c9d6 5814this.container.innerHTML="";
b3b20e24 5815this.date_graph=new Dygraph(this.container,data,_225);
6219c9d6 5816};
285a6bda 5817DateGraph=Dygraph;
b2a516b8 5818