AccountSetting.prototype._CheckAccount_ = function(that)
{
	if($(that).val() == "")
	{
		$(that).closest(".RightColumn").find(".Message").show();
		return 0;
	}
	$(that).closest(".RightColumn").find(".Message").hide();
};

AccountSetting.prototype._CheckPassword_ = function(that)
{
	var Password = $(that).val(), 
	    RetypePassword = $(that).closest(".Form").find(".Row").eq(2).find(":password").val();
	if(!(Password != "" && 
	   RetypePassword != "" && 
	   Password == RetypePassword))
	{
		$(that).closest(".RightColumn").find(".Message").show();
		return 0;
	}
	$(that).closest(".RightColumn").find(".Message").hide();
	$(that).closest(".Form").find(".Row").eq(2).find(".Message").hide();
};

AccountSetting.prototype._CheckRetypePassword_ = function(that)
{
	var Password = $(that).val(), 
	    RetypePassword = $(that).closest(".Form").find(".Row").eq(1).find(":password").val();
	if(!(Password != "" && 
	   RetypePassword != "" && 
	   Password == RetypePassword))
	{
		$(that).closest(".RightColumn").find(".Message").show();
		return 0;
	}
	$(that).closest(".RightColumn").find(".Message").hide();
	$(that).closest(".Form").find(".Row").eq(1).find(".Message").hide();
};

AccountSetting.prototype._Transmission_AccountSetting_Data_ = function(that)
{
	var array = AccountSetting.prototype._Collect_AccountSetting_Data_();
	var Result={"Input":null};
	var Class = new Transmission();
	Class.TransmissionArray("SaveAccountSettingAllData", array, Result);
	var SetInterval = setInterval(function()
	{
		if(Result["Input"]==true)
		{
			clearInterval(SetInterval);
			Class =null; delete Class;
			$(".Form").eq(1).find(".Message").eq(4).hide();
			$(that).closest('.Form').find(".Loading").hide();
			$(that).closest('.Form').find(".Message").eq(0).show();
			AccountSetting.prototype._CommonEnabled_();
		}
		else if(Result["Input"]==false)
		{
			clearInterval(SetInterval);
			Class =null; delete Class;
			$(".Form").eq(1).find(".Message").eq(4).hide();
			$(that).closest('.Form').find(".Loading").hide();
			$(that).closest('.Form').find(".Message").eq(1).show();
		}
	},500);
}

AccountSetting.prototype._CheckDefaultAccount_ = function()
{
	var Return = false;
	var Row = $(".Form").eq(0).find(".Row");
	if(Row.eq(0).find(".Text").val() == "root" &&
	   Row.eq(1).find(".Text").val() == "root")
	{
		Return = true;
	}
	return Return;
}

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

AccountSetting.prototype._Collect_AccountSetting_Data_ = function()
{
	Global_AccountSetting["Manager"]["Account"] = $(".Form").eq(0).find(":text").val();
	Global_AccountSetting["Manager"]["Password"] = $(".Form").eq(0).find(":password").val();
	
	var XmlObject=new Object();
	XmlObject["SystemManagement"]=new Object();
	XmlObject["SystemManagement"]["SystemInformation"]=new Object();
	XmlObject["SystemManagement"]["SystemInformation"]["Login"]=new Object();
	XmlObject["SystemManagement"]["SystemInformation"]["Login"]["UserName"]=Global_AccountSetting["Manager"]["Account"];
	XmlObject["SystemManagement"]["SystemInformation"]["Login"]["Password"]=Global_AccountSetting["Manager"]["Password"];

	var xotree = new XML.ObjTree();
	var xml = xotree.writeXML(XmlObject);

	var Return = new Array(Global_AccountSetting["Manager"]["Account"], Global_AccountSetting["Manager"]["Password"], xml);
	return Return;
}

AccountSetting.prototype._CleanRetypePassword_ = function()
{
	var Row = $("#Main_Center-Content").find(".Form").eq(0).find(".Row");
	Row.eq(2).find(".Text").val("");
}

AccountSetting.prototype._CommonEnabled_ = function()
{
	$("#Main_Top-FunctionWizard").css('pointer-events', "visible");
	$("#Main_Top-FunctionWizard").css('opacity', 1);

	$("#Main_Top-StepFlow").find("div").css('pointer-events', "visible");
	$("#Main_Top-StepFlow").find("div").css('opacity', 1);

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

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

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

	$("#Main_Right-List").find("div").css('pointer-events', "visible");
	$("#Main_Right-List").find("div").css('opacity', 1);

	$("#Main_Bottom-Information").find("div").css('pointer-events', "visible");
	$("#Main_Bottom-Information").find("div").css('opacity', 1);
}

AccountSetting.prototype._SaveData_ = function(that)
{
	$(that).closest('.Form').find(".Message").hide();
	$(that).closest('.Form').find(".Loading").show();
	if(AccountSetting.prototype._AllDataIsCorrect_() == false)
	{
		$(".Form").eq(1).find(".Message").eq(4).hide();
		$(that).closest('.Form').find(".Loading").hide();
		$(that).closest('.Form').find(".Message").eq(2).show();
		AccountSetting.prototype._CleanRetypePassword_();
		return 0;
	}
	if(AccountSetting.prototype._CheckDefaultAccount_() == true)
	{
		$(".Form").eq(1).find(".Message").eq(4).hide();
		$(that).closest('.Form').find(".Loading").hide();
		$(that).closest('.Form').find(".Message").eq(3).show();
		AccountSetting.prototype._CleanRetypePassword_();
		return 0;
	}
	AccountSetting.prototype._Transmission_AccountSetting_Data_(that);
	AccountSetting.prototype._CleanRetypePassword_();
};

AccountSetting.prototype._ShowUi_ = function()
{
	$(".Form").eq(0).find(":text").val(Global_AccountSetting["Manager"]["Account"]);
	$(".Form").eq(0).find(":password").val(Global_AccountSetting["Manager"]["Password"]);
	AccountSetting.prototype._CleanRetypePassword_();
	Class = new Main();
	if(Class.CheckDefaultAccount() == true)
	{
		$(".Form").eq(1).find(".Message").eq(4).show();
	}
	Class = null;
};