//共同
TcpToMsSqlCommon.prototype._GetMsSqlConnectionInformation_ = function()
{
	var Return=new Array();
	var Class = new LoadFile();
	var JSON = Class.ReadFile("./File/IoT_Platform/MsSqlConnection.json", new Object());
	var Index=Object.keys(JSON);
	for(var i=0; i<Index.length; i++)
	{
		if(JSON[Index[i]]["IdentificationName"] != "")
		{
			var MsSqlConnectionInformation = Index[i] + "/" + "Remote";
			Return.push(MsSqlConnectionInformation);
		}
	}
	return Return;
}

TcpToMsSqlCommon.prototype._GetConnectionInformation_ = function()
{
	var Return = new Array();
	var MsSqlConnectionName = TcpToMsSqlCommon.prototype._GetMsSqlConnectionInformation_();
	Return = Return.concat(MsSqlConnectionName);
	return Return;
}




















//更新頁
TcpToMsSqlUpdatePage.prototype._SaveGlobalVariable_ = function(Row)
{
	var Class = new StepFlow();
	Class.LockAllUi();
	var ssocket = io.connect(), Index=0, Length=Row.length;
	Row.eq(Index).find(".Button").click();
	ssocket.emit("BackgroundExecution");
	ssocket.on("BackgroundExecution", function (Return) {
		if(Row.eq(Index).find(".Message").is(":visible") == true && 
		   Row.eq(Index).find(".Message").css("color") == "rgb(34, 119, 0)")//
		{
			Index++;
			Row.eq(Index).find(".Button").click();
			ssocket.emit("BackgroundExecution");
			if(Index==Length)
			{
				ssocket.emit("SocketClose");
				TcpToMsSqlUpdatePage.prototype._ShowFirstPage_();
				Class.UnLockAllUi();
			}
		}
		else if(Index<Length)
		{
			ssocket.emit("BackgroundExecution");
		}
	});
}

TcpToMsSqlUpdatePage.prototype._IsSaveGlobalVariable_ = function()
{
	var Return = true;
	var Class = new Judgment();
	if(Class.IsSaveTcpMasterModuleGlobalVariable() == false)  {return false;}

	Class = new LoadFile();
	var MsSqlConnection = Class.ReadFile("./File/IoT_Platform/MsSqlConnection.json", new Object());
	if(JSON.stringify(MsSqlConnection) != JSON.stringify(Global_MsSqlConnection))  {return false;}

	return Return;
}

TcpToMsSqlUpdatePage.prototype._ShowFirstPage_ = function()
{
	$("#Main_Center-Content").find(".Body").hide();
	$("#Main_Center-Content").find(".Body").eq(1).show();
	TcpToMsSqlFirstPage.prototype._Initialization_();
}

TcpToMsSqlUpdatePage.prototype._Initialization_ = function()
{
	$("#Main_Center-Content").find(".Body").hide();
	$("#Main_Center-Content").find(".Body").eq(0).show();

	if(TcpToMsSqlUpdatePage.prototype._IsSaveGlobalVariable_() == true)
	{
		TcpToMsSqlUpdatePage.prototype._ShowFirstPage_();
		return 0;
	}
	var Row = $("#Main_Center-Content").find(".Body").eq(0).find(".Table").find(".Row");
	TcpToMsSqlUpdatePage.prototype._SaveGlobalVariable_(Row);
}




















//第一頁
TcpToMsSqlFirstPage.prototype._SetConnectionName_ = function(that)
{
	var number = $(that).closest(".DynamicRow").find(".Column").eq(0).text();
	if(typeof(Global_TcpToMsSqlVariable[number]) != "object")	{return 0;}
	
	var Button = $(that).closest(".Column").find(".Button");
	var Combobox =  $(that).closest(".Column").find(".Select");
	var SystemVariable = Object.keys(Global_TcpToMsSqlVariable[number]);
	var object=new Object();
	for(var i=0; i<SystemVariable.length; i++)
	{
		var MsSqlConnectionInformation = Combobox.val();
		Global_TcpToMsSqlVariable[number][SystemVariable[i]]["DatabaseIndex"] = parseInt(MsSqlConnectionInformation.split("/")[0]);
		Global_TcpToMsSqlVariable[number][SystemVariable[i]]["DatabaseType"] = MsSqlConnectionInformation.split("/")[1];
	}
	Button.attr('disabled', true);
}

