/**
 * map.js
 */

Ext.Loader.setConfig({
    enabled: true
});

Ext.Loader.setPath('Ext.ux', '../../res/extjs/examples/ux');

Ext.require([
    'Ext.grid.*',
    'Ext.data.*',
    'Ext.ux.RowExpander',
    'Ext.selection.CheckboxModel'
]);

var sm = Ext.create('Ext.selection.CheckboxModel');
var myMask;
var baseUrl = "";
var theme = "";
var mapStyle = "";
var map;
var mapzoom = 11;
var company_cur = 0;
var StatusStore = null,
    AlarmStore = null;
var firstDraw = true;
var storeTime = 60000;
var centerLng = 121.475644;
var currentLng = 121.475644;
var centerLat = 31.1857;
var currentLat = 31.1857;
var rotation = 0;
var alarm_show_window = null;
var show_alarm_list;
var show_list_cur = 0
var V_LOGINNAME = '',
    V_PASSWORD = '';
var listSync = true;
var synctime = 0;
var company_code = '';
var start = 0;
var end = 360;
var targetZoom = 20;
var maxHeight = 10000;
var maxWidth = 10000;
var SearchList = null;
var markers = [];
var current_company_code = "";
var LabelShow = false;
var MapShow = false;
var last_move;
var wsUri = "wss://iot.usky.cn:55120";
var websocket = null;

var win1_config = {
    title: '<table border=0><tr><td style="width:100px;overflow:hidden">火灾监控</td><td id="win1-title-hiden" style="display:none;font-size:9px;font-weight:normal;margin-top:3px;"><span style="width:40px;text-align:right;overflow:hidden;">总数:</span><span id="title-label-12" style="color:#31e9ff;display:inline-block;width:50px;text-align:left;"></span><span style="display:inline-block;width:50px;text-align:right;">处置率:</span><span id="title-label-11"></span></td></tr></table>',
    titleColor: '#ffffff',
    titleIconColor: '#ffffff',
    titleBackgroundColor: 'rgba(0,0,0,0.1)',
    backgroundColor: 'rgba(23,21,57,0.2)',
    backgroundImage: 'radial-gradient(circle, rgba(23,21,57,0.2), rgba(9,9,27,0.8))',
    border: '1px solid  rgba(0,123,255,0.3)',
    borderRadius: '10px',
    position: 'absolute',
    width: 320,
    height: 120,
    top: 100,
    left: 50,
    zIndex: 200,
    bodyText: '<div id="win1" style="margin-top:-20px;"><table border="0" style="border:0px solid #000;"><tr><td colspan=2 style="height:20px;"></td><td id="data_pie_1" rowspan=3 style="width:110px; height:110px; margin-top:-10px;" onclick="show_all_fireAlarm()"></td></tr><tr><td id="data_label_11" class="data_bar_total_label" style="width:80px;" onclick="show_all_fireAlarm()">报告总数</td><td id="data_number_11" class="data_bar_total_number" style="width:100px;" onclick="show_all_fireAlarm()"></td></tr><tr><td id="data_label_12" class="data_bar_alarm_label" onclick="show_all_fireAlarm()">待处理</td><td id="data_number_12" class="data_bar_alarm_number" onclick="show_all_fireAlarm()"></td></tr></table></div>'
}

var win2_config = {
    title: '<table border=0><tr><td style="width:100px;overflow:hidden">电气火灾监控</td><td id="win2-title-hiden" style="display:none;font-size:9px;font-weight:normal;margin-top:3px;"><span style="width:40px;text-align:right;overflow:hidden;">总数:</span><span id="title-label-22" style="color:#31e9ff;display:inline-block;width:50px;text-align:left;"></span><span style="display:inline-block;width:50px;text-align:right;">处置率:</span><span id="title-label-21"></span></td></tr></table>',
    titleColor: '#ffffff',
    titleIconColor: '#ffffff',
    titleBackgroundColor: 'rgba(0,0,0,0.1)',
    backgroundColor: 'rgba(23,21,57,0.2)',
    backgroundImage: 'radial-gradient(circle, rgba(23,21,57,0.2), rgba(9,9,27,0.8))',
    border: '1px solid  rgba(0,123,255,0.3)',
    borderRadius: '10px',
    position: 'absolute',
    width: 320,
    height: 120,
    top: 260,
    left: 50,
    zIndex: 260,
    bodyText: '<div id="win2" style="margin-top:-20px;"><table border="0" style="border:0px solid #000;"><tr><td colspan=2 style="height:20px;"></td><td id="data_pie_2" rowspan=3 style="width:110px; height:110px; margin-top:-10px;" onclick="show_all_efireAlarm()"></td></tr><tr><td id="data_label_21" class="data_bar_total_label" style="width:80px;" onclick="show_all_efireAlarm()">报告总数</td><td id="data_number_21" class="data_bar_total_number" style="width:100px;" onclick="show_all_efireAlarm()"></td></tr><tr><td id="data_label_22" class="data_bar_alarm_label" onclick="show_all_efireAlarm()">待处理</td><td id="data_number_22" class="data_bar_alarm_number" onclick="show_all_efireAlarm()"></td></tr></table></div>'
}

