
DownLoadDataLog.prototype._ShowPreviousPage_= function(that)
{
	$("#ModuleTable").find(".DynamicRow").remove();
	var Id = "#ModuleToolbar";
	var CurrentlyPage = $(Id).find(".Text").val();
	$(Id).find(".Text").val(parseInt(CurrentlyPage)-1);
	DownLoadDataLog.prototype._RedisplayUi_();
	//DownLoadDataLog.prototype._UpdateNumber_(Global_DataLogFilePathString);
}
DownLoadDataLog.prototype._ShowNextPage_= function(that)
{
	$("#ModuleTable").find(".DynamicRow").remove();
	var Id = "#ModuleToolbar";
	var CurrentlyPage = $(Id).find(".Text").val();
	$(Id).find(".Text").val(parseInt(CurrentlyPage)+1);
	DownLoadDataLog.prototype._RedisplayUi_();
	//DownLoadDataLog.prototype._UpdateNumber_(Global_DataLogFilePathString);
}
DownLoadDataLog.prototype._UpdateNumber_= function(Global_DataLogFilePathString, DisplayNumber)
{
	var NumberOfPages = Math.ceil(Global_DataLogFilePathString[0].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);
	}
}

DownLoadDataLog.prototype._ShowDataLogFileList_= function()
{
	$("#ModuleTable").find(".DynamicRow").remove();
	var Result = {"Input":null};
	var Path1 = $(".PathButton").eq(0).val();
	var Path2 = $(".PathButton").eq(1).val();
	var Path = "/" + Path1 + "/" + Path2;
	var array = new Array(Path);
	var Class = new Transmission();

	Class.TransmissionArray("ShowSDFilePath", array, Result);
	var SetInterval = setInterval(function()
	{
		if(Result["Input"]!=null)
		{
			Global_DataLogFilePathString = Result["Input"];
			DownLoadDataLog.prototype._RedisplayUi_();
			Class = null; delete Class;
			clearInterval(SetInterval);
		}
	},500);
}
DownLoadDataLog.prototype._FilterArray_ = function(Global_DataLogFilePathString)
{
	var count = Global_DataLogFilePathString[0].length;
	var Path = $(".PathButton").eq(1).val();
	var index = 0;
	if(Path=="")
	{
		Path = "First";
	}
	else
	{
		Path = "Second";
	}
	for(i = 0;i < count; i++)
	{
		if(Global_DataLogFilePathString[0][index] == "log.csv")
		{
			Global_DataLogFilePathString[0].splice(index, 1);
			Global_DataLogFilePathString[1].splice(index, 1);
			Global_DataLogFilePathString[2].splice(index, 1);
			continue;
		}
		if(Global_DataLogFilePathString[0][index] == "")
		{
			Global_DataLogFilePathString[0].splice(index, 1);
			Global_DataLogFilePathString[1].splice(index, 1);
			Global_DataLogFilePathString[2].splice(index, 1);
			continue;
		}
		if(Path=="First")
		{
			if(Global_DataLogFilePathString[1][index][0] != 'd')
			{
				Global_DataLogFilePathString[0].splice(index, 1);
				Global_DataLogFilePathString[1].splice(index, 1);
				Global_DataLogFilePathString[2].splice(index, 1);
				continue;
			}
		}
		if(Path=="Second")
		{
			if(Global_DataLogFilePathString[1][index][0] == 'd')
			{
				Global_DataLogFilePathString[0].splice(index, 1);
				Global_DataLogFilePathString[1].splice(index, 1);
				Global_DataLogFilePathString[2].splice(index, 1);
				continue;
			}
		}
		index++;
	}

	//splice(3, 1)
	//Global_DataLogFilePathString = 
}
DownLoadDataLog.prototype._RedisplayUi_ = function()
{
	var DisplayNumber = 10;
	DownLoadDataLog.prototype._FilterArray_(Global_DataLogFilePathString);
	DownLoadDataLog.prototype._UpdateNumber_(Global_DataLogFilePathString, DisplayNumber);
	DownLoadDataLog.prototype._ShowTable_(DisplayNumber);
}
DownLoadDataLog.prototype._ShowTable_ = function(DisplayNumber)
{
	var Type, Name;
	var PageNumber = $("#ModuleToolbar").find(".Text").val();
	var Start = (PageNumber-1)*DisplayNumber;
	ObjectKey = Global_DataLogFilePathString[0].length;
	if((ObjectKey-Start)>DisplayNumber){
		var End = Start + DisplayNumber;
	}
	else{
		var End = ObjectKey;
	}
	for(var i=Start; i<End && End!=0; i++)
	{
		var Name = Global_DataLogFilePathString[0][i];
		var Type = Global_DataLogFilePathString[1][i];
		var Size = Global_DataLogFilePathString[2][i];
		var html;
		Type = Type[0];
		if(Type=='d')
		{
			html = $(".Dynamic").eq(0).html();
		}
		else
		{
			html = $(".Dynamic").eq(1).html();
		}
		$("#ModuleTable").append(html);

		if (Name == "log.csv")
		{
			$("#ModuleTable").find(".DynamicRow").eq(i - Start).css('display',"none");
		}
		else
		{
			$("#ModuleTable").find(".DynamicRow").eq(i - Start).find(".Column").eq(0).text(Name);
			$("#ModuleTable").find(".DynamicRow").eq(i - Start).find(".Column").eq(1).text(Size);
			if(Type=='d')
			{
				$("#ModuleTable").find(".DynamicRow").eq(i - Start).find(".Column").eq(1).text("");	
			}
		}
	}
	$(".Previous").css('pointer-events', "visible");
	$("#Main_Left-List").find(".Left-List").eq(3).css('pointer-events', "visible");
	$(".Body").css('pointer-events', "visible");
}
DownLoadDataLog.prototype._GoToNextPath_ = function(that)
{
	$(".PathButton").eq(1).val(that.childNodes[3].innerText);
	DownLoadDataLog.prototype._ShowDataLogFileList_();
}
DownLoadDataLog.prototype._PreviousPage_ = function(that)
{
	$(that).css("color", "#9400D3");
	DownLoadDataLog.prototype._GoToPreviousPath_();
}
DownLoadDataLog.prototype._GoToPreviousPath_ = function()
{
	var NowPath = $("#Path").eq(0).text().split(" ")[1];
	var layers = NowPath.split("/").length - 1;
	if(layers>=1)
	{
		$(".Previous").css('pointer-events', "none");
		$("#ModuleTable").find(".DynamicRow").remove();
		var array = NowPath.split("/");
		array.splice(array.length - 1);
		var NextPath=array.join("/");
		$("#Path").eq(0).text("Path: "+ NextPath);
		DownLoadDataLog.prototype._ShowDataLogFileList_();
	}
}
DownLoadDataLog.prototype._DownloadDateLogFile_ = function(that)
{
	var Path1 = $(".PathButton").eq(0).val();
	var Path2 = $(".PathButton").eq(1).val();
	var SourcePath = "/" + Path1 + "/" + Path2;
	//var SourcePath = $("#Path").eq(0).text().split(" ")[1];
	var NowPath = $(that).closest(".DynamicRow").find(".Column").eq(0).text();
	var DownFilePath = "/Datalog" + SourcePath + "/" + NowPath;
	//location.href='/DownloadFile/Project_'+location.hostname+'_.tar';
	location.href=DownFilePath;
}


