lxw
2020-07-11 9db52f2f2dd3665fe9da1ae5657e0167c3a34d40
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
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
//检测版本号(需要和后台ActionUtil!getMyAPPVersion的版本号一致)
var version = "1.0.3";
function checkAPPVersion(callback) {
    $.ajax({
        type: 'post',
        async: true,
        url: 'ActionUtil!getMyAPPVersion',
        data: null,
        dataType: 'json',
        success: function(res) {
            var rs = JSON.parse(res.json);
            var newVersion = rs.msg;
            if(newVersion==version) {
                callback(true, version, newVersion);
            }else {
                callback(false, version, newVersion);
            }
        }
    });
}
 
 
var GLOBAL = {};
 
// 给GLOBAL添加属性
GLOBAL.namespace = function(str) {
    var arr = str.split('.'), o = GLOBAL;
    for(var i=(arr[0] == 'GLOBAL')?1:0; i<arr.length; i++) {
        o[arr[i]] = o[arr[i]] || {};
        o = o[arr[i]];
    }
};
 
var timeID;
//在页面右上角显示登陆用户的用户名
function setUserName(){
    checkUserlogin();
}
 
//安全退出
function exitUser(){
    $.post("LoginAction!exitUser",null,function(data){
        //console.info(data);
    });
    window.location.replace("login.jsp");
}
 
 
// 检查当前用户是否在另一主机登陆
function checkUserlogin(){
    //console.info("check***********************");
    $.post("LoginAction_check",null,function(data){
        data = eval("(" + data.result + ")");
        user=data.uinf;
        //console.info(data);
        if(data.code == 1){
            clearInterval(timeID);
            //console.info(123+"*****");
            alert(data.msg);            
            window.location.href="login.jsp";            
        }else{
            clearInterval(timeID);
            timeID = setTimeout(checkUserlogin,100);
        }
    }).error(function(){
        clearInterval(timeID);
    });
};
 
 
 
// 配置是否是登录页
function isLogin(hf) {
    var _isLogin = false;
    var patt = /login.jsp/;
    if(patt.test(hf)) {
        _isLogin = true;
    }
    return _isLogin;
}
 
//取当前页面名称(带后缀名)
function getpageName()
{
    var strUrl=location.href;
    var arrUrl=strUrl.split("/");
    var strPage=arrUrl[arrUrl.length-1];
    var pattern = /(.*\.jsp).*/;
    var regStr = pattern.test(strPage);
    var rsPage = RegExp.$1;
    return rsPage;
}
 
        
 
// Cookie
function getCookie(c_name) { // 根据分隔符取每个变量的值
    if (document.cookie.length > 0) {
        c_start = document.cookie.indexOf(c_name + "=");
        if (c_start != -1) {
            c_start = c_start + c_name.length + 1;
            c_end = document.cookie.indexOf("^", c_start);
            if (c_end == -1)
                c_end = document.cookie.length;
            return unescape(document.cookie.substring(c_start, c_end));
        }
    }
    return "";
}
 
// 设置cookie中的用户名以及密码
function setCookie(c_name, n_value, p_name, p_value, expiredays) // 设置cookie
{
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + expiredays);
    document.cookie = c_name + "=" + escape(n_value) + "^" + p_name + "="
            + escape(p_value)
            + ((expiredays == null) ? "" : "^;expires=" + exdate.toGMTString());
    //console.log(document.cookie+"888");
}
 
// 设置cookie中的用户名以及密码
function setCookietemp(c_name, n_value,expiredays) // 设置cookie
{
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + expiredays);
    document.cookie = c_name + "=" + escape(n_value)
            + ((expiredays == null) ? "" : "^;expires=" + exdate.toGMTString());
    //console.log(document.cookie+"888");
}
 
function setMyCookie(key,value,days){
    console.info(Base64.encode(JSON.stringify(value)));
    setCookietemp(key,Base64.encode(new Buffer(JSON.stringify(value)).toStirng()),days);
}
 
function checkCookie() // 检测cookie是否存在,如果存在则直接读取,否则创建新的cookie
{    
    var username = getCookie("username");
    var password = getCookie("password");
    //console.info("username"+getCookie("username"));
    //console.info("password"+getCookie("password"));
    if (username != null && username != "" && password != null
            && password != "") {
        document.getElementById("user").value = username;
        document.getElementById("password").value = password;
    } else {
        // username = prompt('Please enter your name:', "");
        // password = prompt('Please enter your name:', "");
        if (username != null && username != "" && password != null
                && password != "") {
            setCookie('username', username, 'password', password, 30);
        }
    }
}
 
function cleanCookie(c_name, p_name) { // 使cookie过期
    document.cookie = c_name + "=" + ";" + p_name + "="
            + ";expires=Thu, 01-Jan-70 00:00:01 GMT";
    //console.info("删除成功");
}
 
//深复制一个对象(改变新对象的值,原对象的值不变)
var deepCopy= function(source) { 
    var result={};
    for (var key in source) {
          console.info(key);
          result[key] = typeof source[key]==='object'?deepCopy(source[key]): source[key];
    } 
    return result; 
};
 
 
 
var  CapType_Rest = 0;            //当查询剩余容量时传递
var  CapType_Real = 1;            //当查询实际容量时传递
var STDAH;                        //标纯容量
var MonomerVolType;                //电池电压类型
// 获取标纯电流
function GetFDCurrent(stdcap,hourrate)
{
    var res = 0.055;
    switch(hourrate)
    {
        case 1: res = 0.514; break;
        case 2: res = 0.306; break;
        case 3: res = 0.250; break;
        case 4: res = 0.200; break;
        case 5: res = 0.166; break;
        case 6: res = 0.146; break;
        case 7: res = 0.131; break;
        case 8: res = 0.118; break;
        case 9: res = 0.108; break;
        case 10: res = 0.100; break;
        case 20: res = 0.055; break;
        default: res = 0.055; break;
    }
    
    return (stdcap * res);
}
 