TcpToMsSqlFirstPage.prototype._ChangeDatabaseName_ = function(that)
{
	var Variable = Global_TcpToMsSqlVariable;
	var number = $(that).closest(".DynamicRow").find(".Column").eq(0).text();
	if(typeof(Variable[number]) != "object")	{return 0;}
	
	var Button = $(that).closest(".Column").find(".Button");
	var Combobox =  $(that).closest(".Column").find(".Select");
	var SystemVariable = Object.keys(Variable[number]);
	var DatabaseIndexObject=new Object();
	for(var i=0; i<SystemVariable.length; i++)
	{
		var DatabaseIndex = Variable[number][SystemVariable[i]]["DatabaseIndex"];
		var DatabaseType  = Variable[number][SystemVariable[i]]["DatabaseType"];
		DatabaseIndexObject[DatabaseIndex + "/" + DatabaseType]=new Object();
	}
	var DatabaseIndexArray=Object.keys(DatabaseIndexObject);
	if(DatabaseIndexArray.length == 1 &&
	   DatabaseIndexArray[0].split("/")[0] != "" &&
	   DatabaseIndexArray[0] == Combobox.val()){
		Button.attr('disabled', true);
	}
	else{
		Button.attr('disabled', false);
	}
}

TcpToMsSqlFirstPage.prototype._LoadDatabaseName_ = function(index, number)
{
	var MsSqlConnection = Global_MsSqlConnection;
	var Button = $("#ModuleTable").find(".DynamicRow").eq(index).find(".Column").eq(3).find(".Button");
	var Combobox = $("#ModuleTable").find(".DynamicRow").eq(index).find(".Column").eq(3).find(".Select");
	var ConnectionInformation = TcpToMsSqlCommon.prototype._GetConnectionInformation_();
	for(var i=0; i<ConnectionInformation.length; i++)
	{
		var DatabaseIndex = ConnectionInformation[i].split("/")[0];
		var DatabaseType  = ConnectionInformation[i].split("/")[1];
		var Text;
		if(DatabaseType == "Remote")
		{
			Text = MsSqlConnection[DatabaseIndex]["IdentificationName"] + " (Remote)";
		}
		Combobox.append($("<option></option>").attr("value",ConnectionInformation[i]).text(Text));
	}
	Combobox.append($("<option></option>").attr("disabled",true).text("(Groups)"));
	Combobox.val("");
	if(typeof(Global_TcpToMsSqlVariable[number]) !="object"){
		return 0;
	}
	TcpToMsSqlFirstPage.prototype._ShowApplyButton_(index, number, Combobox);
}

TcpToMsSqlFirstPage.prototype._ShowApplyButton_ = function(index, number, Combobox)
{
	var GlobalVariable = Global_TcpToMsSqlVariable;
	var Button = $("#ModuleTable").find(".DynamicRow").eq(index).find(".Column").eq(3).find(".Button");
	var SystemVariable=Object.keys(GlobalVariable[number]);
	var DatabaseIndexObject = new Object();
	for(var i=0; i<SystemVariable.length; i++)
	{
		var DatabaseIndex = GlobalVariable[number][SystemVariable[i]]["DatabaseIndex"];
		DatabaseIndex = DatabaseIndex + "/" + GlobalVariable[number][SystemVariable[i]]["DatabaseType"];
		DatabaseIndexObject[DatabaseIndex] = new Object();
	}
	var DatabaseIndexArray = Object.keys(DatabaseIndexObject);
	if(DatabaseIndexArray.length == 1)
	{
		Combobox.val(DatabaseIndexArray[0]);
		Button.attr('disabled', true);
	}
	else if(DatabaseIndexArray.length >1){
		Combobox.val("(Groups)");
		Button.attr('disabled', true);
	}
}