var win3_config = {
    title: '<table border=0><tr><td style="width:100px;overflow:hidden">水系统监控</td><td id="win3-title-hiden" style="display:none;font-size:9px;font-weight:normal;margin-top:3px;"><span style="width:40px;text-align:right;overflow:hidden;">总数:</span><span id="title-label-32" style="color:#31e9ff;display:inline-block;width:50px;text-align:left;"></span><span style="display:inline-block;width:50px;text-align:right;">处置率:</span><span id="title-label-31"></span></td></tr></table>',
    titleColor: '#ffffff',
    titleIconColor: '#ffffff',
    titleBackgroundColor: 'rgba(0,0,0,0.1)',
    backgroundColor: 'rgba(23,21,57,0.2)',
    backgroundImage: 'radial-gradient(circle, rgba(23,21,57,0.2), rgba(9,9,27,0.8))',
    border: '1px solid  rgba(0,123,255,0.3)',
    borderRadius: '10px',
    position: 'absolute',
    width: 320,
    height: 120,
    top: 420,
    left: 50,
    zIndex: 260,
    bodyText: '<div id="win3" style="margin-top:-20px;"><table border="0" style="border:0px solid #000;"><tr><td colspan=2 style="height:20px;"></td><td id="data_pie_3" rowspan=3 style="width:110px; height:110px; margin-top:-10px;" onclick="show_all_waterAlarm()"></td></tr><tr><td id="data_label_31" class="data_bar_total_label" style="width:80px;" onclick="show_all_waterAlarm()">报告总数</td><td id="data_number_31" class="data_bar_total_number" style="width:100px;" onclick="show_all_waterAlarm()"></td></tr><tr><td id="data_label_32" class="data_bar_alarm_label" onclick="show_all_waterAlarm()">待处理</td><td id="data_number_32" class="data_bar_alarm_number" onclick="show_all_waterAlarm()"></td></tr></table></div>'
}

var win4_config = {
    title: '<table border=0><tr><td style="width:100px;overflow:hidden">RTU监控</td><td id="win4-title-hiden" style="display:none;font-size:9px;font-weight:normal;margin-top:3px;"><span style="width:40px;text-align:right;overflow:hidden;">总数:</span><span id="title-label-42" style="color:#31e9ff;display:inline-block;width:50px;text-align:left;"></span><span style="display:inline-block;width:50px;text-align:right;">处置率:</span><span id="title-label-41"></span></td></tr></table>',
    titleColor: '#ffffff',
    titleIconColor: '#ffffff',
    titleBackgroundColor: 'rgba(0,0,0,0.1)',
    backgroundColor: 'rgba(23,21,57,0.2)',
    backgroundImage: 'radial-gradient(circle, rgba(23,21,57,0.2), rgba(9,9,27,0.8))',
    border: '1px solid  rgba(0,123,255,0.3)',
    borderRadius: '10px',
    position: 'absolute',
    width: 320,
    height: 120,
    top: 580,
    left: 50,
    zIndex: 260,
    bodyText: '<div id="win4" style="margin-top:-20px;"><table border="0" style="border:0px solid #000;"><tr><td colspan=2 style="height:20px;"></td><td id="data_pie_4" rowspan=3 style="width:110px; height:110px; margin-top:-10px;" onclick="show_all_rtuAlarm()"></td></tr><tr><td id="data_label_41" class="data_bar_total_label" style="width:80px;" onclick="show_all_rtuAlarm()">报告总数</td><td id="data_number_41" class="data_bar_total_number" style="width:100px;" onclick="show_all_rtuAlarm()"></td></tr><tr><td id="data_label_42" class="data_bar_alarm_label" onclick="show_all_rtuAlarm()">待处理</td><td id="data_number_42" class="data_bar_alarm_number" onclick="show_all_rtuAlarm()"></td></tr></table></div>'
}

var dev1_config = {
    title: '<table><tr><td style="width:145px;overflow:hidden;font-weight:bold;">火灾监控设备</td><td><table border=0 style="font-weight:normal;font-size:9px;margin-top:3px;"><tr><td><div style="width:45px;text-align:right;">设备数:</div></td><td><div id="dev1_count" style="color:#31e9ff;width:30px;"></div></td><td><div id="dev1-title-hiden" style="display:none;font-size:9px;text-align:right;">待处理:</div></td><td><div id="dev1-label-hidden" style="display:none;"></div></td></tr></table></td></tr></table>',
    titleColor: '#ffffff',
    titleIconColor: '#ffffff',
    titleBackgroundColor: 'rgba(0,0,0,0.1)',
    backgroundColor: 'rgba(23,21,57,0.2)',
    backgroundImage: 'radial-gradient(circle, rgba(23,21,57,0.2), rgba(9,9,27,0.8))',
    border: '1px solid  rgba(0,123,255,0.3)',
    borderRadius: '10px',
    position: 'absolute',
    width: 320,
    height: 100,
    top: 219,
    left: 50,
    zIndex: 200,
    floding: 'true',
    bodyText: '<div id="dev1" style="font-size:9px;font-weight:normal;"><table border="0" style="border:0px solid #000;width:300px"><tr><td>已处理:</td><td id="device_count_num_12" class="device_confirm_num1"></td><td>待处理:</td><td id="device_count_num_13" class="device_confirm_num2"></td><td>处置率:</td><td id="device_count_num_14" class="device_confirm_num3"></td></tr><tr><td colspan=6 style="height:28px;" onclick="show_all_fireDevice()"><div style="border:0px solid #000;border-radius:3px;width:300px;height:6px;background-color:rgba(255,255,255,0.1);"><div id="device_confirm_14" style="border:0px solid #00a7d1;margin:0px;padding:0px;border-radius:3px;height:6px;width:300px;background-color:#00a7d1"></div></div></td></tr></table></div>'
}

