Main.prototype._GetHardwareData_ = function()
{
	var RReturn = $.Deferred();
	var Class = new LoadFile();
	var ComPort = {Input:null};
	Global_ComPort = Class.ReadFile("./File/ComPortInterfaceSetting.json", new Object(), ComPort);
	var SetInterval = setInterval(function(){
		if(ComPort["Input"] != null)
		{
			Global_ComPort = ComPort["Input"];
			Class = null;
			RReturn.resolve(true);
			clearInterval(SetInterval);
		}
	},500);
	return RReturn.promise();
}

Main.prototype._GetAccountSetting_ = function()
{
	var RReturn = $.Deferred();
	var Class = new LoadFile();
	var AccountSetting = {Input:null};
	Global_AccountSetting = Class.ReadFile("./File/AccountSetting.json", new Object(), AccountSetting);
	var SetInterval = setInterval(function(){
		if(AccountSetting["Input"] != null)
		{
			Global_AccountSetting = AccountSetting["Input"];
			Class = null;
			RReturn.resolve(true);
			clearInterval(SetInterval);
		}
	},500);
	return RReturn.promise();
}

Main.prototype._GetSaveLanguageTxt_ = function()
{
	var Language;
	$.ajax(
		{
		url: "./Language/SaveLanguage.txt",
		type:"GET",
		async: false,
		cache:false,
		success: function(msg)
		{
			Language = msg;
		},
		error:function(xhr, ajaxOptions, thrownError)
		{
			console.log(xhr+":"+ajaxOptions+":"+thrownError);
		}
	});
	return Language;
};

Main.prototype._GetRtuModuleSettingData_ = function()
{
	var RReturn = $.Deferred();
	var Class = new LoadFile();
	var RtuIndex    = {Input:null};  var RtuModule  = {Input:null};
	var RtuVariable = {Input:null};  var RtuSetting = {Input:null};  var RtuIcpdasModule = {Input:null}; var RtuScalingVariable = {Input:null}; var RtuBitwiseVariable = {Input:null};
	Class.ReadFile("./File/RTU_Module/Index.json", new Array(), RtuIndex);
	Class.ReadFile("./File/RTU_Module/Module.json", new Object(), RtuModule);
	Class.ReadFile("./File/RTU_Module/RtuVariable.json", new Object(), RtuVariable);
	Class.ReadFile("./File/RTU_Module/RtuSetting.json", new Object(), RtuSetting);
	Class.ReadFile("./File/RTU_Module/RtuIcpdasModule.json", new Object(), RtuIcpdasModule);
	Class.ReadFile("./File/RTU_Module/RtuScalingVariable.json", new Object(), RtuScalingVariable);
	Class.ReadFile("./File/RTU_Module/RtuBitwiseVariable.json", new Object(), RtuBitwiseVariable);
	var SetInterval_1 = setInterval(function(){
		if(RtuIndex["Input"] != null && RtuModule["Input"] != null && RtuVariable["Input"] != null &&
		   RtuSetting["Input"] != null && RtuScalingVariable["Input"] != null && RtuBitwiseVariable["Input"] != null)
		{
			Global_RtuIndex = RtuIndex["Input"];
			Global_RtuModule = RtuModule["Input"];
			Global_RtuVariable = RtuVariable["Input"];
			Global_RtuSetting = RtuSetting["Input"];
			Global_RtuScalingVariable = RtuScalingVariable["Input"];
			Global_RtuBitwiseVariable = RtuBitwiseVariable["Input"];
			clearInterval(SetInterval_1);
			RReturn.resolve(true);
		}
	},500);
	var SetInterval_2 = setInterval(function(){
		if(RtuIcpdasModule["Input"] != null)
		{
			Global_RtuIcpdasModule = RtuIcpdasModule["Input"];
			clearInterval(SetInterval_2);
		}
	},500);
	return RReturn.promise();
};

Main.prototype._GetTcpModuleSettingData_ = function()
{
	var RReturn = $.Deferred();
	var Class = new LoadFile();
	var TcpIndex    = {Input:null};  var TcpModule  = {Input:null};
	var TcpVariable = {Input:null};  var TcpSetting = {Input:null};  var TcpIcpdasModule = {Input:null}; var TcpScalingVariable = {Input:null}; var TcpBitwiseVariable = {Input:null};
	Class.ReadFile("./File/TCP_Module/Index.json", new Array(), TcpIndex);
	Class.ReadFile("./File/TCP_Module/Module.json", new Object(), TcpModule);
	Class.ReadFile("./File/TCP_Module/TcpVariable.json", new Object(), TcpVariable);
	Class.ReadFile("./File/TCP_Module/TcpSetting.json", new Object(), TcpSetting);
	Class.ReadFile("./File/TCP_Module/TcpIcpdasModule.json", new Object(), TcpIcpdasModule);
	Class.ReadFile("./File/TCP_Module/TcpScalingVariable.json", new Object(), TcpScalingVariable);
	Class.ReadFile("./File/TCP_Module/TcpBitwiseVariable.json", new Object(), TcpBitwiseVariable);
	var SetInterval_1 = setInterval(function(){
		if(TcpIndex["Input"] != null && TcpModule["Input"] != null && TcpVariable["Input"] != null && 
		   TcpSetting["Input"] != null && TcpScalingVariable["Input"] != null && TcpBitwiseVariable["Input"] != null)
		{
			Global_TcpIndex = TcpIndex["Input"];
			Global_TcpModule = TcpModule["Input"];
			Global_TcpVariable = TcpVariable["Input"];
			Global_TcpSetting = TcpSetting["Input"];
			Global_TcpScalingVariable = TcpScalingVariable["Input"];
			Global_TcpBitwiseVariable = TcpBitwiseVariable["Input"];
			clearInterval(SetInterval_1);
			RReturn.resolve(true);
		}
	},500);
	var SetInterval_2 = setInterval(function(){
		if(TcpIcpdasModule["Input"] != null)
		{
			Global_TcpIcpdasModule = TcpIcpdasModule["Input"];
			clearInterval(SetInterval_2);
		}
	},500);
	return RReturn.promise();
};

Main.prototype._GetAsciiModuleSettingData_ = function()
{
	var RReturn = $.Deferred();
	var Class = new LoadFile();
	var AsciiIndex    = {Input:null};
	var AsciiModule   = {Input:null};
	var AsciiVariable = {Input:null};
	var AsciiSetting  = {Input:null};
	Class.ReadFile("./File/ASCII_Module/Index.json", new Array(), AsciiIndex);
	Class.ReadFile("./File/ASCII_Module/Module.json", new Object(), AsciiModule);
	Class.ReadFile("./File/ASCII_Module/AsciiVariable.json", new Object(), AsciiVariable);
	Class.ReadFile("./File/ASCII_Module/AsciiSetting.json", new Object(), AsciiSetting);
	var SetInterval = setInterval(function()
	{
		if(AsciiIndex["Input"] != null && AsciiModule["Input"] != null && AsciiVariable["Input"] != null && AsciiSetting["Input"] != null)
		{
			Global_AsciiIndex = AsciiIndex["Input"];
			Global_AsciiModule = AsciiModule["Input"];
			Global_AsciiVariable = AsciiVariable["Input"];
			Global_AsciiSetting = AsciiSetting["Input"];
			Class = null;
			clearInterval(SetInterval);
			RReturn.resolve(true);
		}
	},500);
	return RReturn.promise();
};

Main.prototype._GetMqttModuleSettingData_ = function()
{
	var RReturn = $.Deferred();
	var Class = new LoadFile();
	var MqttIndex    = {Input:null};
	var MqttModule   = {Input:null};
	var MqttVariable = {Input:null};
	var MqttSetting  = {Input:null};
	Class.ReadFile("./File/MQTT_Module/Index.json", new Array(), MqttIndex);
	Class.ReadFile("./File/MQTT_Module/Module.json", new Object(), MqttModule);
	Class.ReadFile("./File/MQTT_Module/MqttVariable.json", new Object(), MqttVariable);
	Class.ReadFile("./File/MQTT_Module/MqttSetting.json", new Object(), MqttSetting);
	var SetInterval = setInterval(function()
	{
		if(MqttIndex["Input"] != null && MqttModule["Input"] != null && MqttVariable["Input"] != null && MqttSetting["Input"] != null)
		{
			Global_MqttIndex    = MqttIndex["Input"];
			Global_MqttModule   = MqttModule["Input"];
			Global_MqttVariable = MqttVariable["Input"];
			Global_MqttSetting  = MqttSetting["Input"];
			Class = null;
			clearInterval(SetInterval);
			RReturn.resolve(true);
		}
	},500);
	return RReturn.promise();
};