// 获取放电小时率        stdah:标纯容量              current:当前电流    
function GetHourRate(stdah,current)
{
    var index = 0;
    var value=[5.14, 3.06, 2.50, 2.00, 1.66, 1.46, 1.31, 1.18, 1.08, 1.00, 0.55, 0.40];
    var res;
    current = Math.abs(current);
    res = current/(stdah/10);
    if(res >= 5.14) return 1;
    else if(res <= 0.55) return 20;
    else
    {
        for(var index=0; index<10; index++)
        {
            if((res<=value[index]) && (res>value[index+1]))
                break;
            else continue;
        }
        if((value[index]-res) < (res-value[index+1]))
        {
            return (index+1);
        }
        else
        {
            if(index+2 > 10) return (20);
            else return (index+2);
        }
    }  
}
 
function N_TO_10H(n_H)
{
    switch(n_H)
    {
        case  1 : return(1/0.55);
        case  2 : return(1/0.61);
        case  3 : return(1/0.75);
        case  4 : return(1/0.79);
        case  5 : return(1/0.833);
        case  6 : return(1/0.876);
        case  7 : return(1/0.917);
        case  8 : return(1/0.944);
        case  9 : return(1/0.974);
        case  10: return(1/1);
        case  20: return(1/1.1);
    }
    return 1.0;
}
 
//获取剩余容量    STDAH:标称容量            HourRate:放电小时率    SumAH:测试容量        MaxMonomerVol:最大电池电压        MonomerVol:当前电池组的最低单体电压
//MonomerVolType:电池标称电压        CapType:容量类型(定值是常量)
function GetMonomerCap(STDAH,HourRate,SumAH,MaxMonomerVol,
        MonomerVol,MonomerVolType,CapType)
{
    if((MaxMonomerVol - MonomerVolType*0.9) <= 0)
        return 0;
    if(SumAH < 0)
        SumAH *= (-1);
    var tmp_cap;
    tmp_cap = MonomerVol - MonomerVolType * 0.9;
    tmp_cap *= (STDAH - SumAH * N_TO_10H(HourRate));
    var dt_vol = MaxMonomerVol - MonomerVolType*0.9;
    if(dt_vol < 0.01)
        dt_vol = 0.01;
    tmp_cap = tmp_cap/dt_vol;
    if(tmp_cap < 0)
        tmp_cap = 0;
 
    if(CapType == CapType_Rest)
        return tmp_cap;
    else if(CapType == CapType_Real)
        return (tmp_cap + SumAH * N_TO_10H(HourRate));
    else
        return ((tmp_cap + SumAH * N_TO_10H(HourRate))*100 / STDAH);
}
 
/* 获取电池组续航时间
 * 续航时长=实际容量/(放电小时率*实际电流(45))
 * @param int moncapstd 电池组标称容量
 * @param int realcap 电池组实际容量
 * @param int curr53 实时电流(53)
 * 
*/
function getGruopEndurTimeLong(moncapstd, realcap, curr53) {
    var endurTimeLong = 0;
    if(curr53 != 0) {
        var real_curr45 = curr53*53/45;
        var hourRate = N_TO_10H(GetHourRate(moncapstd, real_curr45));
        endurTimeLong = realcap/(hourRate*real_curr45);
    }
    
    return endurTimeLong;
}
 
//获取后备时间
function GetRestTimeSecond(restcap,curr)
{
    var tmp_curr = Math.abs(curr);
    if(tmp_curr < 0.1)
        tmp_curr = 0.1;
        
    var rest_time = ((restcap / tmp_curr) * 3600);
    if(rest_time > (99*3600))
        rest_time = (99*3600);        
    return rest_time;
}
 
// 增大和减小容器
function changeEleHt(ele, ele_fir_ht, ele_sec_ht, status) {
    if(status == 0) {
        ele.height(ele_fir_ht + ele_sec_ht);
        status = 1;
    }else {
        ele.height(ele_sec_ht);
        status = 0;
    }
    return status;
}
 
//将秒转化成00M00H类型
function formatTime1(value) {
    var theTime = parseInt(value);// 秒
    var theTime1 = 0;// 分
    var theTime2 = 0;// 小时
    
    if(theTime >= 60) {
        theTime1 = parseInt(theTime/60);
        theTime = parseInt(theTime%60);
        // alert(theTime1+"-"+theTime);
        if(theTime1 >= 60) {
            theTime2 = parseInt(theTime1/60);
            theTime1 = parseInt(theTime1%60);
        }
    }
    var result = "";
    if(theTime1 >= 0) {
        result =(theTime1<10?"0":"")+parseInt(theTime1)+"M"+result;
    }
    if(theTime2 >= 0) {
        result =(theTime2<10?"0":"")+parseInt(theTime2)+"H"+result;
    }
    return result;
}
 
//将秒转化成时:分:秒
function formatSeconds(value) {
    if(value > 0){
    
    }else{
        value = 0;
    }
    var theTime = parseInt(value);// 秒
    var theTime1 = 0;// 分
    var theTime2 = 0;// 小时
    // alert(theTime);
    if(theTime >= 60) {
        theTime1 = parseInt(theTime/60);
        theTime = parseInt(theTime%60);
        //alert(theTime1+"-"+theTime);
        if(theTime1 >= 60) {
            theTime2 = parseInt(theTime1/60);
            theTime1 = parseInt(theTime1%60);
        }
    }
    var result = (theTime<10?"0":"")+parseInt(theTime);
    if(theTime1 >= 0) {
        result =(theTime1<10?"0":"")+parseInt(theTime1)+":"+result;
    }
    if(theTime2 >= 0) {
        result =(theTime2<10?"0":"")+parseInt(theTime2)+":"+result;
    }
    //console.info(result);
    return result;
}
 