var dev2_config = {
    title: '<table><tr><td style="width:145px;overflow:hidden;font-weight:bold;">电气火灾监控设备</td><td><table border=0 style="font-weight:normal;font-size:9px;margin-top:3px;"><tr><td><div style="width:45px;text-align:right;">设备数:</div></td><td><div id="dev2_count" style="color:#31e9ff;width:30px;"></div></td><td><div id="dev2-title-hiden" style="display:none;font-size:9px;text-align:right;">待处理:</div></td><td><div id="dev2-label-hidden" style="display:none;"></div></td></tr></table></td></tr></table>',
    titleColor: '#ffffff',
    titleIconColor: '#ffffff',
    titleBackgroundColor: 'rgba(0,0,0,0.1)',
    backgroundColor: 'rgba(23,21,57,0.2)',
    backgroundImage: 'radial-gradient(circle, rgba(23,21,57,0.2), rgba(9,9,27,0.8))',
    border: '1px solid  rgba(0,123,255,0.3)',
    borderRadius: '10px',
    position: 'absolute',
    width: 320,
    height: 100,
    top: 379,
    left: 50,
    zIndex: 200,
    floding: 'true',
    bodyText: '<div id="dev2" style="font-size:9px;font-weight:normal;"><table border="0" style="border:0px solid #000;width:300px"><tr><td>已处理:</td><td id="device_count_num_22" class="device_confirm_num1"></td><td>待处理:</td><td id="device_count_num_23" class="device_confirm_num2"></td><td>处置率:</td><td id="device_count_num_24" class="device_confirm_num3"></td></tr><tr><td colspan=6 style="height:28px;" onclick="show_all_efireDevice()"><div style="border:0px solid #000;border-radius:3px;width:300px;height:6px;background-color:rgba(255,255,255,0.1);"><div id="device_confirm_24" style="border:0px solid #00a7d1;margin:0px;padding:0px;border-radius:3px;height:6px;width:300px;background-color:#00a7d1"></div></div></td></tr></table></div>'
}
var dev3_config = {
    title: '<table><tr><td style="width:145px;overflow:hidden;font-weight:bold;">水系统监控设备</td><td><table border=0 style="font-weight:normal;font-size:9px;margin-top:3px;"><tr><td><div style="width:45px;text-align:right;">设备数:</div></td><td><div id="dev3_count" style="color:#31e9ff;width:30px;"></div></td><td><div id="dev3-title-hiden" style="display:none;font-size:9px;text-align:right;">待处理:</div></td><td><div id="dev3-label-hidden" style="display:none;"></div></td></tr></table></td></tr></table>',
    titleColor: '#ffffff',
    titleIconColor: '#ffffff',
    titleBackgroundColor: 'rgba(0,0,0,0.1)',
    backgroundColor: 'rgba(23,21,57,0.2)',
    backgroundImage: 'radial-gradient(circle, rgba(23,21,57,0.2), rgba(9,9,27,0.8))',
    border: '1px solid  rgba(0,123,255,0.3)',
    borderRadius: '10px',
    position: 'absolute',
    width: 320,
    height: 100,
    top: 539,
    left: 50,
    zIndex: 200,
    floding: 'true',
    bodyText: '<div id="dev3" style="font-size:9px;font-weight:normal;"><table border="0" style="border:0px solid #000;width:300px"><tr><td>已处理:</td><td id="device_count_num_32" class="device_confirm_num1"></td><td>待处理:</td><td id="device_count_num_33" class="device_confirm_num2"></td><td>处置率:</td><td id="device_count_num_34" class="device_confirm_num3"></td></tr><tr><td colspan=6 style="height:28px;" onclick="show_all_waterDevice()"><div style="border:0px solid #000;border-radius:3px;width:300px;height:6px;background-color:rgba(255,255,255,0.1);"><div id="device_confirm_34" style="border:0px solid #00a7d1;margin:0px;padding:0px;border-radius:3px;height:6px;width:300px;background-color:#00a7d1"></div></div></td></tr></table></div>'
}
var dev4_config = {
    title: '<table><tr><td style="width:145px;overflow:hidden;font-weight:bold;">RTU监控设备</td><td><table border=0 style="font-weight:normal;font-size:9px;margin-top:3px;"><tr><td><div style="width:45px;text-align:right;">设备数:</div></td><td><div id="dev4_count" style="color:#31e9ff;width:30px;"></div></td><td><div id="dev4-title-hiden" style="display:none;font-size:9px;text-align:right;">待处理:</div></td><td><div id="dev4-label-hidden" style="display:none;"></div></td></tr></table></td></tr></table>',
    titleColor: '#ffffff',
    titleIconColor: '#ffffff',
    titleBackgroundColor: 'rgba(0,0,0,0.1)',
    backgroundColor: 'rgba(23,21,57,0.2)',
    backgroundImage: 'radial-gradient(circle, rgba(23,21,57,0.2), rgba(9,9,27,0.8))',
    border: '1px solid rgba(0,123,255,0.3)',
    borderRadius: '10px',
    position: 'absolute',
    width: 320,
    height: 100,
    top: 699,
    left: 50,
    zIndex: 200,
    floding: 'true',
    bodyText: '<div id="dev4" style="font-size:9px;font-weight:normal;"><table border="0" style="border:0px solid #000;width:300px;"><tr><td>已处理:</td><td id="device_count_num_42" class="device_confirm_num1"></td><td>待处理:</td><td id="device_count_num_43" class="device_confirm_num2"></td><td>处置率:</td><td id="device_count_num_44" class="device_confirm_num3"></td></tr><tr><td colspan=6 style="height:28px;" onclick="show_all_rtuDevice()"><div style="border:0px solid #000;border-radius:3px;width:300px;height:6px;background-color:rgba(255,255,255,0.1);"><div id="device_confirm_44" style="border:0px solid #00a7d1;margin:0px;padding:0px;border-radius:3px;height:6px;width:300px;background-color:#00a7d1"></div></div></td></tr></table></div>'
}