TcpToMsSqlFirstPage.prototype._ChangeCheckbox_ = function(that)
{
	var Bool = $(that).closest(".DynamicRow").find(".Column").eq(4).find(":checkbox").prop("checked");
	var number = $(that).closest(".DynamicRow").find(".Column").eq(0).text();
	if(typeof(Global_TcpToMsSqlVariable[number])!="object"){
		return;
	}
	var SystemVariable = Object.keys(Global_TcpVariable[number]);
	for(var i=0; i<SystemVariable.length; i++)
	{
		Global_TcpToMsSqlVariable[number][SystemVariable[i]]["DatabaseRecord"] = Bool;
	}
}

TcpToMsSqlFirstPage.prototype._ChangeAllCheckbox_ = function(that)
{
	var ModuleTableId = $(that).closest(".Table").attr("id");
	var Bool = $(that).closest(".Row").find(":checkbox").prop("checked");
	var Element = $("#"+ModuleTableId).find(".DynamicRow");
	for(var i=0; i<Element.length; i++)
	{
		if(Element.eq(i).find(":checkbox").prop("checked") != Bool)
		{
			Element.eq(i).find(":checkbox").prop("checked",Bool);
			var that = Element.eq(i).find(":checkbox");
			TcpToMsSqlFirstPage.prototype._ChangeCheckbox_(that);
		}
	}
}

TcpToMsSqlFirstPage.prototype._IsAllDatabaseRecord_ = function(number)
{
	var Return=false;
	if(typeof(Global_TcpToMsSqlVariable[number]) != "object")
	{
		return Return;
	}
	var SystemVariable=Object.keys(Global_TcpToMsSqlVariable[number]);
	if(SystemVariable.length==0)
	{
		return Return;
	}
	for(var i=0; i<SystemVariable.length; i++)
	{
		if(Global_TcpToMsSqlVariable[number][SystemVariable[i]]["DatabaseRecord"]==false)
		{
			return Return;
		}
	}
	Return=true;
	return Return;
}

TcpToMsSqlFirstPage.prototype._GetAllModuleData_ = function()
{
	var Return = new Object();
	var DeviceName = Object.keys(Global_TcpModule);
	for(var i=0; i<DeviceName.length; i++)
	{
		var nmuber = Object.keys(Global_TcpModule[DeviceName[i]]);
		for(var j=0; j<nmuber.length; j++)
		{
			Return[nmuber[j]] = new Object();
			Return[nmuber[j]] = jQuery.parseJSON(JSON.stringify(Global_TcpModule[DeviceName[i]][nmuber[j]]));
		}
	}
	return Return;
}

TcpToMsSqlFirstPage.prototype._GetAllDeviceName_ = function()
{
	var Return=Object.keys(Global_TcpModule);
	return Return;
}

TcpToMsSqlFirstPage.prototype._GetAllNumber_ = function()
{
	var AllDeviceName = TcpToMsSqlFirstPage.prototype._GetAllDeviceName_();
	var ObjectKey = new Array();
	for(var i=0; i<AllDeviceName.length; i++)
	{
		if(typeof(Global_TcpModule[AllDeviceName[i]]) == "object")
		{
			ObjectKey = ObjectKey.concat(Object.keys(Global_TcpModule[AllDeviceName[i]]));
		}
	}
	ObjectKey = ObjectKey.sort(function (a, b) {return a - b});
	return ObjectKey;
}