//格式化时间
Date.prototype.format =function(format)
{
    var o = {
    "M+" : this.getMonth()+1, //month
    "d+" : this.getDate(),    //day
    "h+" : this.getHours(),   //hour
    "m+" : this.getMinutes(), //minute
    "s+" : this.getSeconds(), //second
    "q+" : Math.floor((this.getMonth()+3)/3),  //quarter
    "S" : this.getMilliseconds() //millisecond
    };
    if(/(y+)/.test(format)) format=format.replace(RegExp.$1,
    (this.getFullYear()+"").substr(4- RegExp.$1.length));
    for(var k in o)if(new RegExp("("+ k +")").test(format))
    format = format.replace(RegExp.$1,
    RegExp.$1.length==1? o[k] :
    ("00"+ o[k]).substr((""+ o[k]).length));
    return format;
};
/**
 * 
 * @param {} p    需要拷贝的对象或数组
 * @param {} c    (拷贝对象时:new Object()     拷贝数组时:new Array())
 * @return {}    拷贝后的对象(包括对象和数组)
 */
function deepCopy(p, c) {
        var c = c || {};
        for (var i in p) {
            if (typeof p[i] === 'object') {
                c[i] = (p[i].constructor === Array) ? [] : {};
                deepCopy(p[i], c[i]);
            } else {
                c[i] = p[i];
            }
        }
        return c;
    }
 
 
//根据电池组id查询机历卡信息
function findBattinfByBattGroupId(BattGroupId){
    $.post("BattInfAction_findByBattGroupId","bif.BattGroupId="+BattGroupId,function(data){
        //data=eval("("+data+")");
        data=data.result;
        data=eval("("+data+")");
        //console.info(data);
        if(data.code==1){
            if(data.data.length>0){
                data=data.data[0];
                document.getElementById("StationId").innerHTML=data.StationId;                    //机房id
                document.getElementById("StationName").innerHTML=data.StationName;                //机房名称
                document.getElementById("StationIP").innerHTML=data.StationIp;                    //机房ip
                document.getElementById("batt_group_id").innerHTML=data.BattGroupId;            //电池组ip
                
                document.getElementById("BattGroupName").innerHTML=data.BattGroupName;            //电池组名称
                document.getElementById("BattGroupNum").innerHTML=data.GroupIndexInFBSDevice+1;            //电池组序号
                document.getElementById("BattProducer").innerHTML=data.BattProducer;            //电池品牌
                document.getElementById("BattModel").innerHTML=data.BattModel;                    //电池型号
                document.getElementById("MonCapStd").innerHTML=data.MonCapStd;                    //标称容量
                document.getElementById("MonVolStd").innerHTML=(data.MonVolStd).toFixed(1);        //标称电压    
                document.getElementById("MonResStd").innerHTML=data.MonResStd.toFixed(3);        //标称内阻
                //document.getElementById("MonSerStd").innerHTML=data.MonSerStd.toFixed(0);        //标称内阻
                document.getElementById("MonTmpStd").innerHTML=data.MonTmpStd.toFixed(1);        //标称温度
                document.getElementById("MonCount").innerHTML=data.MonCount;                    //单体数量
                document.getElementById("BattInUseDate").innerHTML=data.BattInUseDate;            //投入使用时间
                if(data.BattGuarantDayCount>0){
                    //$("#BattGuarantDayCount").text(data.BattGuarantDayCount);  //保修年限
                }else{
                    //$("#BattGuarantDayCount").text("已超过保修"+Math.abs(data.BattGuarantDayCount)+"天");                            //保修年限
                }
                document.getElementById("BattFloatCurrent").innerHTML=data.BattFloatCurrent;    //电池浮充电流阀值
                document.getElementById("FloatVolLevel").innerHTML=data.FloatVolLevel;            //电池均充电压阀值
                document.getElementById("FBSDeviceName").innerHTML=data.FBSDeviceName;            //设备名称
                document.getElementById("FBSDeviceId").innerHTML=data.FBSDeviceId;            //设备Id
                //console.info(data);
                document.getElementById("FBSDeviceIp").innerHTML=data.FbsDeviceIp;            //设备Ip
                document.getElementById("GroupIndexInFBSDevice").innerHTML=data.GroupIndexInFBSDevice;            //Bindex
                document.getElementById("installUser").innerHTML= data.install_user;    // 安装人员
                
                //显示电池组机历卡
                $('#card_infor').show();
                $('#allShade').show();
            }
        }
    });
}
 