Main.prototype._GetEipModuleSettingData_ = function()
{
	var RReturn = $.Deferred();
	var Class = new LoadFile();
	var EipProductSpecification = {Input:null};  var EipModule = {Input:null};  var EipIndex = {Input:null};
	var EipSetting = {Input:null};  var ConnectionParameters = {Input:null};  var EipVariable = {Input:null};
	Class.ReadFile("./File/EIP_Module/ProductSpecification.json", new Array(), EipProductSpecification);
	Class.ReadFile("./File/EIP_Module/Module.json", new Object(), EipModule);
	Class.ReadFile("./File/EIP_Module/Index.json", new Array(), EipIndex);
	Class.ReadFile("./File/EIP_Module/EipSetting.json", new Object(), EipSetting);
	Class.ReadFile("./File/EIP_Module/ConnectionParameters.json", new Object(), ConnectionParameters);
	Class.ReadFile("./File/EIP_Module/EipVariable.json", new Object(), EipVariable);
	var SetInterval = setInterval(function()
	{
		if(EipProductSpecification["Input"] != null && EipModule["Input"] != null && EipIndex["Input"] != null &&
		   EipSetting["Input"] != null && ConnectionParameters["Input"] != null && EipVariable["Input"] != null)
		{
			clearInterval(SetInterval);
			Global_EipProductSpecification = EipProductSpecification["Input"];
			Global_EipModule = EipModule["Input"];
			Global_EipIndex = EipIndex["Input"];
			Global_EipSetting = EipSetting["Input"];
			Global_ConnectionParameters = ConnectionParameters["Input"];
			Global_EipVariable = EipVariable["Input"];
			Class = null;
			RReturn.resolve(true);
		}
	},500);
	return RReturn.promise();
};
Main.prototype._GetRegisterModuleSettingData_ = function()
{
	var RReturn = $.Deferred();
	var Class = new LoadFile();
	var RegisterModule = {Input:null}; var RegisterIndex = {Input:null};
	var RegisterSetting = {Input:null}; var RegisterVariable = {Input:null};
	Class.ReadFile("./File/Register_Module/Module.json", new Object(), RegisterModule);
	Class.ReadFile("./File/Register_Module/Index.json", new Array(), RegisterIndex);
	Class.ReadFile("./File/Register_Module/RegisterSetting.json", new Object(), RegisterSetting);
	Class.ReadFile("./File/Register_Module/RegisterVariable.json", new Object(), RegisterVariable);
	var SetInterval = setInterval(function()
	{
		if(RegisterModule["Input"] != null && RegisterIndex["Input"] != null &&
		   RegisterSetting["Input"] != null && RegisterVariable["Input"] != null)
		{
			clearInterval(SetInterval);
			Global_RegisterModule = RegisterModule["Input"];
			Global_RegisterIndex = RegisterIndex["Input"];
			Global_RegisterSetting = RegisterSetting["Input"];
			Global_RegisterVariable = RegisterVariable["Input"];
			Class = null;
			RReturn.resolve(true);
		}
	},500);
	return RReturn.promise();
};
Main.prototype._GetMqttGroupCloudSettingData_ = function()
{
	var RReturn = $.Deferred();
	var Class = new LoadFile();
	var MqttGroupCloudIndex = {Input:null};
	Class.ReadFile("./File/RemoteMQTTGroup/Index.json", new Array(), MqttGroupCloudIndex);
	var SetInterval = setInterval(function()
	{
		if(MqttGroupCloudIndex["Input"] != null)
		{
			clearInterval(SetInterval);
			Global_MqttGroupCloudIndex = MqttGroupCloudIndex["Input"];
			Class = null;
			RReturn.resolve(true);
		}
	},500);
	return RReturn.promise();
};



Main.prototype._GetModuleSettingData_ = function()
{
	var RReturn = $.Deferred();
    $.when(Main.prototype._GetRtuModuleSettingData_(), 
	       Main.prototype._GetTcpModuleSettingData_(), 
	       Main.prototype._GetAsciiModuleSettingData_(), 
	       Main.prototype._GetMqttModuleSettingData_(), 
	       Main.prototype._GetEipModuleSettingData_(),
	       Main.prototype._GetRegisterModuleSettingData_(),
	       Main.prototype._GetMqttGroupCloudSettingData_())
    .done(function(res1, res2, res3, res4, res5,res6){
    	if(res1 == true && res2 == true && res3 == true && res4 == true && res5 == true && res6 == true)
    	{
    		RReturn.resolve(true);
    	}
    });
  	return RReturn.promise();
};

Main.prototype._GetModuleToOpcuaData_ = function()
{
	var RReturn = $.Deferred();
	var Class = new LoadFile();
	var RtuToOpcuaVariable = {Input:null};
	var RtuScalingToOpcuaVariable = {Input:null};
	var RtuBitwiseToOpcuaVariable = {Input:null};
	var TcpToOpcuaVariable = {Input:null};
	var TcpScalingToOpcuaVariable = {Input:null};
	var TcpBitwiseToOpcuaVariable = {Input:null};
	var AsciiToOpcuaVariable = {Input:null};
	var MqttToOpcuaVariable = {Input:null};
	var EipToOpcuaVariable = {Input:null};
	var RegisterToOpcuaVariable = {Input:null};
	Class.ReadFile("./File/RTU_Module/RtuToOpcuaVariable.json", new Object(), RtuToOpcuaVariable);
	Class.ReadFile("./File/RTU_Module/RtuScalingToOpcuaVariable.json", new Object(), RtuScalingToOpcuaVariable);
	Class.ReadFile("./File/RTU_Module/RtuBitwiseToOpcuaVariable.json", new Object(), RtuBitwiseToOpcuaVariable);
	Class.ReadFile("./File/TCP_Module/TcpToOpcuaVariable.json", new Object(), TcpToOpcuaVariable);
	Class.ReadFile("./File/TCP_Module/TcpScalingToOpcuaVariable.json", new Object(), TcpScalingToOpcuaVariable);
	Class.ReadFile("./File/TCP_Module/TcpBitwiseToOpcuaVariable.json", new Object(), TcpBitwiseToOpcuaVariable);
	Class.ReadFile("./File/ASCII_Module/AsciiToOpcuaVariable.json", new Object(), AsciiToOpcuaVariable);
	Class.ReadFile("./File/MQTT_Module/MqttToOpcuaVariable.json", new Object(), MqttToOpcuaVariable);
	Class.ReadFile("./File/EIP_Module/EipToOpcuaVariable.json", new Object(), EipToOpcuaVariable);
	Class.ReadFile("./File/Register_Module/RegisterToOpcuaVariable.json", new Object(), RegisterToOpcuaVariable);

	var SetInterval = setInterval(function()
	{
		if(RtuToOpcuaVariable["Input"] != null && RtuScalingToOpcuaVariable["Input"] != null && RtuBitwiseToOpcuaVariable["Input"] != null &&
		   TcpToOpcuaVariable["Input"] != null && TcpScalingToOpcuaVariable["Input"] != null && AsciiToOpcuaVariable["Input"] != null &&
		   MqttToOpcuaVariable["Input"] != null && EipToOpcuaVariable["Input"] != null && TcpBitwiseToOpcuaVariable["Input"] != null && RegisterToOpcuaVariable["Input"] != null)
		{
			Global_RtuToOpcuaVariable = RtuToOpcuaVariable["Input"];
			Global_RtuScalingToOpcuaVariable = RtuScalingToOpcuaVariable["Input"];
			Global_RtuBitwiseToOpcuaVariable = RtuBitwiseToOpcuaVariable["Input"];
			Global_TcpToOpcuaVariable = TcpToOpcuaVariable["Input"];
			Global_TcpScalingToOpcuaVariable = TcpScalingToOpcuaVariable["Input"];
			Global_TcpBitwiseToOpcuaVariable = TcpBitwiseToOpcuaVariable["Input"];
			Global_AsciiToOpcuaVariable = AsciiToOpcuaVariable["Input"];
			Global_MqttToOpcuaVariable = MqttToOpcuaVariable["Input"];
			Global_EipToOpcuaVariable = EipToOpcuaVariable["Input"];
			Global_RegisterToOpcuaVariable = RegisterToOpcuaVariable["Input"];
			Class = null;
			clearInterval(SetInterval);
			RReturn.resolve(true);
		}
	},500);
	return RReturn.promise();
}

