summaryrefslogtreecommitdiff
path: root/framework/Web/Javascripts/js/base.js
blob: 276c17bdf4efca789d6ce0bd3a2343c4732ca0d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
var Prototype={Version:"1.4.0_rc1",emptyFunction:function(){
},K:function(x){
return x;
}};

if(!Array.prototype.push){
Array.prototype.push=function(){
var _1=this.length;
for(var i=0;i<arguments.length;i++){
this[_1+i]=arguments[i];
}
return this.length;
};
}
if(!Function.prototype.apply){
Function.prototype.apply=function(_3,_4){
var _5=new Array();
if(!_3){
_3=window;
}
if(!_4){
_4=new Array();
}
for(var i=0;i<_4.length;i++){
_5[i]="parameters["+i+"]";
}
_3.__apply__=this;
var _6=eval("object.__apply__("+_5.join(", ")+")");
_3.__apply__=null;
return _6;
};
}

var Class={create:function(){
return function(){
this.initialize.apply(this,arguments);
};
}};
var Abstract=new Object();
Object.extend=function(_1,_2){
for(property in _2){
_1[property]=_2[property];
}
return _1;
};
Object.inspect=function(_3){
try{
if(_3==undefined){
return "undefined";
}
if(_3==null){
return "null";
}
return _3.inspect?_3.inspect():_3.toString();
}
catch(e){
if(e instanceof RangeError){
return "...";
}
throw e;
}
};
Function.prototype.bind=function(_4){
var _5=this;
return function(){
return _5.apply(_4,arguments);
};
};
Function.prototype.bindAsEventListener=function(_6){
var _7=this;
return function(_8){
return _7.call(_6,_8||window.event);
};
};
Object.extend(Number.prototype,{toColorPart:function(){
var _9=this.toString(16);
if(this<16){
return "0"+_9;
}
return _9;
},succ:function(){
return this+1;
},times:function(_10){
$R(0,this,true).each(_10);
return this;
}});
var Try={these:function(){
var _11;
for(var i=0;i<arguments.length;i++){
var _13=arguments[i];
try{
_11=_13();
break;
}
catch(e){
}
}
return _11;
}};
var PeriodicalExecuter=Class.create();
PeriodicalExecuter.prototype={initialize:function(_14,_15){
this.callback=_14;
this.frequency=_15;
this.currentlyExecuting=false;
this.registerCallback();
},registerCallback:function(){
setInterval(this.onTimerEvent.bind(this),this.frequency*1000);
},onTimerEvent:function(){
if(!this.currentlyExecuting){
try{
this.currentlyExecuting=true;
this.callback();
}
finally{
this.currentlyExecuting=false;
}
}
}};
function $(){
var _16=new Array();
for(var i=0;i<arguments.length;i++){
var _17=arguments[i];
if(typeof _17=="string"){
_17=document.getElementById(_17);
}
if(arguments.length==1){
return _17;
}
_16.push(_17);
}
return _16;
}

function isElement(o,_2){
return o&&isObject(o)&&((!_2&&(o==window||o==document))||o.nodeType==1);
}
function $(n,d){
if(isElement(n)){
return n;
}
if(isString(n)==false){
return null;
}
var p,i,x;
if(!d){
d=document;
}
if((p=n.indexOf("?"))>0&&parent.frames.length){
d=parent.frames[n.substring(p+1)].document;
n=n.substring(0,p);
}
if(!(x=d[n])&&d.all){
x=d.all[n];
}
for(i=0;!x&&i<d.forms.length;i++){
x=d.forms[i][n];
}
for(i=0;!x&&d.layers&&i<d.layers.length;i++){
x=DOM.find(n,d.layers[i].document);
}
if(!x&&d.getElementById){
x=d.getElementById(n);
}
return x;
}