//根据stationid查询基站的信息
function findStationInfoByStation(temp){
    //console.info(JSON.stringify(temp));
    $.ajax({     
        type:"post",                 
        url: "Battinf_exAction!serchByCondition",                
        async:true,                
        dataType:'json',
        data:"json="+JSON.stringify(temp),        
        success: function(data){ 
            var model = eval('('+data.result+')');
            //console.log(model);
            if(model.code == 1 && model.data.length>0){
                var station = model.data[0];
                //console.info(station);
                $('#station_stationid_ex').text(temp.StationId_ex);                                            //站点id
                $('#station_stationname').text(station.stationName);                                        //机房名称
                $('#station_stationid').text(station.stationId);                                            //机房名称
                $('#station_affiliation').text(station.affiliation);                                        //所属组织
                $('#station_dataSources').text(station.dataSources);                                        //数据来源
                $('#station_stationType').text(station.stationType);                                        //站址类型
                $('#station_jinweidu').text("经度:" + station.longitude+";纬度:"+station.latitude);            //经纬度
                $('#station_stationAddr').text(station.stationAddr);                                        //所在地址
                $('#station_stationstate').text("站址等级:"+station.stationLevel+";维护状态:"+station.maintenanceState+";封锁状态:"+(station.blockedState==0?'否':'是'));            //机房状态
                $('#station_maintenanceCompany').text(station.maintenanceCompany);                                                                                                //维护单位
                $('#station_stationscenario').text("业务场景:"+station.businessScenario+";覆盖场景:"+station.CoverScenario+";站址地形:"+station.siteTerrain);                        //站址场景
                $('#station_stationproperty').text("产权性质:"+station.propertyRights+";(原)产权单位:"+station.propertyUnit+";是否共享:"+(station.isShare==1?'是':'否'));            //站址产权
                $('#station_useUnit').text(station.useUnit);                                        //使用单位
                $('#station_siteCode').text(station.siteCode);                                        //物理站址编码
                $('#station_historySiteCode').text(station.historySiteCode);                        //历史物理站址编码
                $('#station_siteInternalNumber').text(station.siteInternalNumber);                    //站址内部编号
                $('#station_sitePinyinReferred').text(station.sitePinyinReferred);                    //站址拼音简称
                $('#station_siteChineseReferred').text(station.siteChineseReferred);                //中文简称
                $('#station_isOpenBusiness').text(station.isOpenBusiness);                            //是否开通业务
                $('#station_schoolPersonnel').text(station.schoolPersonnel);                        //录入人员
                $('#station_entryTime').text(station.entryTime);                                    //录入时间
                $('#station_modifyPeople').text(station.modifyPeople);                                //修改人
                $('#station_modifyTime').text(station.modifyTime);                                    //修改时间
                $('#station_note').text(station.note);                                                //备注
                $('#station_receiveorvalidity').text("站址接收标记:"+(station.siteReceivesMark==1?'是':'否')+";是否有效:"+(station.siteValidity==1?'是':'否'));                                                //备注
                $('#station_siteNameCMCC').text(station.siteNameCMCC);                                //移动站址名称
                $('#station_siteNameCTC').text(station.siteNameCTC);                                //联通站址名称
                $('#station_siteNameCUCC').text(station.siteNameCUCC);                                //电信站址名称
                $('#station_producer').text(station.producer);                                        //品牌
                $('#station_lastTimeLong').text(station.lastTimeLong);                                //续航测算时长
                $('#station_lastTimeType').text(station.lastTimeType);                                //续航测算类别
                $('#station_lastTimeDate').text(station.lastTimeDate);                                //续航发生时间
                $('#station_shareInfo').text(station.shareInfo);                                    //共享情况
                $('#station_electPower').text("移动购买:"+(station.electPowerCMCC==1?'是':'否')+";电信购买:"+(station.electPowerCTC==1?'是':'否')+";联通购买:"+(station.electPowerCUCC==1?'是':'否'));                                    //共享情况
                $('#station_isCanElectPower').text(station.isCanElectPower==1?'是':'否');            //是否具备发电条件
                $('#station_upperStationRoute').text(station.upperStationRoute);                    //上站路程
                $('#station_upperStationDifficult').text(station.upperStationDifficult);            //上站难易程度
                $('#station_clienteleErrorService').text(station.clienteleErrorService);            //客户问题库未完成蓄电池维修
                
            }
        }                 
    });
}
    
 
//根据num获取故障类型和故障排除方法
function getTypeBynum(num,list){
    if(num>=0 && list!=undefined && list.length>0){
        for(var i=0;i<list.length;i++){
            if(list[i].num==num){
                return list[i];
            }
        }
    }
    return undefined;
}
    
var brdnType=[
    {num:0,type:'漏液'},
    {num:1,type:'单体电压过低'},
    {num:2,type:'单体电压过高'},
    {num:3,type:'电池反极'},
    {num:4,type:'电池温度过高'},
    {num:5,type:'电池变形'},
    {num:6,type:'其他'}
];
var brdnRemove=[
    {num:0,type:'整组更换'},
    {num:1,type:'单节更换'},
    {num:2,type:'活化'}
];
 
// 根据点击的位置显示内容
function setPosition(container, xLeft, yTop) {
    container.find('a').css('white-space','nowrap');
    // 上下位置
    var scrnHt = $(window).height(); // 获取屏幕的高度
    var yBottom = scrnHt - yTop;    // 获取点击位置距离屏幕底部的距离
    var conHt = container.height();
    if(yBottom < conHt) {
        var shiftY = conHt -yBottom;
        container.offset(function(n, c) {
                var newPos = new Object();
                newPos.top = c.top - shiftY-2;
                newPos.left = c.left;
                return newPos;
        });
    }
 
    // 左右位置
    var scrnWidth = $(window).width();
    var xRight = scrnWidth - xLeft;
    var conWidth = container.width();
    if(xRight < conWidth) {
        var shiftX = conWidth -xRight;
        container.offset(function(n, c) {
                var newPos = new Object();
                newPos.left = c.left - shiftX-2;
                newPos.top = c.top;
                return newPos;
        });
    }
}
 
//生成整体遮罩层()
function createAllMask(ele,opcy){
    var __Ht=ele.height();
    var __div=$('<div class="mask"></div>');
    ele.prepend(__div);
    //定义遮罩层的样式
    ele.children('.mask').css({
        // 'display':'block',
        'position':'absolute',
        'width':'100%',
        'height':__Ht+'px',
        'left':'0',
        'top':'0',
        'z-index':'9999999',
        'opacity':opcy,
        'background-color':'#000'
    });
}
 
//获取连接中的指定参数
function getQueryString(name) { 
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); 
    var r = window.location.search.substr(1).match(reg); 
    if (r != null) {
        return decodeURI(r[2]);
    }     
    return null; 
}
 