Main.prototype._GetModbusToMqttData_ = function()
{
	var RReturn = $.Deferred();
	var Class = new LoadFile();
	var RtuToMqttVariable = {Input:null};  var RtuToMqttSetting = {Input:null};  var TcpToMqttVariable = {Input:null};  var TcpToMqttSetting = {Input:null};  var AsciiToMqttVariable = {Input:null};  var AsciiToMqttSetting = {Input:null};
	Class.ReadFile("./File/RTU_Module/RtuToMqttVariable.json", new Object(), RtuToMqttVariable);
	Class.ReadFile("./File/RTU_Module/RtuToMqttSetting.json", new Object(), RtuToMqttSetting);
	Class.ReadFile("./File/TCP_Module/TcpToMqttVariable.json", new Object(), TcpToMqttVariable);
	Class.ReadFile("./File/TCP_Module/TcpToMqttSetting.json", new Object(), TcpToMqttSetting);
	Class.ReadFile("./File/ASCII_Module/AsciiToMqttVariable.json", new Object(), AsciiToMqttVariable);
	Class.ReadFile("./File/ASCII_Module/AsciiToMqttSetting.json", new Object(), AsciiToMqttSetting);
	var SetInterval = setInterval(function(){
		if(RtuToMqttVariable["Input"] != null && RtuToMqttSetting["Input"] != null &&
			TcpToMqttVariable["Input"] != null && TcpToMqttSetting["Input"] != null &&
			AsciiToMqttVariable["Input"] != null && AsciiToMqttSetting["Input"] != null){
			Global_RtuToMqttVariable = RtuToMqttVariable["Input"];
			Global_RtuToMqttSetting = RtuToMqttSetting["Input"];
			Global_TcpToMqttVariable = TcpToMqttVariable["Input"];
			Global_TcpToMqttSetting = TcpToMqttSetting["Input"];
			Global_AsciiToMqttVariable = AsciiToMqttVariable["Input"];
			Global_AsciiToMqttSetting = AsciiToMqttSetting["Input"];
			Class = null;
			clearInterval(SetInterval);
			RReturn.resolve(true);
		}
	},500);
	return RReturn.promise();
}

Main.prototype._GetEipToMqttData_ = function()
{
	var RReturn = $.Deferred();
	var Class = new LoadFile();
	var EipToMqttVariable = {Input:null};
	var EipToMqttSetting = {Input:null};
	Class.ReadFile("./File/EIP_Module/EipToMqttVariable.json", new Object(), EipToMqttVariable);
	Class.ReadFile("./File/EIP_Module/EipToMqttSetting.json", new Object(), EipToMqttSetting);
	var SetInterval = setInterval(function()
	{
		if(EipToMqttVariable["Input"] != null && EipToMqttSetting["Input"] != null){
			Global_EipToMqttVariable = EipToMqttVariable["Input"];
			Global_EipToMqttSetting = EipToMqttSetting["Input"];
			Class = null;
			clearInterval(SetInterval);
			RReturn.resolve(true);
		}
	},500);
	return RReturn.promise();
}

Main.prototype._GetModbusToMqttJsonData_ = function()
{
	var RReturn = $.Deferred();
	var Class = new LoadFile();
	var RtuToMqttJsonVariable = {Input:null};
	var TcpToMqttJsonVariable = {Input:null};
	var AsciiToMqttJsonVariable = {Input:null};
	Class.ReadFile("./File/RTU_Module/RtuToMqttJsonVariable.json", new Object(), RtuToMqttJsonVariable);
	Class.ReadFile("./File/TCP_Module/TcpToMqttJsonVariable.json", new Object(), TcpToMqttJsonVariable);
	Class.ReadFile("./File/ASCII_Module/AsciiToMqttJsonVariable.json", new Object(), AsciiToMqttJsonVariable);
	var SetInterval = setInterval(function(){
		if(RtuToMqttJsonVariable["Input"] != null && TcpToMqttJsonVariable["Input"] != null && AsciiToMqttJsonVariable["Input"] != null)
		{	
			Global_RtuToMqttJsonVariable = RtuToMqttJsonVariable["Input"];
			Global_TcpToMqttJsonVariable = TcpToMqttJsonVariable["Input"];
			Global_AsciiToMqttJsonVariable = AsciiToMqttJsonVariable["Input"];
			Class = null;
			clearInterval(SetInterval);
			RReturn.resolve(true);
		}
	},500);
	return RReturn.promise();
}

Main.prototype._GetConvertTransmissionData_ = function()
{
	var RReturn = $.Deferred();
    $.when(Main.prototype._GetModuleToOpcuaData_(),
    	   Main.prototype._GetModbusToMqttData_(),
    	   Main.prototype._GetEipToMqttData_(),
    	   Main.prototype._GetModbusToMqttJsonData_())
    .done(function(res1, res2, res3, res4){
      if(res1 == true && res2 == true && res3 == true && res4 == true)
      {
        RReturn.resolve(true);
      }
    });
    return RReturn.promise();
};

Main.prototype._GetIotPlatformSettingData_ = function()
{
	var RReturn = $.Deferred();
	var Class = new LoadFile();
	var RemoteBroker = {Input:null};
	var MqttJsonGroup = {Input:null};
	var AzurePlatform = {Input:null};
	var OpcUaLocalServer = {Input:null};
	var RemoteMqttGroup = {Input:null};
	Class.ReadFile("./File/IoT_Platform/RemoteBroker.json", new Object(), RemoteBroker);
	Class.ReadFile("./File/IoT_Platform/MqttJsonGroup.json", new Object(), MqttJsonGroup);
	Class.ReadFile("./File/RemoteMQTTGroup/RemoteMqttGroup.json", new Object(), RemoteMqttGroup);
	Class.ReadFile("./File/IoT_Platform/Microsoft_Azure_Platform.json", new Object(), AzurePlatform);
	Class.ReadXmlObject("./File/IoT_Platform/UAServerConfig.xml", new Object(), OpcUaLocalServer);
	var SetInterval = setInterval(function(){
		if(RemoteBroker["Input"] != null && MqttJsonGroup["Input"] != null && AzurePlatform["Input"] != null && OpcUaLocalServer["Input"] != null)
		{
			Global_RemoteBroker = RemoteBroker["Input"];
			Global_MqttJsonGroup = MqttJsonGroup["Input"];
			Global_RemoteMqttGroup = RemoteMqttGroup["Input"];
			Global_AzurePlatform = AzurePlatform["Input"];
			Global_OpcUaLocalServer = OpcUaLocalServer["Input"];
			Class = null;
			clearInterval(SetInterval);
			RReturn.resolve(true);
		}
	},500);
	return RReturn.promise();
};

Main.prototype._GetAdvancedFunctionData_ = function()
{
	var RReturn = $.Deferred();
	var Class = new LoadFile();
	var PidOperation                  = {Input:null};
	var IftttConditionTriggerSetting  = {Input:null};
	var IftttConditionTriggerVariable = {Input:null};
	var LocalDataLogger               = {Input:null};
	var MsSqlConnection                = {Input:null};
    var MysqlConnection               = {Input:null};
	Class.ReadFile("./File/PID_Operation/PidOperation.json", new Object(), PidOperation);
	Class.ReadFile("./File/IFTTT_Notify/Setting.json", new Object(), IftttConditionTriggerSetting);
	Class.ReadFile("./File/IFTTT_Notify/Variable.json", new Object(), IftttConditionTriggerVariable);
	Class.ReadFile("./File/IoT_Platform/LocalDataLogger.json", new Object(), LocalDataLogger);
	Class.ReadFile("./File/IoT_Platform/MsSqlConnection.json", new Object(), MsSqlConnection);
    Class.ReadFile("./File/IoT_Platform/MysqlConnection.json", new Object(), MysqlConnection);
	var SetInterval = setInterval(function(){
		if(PidOperation["Input"] != null &&
		   IftttConditionTriggerSetting["Input"] != null &&
		   IftttConditionTriggerVariable["Input"] != null &&
		   LocalDataLogger["Input"] != null &&
		   MsSqlConnection["Input"] != null &&
           MysqlConnection["Input"] != null){
			Global_PidOperation = PidOperation["Input"];
			Global_IftttConditionTriggerSetting = IftttConditionTriggerSetting["Input"];
			Global_IftttConditionTriggerVariable = IftttConditionTriggerVariable["Input"];
			Global_LocalDataLogger = LocalDataLogger["Input"];
			Global_MsSqlConnection = MsSqlConnection["Input"];
            Global_MysqlConnection = MysqlConnection["Input"];
			Class = null;  clearInterval(SetInterval);
			RReturn.resolve(true);
		}
	},500);
	return RReturn.promise();
};