var alarm_alert_config = {
    title: '<table border=0 style="width:320px;"><tr><td id="rt_alarm_alert_icon" style="width:24px;height:24px;"></td><td><span id="rt_alarm_alert_title" style="text-align:right;margin-left:10px;font-widght:bold;color:#31e9ff;overflow:hidden;"></span></td><td style="width:32px;color:#ffffff;cursor:pointer;text-align:left;" onclick="close_alert()"><div style="width:16px;height:16px;background-image:url(../../res/img/common/close-tmp.gif)"></div></td></tr></table>',
    titleColor: '#ffffff',
    titleIconColor: '#ffffff',
    titleBackgroundColor: 'rgba(0,0,0,0.1)',
    backgroundColor: 'rgba(23,21,57,0.2)',
    backgroundImage: 'radial-gradient(circle, rgba(23,21,57,0.2), rgba(9,9,27,0.8))',
    border: '1px solid #31e9ff',
    borderRadius: '10px',
    position: 'absolute',
    width: 320,
    height: 120,
    bottom: -100,
    right: 95,
    zIndex: 990,
    bodyText: '<div><table border="0" style="border:0px solid #31e9ff;margin:5px;font-size:9px;color:#ffffff"><tr><td colspan=2 style="height:20px;"><div id="alarm_time" style="margin-top:3px;"></div><div id="alarm_company" style="margin-top:3px;"></div><div id="alarm_device" style="margin-top:3px;"></div></td></tr></table></div>'
}