function createEleWarning(num, muted){
    //清理告警框
    $('body').children('#eleWarning').remove();
    var __divCon=$('<div id="eleWarning"></div>');  //告警容器
    var __divHeadCon=$('<div class="warning-head"></div>'); //告警头部容器
    var __divHeadImg=$('<div class="warning-img"></div>');  //告警图片
    var __divHeadOut=$('<div class="warning-out">x</div>');  //告警退出
    var __divClear=$('<div class="clear"></div>');  //清除浮动
    __divHeadCon.append(__divHeadImg);
    __divHeadCon.append(__divHeadOut);
    __divHeadCon.append(__divClear);
    __divCon.append(__divHeadCon);
 
    /* 告警的内容*/
    var __divContentCon=$('<div class="warning-content"></div>');   //告警内容容器
    /* 告警的音频*/
    var __divAudio=$('<audio autoplay="autoplay"></audio>');
    // 判断是否静音
    if(muted) {
        __divAudio=$('<audio autoplay="autoplay" muted></audio>');
    }
    var __divSourceWav=$('<source src="sound/warnings.wav" type="audio/wav" />');
    var __divSourceMp3=$('<source src="sound/warnings.mp3" type="audio/mpeg" />');
    __divAudio.append(__divSourceWav);
    __divAudio.append(__divSourceMp3);
 
 
    var __divContentTxt=$('<div class="warning-txt">出现了新告警:<span class="caret"><a href="elewarn.jsp" target="_blank">'+num+'</a></span></div>');   //告警内容
    __divContentCon.append(__divContentTxt);
    __divContentCon.append(__divAudio);
    __divCon.append(__divContentCon);
    $('body').append(__divCon);
}
 
 
 
//点击x清除告警框
$(document).ready(function(){       
    //点击x清除告警框
    $('body').on('click','#eleWarning .warning-head .warning-out',function(){
        $('body').children('#eleWarning').remove();
    });
});
 
var totalAlm_num=Number.POSITIVE_INFINITY;
//查询告警数
function searchAlm(isShowVoice){
    // 判断是否显示右下角的告警提示框
    if(!isShowVoice) {
        self.setTimeout("searchAlm()",10000);
        return;
    }
    // 请求后台查询最新出现的告警个数
    $.post("Battalarm_dataAction!serchRealTime",null,function(data){
        model=eval("("+data.result+")");
        if(model.code==1){
            $('#batt_alarm_num .num').text(model.sum);
            if(totalAlm_num<model.sum){                
                var voiceStatus = checkPageVoiceStatus();
                createEleWarning(model.sum-totalAlm_num, !voiceStatus);
            }
            totalAlm_num=model.sum;
            
            // 5秒后关闭面板
            setTimeout(function() {
                $('body').children('#eleWarning').remove();
            }, 5000);
            
            self.setTimeout("searchAlm()",10000); 
        }
    });    
}
 
/*从多维数组中获取最大值*/
function getMaxFromArr(arr) {
    var newArray = arr.join(",").split(",");
    return Math.max.apply({},newArray);
}
 
/*从多维数组中获取最小值*/
function getMinFromArr (arr) {
    var newArray = arr.join(",").split(",");
    return Math.min.apply({},newArray);
}
 
//日历
/**
 * Calendar
 * 
 * @param beginYear
 *            1990
 * @param endYear
 *            2010
 * @param language
 *            0(zh_cn)|1(en_us)|2(en_en)|3(zh_tw)
 * @param patternDelimiter
 *            "-"
 * @param date2StringPattern
 *            "yyyy-MM-dd"
 * @param string2DatePattern
 *            "ymd"
 * @version 1.0 build 2006-04-01
 * @version 1.1 build 2006-12-17
 * @author KimSoft (jinqinghua [at] gmail.com) NOTE! you can use it free, but
 *         keep the copyright please IMPORTANT:you must include this script file
 *         inner html body elment
 */
function Calendar(beginYear, endYear, language, patternDelimiter,
        date2StringPattern, string2DatePattern) {
    this.beginYear = beginYear || 1970;
    this.endYear = endYear || 2100;
    this.language = language || 0;
    this.patternDelimiter = patternDelimiter || "-";
    this.date2StringPattern = date2StringPattern
            || Calendar.language["date2StringPattern"][this.language].replace(
                    /\-/g, this.patternDelimiter);
    this.string2DatePattern = string2DatePattern
            || Calendar.language["string2DatePattern"][this.language];
 
    this.dateControl = null;
    this.panel = this.getElementById("__calendarPanel");
    this.iframe = window.frames["__calendarIframe"];
    this.form = null;
 
    this.date = new Date();
    this.year = this.date.getFullYear();
    this.month = this.date.getMonth();
 
    this.colors = {
        "bg_cur_day" : "#00CC33",
        "bg_over" : "#EFEFEF",
        "bg_out" : "#FFCC00"
    };
};
 