function isAlien(a){
return isObject(a)&&typeof a.constructor!="function";
}
function isArray(a){
return isObject(a)&&a.constructor==Array;
}
function isBoolean(a){
return typeof a=="boolean";
}
function isFunction(a){
return typeof a=="function";
}
function isNull(a){
return typeof a=="object"&&!a;
}
function isNumber(a){
return typeof a=="number"&&isFinite(a);
}
function isObject(a){
return (a&&typeof a=="object")||isFunction(a);
}
function isRegexp(a){
return a&&a.constructor==RegExp;
}
function isString(a){
return typeof a=="string";
}
function isUndefined(a){
return typeof a=="undefined";
}
function isEmpty(o){
var i,v;
if(isObject(o)){
for(i in o){
v=o[i];
if(isUndefined(v)&&isFunction(v)){
return false;
}
}
}
return true;
}
function undef(v){
return isUndefined(v);
}
function isdef(v){
return !isUndefined(v);
}
function isElement(o,_5){
return o&&isObject(o)&&((!_5&&(o==window||o==document))||o.nodeType==1);
}
function isList(o){
return o&&isObject(o)&&(isArray(o)||o.item);
}

Object.extend(String.prototype,{stripTags:function(){
return this.replace(/<\/?[^>]+>/gi,"");
},escapeHTML:function(){
var _1=document.createElement("div");
var _2=document.createTextNode(this);
_1.appendChild(_2);
return _1.innerHTML;
},unescapeHTML:function(){
var _3=document.createElement("div");
_3.innerHTML=this.stripTags();
return _3.childNodes[0]?_3.childNodes[0].nodeValue:"";
},toQueryParams:function(){
var _4=this.match(/^\??(.*)$/)[1].split("&");
return _4.inject({},function(_5,_6){
var _7=_6.split("=");
_5[_7[0]]=_7[1];
return _5;
});
},toArray:function(){
return this.split("");
},camelize:function(){
var _8=this.split("-");
if(_8.length==1){
return _8[0];
}
var _9=this.indexOf("-")==0?_8[0].charAt(0).toUpperCase()+_8[0].substring(1):_8[0];
for(var i=1,len=_8.length;i<len;i++){
var s=_8[i];
_9+=s.charAt(0).toUpperCase()+s.substring(1);
}
return _9;
},inspect:function(){
return "'"+this.replace("\\","\\\\").replace("'","\\'")+"'";
}});
String.prototype.parseQuery=String.prototype.toQueryParams;

Object.extend(String.prototype,{pad:function(_1,_2,_3){
if(!_3){
_3=" ";
}
var s=this;
var _5=_1.toLowerCase()=="left";
while(s.length<_2){
s=_5?_3+s:s+_3;
}
return s;
},padLeft:function(_6,_7){
return this.pad("left",_6,_7);
},padRight:function(_8,_9){
return this.pad("right",_8,_9);
},zerofill:function(len){
var s=this;
var ix=/^[+-]/.test(s)?1:0;
while(s.length<len){
s=s.insert(ix,"0");
}
return s;
},trim:function(){
return this.replace(/^\s+|\s+$/g,"");
},trimLeft:function(){
return this.replace(/^\s+/,"");
},trimRight:function(){
return this.replace(/\s+$/,"");
}});