var winypxy1_config = {
    title: '<table border=0><tr><td style="width:100px;overflow:hidden">智能烟感监控</td><td id="win1-title-hiden" style="display:none;font-size:9px;font-weight:normal;margin-top:3px;"><span style="width:40px;text-align:right;overflow:hidden;">总数:</span><span id="title-label-12" style="color:#31e9ff;display:inline-block;width:50px;text-align:left;"></span><span style="display:inline-block;width:50px;text-align:right;">处置率:</span><span id="title-label-11"></span></td></tr></table>',
    titleColor: '#ffffff',
    titleIconColor: '#ffffff',
    titleBackgroundColor: 'rgba(0,0,0,0.1)',
    backgroundColor: 'rgba(23,21,57,0.2)',
    backgroundImage: 'radial-gradient(circle, rgba(23,21,57,0.2), rgba(9,9,27,0.8))',
    border: '1px solid  rgba(0,123,255,0.3)',
    borderRadius: '10px',
    position: 'absolute',
    width: 320,
    height: 120,
    top: 60,
    left: 50,
    zIndex: 200,
    bodyText: '<div id="win1" style="margin-top:-20px;"><table border="0" style="border:0px solid #000;"><tr><td colspan=2 style="height:20px;"></td><td id="data_pie_1" rowspan=3 style="width:110px; height:110px; margin-top:-10px;" onclick="show_all_fireAlarm()"></td></tr><tr><td id="data_label_11" class="data_bar_total_label" style="width:80px;" onclick="show_all_fireAlarm()">报告总数</td><td id="data_number_11" class="data_bar_total_number" style="width:100px;" onclick="show_all_fireAlarm()"></td></tr><tr><td id="data_label_12" class="data_bar_alarm_label" onclick="show_all_fireAlarm()">待处理</td><td id="data_number_12" class="data_bar_alarm_number" onclick="show_all_fireAlarm()"></td></tr></table></div>'
}
var devypxy1_config = {
    title: '<table><tr><td style="width:145px;overflow:hidden;font-weight:bold;">智能烟感监控设备</td><td><table border=0 style="font-weight:normal;font-size:9px;margin-top:3px;"><tr><td><div style="width:45px;text-align:right;">设备数:</div></td><td><div id="dev1_count" style="color:#31e9ff;width:30px;"></div></td><td><div id="dev1-title-hiden" style="display:none;font-size:9px;text-align:right;">待处理:</div></td><td><div id="dev1-label-hidden" style="display:none;"></div></td></tr></table></td></tr></table>',
    titleColor: '#ffffff',
    titleIconColor: '#ffffff',
    titleBackgroundColor: 'rgba(0,0,0,0.1)',
    backgroundColor: 'rgba(23,21,57,0.2)',
    backgroundImage: 'radial-gradient(circle, rgba(23,21,57,0.2), rgba(9,9,27,0.8))',
    border: '1px solid  rgba(0,123,255,0.3)',
    borderRadius: '10px',
    position: 'absolute',
    width: 320,
    height: 100,
    top: 179,
    left: 50,
    zIndex: 200,
    floding: 'true',
    bodyText: '<div id="dev1" style="font-size:9px;font-weight:normal;"><table border="0" style="border:0px solid #000;width:300px"><tr><td>已处理:</td><td id="device_count_num_12" class="device_confirm_num1"></td><td>待处理:</td><td id="device_count_num_13" class="device_confirm_num2"></td><td>处置率:</td><td id="device_count_num_14" class="device_confirm_num3"></td></tr><tr><td colspan=6 style="height:28px;" onclick="show_all_fireDevice()"><div style="border:0px solid #000;border-radius:3px;width:300px;height:6px;background-color:rgba(255,255,255,0.1);"><div id="device_confirm_14" style="border:0px solid #00a7d1;margin:0px;padding:0px;border-radius:3px;height:6px;width:300px;background-color:#00a7d1"></div></div></td></tr></table></div>'
}
var winypxy2_config = {
    title: '<table border=0><tr><td style="width:100px;overflow:hidden">电气火灾监控</td><td id="win2-title-hiden" style="display:none;font-size:9px;font-weight:normal;margin-top:3px;"><span style="width:40px;text-align:right;overflow:hidden;">总数:</span><span id="title-label-22" style="color:#31e9ff;display:inline-block;width:50px;text-align:left;"></span><span style="display:inline-block;width:50px;text-align:right;">处置率:</span><span id="title-label-21"></span></td></tr></table>',
    titleColor: '#ffffff',
    titleIconColor: '#ffffff',
    titleBackgroundColor: 'rgba(0,0,0,0.1)',
    backgroundColor: 'rgba(23,21,57,0.2)',
    backgroundImage: 'radial-gradient(circle, rgba(23,21,57,0.2), rgba(9,9,27,0.8))',
    border: '1px solid  rgba(0,123,255,0.3)',
    borderRadius: '10px',
    position: 'absolute',
    width: 320,
    height: 120,
    top: 220,
    left: 50,
    zIndex: 260,
    bodyText: '<div id="win2" style="margin-top:-20px;"><table border="0" style="border:0px solid #000;"><tr><td colspan=2 style="height:20px;"></td><td id="data_pie_2" rowspan=3 style="width:110px; height:110px; margin-top:-10px;" onclick="show_all_efireAlarm()"></td></tr><tr><td id="data_label_21" class="data_bar_total_label" style="width:80px;" onclick="show_all_efireAlarm()">报告总数</td><td id="data_number_21" class="data_bar_total_number" style="width:100px;" onclick="show_all_efireAlarm()"></td></tr><tr><td id="data_label_22" class="data_bar_alarm_label" onclick="show_all_efireAlarm()">待处理</td><td id="data_number_22" class="data_bar_alarm_number" onclick="show_all_efireAlarm()"></td></tr></table></div>'
}

var winypxy3_config = {
    title: '<table border=0><tr><td style="width:100px;overflow:hidden">智能水表监控</td><td id="win3-title-hiden" style="display:none;font-size:9px;font-weight:normal;margin-top:3px;"><span style="width:40px;text-align:right;overflow:hidden;">总数:</span><span id="title-label-32" style="color:#31e9ff;display:inline-block;width:50px;text-align:left;"></span><span style="display:inline-block;width:50px;text-align:right;">处置率:</span><span id="title-label-31"></span></td></tr></table>',
    titleColor: '#ffffff',
    titleIconColor: '#ffffff',
    titleBackgroundColor: 'rgba(0,0,0,0.1)',
    backgroundColor: 'rgba(23,21,57,0.2)',
    backgroundImage: 'radial-gradient(circle, rgba(23,21,57,0.2), rgba(9,9,27,0.8))',
    border: '1px solid  rgba(0,123,255,0.3)',
    borderRadius: '10px',
    position: 'absolute',
    width: 320,
    height: 120,
    top: 380,
    left: 50,
    zIndex: 260,
    bodyText: '<div id="win3" style="margin-top:-20px;"><table border="0" style="border:0px solid #000;"><tr><td colspan=2 style="height:20px;"></td><td id="data_pie_3" rowspan=3 style="width:110px; height:110px; margin-top:-10px;" onclick="show_all_waterAlarm()"></td></tr><tr><td id="data_label_31" class="data_bar_total_label" style="width:80px;" onclick="show_all_waterAlarm()">报告总数</td><td id="data_number_31" class="data_bar_total_number" style="width:100px;" onclick="show_all_waterAlarm()"></td></tr><tr><td id="data_label_32" class="data_bar_alarm_label" onclick="show_all_waterAlarm()">待处理</td><td id="data_number_32" class="data_bar_alarm_number" onclick="show_all_waterAlarm()"></td></tr></table></div>'
}