Calendar.language = {
    "year" : [ "\u5e74", "", "", "\u5e74" ],
    "months" : [
            [ "\u4e00\u6708", "\u4e8c\u6708", "\u4e09\u6708", "\u56db\u6708",
                    "\u4e94\u6708", "\u516d\u6708", "\u4e03\u6708",
                    "\u516b\u6708", "\u4e5d\u6708", "\u5341\u6708",
                    "\u5341\u4e00\u6708", "\u5341\u4e8c\u6708" ],
            [ "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP",
                    "OCT", "NOV", "DEC" ],
            [ "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP",
                    "OCT", "NOV", "DEC" ],
            [ "\u4e00\u6708", "\u4e8c\u6708", "\u4e09\u6708", "\u56db\u6708",
                    "\u4e94\u6708", "\u516d\u6708", "\u4e03\u6708",
                    "\u516b\u6708", "\u4e5d\u6708", "\u5341\u6708",
                    "\u5341\u4e00\u6708", "\u5341\u4e8c\u6708" ] ],
    "weeks" : [
            [ "\u65e5", "\u4e00", "\u4e8c", "\u4e09", "\u56db", "\u4e94",
                    "\u516d" ],
            [ "Sun", "Mon", "Tur", "Wed", "Thu", "Fri", "Sat" ],
            [ "Sun", "Mon", "Tur", "Wed", "Thu", "Fri", "Sat" ],
            [ "\u65e5", "\u4e00", "\u4e8c", "\u4e09", "\u56db", "\u4e94",
                    "\u516d" ] ],
    "clear" : [ "\u6e05\u7a7a", "Clear", "Clear", "\u6e05\u7a7a" ],
    "today" : [ "\u4eca\u5929", "Today", "Today", "\u4eca\u5929" ],
    "close" : [ "\u5173\u95ed", "Close", "Close", "\u95dc\u9589" ],
    "date2StringPattern" : [ "yyyy-MM-dd", "yyyy-MM-dd", "yyyy-MM-dd",
            "yyyy-MM-dd" ],
    "string2DatePattern" : [ "ymd", "ymd", "ymd", "ymd" ]
};
 
 
Calendar.prototype.draw = function() {
    calendar = this;
 
    var _cs = [];
    _cs[_cs.length] = '<form id="__calendarForm" name="__calendarForm" method="post">';
    _cs[_cs.length] = '<table id="__calendarTable" width="100%" border="0" cellpadding="3" cellspacing="1" align="center">';
    _cs[_cs.length] = ' <tr>';
    _cs[_cs.length] = '  <th><input class="l" name="goPrevMonthButton" type="button" id="goPrevMonthButton" value="&lt;" \/><\/th>';
    _cs[_cs.length] = '  <th colspan="5"><select class="year" name="yearSelect" id="yearSelect"><\/select><select class="month" name="monthSelect" id="monthSelect"><\/select><\/th>';
    _cs[_cs.length] = '  <th><input class="r" name="goNextMonthButton" type="button" id="goNextMonthButton" value="&gt;" \/><\/th>';
    _cs[_cs.length] = ' <\/tr>';
    _cs[_cs.length] = ' <tr>';
    for ( var i = 0; i < 7; i++) {
        _cs[_cs.length] = '<th class="theader">';
        _cs[_cs.length] = Calendar.language["weeks"][this.language][i];
        _cs[_cs.length] = '<\/th>';
    }
    _cs[_cs.length] = '<\/tr>';
    for ( var i = 0; i < 6; i++) {
        _cs[_cs.length] = '<tr align="center">';
        for ( var j = 0; j < 7; j++) {
            switch (j) {
            case 0:
                _cs[_cs.length] = '<td class="sun">&nbsp;<\/td>';
                break;
            case 6:
                _cs[_cs.length] = '<td class="sat">&nbsp;<\/td>';
                break;
            default:
                _cs[_cs.length] = '<td class="normal">&nbsp;<\/td>';
                break;
            }
        }
        _cs[_cs.length] = '<\/tr>';
    }
    _cs[_cs.length] = ' <tr>';
    _cs[_cs.length] = '  <th colspan="3"><input type="button" class="b" name="selectTodayButton" id="selectTodayButton" \/><\/th>';
    _cs[_cs.length] = '  <th colspan="1"><input type="button" class="b" name="clearButton" id="clearButton" \/><\/th>';
    _cs[_cs.length] = '  <th colspan="3"><input type="button" class="b" name="closeButton" id="closeButton" \/><\/th>';
    _cs[_cs.length] = ' <\/tr>';
    _cs[_cs.length] = '<\/table>';
    _cs[_cs.length] = '<\/form>';
 
    this.iframe.document.body.innerHTML = _cs.join("");
    this.form = this.iframe.document.forms["__calendarForm"];
    this.form.clearButton.style.visibility = "hidden";
    this.form.clearButton.value = Calendar.language["clear"][this.language];
    
    this.form.selectTodayButton.value = Calendar.language["today"][this.language];
    this.form.closeButton.value = Calendar.language["close"][this.language];
 
    this.form.goPrevMonthButton.onclick = function() {
        calendar.goPrevMonth(this);
    };
    this.form.goNextMonthButton.onclick = function() {
        calendar.goNextMonth(this);
    };
    this.form.yearSelect.onchange = function() {
        calendar.update(this);
    };
    this.form.monthSelect.onchange = function() {
        calendar.update(this);
    };
 
    this.form.clearButton.onclick = function() {
        calendar.dateControl.value = "";
        calendar.hide();
    };
    this.form.closeButton.onclick = function() {
        calendar.hide();
    };
    this.form.selectTodayButton.onclick = function() {
        var today = new Date();
        calendar.date = today;
        calendar.year = today.getFullYear();
        calendar.month = today.getMonth();
        calendar.dateControl.value = today.format(calendar.date2StringPattern);
        calendar.hide();
    };
};
 
Calendar.prototype.bindYear = function() {
    var ys = this.form.yearSelect;
    ys.length = 0;
    for ( var i = this.beginYear; i <= this.endYear; i++) {
        ys.options[ys.length] = new Option(i
                + Calendar.language["year"][this.language], i);
    }
};
 
Calendar.prototype.bindMonth = function() {
    var ms = this.form.monthSelect;
    ms.length = 0;
    for ( var i = 0; i < 12; i++) {
        ms.options[ms.length] = new Option(
                Calendar.language["months"][this.language][i], i);
    }
};
 
Calendar.prototype.goPrevMonth = function(e) {
    if (this.year == this.beginYear && this.month == 0) {
        return;
    }
    this.month--;
    if (this.month == -1) {
        this.year--;
        this.month = 11;
    }
    this.date = new Date(this.year, this.month, 1);
    this.changeSelect();
    this.bindData();
};
 
Calendar.prototype.goNextMonth = function(e) {
    if (this.year == this.endYear && this.month == 11) {
        return;
    }
    this.month++;
    if (this.month == 12) {
        this.year++;
        this.month = 0;
    }
    this.date = new Date(this.year, this.month, 1);
    this.changeSelect();
    this.bindData();
};
 
Calendar.prototype.changeSelect = function() {
    var ys = this.form.yearSelect;
    var ms = this.form.monthSelect;
    for ( var i = 0; i < ys.length; i++) {
        if (ys.options[i].value == this.date.getFullYear()) {
            ys[i].selected = true;
            break;
        }
    }
    for ( var i = 0; i < ms.length; i++) {
        if (ms.options[i].value == this.date.getMonth()) {
            ms[i].selected = true;
            break;
        }
    }
};
 