var $break=new Object();
var $continue=new Object();
var Enumerable={each:function(_1){
var _2=0;
try{
this._each(function(_3){
try{
_1(_3,_2++);
}
catch(e){
if(e!=$continue){
throw e;
}
}
});
}
catch(e){
if(e!=$break){
throw e;
}
}
},all:function(_4){
var _5=true;
this.each(function(_6,_7){
if(!(_5&=(_4||Prototype.K)(_6,_7))){
throw $break;
}
});
return _5;
},any:function(_8){
var _9=true;
this.each(function(_10,_11){
if(_9&=(_8||Prototype.K)(_10,_11)){
throw $break;
}
});
return _9;
},collect:function(_12){
var _13=[];
this.each(function(_14,_15){
_13.push(_12(_14,_15));
});
return _13;
},detect:function(_16){
var _17;
this.each(function(_18,_19){
if(_16(_18,_19)){
_17=_18;
throw $break;
}
});
return _17;
},findAll:function(_20){
var _21=[];
this.each(function(_22,_23){
if(_20(_22,_23)){
_21.push(_22);
}
});
return _21;
},grep:function(_24,_25){
var _26=[];
this.each(function(_27,_28){
var _29=_27.toString();
if(_29.match(_24)){
_26.push((_25||Prototype.K)(_27,_28));
}
});
return _26;
},include:function(_30){
var _31=false;
this.each(function(_32){
if(_32==_30){
_31=true;
throw $break;
}
});
return _31;
},inject:function(_33,_34){
this.each(function(_35,_36){
_33=_34(_33,_35,_36);
});
return _33;
},invoke:function(_37){
var _38=$A(arguments).slice(1);
return this.collect(function(_39){
return _39[_37].apply(_39,_38);
});
},max:function(_40){
var _41;
this.each(function(_42,_43){
_42=(_40||Prototype.K)(_42,_43);
if(_42>=(_41||_42)){
_41=_42;
}
});
return _41;
},min:function(_44){
var _45;
this.each(function(_46,_47){
_46=(_44||Prototype.K)(_46,_47);
if(_46<=(_45||_46)){
_45=_46;
}
});
return _45;
},partition:function(_48){
var _49=[],falses=[];
this.each(function(_50,_51){
((_48||Prototype.K)(_50,_51)?_49:falses).push(_50);
});
return [_49,falses];
},pluck:function(_52){
var _53=[];
this.each(function(_54,_55){
_53.push(_54[_52]);
});
return _53;
},reject:function(_56){
var _57=[];
this.each(function(_58,_59){
if(!_56(_58,_59)){
_57.push(_58);
}
});
return _57;
},sortBy:function(_60){
return this.collect(function(_61,_62){
return {value:_61,criteria:_60(_61,_62)};
}).sort(function(_63,_64){
var a=_63.criteria,b=_64.criteria;
return a<b?-1:a>b?1:0;
}).pluck("value");
},toArray:function(){
return this.collect(Prototype.K);
},zip:function(){
var _66=Prototype.K,args=$A(arguments);
if(typeof args.last()=="function"){
_66=args.pop();
}
var _67=[this].concat(args).map($A);
return this.map(function(_68,_69){
_66(_68=_67.pluck(_69));
return _68;
});
},inspect:function(){
return "#<Enumerable:"+this.toArray().inspect()+">";
}};
Object.extend(Enumerable,{map:Enumerable.collect,find:Enumerable.detect,select:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray});

var $A=Array.from=function(_1){
if(_1.toArray){
return _1.toArray();
}else{
var _2=[];
for(var i=0;i<_1.length;i++){
_2.push(_1[i]);
}
return _2;
}
};
Object.extend(Array.prototype,Enumerable);
Object.extend(Array.prototype,{_each:function(_4){
for(var i=0;i<this.length;i++){
_4(this[i]);
}
},first:function(){
return this[0];
},last:function(){
return this[this.length-1];
},compact:function(){
return this.select(function(_5){
return _5!=undefined||_5!=null;
});
},flatten:function(){
return this.inject([],function(_6,_7){
return _6.concat(_7.constructor==Array?_7.flatten():[_7]);
});
},without:function(){
var _8=$A(arguments);
return this.select(function(_9){
return !_8.include(_9);
});
},indexOf:function(_10){
for(var i=0;i<this.length;i++){
if(this[i]==_10){
return i;
}
}
return false;
},reverse:function(){
var _11=[];
for(var i=this.length;i>0;i--){
_11.push(this[i-1]);
}
return _11;
},inspect:function(){
return "["+this.map(Object.inspect).join(", ")+"]";
}});

