define(function(require, exports, module) {
	var global = require("../../js/global");
	var jGlobal = require("./oneUpgradeGlobal");
	
	var showContentId = null;
	var startTime = null;
	var endTime = null;

	var oneAcUpgrade = window.require("../../common/js/oneAcUpgrade");
	var oneAcUpgradeIns = null;

    var Promise = window.require('bluebird');
    var co = window.require('co');
    var acLauncher = window.require('../../common/js/acLauncher');

	// 收到事件后更新界面
	function updateProcessDom() {
		$(showContentId + " .loading").attr("src", "./image/icon-16-success.png");
		$(showContentId + " .loading").addClass("success");
		$(showContentId + " .loading").removeClass("loading");
		if ($(showContentId + " .wait").length >= 1) {
			$(showContentId + " .wait").eq(0).attr("src", "./image/icon-16-loading.gif");
			$(showContentId + " .wait").eq(0).addClass("loading");
			$(showContentId + " .wait").eq(0).removeClass("wait");
		}
	}
	
	//升级完成后更新界面
	function updateDomAfterUpgrade() {
		/* 显示操作按钮 */
		$("#upgradeBack").show();
		$("#upgradeReport").show();
		
		/* 更新步骤进度 */
		$(".curStepText div:last-child").addClass('strongCurStepDiv');
		$(".curStepIcon div:nth-last-child(2)").addClass('strongStepLine');
		$(".curStepIcon div:nth-last-child(1) img").attr('src', './image/step-icon-on.png');
		
		/* 允许点击菜单切换到其他页面 */
		global.isLoadOnUpgrading = false;
	}
	
	//升级失败后的操作
	function operateAfterUpgradeFail(res) {
		endTime = global.moment();
		$(showContentId + " .loading").attr("src", "./image/icon-16-fail.png");
		$(showContentId + " .loading").parent().find('>span:last').text('(' + res.reason + ')');
		$(showContentId + " .loading").addClass("fail");
		$(showContentId + " .loading").removeClass("loading");
		updateDomAfterUpgrade();
		alert(undefined, res.reason);
	}
	
	//升级报告表格显示
	function showUpgradeAcInfo(info) {		
		var acArray = [];
		for (var i = 0; i < info.length; i++) {
			var tmp = {};
			tmp.acDeviceModel = info[i].deviceModel;
			tmp.acHardVer = info[i].hardVer;
			tmp.acSoftVer = info[i].softVer;
			acArray.push(tmp);
		}				
		$('#acInfoTable').bootstrapTable('load', acArray);
	}
	
	function showUpgradeApInfo(info) {		
		var apArray = [];
		for (var i = 0; i < info.length; i++) {
			var tmp = {};
			tmp.apDeviceModel = info[i].deviceModel;
			tmp.apHardVer = info[i].hardVer;
			tmp.apSoftVer = info[i].softVer;
			tmp.apNum = info[i].num;
			apArray.push(tmp);
		}				
		$('#apInfoTable').bootstrapTable('load', apArray);
	}
	
	//本次升级时长
	function showTime(startTime, endTime, span_min_time, span_sec_time) {
        var sec_time = parseInt((endTime - startTime) / 1000);
        if (sec_time >= 60) {
            var min_time = parseInt(sec_time / 60);
            sec_time = sec_time % 60;
            $(span_min_time).text(min_time);
            $(span_sec_time).text(sec_time);
        } else {
            $(span_min_time).text(0);
            $(span_sec_time).text(sec_time);
        }
    }
	
	//获取升级后的ac信息
	function getAcDataAfterUpgrade() {
		var devName = jGlobal.oneUpgrade.upgradeAcFor11x[0].deviceName;
		var devInfo = global.devicesIns.getDeviceInfoByDeviceName(devName);		
		var aftAcInfoTmp = {};
        aftAcInfoTmp.deviceName = devInfo.deviceName;
        aftAcInfoTmp.deviceSn = devInfo.seriaNo;
		aftAcInfoTmp.deviceModel = devInfo.deviceModel;
		aftAcInfoTmp.hardVer = devInfo.hardVer;
		aftAcInfoTmp.softVer = devInfo.softVer;
		jGlobal.oneUpgrade.uploadInfo.aftAcInfo = [];
		jGlobal.oneUpgrade.uploadInfo.aftAcInfo.push(aftAcInfoTmp);
	}
	
	//获取升级后的ap信息
	function getApDataAfterUpgrade(isApUpgrade) {
		if (isApUpgrade) {
			var upgradeResult = oneAcUpgradeIns.getUpgradeResult();
			
			jGlobal.oneUpgrade.uploadInfo.apSuccessNum = upgradeResult.apSuccessNum;
			jGlobal.oneUpgrade.uploadInfo.apFailNum = upgradeResult.apFailNum;
			
			jGlobal.oneUpgrade.uploadInfo.aftApInfo = [];
			for (var i = 0; i < upgradeResult.apInfo.length; i++) {
				var apInfo = upgradeResult.apInfo[i];
				var aftApInfoTmp = {};
				aftApInfoTmp.deviceModel = apInfo.deviceModel;
				aftApInfoTmp.hardVer = apInfo.hardVer;
				aftApInfoTmp.softVer = apInfo.softVer;
				aftApInfoTmp.num = apInfo.num;
				jGlobal.oneUpgrade.uploadInfo.aftApInfo.push(aftApInfoTmp);
			}
		} else {
			jGlobal.oneUpgrade.uploadInfo.apSuccessNum = 0;
			jGlobal.oneUpgrade.uploadInfo.apFailNum = 0;
			jGlobal.oneUpgrade.uploadInfo.aftApInfo = [];
		}
	}
	
	//升级成功、失败及用户取消时上传统计信息至云端
	function uploadInfoToCloud(result, res, isApUpgrade) {
		//获取统计数据
		jGlobal.oneUpgrade.uploadInfo.upgradeResult = result;
		if (result == 'fail') {
			jGlobal.oneUpgrade.uploadInfo.upgradeFailReason = res.reason;
		} else {
			jGlobal.oneUpgrade.uploadInfo.upgradeFailReason = '';
        }
        console.log('in uploadInfoToCloud, startTime:', startTime, ' endTime:', endTime);
		jGlobal.oneUpgrade.uploadInfo.startTime = startTime.format('YYYY-MM-DD HH:mm:ss');
		jGlobal.oneUpgrade.uploadInfo.endTime = endTime.format('YYYY-MM-DD HH:mm:ss');
		getAcDataAfterUpgrade();
		getApDataAfterUpgrade(isApUpgrade);
		
		console.log("上传到云端的信息为: ", jGlobal.oneUpgrade.uploadInfo);
		statInfoIns.sendWirelessUpgradeInfo(jGlobal.oneUpgrade.uploadInfo);
	}

	// 上报AC、AP的信息到MACC
    function uploadInfoToMacc() {
        var devName = jGlobal.oneUpgrade.upgradeAcFor11x[0].deviceName;
        var devInfo = global.devicesIns.getDeviceInfoByDeviceName(devName);
        var maccHost = global.jsUtil.getPkgInfo().spec.info.maccHost;
        var connectInfo = {};
        connectInfo.protocal = devInfo.protocal;
        connectInfo.host = devInfo.host;
        connectInfo.port = devInfo.port;
        connectInfo.username = devInfo.username;
        connectInfo.password = devInfo.password;
        connectInfo.enablePassword = devInfo.enablePassword;
        connectInfo.encoding = devInfo.encoding;
        connectInfo.sourceCode = 10001;

        co(function* () {
            var res1 = yield acLauncher.launch(connectInfo, maccHost, null, {});
            console.error(res1);

            var res2 = yield acLauncher.uploadDatas(connectInfo, {});
            console.error(res2);
        }).catch(function (e) {
            console.error('e:', e.toString());
            return Promise.reject(e);
        });
    }
	
	function init() {
		initWindowEvent();
		initPageStatistic();
		initVariable();
		initDom();
		initEvent();
		resize();
		initGlobalEvent();
		
		function initWindowEvent() {

		}
		function initPageStatistic() {
			statRecordEle("oneUpgrade#acUpgrading");
		}
		function initVariable() {
			showContentId = null;
			startTime = null;
			endTime = null;
			oneAcUpgradeIns = null;
			
			/* 禁止点击菜单切换到其他页面 */
			global.isLoadOnUpgrading = true;
		}
		function initDom() {
			console.log("待升级的AC版本: ", jGlobal.oneUpgrade.originAcVersion);
			console.log("是否只升级AC: ", jGlobal.oneUpgrade.onlyUpgradeAc);
			console.log("是否只升级AP: ", jGlobal.oneUpgrade.onlyUpgradeAp);
			
			if (jGlobal.oneUpgrade.originAcVersion == "10.") { //只升级10x AC
				showContentId = "#onlyUpgrade10xAc";
				$(".upgradeProgressDiv").hide();
				$(showContentId).show();
			}
			else if (jGlobal.oneUpgrade.originAcVersion == "mid") { //只升级11x AC
				showContentId = "#onlyUpgrade11xAc";
				$(".upgradeProgressDiv").hide();
				$(showContentId).show();
			}
			else if (jGlobal.oneUpgrade.originAcVersion == "11.") { //AC是11x版本
				if (jGlobal.oneUpgrade.onlyUpgradeAc == true && jGlobal.oneUpgrade.onlyUpgradeAp == false) { //只升级AC
					showContentId = "#onlyUpgrade11xAc";
					$(".upgradeProgressDiv").hide();
					$(showContentId).show();
				}
				else if (jGlobal.oneUpgrade.onlyUpgradeAc == false && jGlobal.oneUpgrade.onlyUpgradeAp == true) { //只升级AP
					showContentId = "#onlyUpgradeAp";
					$(".upgradeProgressDiv").hide();
					$(showContentId).show();
				}
				else if (jGlobal.oneUpgrade.onlyUpgradeAc == false && jGlobal.oneUpgrade.onlyUpgradeAp == false) { //同时升级AC和AP
					showContentId = "#upgradeAll";
					$(".upgradeProgressDiv").hide();
					$(showContentId).show();
				}
			}
			
			$('#upgradeInfoModal').modal({
                backdrop: 'static',
                show: false,
                keyboard: false
            });
		}
		function initEvent() {
			$('#upgradeInfoModal').on('show.bs.modal', function() {
				$('#acInfoTable').bootstrapTable('resetView', {height : 80});
				$('#apInfoTable').bootstrapTable('resetView', {height : 200});
				$(".fixed-table-body").addClass('custom-scroll');
			});
			
			$("#upgradeReport").click(function() {
				var upgradeResult = oneAcUpgradeIns.getUpgradeResult();
				console.log("本次升级的统计信息: ", upgradeResult);
				showTime(startTime, endTime, "#minTime", "#secTime");
				
				/* 显示升级后的ac信息 */
				$('#acInfoTable').bootstrapTable({
			        data: []
			    });
				
//				// 调用后台接口获取ac的信息
//				if (upgradeResult.acInfo != undefined) {
//					showUpgradeAcInfo(upgradeResult.acInfo);
//				} else {
//					var info = [];
//					showUpgradeAcInfo(info);
//				}
				
				// ac的信息由前台自己获取，不用后台的数据
				var devName = jGlobal.oneUpgrade.upgradeAcFor11x[0].deviceName;
				var devInfo = global.devicesIns.getDeviceInfoByDeviceName(devName);
				var acInfo = [];
				var acInfoTmp = {};
	    		acInfoTmp.deviceModel = devInfo.deviceModel;
	    		acInfoTmp.hardVer = devInfo.hardVer;
	    		acInfoTmp.softVer = devInfo.softVer;
	    		acInfo.push(acInfoTmp);
	    		showUpgradeAcInfo(acInfo);
				
				/* 显示升级后的ap信息 */
				if (upgradeResult.apSuccessNum != undefined && upgradeResult.apFailNum != undefined) {
					$("#apSucess").text(upgradeResult.apSuccessNum);
					$("#apFail").text(upgradeResult.apFailNum);
				}
				
				$('#apInfoTable').bootstrapTable({
			        data: []
			    });

				$("#acNoSupportTip").text('');
				if (upgradeResult.acInfo != undefined) {
					showUpgradeApInfo(upgradeResult.apInfo);
				} else {
					var info = [];
					showUpgradeApInfo(info);
                    $("#acNoSupportTip").text('(未进行AP升级或无法统计AP的升级信息！)');
				}
			});
			
			$("#upgradeBack").click(function() {
				var curElement = ".main_content";
                var selectMenuText = $(".main_menu .strong_func_menu").text();
                if (selectMenuText == '一键升级') {
                    var curElement = ".main_content", nextPageUrl = "./oneUpgrade/html/oneUpgradeMenu.html";
                } else if (selectMenuText == 'RAC部署') {
                    var curElement = ".main_content", nextPageUrl = "./quickGoneLive/html/quickGoneLive.html";
                }
				global.enterPageCallback(curElement, nextPageUrl);
			});
			
			//取消ap的升级
			$("#cancelApUpgrade").click(function() {
				$(this).hide();
				var res = {};
				res.reason = "已取消升级！";
				operateAfterUpgradeFail(res);
				
				//调用后台接口
				var devName = jGlobal.oneUpgrade.upgradeApFor11x[0].deviceName;
				oneAcUpgradeIns.cancelApUpgrade(devName);
				
//				//显示升级报告
//				endTime = global.moment();
//				$("#upgradeReport").trigger('click');

                //上传AC、AP信息到MACC
                uploadInfoToMacc();

				//上传统计数据到云端				
				uploadInfoToCloud('cancel', res, true);
			});
			
			//根据不同的升级需求做相应的处理
			startTime = global.moment();
			if (jGlobal.oneUpgrade.originAcVersion == "10.") { //只升级10x AC
				oneAcUpgradeIns = new oneAcUpgrade(global.devicesIns);
				
				//收到upgradeEnd事件时, res.result:success(表示当前操作命令成功), 通过res.operation来判断当前处于哪个升级操作
				oneAcUpgradeIns.on("upgrading", function(res) {				
					if (res.operation == "11xAcInit" || res.operation == "11xAcCopy" || res.operation == "11xAcCheckUpgrade"
							|| res.operation == "10xAcInit" || res.operation == "10xAcCopy" || res.operation == "10xAcCheckUpgrade") {					
						if (res.reason != '') {
							$(showContentId + " .loading").parent().find('>span:last').text('(' + res.reason + ')');
						}
						updateProcessDom();
					}
				});
				
				//收到upgradeEnd事件时, res.result:fail/11xAcSuccess/11xApSuccess(表示一个升级流程成功)
				oneAcUpgradeIns.on("upgradeEnd", function(res) {
					if (res.result == "fail") {
						operateAfterUpgradeFail(res);

                        //上传AC、AP信息到MACC
                        uploadInfoToMacc();

						//上传统计数据到云端
						uploadInfoToCloud('fail', res, false);
					}
					else if (res.result == "11xAcSuccess") {
						endTime = global.moment();
						updateDomAfterUpgrade();
						alert(undefined, '全部升级完成！点击《升级报告》可查阅本次升级的情况。');

                        //上传AC、AP信息到MACC
                        uploadInfoToMacc();

						//上传统计数据到云端
						uploadInfoToCloud('success', res, false);
					}
					else if (res.result == "10xAcSuccess") {
						oneAcUpgradeIns.acUpgradeFor11x(jGlobal.oneUpgrade.upgradeAcFor11x, jGlobal.oneUpgrade.isOperators);
					}
				});
				
				//收到upgradeInfo事件时, 提示用户重新配置ac
				oneAcUpgradeIns.on("upgradeInfo", function(res) {
					alert(undefined, res.reason);
				});
				
				oneAcUpgradeIns.acUpgradeFor10x(jGlobal.oneUpgrade.upgradeAcFor10x, false);
			}
			else if (jGlobal.oneUpgrade.originAcVersion == "mid") { //只升级11x AC
				oneAcUpgradeIns = new oneAcUpgrade(global.devicesIns);
				
				//收到upgradeEnd事件时, res.result:success(表示当前操作命令成功), 通过res.operation来判断当前处于哪个升级操作
				oneAcUpgradeIns.on("upgrading", function(res) {				
					if (res.operation == "11xAcInit" || res.operation == "11xAcCopy" || res.operation == "11xAcCheckUpgrade") {					
						if (res.reason != '') {
							$(showContentId + " .loading").parent().find('>span:last').text('(' + res.reason + ')');
						}
						updateProcessDom();
					}
				});
				
				//收到upgradeEnd事件时, res.result:fail/11xAcSuccess/11xApSuccess(表示一个升级流程成功)
				oneAcUpgradeIns.on("upgradeEnd", function(res) {
					if (res.result == "fail") {
						operateAfterUpgradeFail(res);

                        //上传AC、AP信息到MACC
                        uploadInfoToMacc();
						
						//上传统计数据到云端
						uploadInfoToCloud('fail', res, false);
					}
					else if (res.result == "11xAcSuccess") {
						endTime = global.moment();
						updateDomAfterUpgrade();
						alert(undefined, '全部升级完成！点击《升级报告》可查阅本次升级的情况。');

                        //上传AC、AP信息到MACC
                        uploadInfoToMacc();
						
						//上传统计数据到云端
						uploadInfoToCloud('success', res, false);
					}
				});
				
				oneAcUpgradeIns.acUpgradeFor11x(jGlobal.oneUpgrade.upgradeAcFor11x, jGlobal.oneUpgrade.isOperators);
			}
			else if (jGlobal.oneUpgrade.originAcVersion == "11.") { //AC是11x版本
				if (jGlobal.oneUpgrade.onlyUpgradeAc == true && jGlobal.oneUpgrade.onlyUpgradeAp == false) { //只升级AC
					oneAcUpgradeIns = new oneAcUpgrade(global.devicesIns);
					
					//收到upgradeEnd事件时, res.result:success(表示当前操作命令成功), 通过res.operation来判断当前处于哪个升级操作
					oneAcUpgradeIns.on("upgrading", function(res) {				
						if (res.operation == "11xAcInit" || res.operation == "11xAcCopy" || res.operation == "11xAcCheckUpgrade") {					
							if (res.reason != '') {
								$(showContentId + " .loading").parent().find('>span:last').text('(' + res.reason + ')');
							}
							updateProcessDom();
						}
					});
					
					//收到upgradeEnd事件时, res.result:fail/11xAcSuccess/11xApSuccess(表示一个升级流程成功)
					oneAcUpgradeIns.on("upgradeEnd", function(res) {
						if (res.result == "fail") {
							operateAfterUpgradeFail(res);

                            //上传AC、AP信息到MACC
                            uploadInfoToMacc();
							
							//上传统计数据到云端
							uploadInfoToCloud('fail', res, false);
						}
						else if (res.result == "11xAcSuccess") {
							endTime = global.moment();
							updateDomAfterUpgrade();
							alert(undefined, '全部升级完成！点击《升级报告》可查阅本次升级的情况。');

                            //上传AC、AP信息到MACC
                            uploadInfoToMacc();
							
							//上传统计数据到云端
							uploadInfoToCloud('success', res, false);
						}
					});
					
					oneAcUpgradeIns.acUpgradeFor11x(jGlobal.oneUpgrade.upgradeAcFor11x, jGlobal.oneUpgrade.isOperators);
				}
				else if (jGlobal.oneUpgrade.onlyUpgradeAc == false && jGlobal.oneUpgrade.onlyUpgradeAp == true) { //只升级AP
					oneAcUpgradeIns = new oneAcUpgrade(global.devicesIns);
					
					//收到upgradeEnd事件时, res.result:success(表示当前操作命令成功), 通过res.operation来判断当前处于哪个升级操作
					// 有10x AP的界面
					// oneAcUpgradeIns.on("upgrading", function(res) {				
					// 	if (res.operation == "11xApInit" || res.operation == "11xApCopy" || res.operation == "11xApCheckUpgrade"
					// 			|| res.operation == "10xApInit" || res.operation == "10xApCopy" || res.operation == "10xApCheckUpgrade") {					
					// 		if (res.reason != '') {
					// 			$(showContentId + " .loading").parent().find('>span:last').text('(' + res.reason + ')');
					// 		}
					// 		updateProcessDom();
					// 		if (res.operation == "11xApCopy") {
					// 			$("#cancelApUpgrade").show();
					// 		}
					// 	}
					// });

					// 没有10x AP的界面
                    oneAcUpgradeIns.on("upgrading", function(res) {				
						if (res.operation == "11xApInit" || res.operation == "11xApCopy" || res.operation == "11xApCheckUpgrade") {					
							if (res.reason != '') {
								$(showContentId + " .loading").parent().find('>span:last').text('(' + res.reason + ')');
							}
							updateProcessDom();
							if (res.operation == "11xApCopy") {
								$("#cancelApUpgrade").show();
							}
						}
					});
					
					//收到upgradeEnd事件时, res.result:fail/11xAcSuccess/11xApSuccess(表示一个升级流程成功)
					oneAcUpgradeIns.on("upgradeEnd", function(res) {
						if (res.result == "fail") {
							operateAfterUpgradeFail(res);

                            //上传AC、AP信息到MACC
                            uploadInfoToMacc();
							
							//上传统计数据到云端
							uploadInfoToCloud('fail', res, false);
						}
						else if (res.result == "11xApSuccess") {
							endTime = global.moment();
							updateDomAfterUpgrade();
							if (res.reason == '') {
                                alert(undefined, '全部升级完成！点击《升级报告》可查阅本次升级的情况。');
							} else {
                                updateProcessDom();
                                alert(undefined, res.reason);
							}

                            //上传AC、AP信息到MACC
                            uploadInfoToMacc();
							
							//上传统计数据到云端
							uploadInfoToCloud('success', res, true);
						}
						else if (res.result == "10xApSuccess") {
							oneAcUpgradeIns.apUpgradeFor11x(jGlobal.oneUpgrade.upgradeApFor11x, jGlobal.oneUpgrade.isOperators);
						}
					});
					
					oneAcUpgradeIns.apUpgradeFor10x(jGlobal.oneUpgrade.upgradeApFor10x, false);
				}
				else if (jGlobal.oneUpgrade.onlyUpgradeAc == false && jGlobal.oneUpgrade.onlyUpgradeAp == false) { //同时升级11.x AC和所有的AP
					oneAcUpgradeIns = new oneAcUpgrade(global.devicesIns);
					
					//收到upgradeEnd事件时, res.result:success(表示当前操作命令成功), 通过res.operation来判断当前处于哪个升级操作
					// 有10x AP的界面
					// oneAcUpgradeIns.on("upgrading", function(res) {
					// 	if (res.operation == "11xAcInit" || res.operation == "11xAcCopy" || res.operation == "11xAcCheckUpgrade"
					// 		|| res.operation == "11xApInit" || res.operation == "11xApCopy" || res.operation == "11xApCheckUpgrade"
					// 			|| res.operation == "10xApInit" || res.operation == "10xApCopy" || res.operation == "10xApCheckUpgrade") {
					// 		if (res.reason != '') {
					// 			$(showContentId + " .loading").parent().find('>span:last').text('(' + res.reason + ')');
					// 		}
					// 		updateProcessDom();
					// 		if (res.operation == "11xApCopy") {
					// 			$("#cancelApUpgrade").show();
					// 		}
					// 	}
					// });

					// 没有10x AP的界面
                    oneAcUpgradeIns.on("upgrading", function(res) {
                        if (res.operation == "11xAcInit" || res.operation == "11xAcCopy" || res.operation == "11xAcCheckUpgrade"
                            || res.operation == "11xApInit" || res.operation == "11xApCopy" || res.operation == "11xApCheckUpgrade") {
                            if (res.reason != '') {
                                $(showContentId + " .loading").parent().find('>span:last').text('(' + res.reason + ')');
                            }
                            updateProcessDom();
                            if (res.operation == "11xApCopy") {
                                $("#cancelApUpgrade").show();
                            }
                        }
                    });
					
					//收到upgradeEnd事件时, res.result:fail/11xAcSuccess/11xApSuccess(表示一个升级流程成功)
					oneAcUpgradeIns.on("upgradeEnd", function(res) {
						if (res.result == "fail") {						
                            operateAfterUpgradeFail(res);

                            //上传AC、AP信息到MACC
                            uploadInfoToMacc();

                            //上传统计数据到云端
                            uploadInfoToCloud('fail', res, false);
						}
						else if (res.result == "11xAcSuccess") {
							oneAcUpgradeIns.apUpgradeFor10x(jGlobal.oneUpgrade.upgradeApFor10x, false);
						}
						else if (res.result == "11xApSuccess") {
							endTime = global.moment();
							updateDomAfterUpgrade();
                            if (res.reason == '') {
                                alert(undefined, '全部升级完成！点击《升级报告》可查阅本次升级的情况。');
                            } else {
                                updateProcessDom();
                                alert(undefined, res.reason);
                            }

                            //上传AC、AP信息到MACC
                            uploadInfoToMacc();
							
							//上传统计数据到云端
							uploadInfoToCloud('success', res, true);
						}
						else if (res.result == "10xApSuccess") {
							oneAcUpgradeIns.apUpgradeFor11x(jGlobal.oneUpgrade.upgradeApFor11x, jGlobal.oneUpgrade.isOperators);
						}
					});
					
					oneAcUpgradeIns.acUpgradeFor11x(jGlobal.oneUpgrade.upgradeAcFor11x, jGlobal.oneUpgrade.isOperators);
				}
			}
		}
		function resize() {
//			var client_h = document.documentElement.clientHeight;
//			var head_h = $(".main_menu").height();
//			var body_h = client_h - head_h;
//			
//			$(showContentId).height(body_h - 143);
		}
		function initGlobalEvent() {
			global.exitPageCallback.exitFun = function () {
				if ($("#upgradeBack").is(":hidden")) {					
					alert(undefined, "设备正在升级中，请不要离开当前页面!");
					return false;
				} else {					
					return true;
				}
			}
		}
	}
	exports.init = init;
});