TcpToMsSqlFirstPage.prototype._ShowTable_ = function(ObjectKey, DisplayNumber)
{
	var AllModuleData = TcpToMsSqlFirstPage.prototype._GetAllModuleData_();
	$("#ModuleTable").find(".DynamicRow").remove();
	var html = $(".Dynamic").html();
	var PageNumber = $("#ModuleToolbar").find(".Text").val();
	var Start = (PageNumber-1)*DisplayNumber;
	if((ObjectKey.length-Start)>DisplayNumber){
		var End = Start + DisplayNumber;
	}
	else{
		var End = ObjectKey.length;
	}
	var index = 0;
	for(var i=Start; i<End && End!=0; i++)
	{
		$("#ModuleTable").append(html);
		$("#ModuleTable").find(".DynamicRow").eq(index).find(".Column").eq(0).text(ObjectKey[i]);
		$("#ModuleTable").find(".DynamicRow").eq(index).find(".Column").eq(1).text(AllModuleData[ObjectKey[i]]["ModuleName"]);
		TcpToMsSqlFirstPage.prototype._LoadDatabaseName_(index, ObjectKey[i]);
		var Bool = TcpToMsSqlFirstPage.prototype._IsAllDatabaseRecord_(ObjectKey[i]);
		$("#ModuleTable").find(".DynamicRow").eq(index).find(".Column").eq(4).find(":checkbox").prop("checked",Bool);
		index++;
	}
}

TcpToMsSqlFirstPage.prototype._UpdateTableToolbar_ = function(ObjectKey, DisplayNumber)
{
	var NumberOfPages = Math.ceil(ObjectKey.length/DisplayNumber);
	var Id = "#ModuleToolbar";
	$(Id).find("label").eq(1).text(NumberOfPages);
	var CurrentlyPage = $(Id).find(".Text").val();
	CurrentlyPage = parseInt(CurrentlyPage);
	if(CurrentlyPage>NumberOfPages)
	{
		$(Id).find(".Text").val(NumberOfPages);
	}
	else if(CurrentlyPage<=0 || isNaN(CurrentlyPage)==true)
	{
		$(Id).find(".Text").val(1);
	}
	else
	{
		$(Id).find(".Text").val(CurrentlyPage);
	}
}

TcpToMsSqlFirstPage.prototype._RedisplayUi_ = function()
{
	var DisplayNumber = 20;
	var ObjectKey = TcpToMsSqlFirstPage.prototype._GetAllNumber_();
	TcpToMsSqlFirstPage.prototype._UpdateTableToolbar_(ObjectKey, DisplayNumber);
	TcpToMsSqlFirstPage.prototype._ShowTable_(ObjectKey, DisplayNumber);
	var Id = "#ModuleTable";
	$(Id).find(".Row").eq(0).find(":checkbox").prop("checked",false);
}

TcpToMsSqlFirstPage.prototype._ShowPreviousPage_ = function()
{
	var Id = "#ModuleToolbar";
	var CurrentlyPage = $(Id).find(".Text").val();
	$(Id).find(".Text").val(parseInt(CurrentlyPage)-1);
	TcpToMsSqlFirstPage.prototype._RedisplayUi_();
}

TcpToMsSqlFirstPage.prototype._ShowNextPage_ = function()
{
	var Id = "#ModuleToolbar";
	var CurrentlyPage = $(Id).find(".Text").val();
	$(Id).find(".Text").val(parseInt(CurrentlyPage)+1);
	TcpToMsSqlFirstPage.prototype._RedisplayUi_();
}

TcpToMsSqlFirstPage.prototype._Initialization_ = function()
{
	TcpToMsSqlFirstPage.prototype._RedisplayUi_();
}

TcpToMsSqlFirstPage.prototype._SaveFinished_ = function(that, ssocket)
{
	$(that).closest('.Row').find(".Loading").hide();
	$(that).closest('.Row').find(".Message").eq(1).show();
	ssocket.emit("SaveFinished");
	ssocket.on("SaveFinished", function (Return) {
		if(Return == true)
		{
			$(that).closest('.Row').find(".Message").hide();
			$(that).closest('.Row').find(".Message").eq(0).show();
		}
		else
		{
			$(that).closest('.Row').find(".Message").hide();
			$(that).closest('.Row').find(".Message").eq(2).show();
		}
		ssocket.emit("SocketClose");
	});
}