Array.prototype.indexOf=function(_1,_2,_3){
_2=_2||0;
for(var i=_2;i<this.length;i++){
var _5=this[i];
if(_3?_5===_1:isRegexp(_1)?_1.test(_5):isFunction(_1)?_1(_5):_5==_1){
return i;
}
}
return -1;
};
Array.prototype.find=function(_6,_7,_8){
var i=this.indexOf(_6,_7,_8);
if(i!=-1){
return this[i];
}
return null;
};
Array.prototype.contains=function(_9,_10){
return this.indexOf(_9,0,_10)!==-1;
};
Array.prototype.has=Array.prototype.contains;
Array.prototype.include=Array.prototype.contains;
Array.prototype.count=function(_11,_12){
var pos,start=0,count=0;
while((pos=this.indexOf(_11,start,_12))!==-1){
start=pos+1;
count++;
}
return count;
};
Array.prototype.remove=function(_14,all,_16){
while(this.contains(_14,_16)){
this.splice(this.indexOf(_14,0,_16),1);
if(!all){
break;
}
}
return this;
};
Array.prototype.merge=function(){
var a=[];
for(var i=0;i<arguments.length;i++){
for(var j=0;j<arguments[i].length;j++){
a.push(arguments[i][j]);
}
}
for(var i=0;i<a.length;i++){
this.push(a[i]);
}
return this;
};
Array.prototype.min=function(){
if(!this.length){
return;
}
var n=this[0];
for(var i=1;i<this.length;i++){
if(n>this[i]){
n=this[i];
}
}
return n;
};
Array.prototype.max=function(){
if(!this.length){
return;
}
var n=this[0];
for(var i=1;i<this.length;i++){
if(n<this[i]){
n=this[i];
}
}
return n;
};
Array.prototype.first=function(){
return this[0];
};
Array.prototype.last=function(){
return this[this.length-1];
};
Array.prototype.sjoin=function(){
return this.join(" ");
};
Array.prototype.njoin=function(){
return this.join("\n");
};
Array.prototype.cjoin=function(){
return this.join(", ");
};
Array.prototype.equals=function(a,_20){
if(this==a){
return true;
}
if(a.length!=this.length){
return false;
}
return this.map(function(_21,idx){
return _20?_21===a[idx]:_21==a[idx];
}).all();
};
Array.prototype.all=function(fn){
return filter(this,fn).length==this.length;
};
Array.prototype.any=function(fn){
return filter(this,fn).length>0;
};
Array.prototype.each=function(fn){
return each(this,fn);
};
Array.prototype.map=function(fn){
return map(this,fn);
};
Array.prototype.filter=function(fn){
return filter(this,fn);
};
Array.prototype.select=Array.prototype.filter;
Array.prototype.reduce=function(){
var _24=map(arguments);
fn=_24.pop();
d=_24.pop();
return reduce(this,d,fn);
};
Array.prototype.inject=Array.prototype.reduce;
Array.prototype.reject=function(fn){
if(typeof (fn)=="string"){
fn=__strfn("item,idx,list",fn);
}
var _25=this;
var _26=[];
fn=fn||function(v){
return v;
};
map(_25,function(_28,idx,_29){
if(fn(_28,idx,_29)){
_26.push(idx);
}
});
_26.reverse().each(function(idx){
_25.splice(idx,1);
});
return _25;
};
function __strfn(_30,fn){
function quote(s){
return "\""+s.replace(/"/g,"\\\"")+"\"";
}
if(!/\breturn\b/.test(fn)){
fn=fn.replace(/;\s*$/,"");
fn=fn.insert(fn.lastIndexOf(";")+1," return ");
}
return eval("new Function("+map(_30.split(/\s*,\s*/),quote).join()+","+quote(fn)+")");
}
function each(_32,fn){
if(typeof (fn)=="string"){
return each(_32,__strfn("item,idx,list",fn));
}
for(var i=0;i<_32.length;i++){
fn(_32[i],i,_32);
}
}
function map(_33,fn){
if(typeof (fn)=="string"){
return map(_33,__strfn("item,idx,list",fn));
}
var _34=[];
fn=fn||function(v){
return v;
};
for(var i=0;i<_33.length;i++){
_34.push(fn(_33[i],i,_33));
}
return _34;
}
function combine(){
var _35=map(arguments);
var _36=map(_35.slice(0,-1),"map(item)");
var fn=_35.last();
var _37=map(_36,"item.length").max();
var _38=[];
if(!fn){
fn=function(){
return map(arguments);
};
}
if(typeof fn=="string"){
if(_36.length>26){
throw "string functions can take at most 26 lists";
}
var a="a".charCodeAt(0);
fn=__strfn(map(range(a,a+_36.length),"String.fromCharCode(item)").join(","),fn);
}
map(_36,function(li){
while(li.length<_37){
li.push(null);
}
map(li,function(_40,ix){
if(ix<_38.length){
_38[ix].push(_40);
}else{
_38.push([_40]);
}
});
});
return map(_38,function(val){
return fn.apply(fn,val);
});
}
function filter(_43,fn){
if(typeof (fn)=="string"){
return filter(_43,__strfn("item,idx,list",fn));
}
var _44=[];
fn=fn||function(v){
return v;
};
map(_43,function(_45,idx,_43){
if(fn(_45,idx,_43)){
_44.push(_45);
}
});
return _44;
}
function reduce(_46,_47,fn){
if(undef(fn)){
fn=_47;
_47=window.undefined;
}
if(typeof (fn)=="string"){
return reduce(_46,_47,__strfn("a,b",fn));
}
if(isdef(_47)){
_46.splice(0,0,_47);
}
if(_46.length===0){
return false;
}
if(_46.length===1){
return _46[0];
}
var _48=_46[0];
var i=1;
while(i<_46.length){
_48=fn(_48,_46[i++]);
}
return _48;
}
function range(_49,_50,_51){
if(isUndefined(_50)){
return range(0,_49,_51);
}
if(isUndefined(_51)){
_51=1;
}
var ss=(_51/Math.abs(_51));
var r=[];
for(i=_49;i*ss<_50*ss;i=i+_51){
r.push(i);
}
return r;
}