Main.prototype._GetLoggerSettingData_ = function()
{
	var RReturn = $.Deferred();
	var Class = new LoadFile();
	var RtuToLocalDataLoggerVariable = {Input:null};
	var TcpToLocalDataLoggerVariable = {Input:null};
	var RtuToMsSqlVariable  = {Input:null};
	var TcpToMsSqlVariable  = {Input:null};
	var RtuToMysqlConnectionVariable = {Input:null};
	var TcpToMysqlConnectionVariable = {Input:null};
	var MqttToMysqlVariable = {Input:null};
	var MqttToMsSqlVariable = {Input:null};
	Class.ReadFile("./File/RTU_Module/RtuToLocalDataLoggerVariable.json", new Object(), RtuToLocalDataLoggerVariable);
	Class.ReadFile("./File/TCP_Module/TcpToLocalDataLoggerVariable.json", new Object(), TcpToLocalDataLoggerVariable);
	Class.ReadFile("./File/RTU_Module/RtuToMsSqlVariable.json", new Object(), RtuToMsSqlVariable);
	Class.ReadFile("./File/TCP_Module/TcpToMsSqlVariable.json", new Object(), TcpToMsSqlVariable);
	Class.ReadFile("./File/RTU_Module/RtuToMysqlConnectionVariable.json", new Object(), RtuToMysqlConnectionVariable);
	Class.ReadFile("./File/TCP_Module/TcpToMysqlConnectionVariable.json", new Object(), TcpToMysqlConnectionVariable);
	Class.ReadFile("./File/MQTT_Module/MqttToMysqlVariable.json", new Object(), MqttToMysqlVariable);
	Class.ReadFile("./File/MQTT_Module/MqttToMsSqlVariable.json", new Object(), MqttToMsSqlVariable);
	var SetInterval = setInterval(function()
	{
		if(RtuToLocalDataLoggerVariable["Input"] != null &&
		   TcpToLocalDataLoggerVariable["Input"] != null &&
		   RtuToMsSqlVariable["Input"] != null &&
		   TcpToMsSqlVariable["Input"] != null &&
		   RtuToMysqlConnectionVariable["Input"] != null &&
		   TcpToMysqlConnectionVariable["Input"] != null &&
		   MqttToMysqlVariable["Input"] != null &&
		   MqttToMsSqlVariable["Input"] != null)
		{
			Global_RtuToLocalDataLoggerVariable = RtuToLocalDataLoggerVariable["Input"];
			Global_TcpToLocalDataLoggerVariable = TcpToLocalDataLoggerVariable["Input"];
			Global_RtuToMsSqlVariable = RtuToMsSqlVariable["Input"];
			Global_TcpToMsSqlVariable = TcpToMsSqlVariable["Input"];
		    Global_RtuToMysqlConnectionVariable = RtuToMysqlConnectionVariable["Input"];
			Global_TcpToMysqlConnectionVariable = TcpToMysqlConnectionVariable["Input"];
			Global_MqttToMysqlVariable = MqttToMysqlVariable["Input"];
			Global_MqttToMsSqlVariable = MqttToMsSqlVariable["Input"];
			Class = null;
			clearInterval(SetInterval);
			RReturn.resolve(true);
		}
	},500);
	return RReturn.promise();
};

Main.prototype._LoadLanguage_ = function()
{
	var Class = new LoadHtml();
	var JsonArray={Input:null};
	var Language = Main.prototype._GetSaveLanguageTxt_();
	Class.ReadHtml("./Language/"+ Language +".json", JsonArray);
	var TotalJson = new Object();
	var SetInterval = setInterval(function()
	{
		if(JsonArray["Input"] != null)
		{
			for(var i=0; i<JsonArray["Input"].length; i++)
			{
				var Key = Object.keys(JsonArray["Input"][i]);
				for(var j=0; j<Key.length; j++)
				{
					TotalJson[Key[j]] = new Object();
					TotalJson[Key[j]] = JsonArray["Input"][i][Key[j]];
				}
			}
			Global_TranslateJson = JSON.parse(JSON.stringify(TotalJson));
			clearInterval(SetInterval);
		}
	},500);
}

Main.prototype._GetLocalBrokerData_ = function()
{
	var RReturn = $.Deferred();
	var Class = new Cgi();
	var Return = {Input:null};
	Class.RestApi("GetLocalBrokerSetting", new Array(), true, Return);
	var SetInterval = setInterval(function(){
		if(Return["Input"] != null)
		{
			clearInterval(SetInterval);
			Global_LocalBroker = Return["Input"];
			Class = null;
			RReturn.resolve(true);
		}
	},500);
	return RReturn.promise();
};

Main.prototype._AsynchronousInitializeGlobalVariables_ = function()
{
	var RReturn = $.Deferred();
    $.when(Main.prototype._GetHardwareData_(),
    	   Main.prototype._GetAccountSetting_(), 
		   Main.prototype._GetLocalBrokerData_(), 
		   Main.prototype._GetModuleSettingData_(), 
		   Main.prototype._GetConvertTransmissionData_(), 
		   Main.prototype._GetIotPlatformSettingData_(), 
		   Main.prototype._GetAdvancedFunctionData_(), 
		   Main.prototype._GetLoggerSettingData_())
    .done(function(res1, res2, res3, res4, res5, res6, res7, res8){
      if(res1 == true && res2 == true && res3 == true && res4 == true && res5 == true && res6 == true && res7 == true && res8 == true)
      {
      	RReturn.resolve(true);
      }
    });
    return RReturn.promise();
};

Main.prototype._LoadHtml_ = function(DivId, HtmlPath, Result)
{
	var Html = {Input:null};
	var Class = new LoadHtml();	
	Class.ReadHtml(HtmlPath, Html);
	var SetInterval = setInterval(function()
	{
		if(Html["Input"] != null)
		{
			clearInterval(SetInterval);
			var TranslateHtml = Class.TranslateHtml(Html["Input"]);
			$(DivId).empty();
			$(DivId).append(TranslateHtml);
			Class = null;
			Result["Input"] = true;
		}
	},500);
};

Main.prototype._LoadLeftListHtml_Part1_ = function()
{
	var Class = new LoadFile();
	var SystemSettingHtml = {Input:null};
	var ModuleSettingHtml = {Input:null};
	var IotPlatformSettingHtml = {Input:null};
	var ConvertSettingHtml = {Input:null};
	Class.ReadFile("./Plugin/Left_List/html/SystemSetting.html", new Object(), SystemSettingHtml);
	Class.ReadFile("./Plugin/Left_List/html/ModuleSetting.html", new Object(), ModuleSettingHtml);
	Class.ReadFile("./Plugin/Left_List/html/IotPlatformSetting.html", new Object(), IotPlatformSettingHtml);
	Class.ReadFile("./Plugin/Left_List/html/ConvertSetting.html", new Object(), ConvertSettingHtml);
	var SetInterval = setInterval(function()
	{
		if(SystemSettingHtml["Input"] != null && ModuleSettingHtml["Input"] != null && 
			IotPlatformSettingHtml["Input"] != null && ConvertSettingHtml["Input"] != null)
		{
			clearInterval(SetInterval);
			Global_LeftListSystemSettingHtml = SystemSettingHtml["Input"]
			Global_LeftListModuleSettingHtml = ModuleSettingHtml["Input"];
			Global_LeftListIotPlatformSettingHtml = IotPlatformSettingHtml["Input"];
			Global_LeftListConvertSettingHtml = ConvertSettingHtml["Input"];
			Class = null;
		}
	},500);
};

Main.prototype._LoadLeftListHtml_Part2_ = function()
{
	var Class = new LoadFile();
	var AdvancedSettingHtml = {Input:null};  var ListIOStatusHtml = {Input:null};
	var ContentIOStatusHtml = {Input:null};  var FileSettingHtml = {Input:null};
	var LoggerSettingHtml = {Input:null};
	Class.ReadFile("./Plugin/Left_List/html/AdvancedSetting.html", new Object(), AdvancedSettingHtml);
	Class.ReadFile("./Plugin/Left_List/html/IOStatus.html", new Object(), ListIOStatusHtml);
	Class.ReadFile("./Plugin/IOStatus/html/IOStatus.html", new Object(), ContentIOStatusHtml);
	Class.ReadFile("./Plugin/Left_List/html/File.html", new Object(), FileSettingHtml);
	Class.ReadFile("./Plugin/Left_List/html/LoggerSetting.html", new Object(), LoggerSettingHtml);
	var SetInterval = setInterval(function()
	{
		if(AdvancedSettingHtml["Input"] != null &&  ListIOStatusHtml["Input"] != null &&
			ContentIOStatusHtml["Input"] != null && FileSettingHtml["Input"] != null &&
			LoggerSettingHtml["Input"] != null)
		{
			Global_LeftListAdvancedSettingHtml = AdvancedSettingHtml["Input"];
			Global_LeftListIOStatusHtml = ListIOStatusHtml["Input"];
			Global_ContentIOStatusHtml = ContentIOStatusHtml["Input"];
			Global_LeftListFileSettingHtml = FileSettingHtml["Input"];
			Global_LeftListLoggerSettingHtml = LoggerSettingHtml["Input"];
			Class = null;
			clearInterval(SetInterval);
		}
	},500);
};