TcpToMsSqlFirstPage.prototype._SaveStart_ = function(that, ssocket)
{
	ssocket.emit("BackgroundExecution");
	ssocket.on("BackgroundExecution", function (Return) {
	if(Return == true)
	{
		var Class = new Transmission();
		var Callback0 = function(){TcpToMsSqlFirstPage.prototype._SaveFinished_(that, ssocket);}
		var JsonString = JSON.stringify(Global_TcpToMsSqlVariable);
		$(that).closest('.Row').find(".Message").hide();
		$(that).closest('.Row').find(".Loading").show();
		Class.TransmissionJson(ssocket, "SaveTcpToMsSqlVariable", JsonString, Callback0);
	}
	});
}

TcpToMsSqlFirstPage.prototype._EditButton_ = function(that)
{
	$(that).closest(".Column").find(".Message").show();
	var ssocket = io.connect();
	ssocket.emit("BackgroundExecution");
	ssocket.on("BackgroundExecution", function (Return) {
	if(Return == true)
	{
		$("#Main_Center-Content").find(".Body").eq(2).find(".Message").hide();
		var number = parseInt($(that).closest(".DynamicRow").find(".Column").eq(0).text());
		$("#Main_Center-Content").find(".Body").eq(1).hide();
		$("#Main_Center-Content").find(".Body").eq(2).show();
		var Name = $("#Main_Center-Content").find(".Body").eq(2).find(".FormTitle").eq(0).text();
		var Class = new Path();
		Class.LoadPathHtml(Name, 2);
		Class = null;
		TcpToMsSqlSecondPage.prototype._ShowColumn_();
		TcpToMsSqlSecondPage.prototype._SetInitialValue_(number);
		$(that).closest(".Column").find(".Message").hide();
	}
	});
}

TcpToMsSqlFirstPage.prototype._SaveButton_ = function(that)
{
	$(that).closest('.Row').find(".Loading").hide();
	$(that).closest('.Row').find(".Message").hide();
	var ssocket = io.connect();
	TcpToMsSqlFirstPage.prototype._SaveStart_(that, ssocket);
}




















//第二頁
TcpToMsSqlSecondPage.prototype._LoadDatabaseName_ = function(Index, DatabaseIndexInformation)
{
	var MsSqlConnection = Global_MsSqlConnection;
	var Combobox = $("#VariableTable").find(".DynamicRow").eq(Index).find(".Column").eq(4).find(".Select");
	var ConnectionInformation = TcpToMsSqlCommon.prototype._GetConnectionInformation_();
	for(var i=0; i<ConnectionInformation.length; i++)
	{
		var DatabaseIndex = ConnectionInformation[i].split("/")[0];
		var DatabaseType  = ConnectionInformation[i].split("/")[1];
		var Text;
		if(DatabaseType == "Remote")
		{
			Text = MsSqlConnection[DatabaseIndex]["IdentificationName"] + " (Remote)";
		}
		Combobox.append($("<option></option>").attr("value",ConnectionInformation[i]).text(Text));
	}
	Combobox.val(DatabaseIndexInformation);
}

TcpToMsSqlSecondPage.prototype._VariableTableAddNewRow_ = function(number)
{
	if(typeof(Global_TcpToMsSqlVariable[number]) != "object")	{return 0;}
	var html="", TempHtml = $("#Main_Center-Content").find(".Body").eq(2).find(".Dynamic").html();
	var SystemVariable = Object.keys(Global_TcpToMsSqlVariable[number]);
	for(var i=0; i<SystemVariable.length; i++)
	{
		html = html + TempHtml;
	}
	$("#VariableTable").append(html);
}