Calendar.prototype.update = function(e) {
    this.year = e.form.yearSelect.options[e.form.yearSelect.selectedIndex].value;
    this.month = e.form.monthSelect.options[e.form.monthSelect.selectedIndex].value;
    this.date = new Date(this.year, this.month, 1);
    this.changeSelect();
    this.bindData();
};
 
Calendar.prototype.bindData = function() {
    var calendar = this;
    var dateArray = this.getMonthViewDateArray(this.date.getFullYear(),
            this.date.getMonth());
    var tds = this.getElementsByTagName("td", this.getElementById(
            "__calendarTable", this.iframe.document));
    for ( var i = 0; i < tds.length; i++) {
        tds[i].style.backgroundColor = calendar.colors["bg_over"];
        tds[i].onclick = null;
        tds[i].onmouseover = null;
        tds[i].onmouseout = null;
        tds[i].innerHTML = dateArray[i] || "&nbsp;";
        if (i > dateArray.length - 1)
            continue;
        if (dateArray[i]) {
            tds[i].onclick = function() {
                if (calendar.dateControl) {
                    calendar.dateControl.value = new Date(calendar.date
                            .getFullYear(), calendar.date.getMonth(),
                            this.innerHTML).format(calendar.date2StringPattern);
                }
                calendar.hide();
            };
            tds[i].onmouseover = function() {
                this.style.backgroundColor = calendar.colors["bg_out"];
            };
            tds[i].onmouseout = function() {
                this.style.backgroundColor = calendar.colors["bg_over"];
            };
            var today = new Date();
            if (today.getFullYear() == calendar.date.getFullYear()) {
                if (today.getMonth() == calendar.date.getMonth()) {
                    if (today.getDate() == dateArray[i]) {
                        tds[i].style.backgroundColor = calendar.colors["bg_cur_day"];
                        tds[i].onmouseover = function() {
                            this.style.backgroundColor = calendar.colors["bg_out"];
                        };
                        tds[i].onmouseout = function() {
                            this.style.backgroundColor = calendar.colors["bg_cur_day"];
                        };
                    }
                }
            }
        }// end if
    }// end for
};
 
Calendar.prototype.getMonthViewDateArray = function(y, m) {
    var dateArray = new Array(42);
    var dayOfFirstDate = new Date(y, m, 1).getDay();
    var dateCountOfMonth = new Date(y, m + 1, 0).getDate();
    for ( var i = 0; i < dateCountOfMonth; i++) {
        dateArray[i + dayOfFirstDate] = i + 1;
    }
    return dateArray;
};
 
Calendar.prototype.show = function(dateControl, popuControl) {
    if (this.panel.style.visibility == "visible") {
        this.panel.style.visibility = "hidden";
    }
    if (!dateControl) {
        throw new Error("arguments[0] is necessary!");
    }
    this.dateControl = dateControl;
    popuControl = popuControl || dateControl;
 
    this.draw();
    this.bindYear();
    this.bindMonth();
    if (dateControl.value.length > 0) {
        this.date = new Date(dateControl.value.toDate(this.patternDelimiter,
                this.string2DatePattern));
        this.year = this.date.getFullYear();
        this.month = this.date.getMonth();
    }
    this.changeSelect();
    this.bindData();
 
    var xy = this.getAbsPoint(popuControl);
    this.panel.style.left = xy.x + "px";
    this.panel.style.top = (xy.y + dateControl.offsetHeight) + "px";
    this.panel.style.visibility = "visible";
    
};
 
Calendar.prototype.hide = function() {
    //console.info($("#__calendarPanel input").is('focus'));
    this.panel.style.visibility = "hidden";
    this.panel.style.top = '-9999px';
};
 
Calendar.prototype.getElementById = function(id, object) {
    object = object || document;
    return document.getElementById ? object.getElementById(id) : document
            .all(id);
};
 
Calendar.prototype.getElementsByTagName = function(tagName, object) {
    object = object || document;
    return document.getElementsByTagName ? object.getElementsByTagName(tagName)
            : document.all.tags(tagName);
};
 
Calendar.prototype.getAbsPoint = function(e) {
    
//    var x = e.offsetLeft;
//    var y = e.offsetTop;
//    while (e = e.offsetParent) {
//        x += e.offsetLeft;
//        y += e.offsetTop;
//    }
    var yScroll;
    if (self.pageYOffset) {
        yScroll = self.pageYOffset;
    } else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict
        yScroll = document.documentElement.scrollTop;
    } else if (document.body) {// all other Explorers
        yScroll = document.body.scrollTop;
    }
    var   x,y;     
    oRect   =   e.getBoundingClientRect();     
    x=oRect.left;    
    y=oRect.top; 
    return {
        "x" : x,
        "y" : (y+yScroll)
    };
};
 
/**
 * @param d
 *            the delimiter
 * @param p
 *            the pattern of your date
 * @author meizz
 * @author kimsoft add w+ pattern
 */
Date.prototype.format = function(style) {
    var o = {
        "M+" : this.getMonth() + 1, // month
        "d+" : this.getDate(), // day
        "h+" : this.getHours(), // hour
        "m+" : this.getMinutes(), // minute
        "s+" : this.getSeconds(), // second
        "w+" : "\u65e5\u4e00\u4e8c\u4e09\u56db\u4e94\u516d".charAt(this
                .getDay()), // week
        "q+" : Math.floor((this.getMonth() + 3) / 3), // quarter
        "S" : this.getMilliseconds()
    // millisecond
    };
    if (/(y+)/.test(style)) {
        style = style.replace(RegExp.$1, (this.getFullYear() + "")
                .substr(4 - RegExp.$1.length));
    }
    for ( var k in o) {
        if (new RegExp("(" + k + ")").test(style)) {
            style = style.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k]
                    : ("00" + o[k]).substr(("" + o[k]).length));
        }
    }
    return style;
};
 
/**
 * @param d
 *            the delimiter
 * @param p
 *            the pattern of your date
 * @rebuilder kimsoft
 * @version build 2006.12.15
 */