Main.prototype._LoadDescriptionHtml_Part1_ = function()
{
	var Class = new LoadFile();
	var DescriptionSystemSettingHtml = {Input:null};
	var DescriptionModuleSettingHtml = {Input:null};
	var DescriptionIotPlatformSettingHtml = {Input:null};
	var DescriptionConvertSettingHtml = {Input:null};
	Class.ReadFile("./Plugin/Description/html/SystemSetting.html", new Object(), DescriptionSystemSettingHtml);
	Class.ReadFile("./Plugin/Description/html/ModuleSetting.html", new Object(), DescriptionModuleSettingHtml);
	Class.ReadFile("./Plugin/Description/html/IotPlatformSetting.html", new Object(), DescriptionIotPlatformSettingHtml);
	Class.ReadFile("./Plugin/Description/html/ConvertTransmission.html", new Object(), DescriptionConvertSettingHtml);
	var SetInterval = setInterval(function()
	{
		if(DescriptionSystemSettingHtml["Input"] != null &&
		   DescriptionModuleSettingHtml["Input"] != null &&
		   DescriptionIotPlatformSettingHtml["Input"] != null &&
		   DescriptionConvertSettingHtml["Input"] != null)
		{
			Global_DescriptionSystemSettingHtml = DescriptionSystemSettingHtml["Input"];
			Global_DescriptionModuleSettingHtml = DescriptionModuleSettingHtml["Input"];
			Global_DescriptionIotPlatformSettingHtml = DescriptionIotPlatformSettingHtml["Input"];
			Global_DescriptionConvertSettingHtml = DescriptionConvertSettingHtml["Input"];
			Class = null;
			clearInterval(SetInterval);
		}
	},500);
};

Main.prototype._LoadDescriptionHtml_Part2_ = function()
{
	var Class = new LoadFile();
	var DescriptionAdvancedSettingHtml = {Input:null};
	var DescriptionLoggerSettingHtml = {Input:null};
	Class.ReadFile("./Plugin/Description/html/AdvancedSetting.html", new Object(), DescriptionAdvancedSettingHtml);
	Class.ReadFile("./Plugin/Description/html/LoggerSetting.html", new Object(), DescriptionLoggerSettingHtml);
	var SetInterval = setInterval(function()
	{
		if(DescriptionAdvancedSettingHtml["Input"] != null &&
		   DescriptionLoggerSettingHtml["Input"] != null)
		{
			Global_DescriptionAdvancedSettingHtml = DescriptionAdvancedSettingHtml["Input"];
			Global_DescriptionLoggerSettingHtml = DescriptionLoggerSettingHtml["Input"];
			Class = null;
			clearInterval(SetInterval);
		}
	},500);
};

Main.prototype._LoadVersion_ = function()
{
	var Result={"Input":null};
	var Class = new Cgi();
	Class.RestApi("GetVersion", new Array(), true, Result);
	var SetInterval = setInterval(function()
	{
		if(Result["Input"] != null)
		{
			Global_MiddlewareVersion   = Result["Input"][0];
			Global_MainProgramVersion  = Result["Input"][1];
			Global_WebInterfaceVersion = Result["Input"][2];
			Global_InstallInformation  = Result["Input"][3];
			Class = null;
			clearInterval(SetInterval);
		}
	},500);
};

Main.prototype._LoadCenterContentHtml_Part1_ = function()
{
	var Class = new LoadFile();
	var ControllerServiceSettingHtml = {Input:null};  var ControllerServiceSettingCss = {Input:null};
	var TimeSettingCss = {Input:null};  var TimeSettingHtml = {Input:null};
	var AccountSettingHtml = {Input:null};
	Class.ReadFile("./Plugin/ControllerServiceSetting/html/ControllerServiceSetting.html", new Object(), ControllerServiceSettingHtml);
	Class.ReadFile("./Plugin/ControllerServiceSetting/html/Css.html", new Object(), ControllerServiceSettingCss);
	Class.ReadFile("./Plugin/TimeSetting/html/TimeSetting.html", new Object(), TimeSettingHtml);
	Class.ReadFile("./Plugin/TimeSetting/html/Css.html", new Object(), TimeSettingCss);
	Class.ReadFile("./Plugin/AccountSetting/html/AccountSetting.html", new Object(), AccountSettingHtml);
	var SetInterval = setInterval(function()
	{
		if(ControllerServiceSettingHtml["Input"] != null && ControllerServiceSettingCss["Input"] != null && 
			TimeSettingCss["Input"] != null && TimeSettingHtml["Input"] != null &&
			AccountSettingHtml["Input"] != null)
		{
			Global_ControllerServiceSettingHtml = ControllerServiceSettingHtml["Input"];
			Global_ControllerServiceSettingCss = ControllerServiceSettingCss["Input"];
			Global_TimeSettingCss = TimeSettingCss["Input"];
			Global_TimeSettingHtml = TimeSettingHtml["Input"];
			Global_AccountSettingHtml = AccountSettingHtml["Input"];
			Class = null;
			clearInterval(SetInterval);
		}
	},500);
};

Main.prototype._LoadCenterContentHtml_Part2_ = function()
{
	var Class = new LoadFile();
	var BootCss = {Input:null};  var BootHtml = {Input:null};
	var ComPortInterfaceSettingCss = {Input:null};  var ComPortInterfaceSettingHtml = {Input:null};
	var NetworkSettingCssHtml = {Input:null};  var NetworkSettingUpdatePageHtml = {Input:null};  var NetworkSettingHtml = {Input:null};
	Class.ReadFile("./Plugin/Boot/html/Css.html", new Object(), BootCss);
	Class.ReadFile("./Plugin/Boot/html/Boot.html", new Object(), BootHtml);
	Class.ReadFile("./Plugin/ComPortInterfaceSetting/html/Css.html", new Object(), ComPortInterfaceSettingCss);
	Class.ReadFile("./Plugin/ComPortInterfaceSetting/html/ComPortInterfaceSetting.html", new Object(), ComPortInterfaceSettingHtml);
	Class.ReadFile("./Plugin/NetworkSetting/html/Css.html", new Object(), NetworkSettingCssHtml);
	Class.ReadFile("./Plugin/NetworkSetting/html/UpdatePage.html", new Object(), NetworkSettingUpdatePageHtml);
	Class.ReadFile("./Plugin/NetworkSetting/html/NetworkSetting.html", new Object(), NetworkSettingHtml);
	var SetInterval = setInterval(function(){
		if(BootCss["Input"] != null && BootHtml["Input"] != null && ComPortInterfaceSettingCss["Input"] != null && ComPortInterfaceSettingHtml["Input"] != null && NetworkSettingCssHtml["Input"] != null && NetworkSettingUpdatePageHtml["Input"] != null && NetworkSettingHtml["Input"] != null)
		{
			clearInterval(SetInterval);
			Global_BootCss = BootCss["Input"];
			Global_BootHtml = BootHtml["Input"];
			Global_ComPortInterfaceSettingHtml = ComPortInterfaceSettingHtml["Input"];
			Global_ComPortInterfaceSettingCss = ComPortInterfaceSettingCss["Input"];
			Global_NetworkSettingCssHtml = NetworkSettingCssHtml["Input"];
			Global_NetworkSettingUpdatePageHtml = NetworkSettingUpdatePageHtml["Input"];
			Global_NetworkSettingHtml = NetworkSettingHtml["Input"];
			Class = null;
		}
	},500);
}