var winypxy4_config = {
    title: '<table border=0><tr><td style="width:140px;overflow:hidden">智能消火栓监控</td><td id="win4-title-hiden" style="display:none;font-size:9px;font-weight:normal;margin-top:3px;"><span style="width:40px;text-align:right;overflow:hidden;">总数:</span><span id="title-label-42" style="color:#31e9ff;display:inline-block;width:50px;text-align:left;"></span><span style="display:inline-block;width:50px;text-align:right;">处置率:</span><span id="title-label-41"></span></td></tr></table>',
    titleColor: '#ffffff',
    titleIconColor: '#ffffff',
    titleBackgroundColor: 'rgba(0,0,0,0.1)',
    backgroundColor: 'rgba(23,21,57,0.2)',
    backgroundImage: 'radial-gradient(circle, rgba(23,21,57,0.2), rgba(9,9,27,0.8))',
    border: '1px solid  rgba(0,123,255,0.3)',
    borderRadius: '10px',
    position: 'absolute',
    width: 320,
    height: 120,
    top: 540,
    left: 50,
    zIndex: 260,
    bodyText: '<div id="win4" style="margin-top:-20px;"><table border="0" style="border:0px solid #000;"><tr><td colspan=2 style="height:20px;"></td><td id="data_pie_4" rowspan=3 style="width:110px; height:110px; margin-top:-10px;" onclick="show_all_waterAlarm()"></td></tr><tr><td id="data_label_41" class="data_bar_total_label" style="width:80px;" onclick="show_all_waterAlarm()">报告总数</td><td id="data_number_41" class="data_bar_total_number" style="width:100px;" onclick="show_all_waterAlarm()"></td></tr><tr><td id="data_label_42" class="data_bar_alarm_label" onclick="show_all_waterAlarm()">待处理</td><td id="data_number_42" class="data_bar_alarm_number" onclick="show_all_waterAlarm()"></td></tr></table></div>'
}
var winypxy5_config = {
    title: '<table border=0><tr><td style="width:140px;overflow:hidden">智能井盖监控</td><td id="win5-title-hiden" style="display:none;font-size:9px;font-weight:normal;margin-top:3px;"><span style="width:40px;text-align:right;overflow:hidden;">总数:</span><span id="title-label-52" style="color:#31e9ff;display:inline-block;width:50px;text-align:left;"></span><span style="display:inline-block;width:50px;text-align:right;">处置率:</span><span id="title-label-51"></span></td></tr></table>',
    titleColor: '#ffffff',
    titleIconColor: '#ffffff',
    titleBackgroundColor: 'rgba(0,0,0,0.1)',
    backgroundColor: 'rgba(23,21,57,0.2)',
    backgroundImage: 'radial-gradient(circle, rgba(23,21,57,0.2), rgba(9,9,27,0.8))',
    border: '1px solid  rgba(0,123,255,0.3)',
    borderRadius: '10px',
    position: 'absolute',
    width: 320,
    height: 120,
    top: 700,
    left: 50,
    zIndex: 260,
    bodyText: '<div id="win5" style="margin-top:-20px;"><table border="0" style="border:0px solid #000;"><tr><td colspan=2 style="height:20px;"></td><td id="data_pie_5" rowspan=3 style="width:110px; height:110px; margin-top:-10px;"></td></tr><tr><td id="data_label_51" class="data_bar_total_label" style="width:80px;">报告总数</td><td id="data_number_51" class="data_bar_total_number" style="width:100px;"></td></tr><tr><td id="data_label_52" class="data_bar_alarm_label">待处理</td><td id="data_number_52" class="data_bar_alarm_number"></td></tr></table></div>'
}
var devypxy2_config = {
    title: '<table><tr><td style="width:145px;overflow:hidden;font-weight:bold;">电气火灾监控设备</td><td><table border=0 style="font-weight:normal;font-size:9px;margin-top:3px;"><tr><td><div style="width:45px;text-align:right;">设备数:</div></td><td><div id="dev2_count" style="color:#31e9ff;width:30px;"></div></td><td><div id="dev2-title-hiden" style="display:none;font-size:9px;text-align:right;">待处理:</div></td><td><div id="dev2-label-hidden" style="display:none;"></div></td></tr></table></td></tr></table>',
    titleColor: '#ffffff',
    titleIconColor: '#ffffff',
    titleBackgroundColor: 'rgba(0,0,0,0.1)',
    backgroundColor: 'rgba(23,21,57,0.2)',
    backgroundImage: 'radial-gradient(circle, rgba(23,21,57,0.2), rgba(9,9,27,0.8))',
    border: '1px solid  rgba(0,123,255,0.3)',
    borderRadius: '10px',
    position: 'absolute',
    width: 320,
    height: 100,
    top: 339,
    left: 50,
    zIndex: 200,
    floding: 'true',
    bodyText: '<div id="dev2" style="font-size:9px;font-weight:normal;"><table border="0" style="border:0px solid #000;width:300px"><tr><td>已处理:</td><td id="device_count_num_22" class="device_confirm_num1"></td><td>待处理:</td><td id="device_count_num_23" class="device_confirm_num2"></td><td>处置率:</td><td id="device_count_num_24" class="device_confirm_num3"></td></tr><tr><td colspan=6 style="height:28px;" onclick="show_all_efireDevice()"><div style="border:0px solid #000;border-radius:3px;width:300px;height:6px;background-color:rgba(255,255,255,0.1);"><div id="device_confirm_24" style="border:0px solid #00a7d1;margin:0px;padding:0px;border-radius:3px;height:6px;width:300px;background-color:#00a7d1"></div></div></td></tr></table></div>'
}
var devypxy3_config = {
    title: '<table><tr><td style="width:145px;overflow:hidden;font-weight:bold;">智能水表监控设备</td><td><table border=0 style="font-weight:normal;font-size:9px;margin-top:3px;"><tr><td><div style="width:45px;text-align:right;">设备数:</div></td><td><div id="dev3_count" style="color:#31e9ff;width:30px;"></div></td><td><div id="dev3-title-hiden" style="display:none;font-size:9px;text-align:right;">待处理:</div></td><td><div id="dev3-label-hidden" style="display:none;"></div></td></tr></table></td></tr></table>',
    titleColor: '#ffffff',
    titleIconColor: '#ffffff',
    titleBackgroundColor: 'rgba(0,0,0,0.1)',
    backgroundColor: 'rgba(23,21,57,0.2)',
    backgroundImage: 'radial-gradient(circle, rgba(23,21,57,0.2), rgba(9,9,27,0.8))',
    border: '1px solid  rgba(0,123,255,0.3)',
    borderRadius: '10px',
    position: 'absolute',
    width: 320,
    height: 100,
    top: 499,
    left: 50,
    zIndex: 200,
    floding: 'true',
    bodyText: '<div id="dev3" style="font-size:9px;font-weight:normal;"><table border="0" style="border:0px solid #000;width:300px"><tr><td>已处理:</td><td id="device_count_num_32" class="device_confirm_num1"></td><td>待处理:</td><td id="device_count_num_33" class="device_confirm_num2"></td><td>处置率:</td><td id="device_count_num_34" class="device_confirm_num3"></td></tr><tr><td colspan=6 style="height:28px;" onclick="show_all_waterDevice()"><div style="border:0px solid #000;border-radius:3px;width:300px;height:6px;background-color:rgba(255,255,255,0.1);"><div id="device_confirm_34" style="border:0px solid #00a7d1;margin:0px;padding:0px;border-radius:3px;height:6px;width:300px;background-color:#00a7d1"></div></div></td></tr></table></div>'
}
var devypxy4_config = {
    title: '<table><tr><td style="width:145px;overflow:hidden;font-weight:bold;">智能消火栓监控设备</td><td><table border=0 style="font-weight:normal;font-size:9px;margin-top:3px;"><tr><td><div style="width:45px;text-align:right;">设备数:</div></td><td><div id="dev4_count" style="color:#31e9ff;width:30px;"></div></td><td><div id="dev4-title-hiden" style="display:none;font-size:9px;text-align:right;">待处理:</div></td><td><div id="dev4-label-hidden" style="display:none;"></div></td></tr></table></td></tr></table>',
    titleColor: '#ffffff',
    titleIconColor: '#ffffff',
    titleBackgroundColor: 'rgba(0,0,0,0.1)',
    backgroundColor: 'rgba(23,21,57,0.2)',
    backgroundImage: 'radial-gradient(circle, rgba(23,21,57,0.2), rgba(9,9,27,0.8))',
    border: '1px solid rgba(0,123,255,0.3)',
    borderRadius: '10px',
    position: 'absolute',
    width: 320,
    height: 100,
    top: 659,
    left: 50,
    zIndex: 200,
    floding: 'true',
    bodyText: '<div id="dev4" style="font-size:9px;font-weight:normal;"><table border="0" style="border:0px solid #000;width:300px;"><tr><td>已处理:</td><td id="device_count_num_42" class="device_confirm_num1"></td><td>待处理:</td><td id="device_count_num_43" class="device_confirm_num2"></td><td>处置率:</td><td id="device_count_num_44" class="device_confirm_num3"></td></tr><tr><td colspan=6 style="height:28px;" onclick="show_all_waterDevice()"><div style="border:0px solid #000;border-radius:3px;width:300px;height:6px;background-color:rgba(255,255,255,0.1);"><div id="device_confirm_44" style="border:0px solid #00a7d1;margin:0px;padding:0px;border-radius:3px;height:6px;width:300px;background-color:#00a7d1"></div></div></td></tr></table></div>'
}
var devypxy5_config = {
    title: '<table><tr><td style="width:145px;overflow:hidden;font-weight:bold;">智能井盖监控设备</td><td><table border=0 style="font-weight:normal;font-size:9px;margin-top:3px;"><tr><td><div style="width:45px;text-align:right;">设备数:</div></td><td><div id="dev5_count" style="color:#31e9ff;width:30px;"></div></td><td><div id="dev5-title-hiden" style="display:none;font-size:9px;text-align:right;">待处理:</div></td><td><div id="dev5-label-hidden" style="display:none;"></div></td></tr></table></td></tr></table>',
    titleColor: '#ffffff',
    titleIconColor: '#ffffff',
    titleBackgroundColor: 'rgba(0,0,0,0.1)',
    backgroundColor: 'rgba(23,21,57,0.2)',
    backgroundImage: 'radial-gradient(circle, rgba(23,21,57,0.2), rgba(9,9,27,0.8))',
    border: '1px solid rgba(0,123,255,0.3)',
    borderRadius: '10px',
    position: 'absolute',
    width: 320,
    height: 100,
    top: 819,
    left: 50,
    zIndex: 200,
    floding: 'true',
    bodyText: '<div id="dev5" style="font-size:9px;font-weight:normal;"><table border="0" style="border:0px solid #000;width:300px;"><tr><td>已处理:</td><td id="device_count_num_52" class="device_confirm_num1"></td><td>待处理:</td><td id="device_count_num_53" class="device_confirm_num2"></td><td>处置率:</td><td id="device_count_num_54" class="device_confirm_num3"></td></tr><tr><td colspan=6 style="height:28px;"><div style="border:0px solid #000;border-radius:3px;width:300px;height:6px;background-color:rgba(255,255,255,0.1);"><div id="device_confirm_54" style="border:0px solid #00a7d1;margin:0px;padding:0px;border-radius:3px;height:6px;width:300px;background-color:#00a7d1"></div></div></td></tr></table></div>'
}