var Hash={_each:function(_1){
for(key in this){
var _2=this[key];
if(typeof _2=="function"){
continue;
}
var _3=[key,_2];
_3.key=key;
_3.value=_2;
_1(_3);
}
},keys:function(){
return this.pluck("key");
},values:function(){
return this.pluck("value");
},merge:function(_4){
return $H(_4).inject($H(this),function(_5,_6){
_5[_6.key]=_6.value;
return _5;
});
},toQueryString:function(){
return this.map(function(_7){
return _7.map(encodeURIComponent).join("=");
}).join("&");
},inspect:function(){
return "#<Hash:{"+this.map(function(_8){
return _8.map(Object.inspect).join(": ");
}).join(", ")+"}>";
}};
function $H(_9){
var _10=Object.extend({},_9||{});
Object.extend(_10,Enumerable);
Object.extend(_10,Hash);
return _10;
}

var Range=Class.create();
Object.extend(Range.prototype,Enumerable);
Object.extend(Range.prototype,{initialize:function(_1,_2,_3){
this.start=_1;
this.end=_2;
this.exclusive=_3;
},_each:function(_4){
var _5=this.start;
do{
_4(_5);
_5=_5.succ();
}while(this.include(_5));
},include:function(_6){
if(_6<this.start){
return false;
}
if(this.exclusive){
return _6<this.end;
}
return _6<=this.end;
}});
var $R=function(_7,_8,_9){
return new Range(_7,_8,_9);
};

function __strfn(_1,fn){
function quote(s){
return "\""+s.replace(/"/g,"\\\"")+"\"";
}
if(!/\breturn\b/.test(fn)){
fn=fn.replace(/;\s*$/,"");
fn=fn.insert(fn.lastIndexOf(";")+1," return ");
}
return eval("new Function("+map(_1.split(/\s*,\s*/),quote).join()+","+quote(fn)+")");
}
function each(_4,fn){
if(typeof (fn)=="string"){
return each(_4,__strfn("item,idx,list",fn));
}
for(var i=0;i<_4.length;i++){
fn(_4[i],i,_4);
}
}
function map(_6,fn){
if(typeof (fn)=="string"){
return map(_6,__strfn("item,idx,list",fn));
}
var _7=[];
fn=fn||function(v){
return v;
};
for(var i=0;i<_6.length;i++){
_7.push(fn(_6[i],i,_6));
}
return _7;
}