Main.prototype._LoadCenterContentHtml_Part3_ = function()
{
	var Class = new LoadFile();
	var RtuModuleCss = {Input:null};  var RtuModuleFirstPageHtml = {Input:null};  var RtuModuleSecondPageHtml = {Input:null};
	var TcpModuleCss = {Input:null};  var TcpModuleFirstPageHtml = {Input:null};  var TcpModuleSecondPageHtml = {Input:null};
	Class.ReadFile("./Plugin/RtuModule/html/Css.html", new Object(), RtuModuleCss);
	Class.ReadFile("./Plugin/RtuModule/html/FirstPage.html", new Object(), RtuModuleFirstPageHtml);
	Class.ReadFile("./Plugin/RtuModule/html/SecondPage.html", new Object(), RtuModuleSecondPageHtml);
	Class.ReadFile("./Plugin/TcpModule/html/Css.html", new Object(), TcpModuleCss);
	Class.ReadFile("./Plugin/TcpModule/html/FirstPage.html", new Object(), TcpModuleFirstPageHtml);
	Class.ReadFile("./Plugin/TcpModule/html/SecondPage.html", new Object(), TcpModuleSecondPageHtml);
	var SetInterval = setInterval(function()
	{
		if(RtuModuleCss["Input"] != null && RtuModuleFirstPageHtml["Input"] != null && RtuModuleSecondPageHtml["Input"] != null &&
		   TcpModuleCss["Input"] != null && TcpModuleFirstPageHtml["Input"] != null && TcpModuleSecondPageHtml["Input"] != null)
		{
			Global_RtuModuleCss = RtuModuleCss["Input"];
			Global_RtuModuleFirstPageHtml = RtuModuleFirstPageHtml["Input"];
			Global_RtuModuleSecondPageHtml = RtuModuleSecondPageHtml["Input"];
			Global_TcpModuleCss = TcpModuleCss["Input"];
			Global_TcpModuleFirstPageHtml = TcpModuleFirstPageHtml["Input"];
			Global_TcpModuleSecondPageHtml = TcpModuleSecondPageHtml["Input"];
			Class = null;
			clearInterval(SetInterval);
		}
	},500);
}

Main.prototype._LoadCenterContentHtml_Part4_ = function()
{
	var Class = new LoadFile();
	var AsciiModuleCssHtml = {Input:null};  var AsciiModuleFirstPageHtml = {Input:null};  var AsciiModuleSecondPageHtml = {Input:null};
	var MqttModuleCssHtml = {Input:null};  var MqttModuleUpdatePageHtml = {Input:null};  var MqttModuleFirstPageHtml = {Input:null};  var MqttModuleSecondPageHtml = {Input:null};
	Class.ReadFile("./Plugin/AsciiModule/html/Css.html", new Object(), AsciiModuleCssHtml);
	Class.ReadFile("./Plugin/AsciiModule/html/FirstPage.html", new Object(), AsciiModuleFirstPageHtml);
	Class.ReadFile("./Plugin/AsciiModule/html/SecondPage.html", new Object(), AsciiModuleSecondPageHtml);
	Class.ReadFile("./Plugin/MqttModule/html/Css.html", new Object(), MqttModuleCssHtml);
	Class.ReadFile("./Plugin/MqttModule/html/UpdatePage.html", new Object(), MqttModuleUpdatePageHtml);
	Class.ReadFile("./Plugin/MqttModule/html/FirstPage.html", new Object(), MqttModuleFirstPageHtml);
	Class.ReadFile("./Plugin/MqttModule/html/SecondPage.html", new Object(), MqttModuleSecondPageHtml);
	var SetInterval = setInterval(function()
	{
		if(AsciiModuleCssHtml["Input"] != null && AsciiModuleFirstPageHtml["Input"] != null && AsciiModuleSecondPageHtml["Input"] != null)
		{
			Global_AsciiModuleCssHtml = AsciiModuleCssHtml["Input"];
			Global_AsciiModuleFirstPageHtml = AsciiModuleFirstPageHtml["Input"];
			Global_AsciiModuleSecondPageHtml = AsciiModuleSecondPageHtml["Input"];
			Global_MqttModuleCssHtml = MqttModuleCssHtml["Input"];
			Global_MqttModuleUpdatePageHtml = MqttModuleUpdatePageHtml["Input"];
			Global_MqttModuleFirstPageHtml = MqttModuleFirstPageHtml["Input"];
			Global_MqttModuleSecondPageHtml = MqttModuleSecondPageHtml["Input"];
			Class = null;
			clearInterval(SetInterval);
		}
	},500);
}

Main.prototype._LoadCenterContentHtml_Part5_ = function()
{
	var Class = new LoadFile();
	var EipModuleCssHtml = {Input:null};  var EipModuleFirstPageHtml = {Input:null};  var EipModuleSecondPageHtml = {Input:null};
	Class.ReadFile("./Plugin/EipModule/html/Css.html", new Object(), EipModuleCssHtml);
	Class.ReadFile("./Plugin/EipModule/html/FirstPage.html", new Object(), EipModuleFirstPageHtml);
	Class.ReadFile("./Plugin/EipModule/html/SecondPage.html", new Object(), EipModuleSecondPageHtml);
	var SetInterval = setInterval(function()
	{
		if(EipModuleCssHtml["Input"] != null && EipModuleFirstPageHtml["Input"] != null && EipModuleSecondPageHtml["Input"] != null)
		{
			clearInterval(SetInterval);
			Global_EipModuleCssHtml = EipModuleCssHtml["Input"];
			Global_EipModuleFirstPageHtml = EipModuleFirstPageHtml["Input"];
			Global_EipModuleSecondPageHtml = EipModuleSecondPageHtml["Input"];
			Class = null;
		}
	},500);
}

Main.prototype._LoadCenterContentHtml_Part6_ = function()
{
	Main.prototype._LoadMysqlConnectionLeftListHtml_();
	Main.prototype._LoadRtuToMysqlConnectionLeftListHtml_();
	Main.prototype._LoadTcpToMysqlConnectionLeftListHtml_();
	Main.prototype._LoadMqttToMysqlLeftListHtml_();
	Main.prototype._LoadMqttToMsSqlLeftListHtml_();
}

Main.prototype._LoadMysqlConnectionLeftListHtml_ = function()
{
	var Class = new LoadFile();
	var MysqlConnectionCss = {Input:null};  var MysqlConnectionFirstPageHtml = {Input:null};  var MysqlConnectionSecondPageHtml = {Input:null};
	Class.ReadFile("./Plugin/MysqlConnection/html/Css.html", new Object(), MysqlConnectionCss);
	Class.ReadFile("./Plugin/MysqlConnection/html/FirstPage.html", new Object(), MysqlConnectionFirstPageHtml);
	Class.ReadFile("./Plugin/MysqlConnection/html/SecondPage.html", new Object(), MysqlConnectionSecondPageHtml);
	var SetInterval = setInterval(function()
	{
		if(MysqlConnectionCss["Input"] != null && MysqlConnectionFirstPageHtml["Input"] != null && MysqlConnectionSecondPageHtml["Input"] != null)
		{
			Global_MysqlConnectionCss = MysqlConnectionCss["Input"];
			Global_MysqlConnectionFirstPageHtml = MysqlConnectionFirstPageHtml["Input"];
			Global_MysqlConnectionSecondPageHtml = MysqlConnectionSecondPageHtml["Input"];
			Class = null;
			clearInterval(SetInterval);
		}
	},500);
}

Main.prototype._LoadRtuToMysqlConnectionLeftListHtml_ = function()
{
	var Class = new LoadFile();
	var RtuToMysqlConnectionCss = {Input:null};  var RtuToMysqlConnectionFirstPageHtml = {Input:null};  var RtuToMysqlConnectionSecondPageHtml = {Input:null}; var RtuToMysqlConnectionUpdatePageHtml = {Input:null};
	Class.ReadFile("./Plugin/RtuToMysqlConnection/html/Css.html", new Object(), RtuToMysqlConnectionCss);
	Class.ReadFile("./Plugin/RtuToMysqlConnection/html/UpdatePage.html", new Object(), RtuToMysqlConnectionUpdatePageHtml);
	Class.ReadFile("./Plugin/RtuToMysqlConnection/html/FirstPage.html", new Object(), RtuToMysqlConnectionFirstPageHtml);
	Class.ReadFile("./Plugin/RtuToMysqlConnection/html/SecondPage.html", new Object(), RtuToMysqlConnectionSecondPageHtml);
	var SetInterval = setInterval(function()
	{
		if(RtuToMysqlConnectionCss["Input"] != null && RtuToMysqlConnectionFirstPageHtml["Input"] != null && 
		   RtuToMysqlConnectionSecondPageHtml["Input"] != null && RtuToMysqlConnectionUpdatePageHtml["Input"] != null)
		{
			Global_RtuToMysqlConnectionCss = RtuToMysqlConnectionCss["Input"];
			Global_RtuToMysqlConnectionUpdatePageHtml = RtuToMysqlConnectionUpdatePageHtml["Input"];
			Global_RtuToMysqlConnectionFirstPageHtml = RtuToMysqlConnectionFirstPageHtml["Input"];
			Global_RtuToMysqlConnectionSecondPageHtml = RtuToMysqlConnectionSecondPageHtml["Input"];
			Class = null;
			clearInterval(SetInterval);
		}
	},500);
}