var close_alert = function() {
    removeDIV("rt_alarm_alert");
}

var initWebSocket = function() {
    try {
        if (typeof MozWebSocket == 'function')
            WebSocket = MozWebSocket;
        if (websocket && websocket.readyState == 1)
            websocket.close();
        websocket = new WebSocket(wsUri);
        websocket.onopen = function(evt) {
            var json = {};
            json.agentid = $("#V_LOGINNAME").val();
            console.log("Connected.");
            (function() {})()
            websocket.send(JSON.stringify(json));
        };
        websocket.onclose = function(evt) {
            console.log("DisConnected.");
            (function() {})()
            initWebSocket();
        };
        websocket.onmessage = function(evt) {
            console.log("Received:", evt.data);
            var jData = eval('(' + evt.data + ')');
            if (jData.dwtype != undefined) {
                if (document.getElementById('rt_alarm_alert') != undefined)
                    removeDIV('rt_alarm_alert');
                var alarm_alert = new UNote();
                alarm_alert.create("rt_alarm_alert", "container", alarm_alert_config);
                var Icon = document.createElement('img');
                Icon.width = '32';
                Icon.height = '32';
                Icon.src = "../../res/img/icons/alarm_tab_04.gif"
                if (jData.detype == 1) {
                    Icon.src = "../../res/img/icons/alarm_tab_01.gif"
                } else if (jData.dwtype == 2) {
                    Icon.src = "../../res/img/icons/alarm_tab_03.gif"
                } else if (jData.dwtype == 6) {
                    Icon.src = "../../res/img/icons/alarm_tab_04.gif"
                } else if (jData.dwtype == 7) {
                    Icon.src = "../../res/img/icons/alarm_tab_02.gif"
                } else if (jData.dwtype == 16) {
                    Icon.src = "../../res/img/icons/alarm_tab_05.gif"
                }
                document.getElementById("rt_alarm_alert_icon").innerHTML = "";
                document.getElementById("rt_alarm_alert_icon").appendChild(Icon);
                document.getElementById("rt_alarm_alert_title").innerHTML = jData.evtname;
                document.getElementById("alarm_time").innerHTML = jData.time;
                document.getElementById("alarm_company").innerHTML = jData.company;
                document.getElementById("alarm_device").innerHTML = jData.devicename;
                alarm_alert.show();
                $("#rt_alarm_alert").animate({
                    bottom: '0px'
                });
            }
        };
        websocket.onerror = function(evt) {
            console.log("Error:", evt.data);
            (function() {})()
        };
    } catch (exception) {
        console.log("Exception:", exception);
        (function() {})()
    }
}