TcpToMsSqlSecondPage.prototype._SetVariableTableNewRowValue_ = function(number)
{
	var GlobalVariable = Global_TcpToMsSqlVariable;
	if(typeof(GlobalVariable[number]) != "object")	{return 0;}
	var Variable = Global_TcpVariable[number];
	var Class=new Algorithm();
	var SystemVariable = Object.keys(GlobalVariable[number]).sort(Class.StringNumberMixedSort());
	var Row = $("#VariableTable").find(".DynamicRow");
	for(var i=0; i<SystemVariable.length; i++)
	{
		Row.eq(i).find(".Column").eq(0).text(SystemVariable[i]);
		Row.eq(i).find(".Column").eq(1).find(".Text").val(Variable[SystemVariable[i]]["VariableName"]);
		var ReadWriteType = TcpToMsSqlSecondPage.prototype._GetReadWriteType_(SystemVariable[i].split("-")[0]);
		Row.eq(i).find(".Column").eq(2).find(".Select").val(ReadWriteType);
		Row.eq(i).find(".Column").eq(3).text(SystemVariable[i].split("-")[1]);
		var DatabaseIndexInformation = GlobalVariable[number][SystemVariable[i]]["DatabaseIndex"] + "/" + GlobalVariable[number][SystemVariable[i]]["DatabaseType"];
		TcpToMsSqlSecondPage.prototype._LoadDatabaseName_(i, DatabaseIndexInformation);
		var Bool = GlobalVariable[number][SystemVariable[i]]["DatabaseRecord"];
		Row.eq(i).find(".Column").eq(5).find(".Checkbox").prop("checked",Bool);
	}
}

TcpToMsSqlSecondPage.prototype._GetModuleName_ = function(number)
{
	var Return="";
	var DeviceName = Object.keys(Global_TcpModule);
	for(var i=0; i<DeviceName.length; i++)
	{
		if(typeof(Global_TcpModule[DeviceName[i]][number]) == "object")
		{
			Return = Global_TcpModule[DeviceName[i]][number]["ModuleName"];
			break;
		}
	}
	return Return;
}

TcpToMsSqlSecondPage.prototype._ClearTable_ = function(number)
{
	$("#VariableTable").find(".Row").eq(0).find(".Checkbox").prop("checked",false);
	$("#VariableTable").find(".DynamicRow").remove();
}

TcpToMsSqlSecondPage.prototype._SetVariableTableInitialValue_ = function(number)
{
	TcpToMsSqlSecondPage.prototype._VariableTableAddNewRow_(number);
	TcpToMsSqlSecondPage.prototype._SetVariableTableNewRowValue_(number);
}

TcpToMsSqlSecondPage.prototype._SetFormInitialValue_ = function(number)
{
	var ModuleName=TcpToMsSqlSecondPage.prototype._GetModuleName_(number);
	var ContentSettings = $("#Main_Center-Content").find(".Body").eq(2).find(".Form").eq(0).find(".Row");
	ContentSettings.eq(0).find(".Text").val(number);
	ContentSettings.eq(1).find(".Text").val(ModuleName);
}

TcpToMsSqlSecondPage.prototype._SetInitialValue_ = function(number)
{
	TcpToMsSqlSecondPage.prototype._ClearTable_(number);
	TcpToMsSqlSecondPage.prototype._SetFormInitialValue_(number);
	TcpToMsSqlSecondPage.prototype._SetVariableTableInitialValue_(number);
}