Main.prototype._LoadTcpToMysqlConnectionLeftListHtml_ = function()
{
	var Class = new LoadFile();
	var TcpToMysqlConnectionCss = {Input:null};  var TcpToMysqlConnectionFirstPageHtml = {Input:null};  var TcpToMysqlConnectionSecondPageHtml = {Input:null}; var TcpToMysqlConnectionUpdatePageHtml = {Input:null};
	Class.ReadFile("./Plugin/TcpToMysqlConnection/html/Css.html", new Object(), TcpToMysqlConnectionCss);
	Class.ReadFile("./Plugin/TcpToMysqlConnection/html/UpdatePage.html", new Object(), TcpToMysqlConnectionUpdatePageHtml);
	Class.ReadFile("./Plugin/TcpToMysqlConnection/html/FirstPage.html", new Object(), TcpToMysqlConnectionFirstPageHtml);
	Class.ReadFile("./Plugin/TcpToMysqlConnection/html/SecondPage.html", new Object(), TcpToMysqlConnectionSecondPageHtml);
	var SetInterval = setInterval(function()
	{
		if(TcpToMysqlConnectionCss["Input"] != null && TcpToMysqlConnectionFirstPageHtml["Input"] != null && 
		   TcpToMysqlConnectionSecondPageHtml["Input"] != null && TcpToMysqlConnectionUpdatePageHtml["Input"] != null)
		{
			Global_TcpToMysqlConnectionCss = TcpToMysqlConnectionCss["Input"];
			Global_TcpToMysqlConnectionUpdatePageHtml = TcpToMysqlConnectionUpdatePageHtml["Input"];
			Global_TcpToMysqlConnectionFirstPageHtml = TcpToMysqlConnectionFirstPageHtml["Input"];
			Global_TcpToMysqlConnectionSecondPageHtml = TcpToMysqlConnectionSecondPageHtml["Input"];
			Class = null;
			clearInterval(SetInterval);
		}
	},500);
}
Main.prototype._LoadMqttToMysqlLeftListHtml_ = function()
{
	var Class = new LoadFile();
	var MqttToMysqlCss = {Input:null};  var MqttToMysqlFirstPageHtml = {Input:null};  var MqttToMysqlSecondPageHtml = {Input:null}; var MqttToMysqlUpdatePageHtml = {Input:null};
	Class.ReadFile("./Plugin/MqttToMysql/html/Css.html", new Object(), MqttToMysqlCss);
	Class.ReadFile("./Plugin/MqttToMysql/html/UpdatePage.html", new Object(), MqttToMysqlUpdatePageHtml);
	Class.ReadFile("./Plugin/MqttToMysql/html/FirstPage.html", new Object(), MqttToMysqlFirstPageHtml);
	Class.ReadFile("./Plugin/MqttToMysql/html/SecondPage.html", new Object(), MqttToMysqlSecondPageHtml);
	var SetInterval = setInterval(function()
	{
		if(MqttToMysqlCss["Input"] != null && MqttToMysqlFirstPageHtml["Input"] != null && 
		   MqttToMysqlSecondPageHtml["Input"] != null && MqttToMysqlUpdatePageHtml["Input"] != null)
		{
			Global_MqttToMysqlCss = MqttToMysqlCss["Input"];
			Global_MqttToMysqlUpdatePageHtml = MqttToMysqlUpdatePageHtml["Input"];
			Global_MqttToMysqlFirstPageHtml = MqttToMysqlFirstPageHtml["Input"];
			Global_MqttToMysqlSecondPageHtml = MqttToMysqlSecondPageHtml["Input"];
			Class = null;
			clearInterval(SetInterval);
		}
	},500);
}
Main.prototype._LoadMqttToMsSqlLeftListHtml_ = function()
{
	var Class = new LoadFile();
	var MqttToMsSqlCss = {Input:null};  var MqttToMsSqlFirstPageHtml = {Input:null};  var MqttToMsSqlSecondPageHtml = {Input:null}; var MqttToMsSqlUpdatePageHtml = {Input:null};
	Class.ReadFile("./Plugin/MqttToMsSql/html/Css.html", new Object(), MqttToMsSqlCss);
	Class.ReadFile("./Plugin/MqttToMsSql/html/UpdatePage.html", new Object(), MqttToMsSqlUpdatePageHtml);
	Class.ReadFile("./Plugin/MqttToMsSql/html/FirstPage.html", new Object(), MqttToMsSqlFirstPageHtml);
	Class.ReadFile("./Plugin/MqttToMsSql/html/SecondPage.html", new Object(), MqttToMsSqlSecondPageHtml);
	var SetInterval = setInterval(function()
	{
		if(MqttToMsSqlCss["Input"] != null && MqttToMsSqlFirstPageHtml["Input"] != null && 
		   MqttToMsSqlSecondPageHtml["Input"] != null && MqttToMsSqlUpdatePageHtml["Input"] != null)
		{
			Global_MqttToMsSqlCss = MqttToMsSqlCss["Input"];
			Global_MqttToMsSqlUpdatePageHtml = MqttToMsSqlUpdatePageHtml["Input"];
			Global_MqttToMsSqlFirstPageHtml = MqttToMsSqlFirstPageHtml["Input"];
			Global_MqttToMsSqlSecondPageHtml = MqttToMsSqlSecondPageHtml["Input"];
			Class = null;
			clearInterval(SetInterval);
		}
	},500);
}
Main.prototype._LoadCenterContentHtml_Part7_ = function()
{
	Main.prototype._LoadRegisterLeftListHtml_();
	Main.prototype._LoadRegisterToOpcuaHtml_();
}
Main.prototype._LoadRegisterToOpcuaHtml_ = function()
{
	var Class = new LoadFile();
	var RegisterToOpcuaCss = {Input:null};  
	var RegisterToOpcuaFirstPageHtml = {Input:null};  
	var RegisterToOpcuaSecondPageHtml = {Input:null}; 
	var RegisterToOpcuaUpdatePageHtml = {Input:null};
	Class.ReadFile("./Plugin/RegisterToOpcua/html/Css.html", new Object(), RegisterToOpcuaCss);
	Class.ReadFile("./Plugin/RegisterToOpcua/html/FirstPage.html", new Object(), RegisterToOpcuaFirstPageHtml);
	Class.ReadFile("./Plugin/RegisterToOpcua/html/SecondPage.html", new Object(), RegisterToOpcuaSecondPageHtml);
	Class.ReadFile("./Plugin/RegisterToOpcua/html/UpdatePage.html", new Object(), RegisterToOpcuaUpdatePageHtml);

	var SetInterval = setInterval(function()
	{
		if(RegisterToOpcuaCss["Input"] != null && RegisterToOpcuaFirstPageHtml["Input"] != null && 
		   RegisterToOpcuaSecondPageHtml["Input"] != null && RegisterToOpcuaUpdatePageHtml["Input"])
		{
			Global_RegisterToOpcuaCss = RegisterToOpcuaCss["Input"];
			Global_RegisterToOpcuaFirstPageHtml = RegisterToOpcuaFirstPageHtml["Input"];
			Global_RegisterToOpcuaSecondPageHtml = RegisterToOpcuaSecondPageHtml["Input"];
			Global_RegisterToOpcuaUpdatePageHtml = RegisterToOpcuaUpdatePageHtml["Input"];
			Class = null;
			clearInterval(SetInterval);
		}
	},500);
}



Main.prototype._LoadRegisterLeftListHtml_ = function()
{
	var Class = new LoadFile();
	var RegisterCss = {Input:null};  
	var RegisterFirstPageHtml = {Input:null};  
	var RegisterSecondPageHtml = {Input:null}; 
	Class.ReadFile("./Plugin/RegisterModule/html/Css.html", new Object(), RegisterCss);
	Class.ReadFile("./Plugin/RegisterModule/html/FirstPage.html", new Object(), RegisterFirstPageHtml);
	Class.ReadFile("./Plugin/RegisterModule/html/SecondPage.html", new Object(), RegisterSecondPageHtml);
	var SetInterval = setInterval(function()
	{
		if(RegisterCss["Input"] != null && RegisterFirstPageHtml["Input"] != null && 
		   RegisterSecondPageHtml["Input"] != null)
		{
			Global_RegisterModuleCss = RegisterCss["Input"];
			Global_RegisterModuleFirstPageHtml = RegisterFirstPageHtml["Input"];
			Global_RegisterModuleSecondPageHtml = RegisterSecondPageHtml["Input"];
			Class = null;
			clearInterval(SetInterval);
		}
	},500);
}