//Css
DownLoadDataLogCss.prototype._ChangeMouseoverFilePathCss_ = function(that)
{
	var index = $("div input").index(that);
	$(that).css("background-color", "#DEDEDE");
	$(that).css("cursor", "pointer");
	$(that).css("cursor", "#0F0F0F");
	$(that).css("border", "1px #B5B5B5 solid");
	$(that).closest(".PathDiv").find(".Pathlabel").eq(index).css("border", "1px #B5B5B5 solid");
	$(that).closest(".PathDiv").find(".Pathlabel").eq(index).css("background-color", "#DEDEDE");
	/*var color = $(that).css("border-bottom-color"); 
	if(color != "rgb(57, 93, 139)")
	{
		$(that).css("color", "rgb(112, 112, 112)");
		$(that).css("cursor", "default");
	}*/
}
DownLoadDataLogCss.prototype._ChangeMouseoutFilePathCss_ = function(that)
{

	var index = $("div input").index(that);
	$(that).css("background-color", "#EDEDED");
	$(that).css("cursor", "#8C8C8C");
	$(that).css("border", "0");
	$(that).closest(".PathDiv").find(".Pathlabel").eq(index).css("border", "0");
	$(that).closest(".PathDiv").find(".Pathlabel").eq(index).css("background-color", "#EDEDED");
	/*var color = $(that).css("border-bottom-color"); 
	if(color != "rgb(57, 93, 139)")
	{
		$(that).css("color", "rgb(112, 112, 112)");
		$(that).css("cursor", "default");
	}*/
}

DownLoadDataLogCss.prototype._ChangeMouseoutDivCss_ = function(that)
{
	$(that).css("text-decoration", "inherit");
	/*var color = $(that).css("border-bottom-color"); 
	if(color != "rgb(57, 93, 139)")
	{
		$(that).css("color", "rgb(112, 112, 112)");
		$(that).css("cursor", "default");
	}*/
}
DownLoadDataLogCss.prototype._ChangeMouseoverDivCss_ = function(that)
{
	//$(that).css("color", "#9400D3");
	$(that).css("cursor", "pointer");
	$(that).css("text-decoration", "underline");
	//$(that).css("font-weight", "bold");
};