TcpToMsSqlSecondPage.prototype._ModifyTcpToMsSqlVariableObject_ = function(number)
{
	var Row = $("#VariableTable").find(".DynamicRow");
	for(var i=0; i<Row.length; i++)
	{
		var SystemVariable = Row.eq(i).find(".Column").eq(0).text();
		var DatabaseIndexInformation = Row.eq(i).find(".Column").eq(4).find(".Select").val();
		var Bool = Row.eq(i).find(":checkbox").prop("checked");
		Global_TcpToMsSqlVariable[number][SystemVariable]["DatabaseRecord"] = Bool;
		if(DatabaseIndexInformation != null)
		{
			Global_TcpToMsSqlVariable[number][SystemVariable]["DatabaseIndex"] = parseInt(DatabaseIndexInformation.split("/")[0]);
			Global_TcpToMsSqlVariable[number][SystemVariable]["DatabaseType"] = DatabaseIndexInformation.split("/")[1];
		}
	}
}

TcpToMsSqlSecondPage.prototype._ConfirmButton_ = function(that)
{
	$(that).closest(".Row").find(".Message").hide();
	var Bool=TcpToMsSqlSecondPage.prototype._AllDataIsCorrect_();
	if(Bool==false)
	{
		$(that).closest(".Row").find(".Message").show();
		return 0;
	}
	var ContentSettings = $("#Main_Center-Content").find(".Body").eq(2).find(".Form").eq(0).find(".Row");
	var number = parseInt(ContentSettings.eq(0).find(".Text").val());
	TcpToMsSqlSecondPage.prototype._ModifyTcpToMsSqlVariableObject_(number);
	$("#Main_Center-Content").find(".Body").eq(2).hide();
	$("#Main_Center-Content").find(".Body").eq(1).show();
	TcpToMsSqlFirstPage.prototype._RedisplayUi_();
	var Class = new Path();
	Class.LoadPathHtml($("#Left-List-TcpToMsSql").text(), 1, "main_PathTcpToMsSql_click(this)");
	Class = null;
}

TcpToMsSqlSecondPage.prototype._NoConfirmButton_ = function()
{
	$("#Main_Center-Content").find(".Body").eq(2).hide();
	$("#Main_Center-Content").find(".Body").eq(1).show();
	var Class = new Path();
	Class.LoadPathHtml($("#Left-List-TcpToMsSql").text(), 1, "main_PathTcpToMsSql_click(this)");
	Class = null;
}

TcpToMsSqlSecondPage.prototype._ShowColumn_ = function()
{
	$("#VariableTable").find(".Row").find(".TitleColumn").eq(2).show();
	$("#VariableTable").find(".Row").find(".TitleColumn").eq(3).show();
	var DynamicRow = $("#VariableTable").find(".DynamicRow");
	for(var i=0; i<DynamicRow.length; i++)
	{
		DynamicRow.eq(i).find(".Column").eq(2).show();
		DynamicRow.eq(i).find(".Column").eq(3).show();
	}
}

TcpToMsSqlSecondPage.prototype._HideColumn_ = function()
{
	$("#VariableTable").find(".Row").find(".TitleColumn").eq(2).hide();
	$("#VariableTable").find(".Row").find(".TitleColumn").eq(3).hide();
	var DynamicRow = $("#VariableTable").find(".DynamicRow");
	for(var i=0; i<DynamicRow.length; i++)
	{
		DynamicRow.eq(i).find(".Column").eq(2).hide();
		DynamicRow.eq(i).find(".Column").eq(3).hide();
	}
}

TcpToMsSqlSecondPage.prototype._GetReadWriteType_ = function(string)
{
	var Return;
	if(string == "DO")			{Return = "ReadWrite";}
	else if(string == "DI")		{Return = "Read";}
	else if(string == "AO")		{Return = "ReadWrite";}
	else if(string == "AI")		{Return = "Read";}
	return Return;
}

TcpToMsSqlSecondPage.prototype._AllDataIsCorrect_ = function()
{
	var Return = true;
	var length = $("#VariableTable").find(".DynamicRow").length;
	for(var i=0; i<length; i++)
	{
		var ShowMessage = $("#VariableTable").find(".DynamicRow").eq(i).find(".Message").eq(0).is(":visible");
		if(ShowMessage == true)
		{
			Return = false;
		}
	}
	return Return;
}