String.prototype.toDate = function(delimiter, pattern) {
    delimiter = delimiter || "-";
    pattern = pattern || "ymd";
    var a = this.split(delimiter);
    var y = parseInt(a[pattern.indexOf("y")], 10);
    // remember to change this next century ;)
    if (y.toString().length <= 2)
        y += 2000;
    if (isNaN(y))
        y = new Date().getFullYear();
    var m = parseInt(a[pattern.indexOf("m")], 10) - 1;
    var d = parseInt(a[pattern.indexOf("d")], 10);
    if (isNaN(d))
        d = 1;
    return new Date(y, m, d);
};
 
document
        .writeln('<div id="__calendarPanel" style="position:absolute;visibility:hidden;z-index:99999999;background-color:#FFFFFF;border:1px solid #666666;width:200px;height:216px;top:-999px;">');
document
        .writeln('<iframe name="__calendarIframe" id="__calendarIframe" width="100%" height="100%" scrolling="no" frameborder="0" style="margin:0px;"><\/iframe>');
var __ci = window.frames['__calendarIframe'];
__ci.document
        .writeln('<!DOCTYPE html PUBLIC "-\/\/W3C\/\/DTD XHTML 1.0 Transitional\/\/EN" "http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-transitional.dtd">');
__ci.document.writeln('<html xmlns="http:\/\/www.w3.org\/1999\/xhtml">');
__ci.document.writeln('<head>');
__ci.document
        .writeln('<meta http-equiv="Content-Type" content="text\/html; charset=utf-8" \/>');
__ci.document.writeln('<title>Web Calendar(UTF-8) Written By KimSoft<\/title>');
__ci.document.writeln('<style type="text\/css">');
__ci.document.writeln('<!--');
__ci.document.writeln('body {font-size:12px;margin:0px;text-align:center;}');
__ci.document.writeln('form {margin:0px;}');
__ci.document.writeln('select {font-size:12px;background-color:#EFEFEF;}');
__ci.document
        .writeln('table {border:0px solid #CCCCCC;background-color:#FFFFFF}');
__ci.document
        .writeln('th {font-size:12px;font-weight:normal;background-color:#FFFFFF;}');
__ci.document
        .writeln('th.theader {font-weight:normal;background-color:#666666;color:#FFFFFF;width:24px;}');
__ci.document.writeln('select.year {width:64px;}');
__ci.document.writeln('select.month {width:60px;}');
__ci.document.writeln('td {font-size:12px;text-align:center;}');
__ci.document.writeln('td.sat {color:#0000FF;background-color:#EFEFEF;}');
__ci.document.writeln('td.sun {color:#FF0000;background-color:#EFEFEF;}');
__ci.document.writeln('td.normal {background-color:#EFEFEF;}');
__ci.document
        .writeln('input.l {border: 1px solid #CCCCCC;background-color:#EFEFEF;width:20px;height:20px;}');
__ci.document
        .writeln('input.r {border: 1px solid #CCCCCC;background-color:#EFEFEF;width:20px;height:20px;}');
__ci.document
        .writeln('input.b {border: 1px solid #CCCCCC;background-color:#EFEFEF;width:100%;height:20px;}');
__ci.document.writeln('-->');
__ci.document.writeln('<\/style>');
__ci.document.writeln('<\/head>');
__ci.document.writeln('<body>');
__ci.document.writeln('<\/body>');
__ci.document.writeln('<\/html>');
__ci.document.close();
document.writeln('<\/div>');
var calendar = new Calendar();
// -->
 
// 设置日历位置
function showCalendar(param) {
    new Calendar().show(param);
    var winWidth = $(window).width();
 
    var offsetLeft = $('#__calendarPanel').offset().left;
    var calendarWidth = $('#__calendarPanel').width();
 
    var fullWidth = offsetLeft + calendarWidth;
 
    if(fullWidth > winWidth) {
        $('#__calendarPanel').css('left', winWidth - 205+"px");
    }
}
 
 
// 正则验证英文名称
function pregEnName(enName) {
    if(enName == undefined || enName.trim().length == 0) {
        return '不能为空';
    }
    var pattern = /^[a-zA-Z0-9]+$/i;
    if(pattern.test(enName)) {
        return '输入合法';
    }else {
        return '格式不正确';
    }
}
 
// 正则验证密码
function pregPwd(pwd) {
    if(pwd == undefined || pwd.trim().length == 0) {
        return '不能为空';
    }
    var pattern  = /^[a-zA-Z0-9!@#$%^&*?.]+$/;
    if(pattern.test(pwd)) {
        return '输入合法';
    }else {
        return '格式不正确';
    }
}
 
/*****************常用判断数据类型*****************/
 
//是否为数字
function isNumber(s) {
    return !isNaN(s);
}
 
// 是否为字符串
function isString(s) {
    return typeof s === 'string';
}
 
// 是否为布尔类型
function isBoolean(s) {
    return typeof s === 'boolean';
}
 
// 判断是否为函数
function isFunction(s) {
    return typeof s === 'function';
}
// 判断是否为空
function isNull(s) {
    return typeof s === 'null';
}
 
// 判断是否为未定义
function isUndefined(s) {
    return typeof s === 'undefined'; 
}
 
// 判断是否为数组
function isArray(s) {
    return s instanceof Array;
}
 
// 判断是否为对象
function isObject(s) {
    return (typeof s === 'object' && !isArray(s));
}
 
//使用XMLHttpRequest的方式获取模板页
function getTpl(url) {
    var xmlhttp;    // 实例化XMLHttpRequest对象
    if(window.XMLHttpRequest) {
        xmlhttp = new XMLHttpRequest();
    }else {
        xmlhttp = new ActiveXObject('Mocrosoft.XMLHTTP');
    }
    
    // 设置请求
    xmlhttp.open('GET', url, false);
    
    // 发送请求
    xmlhttp.send();
    
    var tpl;
    if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
        tpl = xmlhttp.responseText;
    }else {
        tpl = "";
    }
    
    return tpl;
}