Prado=Class.create();
Prado.version="3.0a";
Prado.Button=Class.create();
Prado.Button.buttonFired=false;
Prado.Button.fireButton=function(_1,_2){
if(!Prado.Button.buttonFired&&_1.keyCode==13&&!(_1.srcElement&&(_1.srcElement.tagName.toLowerCase()=="textarea"))){
var _3=document.getElementById?document.getElementById(_2):document.all[_2];
if(_3&&typeof (_3.click)!="undefined"){
Prado.Button.buttonFired=true;
_3.click();
_1.cancelBubble=true;
if(_1.stopPropagation){
_1.stopPropagation();
}
return false;
}
}
return true;
};
Prado.TextBox=Class.create();
Prado.TextBox.handleReturnKey=function(_4){
if(_4.keyCode==13){
var _5;
if(typeof (_4.target)!="undefined"){
_5=_4.target;
}else{
if(typeof (_4.srcElement)!="undefined"){
_5=_4.srcElement;
}
}
if((typeof (_5)!="undefined")&&(_5!=null)){
if(typeof (_5.onchange)!="undefined"){
_5.onchange();
_4.cancelBubble=true;
if(_4.stopPropagation){
_4.stopPropagation();
}
return false;
}
}
}
return true;
};

Prado.doPostBack=function(_1,_2,_3,_4,_5,_6,_7,_8){
if(typeof (_4)=="undefined"){
var _4=false;
var _5="";
var _6=null;
var _7=false;
var _8=true;
}
var _9=document.getElementById?document.getElementById(_1):document.forms[_1];
var _10=true;
if(_4){
_10=Prado.Validation.validate(_5);
}
if(_10){
if(_6!=null&&(_6.length>0)){
_9.action=_6;
}
if(_7){
var _11=_9.elements["PRADO_LASTFOCUS"];
if((typeof (_11)!="undefined")&&(_11!=null)){
var _12=document.activeElement;
if(typeof (_12)=="undefined"){
_11.value=_2;
}else{
if((_12!=null)&&(typeof (_12.id)!="undefined")){
if(_12.id.length>0){
_11.value=_12.id;
}else{
if(typeof (_12.name)!="undefined"){
_11.value=_12.name;
}
}
}
}
}
}
if(!_8){
_10=false;
}
}
if(_10&&(!_9.onsubmit||_9.onsubmit())){
_9.PRADO_POSTBACK_TARGET.value=_2;
_9.PRADO_POSTBACK_PARAMETER.value=_3;
_9.submit();
}
};

Prado.Focus=Class.create();
Prado.Focus.setFocus=function(id){
var _2=document.getElementById?document.getElementById(id):document.all[id];
if(_2&&!Prado.Focus.canFocusOn(_2)){
_2=Prado.Focus.findTarget(_2);
}
if(_2){
try{
_2.focus();
_2.scrollIntoView(false);
if(window.__smartNav){
window.__smartNav.ae=_2.id;
}
}
catch(e){
}
}
};
Prado.Focus.canFocusOn=function(_3){
if(!_3||!(_3.tagName)){
return false;
}
var _4=_3.tagName.toLowerCase();
return !_3.disabled&&(!_3.type||_3.type.toLowerCase()!="hidden")&&Prado.Focus.isFocusableTag(_4)&&Prado.Focus.isVisible(_3);
};
Prado.Focus.isFocusableTag=function(_5){
return (_5=="input"||_5=="textarea"||_5=="select"||_5=="button"||_5=="a");
};
Prado.Focus.findTarget=function(_6){
if(!_6||!(_6.tagName)){
return null;
}
var _7=_6.tagName.toLowerCase();
if(_7=="undefined"){
return null;
}
var _8=_6.childNodes;
if(_8){
for(var i=0;i<_8.length;i++){
try{
if(Prado.Focus.canFocusOn(_8[i])){
return _8[i];
}else{
var _10=Prado.Focus.findTarget(_8[i]);
if(_10){
return _10;
}
}
}
catch(e){
}
}
}
return null;
};
Prado.Focus.isVisible=function(_11){
var _12=_11;
while((typeof (_12)!="undefined")&&(_12!=null)){
if(_12.disabled||(typeof (_12.style)!="undefined"&&((typeof (_12.style.display)!="undefined"&&_12.style.display=="none")||(typeof (_12.style.visibility)!="undefined"&&_12.style.visibility=="hidden")))){
return false;
}
if(typeof (_12.parentNode)!="undefined"&&_12.parentNode!=null&&_12.parentNode!=_12&&_12.parentNode.tagName.toLowerCase()!="body"){
_12=_12.parentNode;
}else{
return true;
}
}
return true;
};