Main.prototype._LoadPathHtml_ = function()
{
	var Class = new LoadFile();
	var HeadPathHtml = {Input:null};
	var OtherPathHtml = {Input:null};
	Class.ReadFile("./Plugin/Main/html/Path/HeadPath.html", new Object(), HeadPathHtml);
	Class.ReadFile("./Plugin/Main/html/Path/OtherPath.html", new Object(), OtherPathHtml);
	var SetInterval = setInterval(function()
	{
		if(HeadPathHtml["Input"] != null &&
		   OtherPathHtml["Input"] != null)
		{
			clearInterval(SetInterval);
			Global_HeadPathHtml = HeadPathHtml["Input"];
			Global_OtherPathHtml = OtherPathHtml["Input"];
			Class = null;
		}
	},500);
};

Main.prototype._CheckLoginCredentials_ = function(Result)
{
	var Class = new Cgi();
	var Return = {Input:null};
	Class.RestApi("CheckLoginCredentials", new Array(), true, Return);
	var SetInterval = setInterval(function(){
		if(Return["Input"] != null)
		{
			clearInterval(SetInterval);
			Result["Input"]=Return["Input"];
			Class = null;
		}
	},500);
};

Main.prototype._InitializeMainUi_ = function()
{
	$("#Main_Top-StepFlow").hide();
	var Result1 = {Input:null};  var Result2 = {Input:null};  var Result3 = {Input:null};  var Result4 = {Input:null};
	var Result5 = {Input:null};
	var SetInterval1 = setInterval(function(){
	if(typeof(Global_TranslateJson) != "undefined" && typeof(main_TopMenuCommon_mouseover) != "undefined" && typeof(main_TopMenuCommon_mouseout) != "undefined")
	{
		Main.prototype._LoadHtml_("#Main_Bottom-Information", "./Plugin/Main/html/Bottom/Information.html", Result1);
		Main.prototype._LoadHtml_("#Main_Top-Menu", "./Plugin/Top_Menu/html/Menu.html", Result2);
		Main.prototype._LoadHtml_("#Main_Top-StepFlow", "./Plugin/StepProcess/html/StepFlow.html", Result3);
		Main.prototype._LoadHtml_("#Main_Top-FunctionWizard", "./Plugin/StepProcess/html/FunctionWizard.html", Result4);
		Main.prototype._LoadHtml_("#Main_Top-SystemInformation", "./Plugin/SystemInformation/html/SystemInformation.html", Result5);
		clearInterval(SetInterval1);
	}},100);

	var SetInterval2 = setInterval(function(){
	if(Result1["Input"] == true && Result2["Input"] == true && Result3["Input"] == true && Result4["Input"] == true && Result5["Input"] == true)
	{
		var Size = $("#Main_Top-FunctionWizard").find(".FunctionWizardTable").find(".Select").find("option").size();
		for(var i=1; i<Size; i++)
		{
			$("#Main_Top-FunctionWizard").find(".FunctionWizardTable").find(".Select").find("option").eq(i).val(i-1);
		}
		clearInterval(SetInterval2);
	}},500);
}

Main.prototype._ShowMainUi_ = function()
{
	var SetInterval_1 = setInterval(function(){		
		if(typeof(Global_HeadPathHtml) != "undefined")
		{
			clearInterval(SetInterval_1);
			var Bar = new ProgressBar();
			Bar.HideProgressBar();
			$("#Main_Base").show();
		}
	},500);
	var SetInterval_2 = setInterval(function(){ 
		var StepFlowSize = $("#Main_Top-StepFlow").find(".StepTable").size();
		var MenuSize = $("#Main_Top-Menu").find(".Top-Menu").size();
		var FunctionWizardSize = $("#Main_Top-FunctionWizard").find(".FunctionWizardTable").size();
		if(StepFlowSize > 0 && MenuSize > 0 && FunctionWizardSize > 0 && 
		   typeof(main_SystemSetting_click) != "undefined" && typeof(StepFlow) != "undefined")
		{
			clearInterval(SetInterval_2);
			$("#Main_Top-StepFlow").show();
			$("#Main_Top-StepFlow").find(".StepTable").hide();
			$("#Main_Top-SystemInformation").show();
			$("#Main_Top-Menu").children("div").eq(0).click();
			var Class = new StepFlow();
			Class.StartFingerIcon();
			Main.prototype._ShowSystemInformation_();

			var TopMenuId = "Top-Menu-SystemSetting";
			var LeftListId = "Left-List-AccountSetting";
			var DefaultAccount = false;
			DefaultAccount = Main.prototype._CheckDefaultAccount_(TopMenuId, LeftListId);
			
			if(DefaultAccount == true)
			{
				Main.prototype._ClickElement_(TopMenuId, LeftListId);
				Main.prototype._DisableElement_(TopMenuId, LeftListId);
			}
		}
	},500);
}

Main.prototype._CheckDefaultAccount_ = function()
{
	var Return = false;

	if(Global_AccountSetting["Manager"]["Account"] == "root" &&
	   Global_AccountSetting["Manager"]["Password"] == "root")
	{
		Return = true;
	}
	return Return;
}

Main.prototype._ClickElement_ = function(TopMenuId, LeftListId)
{
	$("#Main_Top-Menu").find("#"+TopMenuId).click();
	$("#Main_Left-List").find("div").css('pointer-events', "none");
	$("#Main_Left-List").find("#"+LeftListId).click();
}

Main.prototype._DisableElement_ = function(TopMenuId, LeftListId)
{
	$("#Main_Top-FunctionWizard").css('pointer-events', "none");
	$("#Main_Top-FunctionWizard").css('opacity', 0.5);

	$("#Main_Top-Menu").find("div").css('pointer-events', "none");
	$("#Main_Top-Menu").find("div").css('opacity', 0.5);

	$("#Main_Top-Path").find("div").css('pointer-events', "none");
	$("#Main_Top-Path").find("div").css('opacity', 0.5);

	$("#Main_Left-List").find("div").css('pointer-events', "none");
	$("#Main_Left-List").find("div").css('opacity', 0.5);

	$("#Main_Top-Menu").find("#"+TopMenuId).css('pointer-events', "visible");
	$("#Main_Top-Menu").find("#"+TopMenuId).css('opacity', 1);

	$("#Main_Left-List").find("#"+LeftListId).css('pointer-events', "visible");
	$("#Main_Left-List").find("#"+LeftListId).css('opacity', 1);
}

Main.prototype._ShowSystemInformation_ = function()
{
	var Class = new SystemInformation;
	Class.ShowSystemInformationUi();
}

Main.prototype._SignInConnection_ = function()
{
	var SetInterval = setInterval(function()
	{
		Global_Socket.emit("MainPageConnection", true);
	},1000);
}

Main.prototype._StartMainLoad_ = function()
{	
	Main.prototype._LoadLanguage_();
	Main.prototype._AsynchronousInitializeGlobalVariables_();

	Main.prototype._LoadLeftListHtml_Part1_();
	Main.prototype._LoadLeftListHtml_Part2_();
	Main.prototype._LoadDescriptionHtml_Part1_();
	Main.prototype._LoadDescriptionHtml_Part2_();
	Main.prototype._LoadVersion_();
	Main.prototype._LoadHardwareInformation_();

	Main.prototype._LoadCenterContentHtml_Part1_();
	Main.prototype._LoadCenterContentHtml_Part2_();
	Main.prototype._LoadCenterContentHtml_Part3_();
	Main.prototype._LoadCenterContentHtml_Part4_();
	Main.prototype._LoadCenterContentHtml_Part5_();
	Main.prototype._LoadCenterContentHtml_Part6_();
	Main.prototype._LoadCenterContentHtml_Part7_();

	Main.prototype._LoadPathHtml_();
	Main.prototype._InitializeMainUi_();
	Main.prototype._ShowMainUi_();
}
Main.prototype._LoadHardwareInformation_ = function()
{	
	var Result = {Input:null};
	var Class = new Transmission;
	Class.TransmissionArray("GetFlashVersionInformation", new Array(), Result);
	var SetInterval = setInterval(function()
	{
		if(Result["Input"] != null)
		{
			Global_FlashInformation = Result["Input"];
			clearInterval(SetInterval);
		}
	},1000);
}