var toDecimal = function(x) {
    var f = parseFloat(x);
    if (isNaN(f)) {
        return;
    }
    f = Math.round(x * 100) / 100;
    return f;
}

var bigger_mouseover = function() {
    $("#map_btn_bigger").removeClass('map_btn_bigger_off');
    $("#map_btn_bigger").addClass('map_btn_bigger_on');
}

var bigger_mouseout = function() {
    $("#map_btn_bigger").removeClass('map_btn_bigger_on');
    $("#map_btn_bigger").addClass('map_btn_bigger_off');
}

var bigger_click = function() {
    map.zoomIn();
}

var smaller_mouseover = function() {
    $("#map_btn_smaller").removeClass('map_btn_smaller_off');
    $("#map_btn_smaller").addClass('map_btn_smaller_on');
}

var smaller_mouseout = function() {
    $("#map_btn_smaller").removeClass('map_btn_smaller_on');
    $("#map_btn_smaller").addClass('map_btn_smaller_off');
}

var smaller_click = function() {
    map.zoomOut();
}

var shower_mouseover = function() {
    if (!LabelShow) {
        $("#map_btn_showlaebl").removeClass('map_btn_showlaebl_off');
        $("#map_btn_showlaebl").addClass('map_btn_showlaebl_on');
    }
}

var shower_mouseout = function() {
    if (!LabelShow) {
        $("#map_btn_showlaebl").removeClass('map_btn_showlaebl_on');
        $("#map_btn_showlaebl").addClass('map_btn_showlaebl_off');
    }
}

var shower_click = function() {
    LabelShow = !LabelShow;
    if (LabelShow) {
        $("#map_btn_showlaebl").removeClass('map_btn_showlaebl_on');
        $("#map_btn_showlaebl").addClass('map_btn_hidelabel');
        $(".info").removeClass('hiden');
        $(".info").addClass('shown');
    } else {
        $("#map_btn_showlaebl").removeClass('map_btn_hidelabel');
        $("#map_btn_showlaebl").addClass('map_btn_showlaebl_on');
        $(".info").removeClass('shown');
        $(".info").addClass('hiden');
    }
}

var left_mouseover = function() {
