Index: SPARQLBuilderWWW/web/jsgui.html
===================================================================
--- SPARQLBuilderWWW/web/jsgui.html (revision 170)
+++ SPARQLBuilderWWW/web/jsgui.html (revision 183)
@@ -68,4 +68,6 @@
 // 霑斐☆繝代せ縺ｮ繧ｪ繝悶ず繧ｧ繧ｯ繝�
 var pathobj = [];
+// 陦ｨ遉ｺ縺吶ｋ繝代せ縺ｮ謨ｰ
+var pathlimit = 10;
 
 // 騾√ｉ繧後◆繝代せ縺ｮ謨ｰ
@@ -92,5 +94,5 @@
 	// 縺昴ｌ縺槭ｌ縺ｫ繧ｻ繝�ヨ
 	document.getElementById("menu").style.width = menuwidth;
-	document.endpoint.inputendpoint.style.width = inputswidth;
+	document.getElementById("ajaxload").style.width = menuwidth;
 	document.endpoint.selectendpoint.style.width = inputswidth;
 	document.seclass.startclass.style.width = inputswidth;
@@ -100,5 +102,7 @@
 	// 繧ｰ繝ｩ繝墓緒逕ｻ驛ｨ蛻�ｒ荳企Κ繝｡繝九Η繝ｼ逶ｴ蠕後↓謗･縺吶ｋ繧医≧縺ｫ險ｭ螳�
 	document.getElementById("graph").style.top = document.getElementById("menu").offsetHeight + "px";
-
+	document.getElementById("ajaxload").style.height = document.getElementById("menu").offsetHeight + "px";
+
+	ajaxload("view");
 	// 繧ｨ繝ｳ繝峨�繧､繝ｳ繝井ｸ隕ｧ繧貞叙蠕励＠繧ｻ繝�ヨ
 	$.ajax({
@@ -108,7 +112,9 @@
 		success : function(data) {
 			setEndpoints(data);
+			ajaxload("hide");
 		},
 		error : function(XMLHttpRequest, textStatus, errorThrown) {
 			alert("繝ｪ繧ｯ繧ｨ繧ｹ繝域凾縺ｫ縺ｪ繧薙ｉ縺九�繧ｨ繝ｩ繝ｼ縺檎匱逕溘＠縺ｾ縺励◆�� + textStatus +":\n" + errorThrown);
+			ajaxload("hide");
 		}
 	});
@@ -116,4 +122,12 @@
 });
 
+function ajaxload(mode){
+	if(mode == "view"){
+		document.getElementById("ajaxload").style.display = "block";
+	}else{
+		document.getElementById("ajaxload").style.display = "none";
+	}
+}
+
 // 謠冗判蜃ｦ逅�
 function view_map(){
@@ -122,439 +136,517 @@
 	var json = make_data(0);
 
-	// 蜃ｺ譚･荳翫′縺｣縺溽ｵ先棡繧呈ｸ｡縺励※繝槭ャ繝嶺ｸ翫�繝ｭ繧ｱ繝ｼ繧ｷ繝ｧ繝ｳ繧偵そ繝�ヨ
-	set_map_location(0, json['nodes'], json['links']);
-
-	// SVG縺ｮ蟷�→鬮倥＆繧定ｨｭ螳夲ｼ亥ｹ�ｼ夂判髱｢縺�▲縺ｱ縺�鬮倥＆�壹ヱ繧ｹ縺ｮ謨ｰ縺ｫ蠢懊§險ｭ螳夲ｼ�
-	var width = window.innerWidth;
-	var height = ((NODEHEIGHT * 1.5) * PATHNUM) + (NODEHEIGHT / 2);
-
-	// 繧ｫ繝ｩ繝ｼ繧貞叙蠕�
-	var color = d3.scale.category20();
-
 	// SVG縺悟ｭ伜惠縺吶ｋ縺ｪ繧峨�蜑企勁
 	if (d3.select("#graph").select("svg")) {
-	        d3.select("#graph").select("svg").remove();
-	}
-
-	// 逕ｻ髱｢繧ｵ繧､繧ｺ縺ｫ蜷医ｏ縺婀VG縺ｮ霑ｽ蜉
-	var svg = d3.select("#graph").append("svg")
-	    .attr("width", width)
-	    .attr("height", height);
-
-	// 閭梧勹縺ｮ霑ｽ蜉
-	var bg = svg
-		.append("rect")
-		.attr("x", 0)
-		.attr("y", 0)
-		.attr("width", width)
-		.attr("height", height)
-		.attr("fill", "#fafafa");
-
-	// links驟榊�繧呈ｸ｡縺励Μ繝ｳ繧ｯ縺ｮ菴懈�
-	var link = svg.selectAll(".link")
-		.data(json.links)
-		.enter().append("line")
-		.attr("class", "link")
-		.style("stroke-width", function(d) { return Math.sqrt(d.value);});
-
-	// nodes驟榊�繧呈ｸ｡縺励ヮ繝ｼ繝峨�菴懈�
-	var node = svg.selectAll(".node")
-		.data(json.nodes)
-		.enter().append("circle")
-		.attr("class", "node")
-		.attr("r", (NODEHEIGHT / 2))
-		.attr("cx", function(d) { return d.x;} )
-		.attr("cy",  function(d) { return d.y; })
-		.style("stroke", function(d) { return '#fafafa'; })
-		.style("stroke-width", function(d) { return '1.5px'; })
-		.style("fill", function(d) { return color(d.group); })
-		.style("cursor", function(d) { return 'pointer'; });
-
-	// nodes驟榊�繧呈ｸ｡縺励ヮ繝ｼ繝峨ユ繧ｭ繧ｹ繝医�菴懈�
-	var tnode = svg.selectAll("text.node")
-		.data(json.nodes)
-		.enter().append("svg:text")
-		.attr("class", "tnode")
-		.attr("x", function(d) { return d.x; })
-		.attr("y", function(d) { return d.y; })
-		.text(function(d) { return d.name; })
-		.style("fill", function(d) { return '#000000'; })
-		.style("text-anchor", function(d) { return 'middle'; })
-		.style("pointer-events", "none");
-
-	// 繝ｪ繝ｳ繧ｯ繝�く繧ｹ繝医�菴懈�
-	var tlink = svg.selectAll("text.link")
-		.data(json.links)
-		.enter().append("svg:text")
-		.attr("class", "tlink")
-		.attr("x", function(d) { return (json.nodes[d.source].x + json.nodes[d.target].x) / 2; })
-		.attr("y", function(d) { return (json.nodes[d.source].y + json.nodes[d.target].y) / 2; })
-		.style("fill", function(d) { return '#000000'; })
-		.style("text-anchor", function(d) { return 'middle'; });
-
-	// 繝弱�繝峨∈縺ｮ繧ｪ繝ｳ繝槭え繧ｹ縺ｧ繝代せ謗｢邏｢縲√ヱ繧ｹ荳ｭ縺ｮ繝ｪ繝ｳ繧ｯ譁�ｭ励ｒ陦ｨ遉ｺ
-	node.on("mouseover", function(d){
-
-		// 繝槭え繧ｹ縺ｮ蜍輔″繧ｫ繧ｦ繝ｳ繝医ｒ繝ｪ繧ｻ繝�ヨ
-		MOUSEMOVED = 0;
-
-		// 陦ｨ遉ｺ縺吶ｋ繝代せ菫晏ｭ倡畑驟榊�
-		var path = [];
-		// 繝��繝ｫ繝√ャ繝励∈縺ｮ蜷榊燕陦ｨ遉ｺ逕ｨ驟榊�
-		var pathname = [];
-
-		// 繝ｫ繝ｼ繝医ヮ繝ｼ繝我ｻ･螟悶↑繧�
-		if(d.nodeid != 0){
-			// 縺ｾ縺壹が繝ｳ繝槭え繧ｹ縺輔ｌ縺溘ヮ繝ｼ繝峨�id縺ｨ蜷榊燕繧偵◎繧後◇繧瑚ｿｽ蜉
-			path.push(d.nodeid);
-			pathname.push(d.name);
-
-			// 繝代せ謗｢邏｢
+		d3.select("#graph").select("svg").remove();
+	}
+
+	if(json['nodes'].length != 0){
+
+		// 蜃ｺ譚･荳翫′縺｣縺溽ｵ先棡繧呈ｸ｡縺励※繝槭ャ繝嶺ｸ翫�繝ｭ繧ｱ繝ｼ繧ｷ繝ｧ繝ｳ繧偵そ繝�ヨ
+		set_map_location(0, json['nodes'], json['links']);
+
+		// SVG縺ｮ蟷�→鬮倥＆繧定ｨｭ螳夲ｼ亥ｹ�ｼ夂判髱｢縺�▲縺ｱ縺�鬮倥＆�壹ヱ繧ｹ縺ｮ謨ｰ縺ｫ蠢懊§險ｭ螳夲ｼ�
+		var width = window.innerWidth;
+		var height = ((NODEHEIGHT * 1.5) * PATHNUM) + (NODEHEIGHT / 2);
+
+		// 繧ｫ繝ｩ繝ｼ繧貞叙蠕�
+		var color = d3.scale.category20();
+
+		// 逕ｻ髱｢繧ｵ繧､繧ｺ縺ｫ蜷医ｏ縺婀VG縺ｮ霑ｽ蜉
+		var svg = d3.select("#graph").append("svg")
+			.attr("width", width)
+			.attr("height", height);
+
+		// 閭梧勹縺ｮ霑ｽ蜉
+		var bg = svg
+			.append("rect")
+			.attr("x", 0)
+			.attr("y", 0)
+			.attr("width", width)
+			.attr("height", height)
+			.attr("fill", "#fafafa");
+
+		// links驟榊�繧呈ｸ｡縺励Μ繝ｳ繧ｯ縺ｮ菴懈�
+		var link = svg.selectAll(".link")
+			.data(json.links)
+			.enter().append("line")
+			.attr("class", "link")
+			.style("stroke-width", function(d) { return Math.sqrt(d.value);});
+
+		// nodes驟榊�繧呈ｸ｡縺励ヮ繝ｼ繝峨�菴懈�
+		var node = svg.selectAll(".node")
+			.data(json.nodes)
+			.enter().append("circle")
+			.attr("class", "node")
+			.attr("r", (NODEHEIGHT / 2))
+			.attr("cx", function(d) { return d.x;} )
+			.attr("cy",  function(d) { return d.y; })
+			.style("stroke", function(d) { return '#fafafa'; })
+			.style("stroke-width", function(d) { return '1.5px'; })
+			.style("fill", function(d) { return color(d.group); })
+			.style("cursor", function(d) { return 'pointer'; });
+
+		// nodes驟榊�繧呈ｸ｡縺励ヮ繝ｼ繝峨ユ繧ｭ繧ｹ繝医�菴懈�
+		var tnode = svg.selectAll("text.node")
+			.data(json.nodes)
+			.enter().append("svg:text")
+			.attr("class", "tnode")
+			.attr("x", function(d) { return d.x; })
+			.attr("y", function(d) { return d.y; })
+			.text(function(d) { return d.name; })
+			.style("fill", function(d) { return '#000000'; })
+			.style("text-anchor", function(d) { return 'middle'; })
+			.style("pointer-events", "none");
+
+		// 繝ｪ繝ｳ繧ｯ繝�く繧ｹ繝医�菴懈�
+		var tlink = svg.selectAll("text.link")
+			.data(json.links)
+			.enter().append("svg:text")
+			.attr("class", "tlink")
+			.attr("x", function(d) { return (json.nodes[d.source].x + json.nodes[d.target].x) / 2; })
+			.attr("y", function(d) { return (json.nodes[d.source].y + json.nodes[d.target].y) / 2; })
+			.style("fill", function(d) { return '#000000'; })
+			.style("text-anchor", function(d) { return 'middle'; });
+
+		// 繝弱�繝峨∈縺ｮ繧ｪ繝ｳ繝槭え繧ｹ縺ｧ繝代せ謗｢邏｢縲√ヱ繧ｹ荳ｭ縺ｮ繝ｪ繝ｳ繧ｯ譁�ｭ励ｒ陦ｨ遉ｺ
+		node.on("mouseover", function(d){
+
+			// 繝槭え繧ｹ縺ｮ蜍輔″繧ｫ繧ｦ繝ｳ繝医ｒ繝ｪ繧ｻ繝�ヨ
+			MOUSEMOVED = 0;
+
+			// 陦ｨ遉ｺ縺吶ｋ繝代せ菫晏ｭ倡畑驟榊�
+			var path = [];
+			// 繝��繝ｫ繝√ャ繝励∈縺ｮ蜷榊燕陦ｨ遉ｺ逕ｨ驟榊�
+			var pathname = [];
+
+			// 繝ｫ繝ｼ繝医ヮ繝ｼ繝我ｻ･螟悶↑繧�
+			if(d.nodeid != 0){
+				// 縺ｾ縺壹が繝ｳ繝槭え繧ｹ縺輔ｌ縺溘ヮ繝ｼ繝峨�id縺ｨ蜷榊燕繧偵◎繧後◇繧瑚ｿｽ蜉
+				path.push(d.nodeid);
+				pathname.push(d.name);
+
+				// 繝代せ謗｢邏｢
+				do{
+					// 繝ｪ繝ｳ繧ｯ縺ｮ謨ｰ縺縺醍ｹｰ繧願ｿ斐＠
+					for(var i = 0; i < link.data().length; i++){
+						// 迴ｾ蝨ｨ縺ｮ譛蠕悟ｰｾ縺ｫ郢九′繧九Μ繝ｳ繧ｯ縺後≠繧後�
+						if(path[(path.length-1)] == link.data()[i].target){
+							// 縺昴�繝ｪ繝ｳ繧ｯ縺ｮ繧ｽ繝ｼ繧ｹ蛛ｴ繝弱�繝峨�id繧定ｿｽ蜉
+							path.push(link.data()[i].source);
+							// 縺昴�繝ｪ繝ｳ繧ｯ縺ｮ蜷榊燕縺ｨ繧ｽ繝ｼ繧ｹ蛛ｴ繝弱�繝峨�蜷榊燕繧定ｿｽ蜉
+							pathname.push(link.data()[i].property);
+							pathname.push(node.data()[link.data()[i].source].name);
+						}
+					}
+				// 繝ｫ繝ｼ繝医ヮ繝ｼ繝峨↓霎ｿ繧顔捩縺上∪縺ｧ郢ｰ繧願ｿ斐☆
+				}while(path[(path.length-1)] != 0);
+
+				// 譛ｫ遶ｯ繝弱�繝峨〒縺ｪ縺�↑繧�
+				if(d.path == "notend"){
+					// 繝��繝ｫ繝√ャ繝励ｒ髱櫁｡ｨ遉ｺ縺ｫ
+					document.getElementById("showpath").style.display = "none";
+				}else{
+					// 譛ｫ遶ｯ繝弱�繝峨↑繧峨ヤ繝ｼ繝ｫ繝√ャ繝励�諠�ｱ繧呈峩譁ｰ
+					var resultText = "<h3>Selected Path</h3>";
+					// 繝代せ縺ｮ蜷榊燕驟榊�蛻�ｾ後ｍ縺九ｉ郢ｰ繧願ｿ斐＠縺ｪ縺後ｉ
+					for (var i = pathname.length;i > 0; i--){
+						// 螂�焚逡ｪ逶ｮ�医ヮ繝ｼ繝峨�蜷榊燕�峨�螟ｪ蟄励↓
+						if(i % 2 == 1){
+							resultText = resultText + "<span style=\"font-weight: bold;\">" + pathname[i - 1] + "</span><br><br>";
+						// 蛛ｶ謨ｰ逡ｪ逶ｮ�医Μ繝ｳ繧ｯ縺ｮ蜷榊燕�峨�縺昴�縺ｾ縺ｾ縺ｧ陦ｨ遉ｺ
+						}else{
+							resultText = resultText + pathname[i - 1] + "<br><br>";
+						}
+					}
+					// 繝��繝ｫ繝√ャ繝励�蜀�ｮｹ繧呈嶌縺肴鋤縺�
+					document.getElementById("selectpath").innerHTML=(resultText);
+					document.getElementById("showpath").style.display = "block";
+
+					// 繧ｵ繝ｼ繝悶Ξ繝�ヨ縺ｫ騾√ｊ霑斐☆繝代せ繧ｪ繝悶ず繧ｧ繧ｯ繝医ｒ菫晏ｭ�
+					pathobj = d.path;
+
+					// 繝��繝ｫ繝√ャ繝苓｡ｨ遉ｺ譎ゅ�蠎ｧ讓呻ｼ医が繝ｳ繝槭え繧ｹ縺輔ｌ縺溘ヮ繝ｼ繝峨�讓ｪ縺ｫ繝懊ち繝ｳ縺梧擂繧九ｈ縺��鄂ｮ��
+					var xPosition = parseFloat(d3.select(this).attr("cx")) + parseFloat(d3.select(this).style("stroke-width")) + (NODEHEIGHT * 0.5);
+					var yPosition = parseFloat(d3.select(this).attr("cy") - document.getElementById("showpath").offsetHeight + document.getElementById("menu").offsetHeight) + (NODEHEIGHT * 0.5);
+
+					// 繝��繝ｫ繝√ャ繝励′逕ｻ髱｢螟悶↓蜃ｺ縺ｪ縺�ｈ縺�｣懈ｭ｣
+					if(xPosition < 0){
+						xPosition = 0;
+					}
+					if(yPosition < 0){
+						yPosition = 0;
+					}
+
+					// 逕滓�縺励◆蠎ｧ讓吶↓繝��繝ｫ繝√ャ繝励ｒ陦ｨ遉ｺ
+					document.getElementById("showpath").style.left = xPosition + "px"
+					document.getElementById("showpath").style.top = yPosition + "px"
+				}
+			// 繝ｫ繝ｼ繝医ヮ繝ｼ繝峨□縺｣縺溘↑繧�
+			}else{
+				// 繝��繝ｫ繝√ャ繝励ｒ髱櫁｡ｨ遉ｺ
+				document.getElementById("showpath").style.display = "none";
+			}
+
+			// 繧ｪ繝ｳ繝槭え繧ｹ縺輔ｌ縺溘ヮ繝ｼ繝峨�鬮倥＆縺ｫ隕ｪ繧貞粋繧上○繧九◆繧√↓蜷医ｏ縺帙ｋ鬮倥＆繧剃ｿ晏ｭ�
+			var movey = d.y;
+
+			// 蜷�ヮ繝ｼ繝峨↓蟇ｾ縺�
+			node
+				// 霈ｪ驛ｭ邱壹�濶ｲ繧定ｨｭ螳�
+				.style("stroke", function(d){
+					// 縺ｾ縺壹�閭梧勹濶ｲ�医ョ繝輔か繝ｫ繝茨ｼ峨ｒ謖�ｮ�
+					var strokecolor = "#fafafa";
+
+					// 繝代せ蛻､螳壹�蜑榊�逅�
+					// 陦ｨ遉ｺ繝輔Λ繧ｰ縺系ow�亥燕蝗槭が繝ｳ繝槭え繧ｹ縺ｧ蜍輔＞縺ｦ縺�◆繝弱�繝会ｼ峨↑繧�
+					if(d.view == "now"){
+						// 繝弱�繝峨�陦ｨ遉ｺ繝輔Λ繧ｰ繧地o縺ｫ
+						d.view = "no";
+					}
+					// 陦ｨ遉ｺ繝輔Λ繧ｰ縺稽oved�医け繝ｪ繝�け縺輔ｌ蝗ｺ螳壽ｸ医∩縺縺悟燕蝗槫虚縺�※縺�◆繝弱�繝会ｼ峨↑繧�
+					if(d.view == "moved"){
+						// 陦ｨ遉ｺ繝輔Λ繧ｰ繧団licked縺ｫ謌ｻ縺�
+						d.view = "clicked";
+					}
+
+					// 陦ｨ遉ｺ繝輔Λ繧ｰ縺系o縺ｮ繧ゅ�縺九ｉ遒ｺ隱�
+					if(d.view == "no"){
+						// 繝代せ縺ｮ繝弱�繝画焚縺縺醍ｹｰ繧願ｿ斐＠縺ｪ縺後ｉ
+						for(var n = 0; n < path.length; n++){
+							// 繝代せ蜀�↓蜷ｫ縺ｾ繧後ｋ繝弱�繝峨□縺｣縺溘ｉ
+							if(path[n] == d.nodeid){
+								// 霈ｪ驛ｭ邱壹ｒ襍､縺ｫ
+								strokecolor = "#ffaaaa";
+								// 陦ｨ遉ｺ繝輔Λ繧ｰ繧地ow�井ｻ雁屓蜍輔＞縺溘ヮ繝ｼ繝会ｼ峨↓
+								d.view = "now";
+							}
+						}
+					// 蝗ｺ螳壽ｸ医∩繝弱�繝峨□縺｣縺溘ｉ
+					}else if(d.view == "clicked"){
+						// 縺ｾ縺壹�霈ｪ驛ｭ邱壹ｒ襍､縺ｫ
+						strokecolor = "#ffaaaa";
+						// 繝代せ蜀�↓蜷ｫ縺ｾ繧後ｋ繝弱�繝峨°繝√ぉ繝�け
+						for(var n = 0; n < path.length; n++){
+							if(path[n] == d.nodeid){
+								// 蜷ｫ縺ｾ繧後※縺�◆縺ｪ繧我ｻ雁屓蜍輔°縺吶◆繧√ヵ繝ｩ繧ｰ繧知oved縺ｫ
+								d.view = "moved";
+							}
+						}
+					}
+
+					// 縺薙％縺ｾ縺ｧ縺ｧ蠕励ｉ繧後◆霈ｪ驛ｭ邱壹�濶ｲ繧定ｿ斐☆
+					return strokecolor;
+				})
+				// 鬮倥＆縺ｮ蛟､
+				.attr("cy", function(d){
+					// 繝弱�繝峨′莉雁屓繧ｪ繝ｳ繝槭え繧ｹ縺輔ｌ縺溘�縺ｾ縺溘�蝗ｺ螳壽ｸ医∩縺縺檎ｧｻ蜍輔ヵ繝ｩ繧ｰ繧偵▽縺代ｉ繧後※縺�ｌ縺ｰ
+					if(d.view == "now" || d.view == "moved"){
+						// 迴ｾ蝨ｨ縺ｮ鬮倥＆繧貞叙蠕�
+						var curty = d.y;
+						// d.y縺ｫ蟄舌ヮ繝ｼ繝峨�鬮倥＆繧偵そ繝�ヨ
+						d.y = movey;
+						// 迴ｾ蝨ｨ縺ｮ鬮倥＆繧定ｿ斐☆�医％縺ｮ譎らせ縺ｧ縺ｯ迴ｾ蝨ｨ菴咲ｽｮ縺ｫ謠冗判縺輔ｌ縲〉edraw髢｢謨ｰ縺ｧd.y縺ｫ繧｢繝九Γ繝ｼ繧ｷ繝ｧ繝ｳ縺輔ｌ繧具ｼ�
+						return curty;
+					// 遘ｻ蜍募ｯｾ雎｡縺ｧ縺ｪ縺�↑繧�
+					}else{
+						// 迴ｾ蝨ｨ菴咲ｽｮ繧偵◎縺ｮ縺ｾ縺ｾ霑斐☆
+						return d.y;
+					}
+				});
+
+			// 蜷�Μ繝ｳ繧ｯ繝�く繧ｹ繝医↓蟇ｾ縺�
+			tlink
+				// 繝�く繧ｹ繝郁｡ｨ遉ｺ蛻､螳�
+				.text(function(d) {
+					// 繝�ヵ繧ｩ繝ｫ繝医〒遨ｺ繧偵そ繝�ヨ
+					var linktext = "";
+					// 陦ｨ遉ｺ繝輔Λ繧ｰ縺系ow�亥燕蝗櫁｡ｨ遉ｺ縺輔ｌ縺ｦ縺�◆繝ｪ繝ｳ繧ｯ�峨↑繧�
+					if(d.view == "now"){
+						// 陦ｨ遉ｺ繝輔Λ繧ｰ繧定ｧ｣髯､
+						d.view = "no";
+					}
+
+					// 陦ｨ遉ｺ繝輔Λ繧ｰ縺系o縺ｪ繧�
+					if(d.view == "no"){
+						// 繝代せ縺ｮ繝弱�繝画焚蛻�ｹｰ繧願ｿ斐＠
+						for(var t = 0; t < path.length; t++){
+							// 閾ｪ霄ｫ縺後◎縺ｮ繝弱�繝峨∈謗･邯壹＠縺ｦ縺�ｋ繝ｪ繝ｳ繧ｯ�医°縺､縺昴�繝弱�繝峨′謚倥ｊ縺溘◆縺ｾ繧後※縺�↑縺代ｌ縺ｰ��
+							if(path[t] == d.target && node.data()[d.target].view != "hide"){
+								// 繝ｪ繝ｳ繧ｯ繝�く繧ｹ繝医↓繝励Ο繝代ユ繧｣縺ｮ蛟､繧偵そ繝�ヨ
+								linktext = d.property
+								// 陦ｨ遉ｺ繝輔Λ繧ｰ縺ｫnow繧偵そ繝�ヨ
+								d.view = "now";
+							}
+						}
+					// 陦ｨ遉ｺ繝輔Λ繧ｰ縺掲ix�医け繝ｪ繝�け縺輔ｌ縺溘ヱ繧ｹ縺ｮ繝ｪ繝ｳ繧ｯ�峨↑繧峨��医°縺､郢九′繧句�縺ｮ繝弱�繝峨′謚倥ｊ縺溘◆縺ｾ繧後※縺�↑縺代ｌ縺ｰ��
+					}else if(d.view == "fix" && node.data()[d.target].view != "hide"){
+						// 繝ｪ繝ｳ繧ｯ繝�く繧ｹ繝医↓繝励Ο繝代ユ繧｣縺ｮ蛟､繧偵そ繝�ヨ
+						linktext = d.property
+					}
+					// 縺薙％縺ｾ縺ｧ縺ｧ縺ｧ縺阪◆繝ｪ繝ｳ繧ｯ繝�く繧ｹ繝医ｒ霑斐☆
+					return linktext;
+				});
+
+			// 蜷�Μ繝ｳ繧ｯ縺ｫ蟇ｾ縺�
+			link
+				// 邱壹�濶ｲ蛻､螳�
+				.style("stroke", function(d){
+					// 陦ｨ遉ｺ繝輔Λ繧ｰ縺系o縺ｪ繧峨�
+					if(d.view == "no"){
+						// 濶ｲ繧偵ョ繝輔か繝ｫ繝医↓
+						return "#999";
+					// 縺昴ｌ莉･螟厄ｼ亥崋螳壹ｄ繧ｪ繝ｳ繝槭え繧ｹ縺輔ｌ縺溘ヱ繧ｹ縺ｫ蜷ｫ縺ｾ繧後ｋ�峨↑繧�
+					}else{
+						// 濶ｲ繧定ｵ､縺ｫ
+						return "#ffaaaa";
+					}
+				});
+
+			// 縺薙％縺ｾ縺ｧ縺ｮ險ｭ螳壹ｒ蜈�↓蜀肴緒逕ｻ
+			redraw();
+
+		// 繝弱�繝峨∈縺ｮ繧ｯ繝ｪ繝�け縺ｧ驕ｸ謚槫崋螳壼喧�亥所縺ｳ謚倥ｊ逡ｳ縺ｿ蜃ｦ逅�ｼ�
+		}).on("click", function(d){
+
+			// 蜷�ヮ繝ｼ繝峨↓蟇ｾ縺�
+			node
+				// 霈ｪ驛ｭ邱壹�蛻､螳�
+				.style("stroke", function(d) {
+					// 繝�ヵ繧ｩ繝ｫ繝医�濶ｲ繧偵そ繝�ヨ
+					var strokecolor = "#fafafa"
+					// 陦ｨ遉ｺ繝輔Λ繧ｰ縺後が繝ｳ繝槭え繧ｹ荳ｭ繝ｻ蝗ｺ螳壻ｸｭ繝ｻ遘ｻ蜍穂ｸｭ�磯∈謚槭＆繧後※縺�ｋ繝弱�繝会ｼ峨↑繧峨�
+					if(d.view == "now" || d.view == "clicked" || d.view == "moved"){
+						// 濶ｲ繧定ｵ､縺ｫ
+						strokecolor = "#ffaaaa"
+						// 陦ｨ遉ｺ繝輔Λ繧ｰ繧貞崋螳壻ｸｭ縺ｫ
+						d.view = "clicked";
+					}
+					// 縺薙％縺ｾ縺ｧ縺ｧ縺ｧ縺阪◆濶ｲ繧定ｿ斐☆
+					return strokecolor;
+				});
+
+			// 縺薙％縺九ｉ蟄舌ヮ繝ｼ繝峨�逡ｳ縺ｿ霎ｼ縺ｿ蜃ｦ逅�ｼ育樟蝨ｨ縺ｯ蟒�ｭ｢縲∝ｿｵ縺ｮ縺溘ａ繧ｳ繝ｼ繝峨�谿九＠縺ｦ縺翫￥��
+			/*
+			var childs = [];
+			var prevchilds = [];
+			prevchilds.push(d.nodeid);
+
+			//
 			do{
-				// 繝ｪ繝ｳ繧ｯ縺ｮ謨ｰ縺縺醍ｹｰ繧願ｿ斐＠
-				for(var i = 0; i < link.data().length; i++){
-					// 迴ｾ蝨ｨ縺ｮ譛蠕悟ｰｾ縺ｫ郢九′繧九Μ繝ｳ繧ｯ縺後≠繧後�
-					if(path[(path.length-1)] == link.data()[i].target){
-						// 縺昴�繝ｪ繝ｳ繧ｯ縺ｮ繧ｽ繝ｼ繧ｹ蛛ｴ繝弱�繝峨�id繧定ｿｽ蜉
-						path.push(link.data()[i].source);
-						// 縺昴�繝ｪ繝ｳ繧ｯ縺ｮ蜷榊燕縺ｨ繧ｽ繝ｼ繧ｹ蛛ｴ繝弱�繝峨�蜷榊燕繧定ｿｽ蜉
-						pathname.push(link.data()[i].property);
-						pathname.push(node.data()[link.data()[i].source].name);
-					}
+				var tmpchilds = [];
+				var curchilds = [];
+				for(var p = 0; p < prevchilds.length; p++){
+					tmpchilds = get_children(prevchilds[p], json['links']);
+					curchilds = curchilds.concat(tmpchilds);
 				}
-			// 繝ｫ繝ｼ繝医ヮ繝ｼ繝峨↓霎ｿ繧顔捩縺上∪縺ｧ郢ｰ繧願ｿ斐☆
-			}while(path[(path.length-1)] != 0);
-
-			// 譛ｫ遶ｯ繝弱�繝峨〒縺ｪ縺�↑繧�
-			if(d.path == "notend"){
-				// 繝��繝ｫ繝√ャ繝励ｒ髱櫁｡ｨ遉ｺ縺ｫ
-				document.getElementById("showpath").style.display = "none";
-			}else{
-				// 譛ｫ遶ｯ繝弱�繝峨↑繧峨ヤ繝ｼ繝ｫ繝√ャ繝励�諠�ｱ繧呈峩譁ｰ
-				var resultText = "<h3>Selected Path</h3>";
-				// 繝代せ縺ｮ蜷榊燕驟榊�蛻�ｾ後ｍ縺九ｉ郢ｰ繧願ｿ斐＠縺ｪ縺後ｉ
-				for (var i = pathname.length;i > 0; i--){
-					// 螂�焚逡ｪ逶ｮ�医ヮ繝ｼ繝峨�蜷榊燕�峨�螟ｪ蟄励↓
-					if(i % 2 == 1){
-						resultText = resultText + "<span style=\"font-weight: bold;\">" + pathname[i - 1] + "</span><br><br>";
-					// 蛛ｶ謨ｰ逡ｪ逶ｮ�医Μ繝ｳ繧ｯ縺ｮ蜷榊燕�峨�縺昴�縺ｾ縺ｾ縺ｧ陦ｨ遉ｺ
-					}else{
-						resultText = resultText + pathname[i - 1] + "<br><br>";
-					}
+				prevchilds = curchilds;
+				childs = childs.concat(curchilds);
+
+			}while(curchilds.length != 0);
+
+			var childy = d.y;
+			for(var c = 0; c < childs.length; c++){
+				if(node.data()[childs[c]].y < childy){
+					childy = node.data()[childs[c]].y;
 				}
-				// 繝��繝ｫ繝√ャ繝励�蜀�ｮｹ繧呈嶌縺肴鋤縺�
-				document.getElementById("selectpath").innerHTML=(resultText);
-
-				// 繧ｵ繝ｼ繝悶Ξ繝�ヨ縺ｫ騾√ｊ霑斐☆繝代せ繧ｪ繝悶ず繧ｧ繧ｯ繝医ｒ菫晏ｭ�
-				pathobj = d.path;
-
-				// 繝��繝ｫ繝√ャ繝苓｡ｨ遉ｺ譎ゅ�蠎ｧ讓呻ｼ医が繝ｳ繝槭え繧ｹ縺輔ｌ縺溘ヮ繝ｼ繝峨�讓ｪ縺ｫ繝懊ち繝ｳ縺梧擂繧九ｈ縺��鄂ｮ��
-				var xPosition = parseFloat(d3.select(this).attr("cx")) + parseFloat(d3.select(this).style("stroke-width")) + (NODEHEIGHT * 0.5);
-				var yPosition = parseFloat(d3.select(this).attr("cy") - document.getElementById("showpath").offsetHeight + document.getElementById("menu").offsetHeight) + (NODEHEIGHT * 0.5);
-
-				// 繝��繝ｫ繝√ャ繝励′逕ｻ髱｢螟悶↓蜃ｺ縺ｪ縺�ｈ縺�｣懈ｭ｣
-				if(xPosition < 0){
-					xPosition = 0;
+			}
+
+			d.y = childy;
+
+			var maxdy = 0;
+			var mindy = 0;
+
+			for(var c = 0; c < childs.length; c++){
+				if(node.data()[childs[c]].view != "hide"){
+					var dy = node.data()[childs[c]].y - d.y;
+					if(dy > maxdy){
+						maxdy = dy;
+					}
+					node.data()[childs[c]].x = d.x;
+					node.data()[childs[c]].y = d.y;
+					node.data()[childs[c]].dy = dy;
+					node.data()[childs[c]].view = "hide";
+					node.data()[childs[c]].hideparent = d.nodeid;
+				}else{
+					if(node.data()[childs[c]].hideparent == d.nodeid){
+						node.data()[childs[c]].x = d.x + (TREESPACE * (node.data()[childs[c]].group - d.group));
+						node.data()[childs[c]].y = node.data()[childs[c]].y + node.data()[childs[c]].dy;
+						if(-node.data()[childs[c]].dy < mindy){
+							mindy = -node.data()[childs[c]].dy;
+						}
+						node.data()[childs[c]].view = "appear";
+						node.data()[childs[c]].hideparent = -1;
+					}
 				}
-				if(yPosition < 0){
-					yPosition = 0;
+			}
+
+			node
+			.attr("r", function(d){
+				if(d.view == "appear"){
+					d.view = "no";
+				}else if(d.y > childy){
+					d.y = d.y - maxdy - mindy;
 				}
-
-				// 逕滓�縺励◆蠎ｧ讓吶↓繝��繝ｫ繝√ャ繝励ｒ陦ｨ遉ｺ
-				document.getElementById("showpath").style.left = xPosition + "px"
-				document.getElementById("showpath").style.top = yPosition + "px"
-				document.getElementById("showpath").style.display = "block";
+				if(d.view == "hide"){
+					d.x = node.data()[d.hideparent].x;
+					d.y = node.data()[d.hideparent].y;
+				}
+				if(d.nodeid == 0){
+					d.y = childy;
+				}
+				return (NODEHEIGHT / 2);
+			});
+			*/
+
+			// 蜷�Μ繝ｳ繧ｯ縺ｫ蟇ｾ縺�
+			tlink
+				// 繝�く繧ｹ繝郁｡ｨ遉ｺ蛻､螳�
+				.text(function(d) {
+					// 繝�ヵ繧ｩ繝ｫ繝医〒遨ｺ縺ｫ
+					var linktext = "";
+					// 陦ｨ遉ｺ繝輔Λ繧ｰ縺檎樟蝨ｨ陦ｨ遉ｺ荳ｭ縺ｾ縺溘�蝗ｺ螳壼喧貂医∩縺ｪ繧峨��医°縺､謚倥ｊ逡ｳ縺ｿ荳ｭ縺ｧ縺ｪ縺代ｌ縺ｰ��
+					if((d.view == "now" || d.view == "fix") && (node.data()[d.target].view != "hide")){
+						// 繝ｪ繝ｳ繧ｯ繝�く繧ｹ繝医↓繝励Ο繝代ユ繧｣縺ｮ蛟､繧偵そ繝�ヨ
+						linktext = d.property
+						// 陦ｨ遉ｺ繝輔Λ繧ｰ繧貞崋螳壻ｸｭ縺ｫ
+						d.view = "fix";
+					}
+					// 繝�く繧ｹ繝医ｒ霑斐☆
+					return linktext;
+				});
+
+			// 縺薙％縺ｾ縺ｧ縺ｮ蜃ｦ逅�ｵ先棡繧貞�縺ｫ蜀肴緒逕ｻ
+			redraw();
+
+		});
+
+		// 蜀肴緒逕ｻ髢｢謨ｰ
+		var redraw = function (duration){
+
+			// 縺九￠繧区凾髢薙′譛ｪ謖�ｮ壹↑繧峨�
+			if(duration == undefined){
+				// 0.5遘偵°縺代※繧｢繝九Γ繝ｼ繧ｷ繝ｧ繝ｳ
+				duration = 500;
 			}
-		// 繝ｫ繝ｼ繝医ヮ繝ｼ繝峨□縺｣縺溘↑繧�
-		}else{
+
+			// 蜷�Μ繝ｳ繧ｯ縺ｫ縺､縺�※險ｭ螳壹＆繧後◆菴咲ｽｮ縺ｫ蜀肴緒逕ｻ
+			link
+				.transition()
+				.duration(duration)
+				.attr("x1", function(d) {return node.data()[d.source].x;})
+				.attr("y1", function(d) {return node.data()[d.source].y;})
+				.attr("x2", function(d) {return node.data()[d.target].x;})
+				.attr("y2", function(d) {return node.data()[d.target].y;});
+
+			// 蜷�Μ繝ｳ繧ｯ繝�く繧ｹ繝医↓縺､縺�※險ｭ螳壹＆繧後◆菴咲ｽｮ縺ｫ蜀肴緒逕ｻ
+			tlink
+				.transition()
+				.duration(duration)
+				.attr("x", function(d) {return (node.data()[d.source].x + node.data()[d.target].x) / 2;})
+				.attr("y", function(d) {return ((node.data()[d.source].y + node.data()[d.target].y) / 2) + 5;});
+
+			// 蜷�ヮ繝ｼ繝峨↓縺､縺�※險ｭ螳壹＆繧後◆菴咲ｽｮ縺ｫ蜀肴緒逕ｻ�医°縺､謚倥ｊ縺溘◆縺ｾ繧御ｸｭ縺ｮ蝣ｴ蜷医�謠冗判蛻�ｲ仙�逅�ｼ�
+			node
+				.transition()
+				.duration(duration)
+				.attr("cx", function(d) {return d.x;})
+				.attr("cy", function(d) {return d.y;})
+				.style("opacity", function(d){
+					var opa = 1.0;
+					if(d.view == "hide"){
+						opa = 0.0;
+					}
+					return opa;
+				})
+				.style("fill", function(d) {
+					var fcolor = color(d.group);
+
+					for(var n = 0; n < node.data().length; n++){
+						if(d.nodeid == node.data()[n].hideparent){
+							fcolor = "ffaaaa";
+						}
+					}
+					return fcolor;
+				})
+				.style("pointer-events", function(d){
+					var pe = "auto";
+					if(d.view == "hide"){
+						pe = "none";
+					}
+					return pe;
+				});
+
+			// 蜷�ヮ繝ｼ繝峨ユ繧ｭ繧ｹ繝医↓縺､縺�※險ｭ螳壹＆繧後◆菴咲ｽｮ縺ｫ蜀肴緒逕ｻ縲√ユ繧ｭ繧ｹ繝域緒逕ｻ菴咲ｽｮ繧剃ｸ贋ｸ九↓謖ｯ繧具ｼ医°縺､謚倥ｊ縺溘◆縺ｾ繧御ｸｭ縺ｮ蝣ｴ蜷医�謠冗判蛻�ｲ仙�逅�ｼ�
+			tnode
+			.transition()
+			.duration(duration)
+			.attr("x", function(d) {return d.x;})
+			.attr("y", function(d) {
+				// 繝�ヵ繧ｩ繝ｫ繝医〒蟆代＠荳九￡繧�
+				var updown = (NODEHEIGHT * 0.4);
+				// 螂�焚逡ｪ逶ｮ縺ｮ豺ｱ縺輔↑繧牙ｰ代＠荳翫￡繧�
+				if(d.group % 2 == 1){
+					updown = -(NODEHEIGHT * 0.2);
+				}
+				// 縺昴�蛟､繧帝ｫ倥＆縺ｫ霑斐☆縺薙→縺ｧ繝�く繧ｹ繝域緒逕ｻ菴咲ｽｮ縺御ｺ偵＞驕輔＞縺ｫ縺ｪ繧�
+				return d.y + updown;
+			})
+			// 謚倥ｊ逡ｳ縺ｿ迥ｶ諷九↑繧峨ユ繧ｭ繧ｹ繝郁｡ｨ遉ｺ繧呈ｶ医☆
+			.text(function(d){
+				var nodetext = d.name
+				if(d.view == "hide"){
+					nodetext = "";
+				}
+				return nodetext;
+			});
+
+		};
+
+		// 閭梧勹驛ｨ蛻�′繧ｯ繝ｪ繝�け縺輔ｌ縺溘ｉ陦ｨ遉ｺ縺ｮ蝗ｺ螳壼喧繧定ｧ｣髯､
+		bg.on("click", function() {
 			// 繝��繝ｫ繝√ャ繝励ｒ髱櫁｡ｨ遉ｺ
 			document.getElementById("showpath").style.display = "none";
-		}
-
-		// 繧ｪ繝ｳ繝槭え繧ｹ縺輔ｌ縺溘ヮ繝ｼ繝峨�鬮倥＆縺ｫ隕ｪ繧貞粋繧上○繧�
-		// 蜷医ｏ縺帙ｋ鬮倥＆繧剃ｿ晏ｭ�
-		var movey = d.y;
-
-		// 蜷�ヮ繝ｼ繝峨↓蟇ｾ縺�
-		node
-			// 霈ｪ驛ｭ邱壹�濶ｲ繧定ｨｭ螳�
-			.style("stroke", function(d){
-				// 縺ｾ縺壹�閭梧勹濶ｲ�医ョ繝輔か繝ｫ繝茨ｼ峨ｒ謖�ｮ�
-				var strokecolor = "#fafafa";
-				// 蜑榊屓濶ｲ繧剃ｻ倥￠縺ｦ縺�◆繝弱�繝峨↑繧�
-				if(d.view == "now"){
-					// 繝弱�繝峨�濶ｲ莉倥￠繧偵↑縺励↓
+			d3.selectAll(".node").style("stroke-width", function(d) { return '1.5px'; });
+			d3.selectAll(".node").style("stroke", function(d) { return '#ffffff'; });
+
+			// 蜷�ヮ繝ｼ繝峨�霈ｪ驛ｭ邱壹�濶ｲ繧偵ョ繝輔か繝ｫ繝医↓
+			node
+				.style("stroke", function(d){
+					if(d.view != "hide"){
+						d.view = "no";
+					}
+					return "#fafafa";
+				});
+
+			// 繝ｪ繝ｳ繧ｯ繝�く繧ｹ繝医ｒ蜈ｨ縺ｦ遨ｺ縺ｫ
+			tlink
+				.text(function(d) {
 					d.view = "no";
-				}
-				if(d.view == "moved"){
-					d.view = "clicked";
-				}
-
-				if(d.view == "no"){
-					for(var n = 0; n < path.length; n++){
-						if(path[n] == d.nodeid){
-							strokecolor = "#ffaaaa";
-							d.view = "now";
-						}
-					}
-				}else if(d.view == "clicked"){
-					strokecolor = "#ffaaaa";
-					for(var n = 0; n < path.length; n++){
-						if(path[n] == d.nodeid){
-							d.view = "moved";
-						}
-					}
-				}
-
-				return strokecolor;
-			})
-			.attr("cy", function(d){
-				if(d.view == "now" || d.view == "moved"){
-					var curty = d.y;
-					d.y = movey;
-					return curty;
-				}else{
-					return d.y;
-				}
-			});
-
-		tlink
-			.text(function(d) {
-				var linktext = "";
-				if(d.view == "now"){
-					d.view = "no";
-				}
-
-				if(d.view == "no"){
-					for(var t = 0; t < path.length; t++){
-						if(path[t] == d.target && node.data()[d.target].view != "hide"){
-							linktext = d.property
-							d.view = "now";
-						}
-					}
-				}else if(d.view == "fix" && node.data()[d.target].view != "hide"){
-					linktext = d.property
-				}
-				return linktext;
-			});
-
-		link
-			.style("stroke", function(d){
-				if(d.view == "no"){
+					return "";
+				});
+
+			// 繝ｪ繝ｳ繧ｯ縺ｮ濶ｲ繧貞�縺ｦ繝�ヵ繧ｩ繝ｫ繝医↓
+			link
+				.style("stroke", function(d){
 					return "#999";
-				}else{
-					return "#ffaaaa";
-				}
-			});
-
-		redraw();
-
-	}).on("click", function(d){
-
-		node
-		.style("stroke", function(d) {
-			var strokecolor = "#fafafa"
-			if(d.view == "now" || d.view == "clicked" || d.view == "moved"){
-				strokecolor = "#ffaaaa"
-				d.view = "clicked";
+				});
+
+		});
+
+		// 閭梧勹荳翫〒繝槭え繧ｹ縺悟虚縺上＃縺ｨ縺ｫ
+		bg.on("mousemove", function(){
+			// MOUSEMOVED繧定ｿｽ蜉�医ヮ繝ｼ繝峨↓繧ｪ繝ｳ繝槭え繧ｹ縺輔ｌ繧句ｺｦ縺ｫ繧ｫ繧ｦ繝ｳ繝医Μ繧ｻ繝�ヨ��
+			MOUSEMOVED++;
+			// 30繧定ｶ�∴縺溘ｉ
+			if(MOUSEMOVED > 30){
+				// 繝��繝ｫ繝√ャ繝励ｒ髱櫁｡ｨ遉ｺ縺ｫ縺励※繧ｫ繧ｦ繝ｳ繝医Μ繧ｻ繝�ヨ
+				document.getElementById("showpath").style.display = "none";
+				MOUSEMOVED = 0;
 			}
-			return strokecolor;
 		});
 
-		//d.hideparent = d.nodeid;
-
-		var childs = [];
-		var prevchilds = [];
-		prevchilds.push(d.nodeid);
-
-		do{
-			var tmpchilds = [];
-			var curchilds = [];
-			for(var p = 0; p < prevchilds.length; p++){
-				tmpchilds = get_children(prevchilds[p], json['links']);
-				curchilds = curchilds.concat(tmpchilds);
-			}
-			prevchilds = curchilds;
-			childs = childs.concat(curchilds);
-
-		}while(curchilds.length != 0);
-
-		var childy = d.y;
-		for(var c = 0; c < childs.length; c++){
-			if(node.data()[childs[c]].y < childy){
-				childy = node.data()[childs[c]].y;
-			}
-		}
-
-		d.y = childy;
-
-		var maxdy = 0;
-		var mindy = 0;
-
-		for(var c = 0; c < childs.length; c++){
-			if(node.data()[childs[c]].view != "hide"){
-				var dy = node.data()[childs[c]].y - d.y;
-				if(dy > maxdy){
-					maxdy = dy;
-				}
-				node.data()[childs[c]].x = d.x;
-				node.data()[childs[c]].y = d.y;
-				node.data()[childs[c]].dy = dy;
-				node.data()[childs[c]].view = "hide";
-				node.data()[childs[c]].hideparent = d.nodeid;
-			}else{
-				if(node.data()[childs[c]].hideparent == d.nodeid){
-					node.data()[childs[c]].x = d.x + (TREESPACE * (node.data()[childs[c]].group - d.group));
-					node.data()[childs[c]].y = node.data()[childs[c]].y + node.data()[childs[c]].dy;
-					if(-node.data()[childs[c]].dy < mindy){
-						mindy = -node.data()[childs[c]].dy;
-					}
-					node.data()[childs[c]].view = "appear";
-					node.data()[childs[c]].hideparent = -1;
-				}
-			}
-		}
-
-		node
-		.attr("r", function(d){
-			if(d.view == "appear"){
-				d.view = "no";
-			}else if(d.y > childy){
-				d.y = d.y - maxdy - mindy;
-			}
-			if(d.view == "hide"){
-				d.x = node.data()[d.hideparent].x;
-				d.y = node.data()[d.hideparent].y;
-			}
-			if(d.nodeid == 0){
-				d.y = childy;
-			}
-			return (NODEHEIGHT / 2);
-		});
-
-		tlink
-		.text(function(d) {
-			var linktext = "";
-			if((d.view == "now" || d.view == "fix") && (node.data()[d.target].view != "hide")){
-				linktext = d.property
-				d.view = "fix";
-			}
-			return linktext;
-		});
-
-
-		redraw();
-
-	});
-
-	var redraw = function (duration){
-
-		if(duration == undefined){
-			duration = 500;
-		}
-
-		link
-		.transition()
-		.duration(duration)
-		.attr("x1", function(d) {return node.data()[d.source].x;})
-		.attr("y1", function(d) {return node.data()[d.source].y;})
-		.attr("x2", function(d) {return node.data()[d.target].x;})
-		.attr("y2", function(d) {return node.data()[d.target].y;});
-
-		tlink
-		.transition()
-		.duration(duration)
-		.attr("x", function(d) {return (node.data()[d.source].x + node.data()[d.target].x) / 2;})
-		.attr("y", function(d) {return ((node.data()[d.source].y + node.data()[d.target].y) / 2) + 5;});
-
-		node
-		.transition()
-		.duration(duration)
-		.attr("cx", function(d) {return d.x;})
-		.attr("cy", function(d) {return d.y;})
-		.style("opacity", function(d){
-			var opa = 1.0;
-			if(d.view == "hide"){
-				opa = 0.0;
-			}
-			return opa;
-		})
-		.style("fill", function(d) {
-			var fcolor = color(d.group);
-
-			for(var n = 0; n < node.data().length; n++){
-				if(d.nodeid == node.data()[n].hideparent){
-					fcolor = "ffaaaa";
-				}
-			}
-			return fcolor;
-		})
-		.style("pointer-events", function(d){
-			var pe = "auto";
-			if(d.view == "hide"){
-				pe = "none";
-			}
-			return pe;
-		});
-
-		tnode
-		.transition()
-		.duration(duration)
-		.attr("x", function(d) {return d.x;})
-		.attr("y", function(d) {
-			var updown = (NODEHEIGHT * 0.4);
-			if(d.group % 2 == 1){
-				updown = -(NODEHEIGHT * 0.2);
-			}
-			if(d.view == "now" || d.view == "moved"){
-				//updown = 5;
-			}
-			return d.y + updown;
-		})
-		.text(function(d){
-			var nodetext = d.name
-			if(d.view == "hide"){
-				nodetext = "";
-			}
-			return nodetext;
-		});
-
-	};
-
-	bg.on("click", function() {
-		document.getElementById("showpath").style.display = "none";
-		d3.selectAll(".node").style("stroke-width", function(d) { return '1.5px'; });
-		d3.selectAll(".node").style("stroke", function(d) { return '#ffffff'; });
-
-		node
-		.style("stroke", function(d){
-			if(d.view != "hide"){
-				d.view = "no";
-			}
-			return "#fafafa";
-		});
-
-		tlink
-		.text(function(d) {
-			d.view = "no";
-			return "";
-		});
-
-		link
-		.style("stroke", function(d){
-			return "#999";
-		});
-
-	});
-
-	bg.on("mousemove", function(){
-		MOUSEMOVED++;
-		if(MOUSEMOVED > 30){
-			document.getElementById("showpath").style.display = "none";
-			MOUSEMOVED = 0;
-		}
-	});
-
-	redraw(0);
+		// 蛻晏屓縺ｮ縺ｿduration繧�縺ｨ謖�ｮ壹＠蜀肴緒逕ｻ�医い繝九Γ繝ｼ繧ｷ繝ｧ繝ｳ縺ｪ縺暦ｼ�
+		redraw(0);
+	}
 }
 
@@ -573,8 +665,37 @@
 	DRAWHEIGHT = NODEHEIGHT;
 
+	var viewnum;
+
 	var obj = JSON.parse(jsontext);
+
+	document.getElementById("resultmessage").style.color = "black";
+	document.getElementById("resultmessage").style.fontWeight = "normal";
+
+	document.getElementById("plural").innerHTML = "s";
+
+	if(obj['paths'].length == 0){
+		document.getElementById("resultmessage").style.color = "red";
+		document.getElementById("resultmessage").style.fontWeight = "bold";
+		document.getElementById("plural").innerHTML = "";
+	}else if(obj['paths'].length == 1){
+		document.getElementById("plural").innerHTML = "";
+	}
+
+	if(obj['paths'].length <= 10){
+		viewnum = obj['paths'].length;
+		document.getElementById("viewall").style.display = "none";
+	}else if(pathlimit == 10){
+		viewnum = 10;
+		document.getElementById("viewall").style.display = "block";
+	}else{
+		viewnum = obj['paths'].length;
+		document.getElementById("viewall").style.display = "none";
+	}
+
+	document.getElementById("pathnum").innerHTML = obj['paths'].length;
+	document.getElementById("resultmessage").style.display = "block";
+
 	// obj繝医ャ繝鈴嚴螻､縺ｮ謨ｰ縺縺醍ｹｰ繧願ｿ斐＠縺ｪ縺後ｉ
-	//for(var i = 0; i < obj['paths'].length; i++){
-        for(var i = 0; i < 10; i++){
+	for(var i = 0; i < viewnum; i++){
 		if(i == 0){
 			// 蛻晏屓縺縺代Ν繝ｼ繝医ヮ繝ｼ繝峨ｒ繝励ャ繧ｷ繝･
@@ -667,14 +788,4 @@
 		depth = 0;
 	}
-/*
-	// fromAngle縺梧悴螳夂ｾｩ縺ｪ繧峨�0繧偵そ繝�ヨ
-	if (fromAngle == undefined){
-		fromAngle = 0;
-	}
-	// toAngle縺梧悴螳夂ｾｩ縺ｪ繧峨�1繧偵そ繝�ヨ
-	if (toAngle == undefined){
-		toAngle = 1;
-	}
-*/
 
 	// 蜷�ｨｮ蛻晄悄蛹�
@@ -682,9 +793,4 @@
 	var parent = undefined;
 	var parentsChildren = undefined;
-
-	/*
-	ret['nodes'].push({'name':'aaaa', 'group': depth, 'x':(WIDTH/2), 'y':(HEIGHT/2)});
-	ret['links'].push({'source':parent, 'target':newIndex, 'value':5});
-	*/
 
 	// links驟榊�縺ｮ謨ｰ縺縺醍ｹｰ繧願ｿ斐＠縺ｪ縺後ｉ
@@ -715,13 +821,4 @@
 	}
 
-	/*
-	var x = (WIDTH/2) + depth * (WIDTH / (MAXDEPTH * 2 + 1)) * Math.sin(2 * 3.14 * ((toAngle + fromAngle) / 2));
-	var y = (HEIGHT/2) + depth * (HEIGHT / (MAXDEPTH * 2 + 1)) * Math.cos(2 * 3.14 * ((toAngle + fromAngle) / 2));
-	nodes[myNodeIndex].x = x;
-	nodes[myNodeIndex].y = y;
-
-	CIRCLE_SIZE = (WIDTH / (MAXDEPTH * 2 + 1));
-	*/
-
 	children = get_children(myNodeIndex, links);
 
@@ -768,4 +865,5 @@
 	document.getElementById("showpath").style.display = "none";
 
+	ajaxload("view");
 	$.ajax({
 		type: "GET",
@@ -773,5 +871,5 @@
 		data: {
 		    ep: sel
-  },
+		},
 		dataType: 'json',
 		success : function(epclass) {
@@ -782,7 +880,9 @@
 				$("*[name=endclass]").append('<option value="' + epclass[i] + '">' + epclass[i]);
 			}
+			ajaxload("hide");
 		},
 		error : function(XMLHttpRequest, textStatus, errorThrown) {
 			alert("繝ｪ繧ｯ繧ｨ繧ｹ繝域凾縺ｫ縺ｪ繧薙ｉ縺九�繧ｨ繝ｩ繝ｼ縺檎匱逕溘＠縺ｾ縺励◆�� + textStatus +":\n" + errorThrown);
+			ajaxload("hide");
 		}
 	});
@@ -794,8 +894,4 @@
 	var sel = $("*[name=selectendpoint]").val();
 
-	if(sel == "input"){
-		sel = $("*[name=inputendpoint]").val();
-	}
-
 	MAXDEPTH = 0;
 
@@ -806,4 +902,5 @@
 	var selend = $("*[name=endclass]").val();
 
+	ajaxload("view");
 	$.ajax({
 		type: "GET",
@@ -813,17 +910,25 @@
 		    startclass: selstart,
 		    endclass: selend
-  },
+		},
 		dataType: 'text',
 		success : function(nodes) {
 			jsontext = nodes;
-                        console.log(nodes);
+			pathlimit = 10;
 			view_map();
+			ajaxload("hide");
 		},
 		error : function(XMLHttpRequest, textStatus, errorThrown) {
 			alert("繝ｪ繧ｯ繧ｨ繧ｹ繝域凾縺ｫ縺ｪ繧薙ｉ縺九�繧ｨ繝ｩ繝ｼ縺檎匱逕溘＠縺ｾ縺励◆�� + textStatus +":\n" + errorThrown);
+			ajaxload("hide");
 		}
 	});
 }
 
+function viewAll(){
+	pathlimit = 0;
+	document.getElementById("viewall").style.display = "none";
+	view_map();
+}
+
 function getSPARQL(){
 
@@ -832,4 +937,5 @@
 	//document.getElementById("selectpath").innerHTML=(resultText);
 
+	ajaxload("view");
 	$.ajax({
 		type: "GET",
@@ -837,5 +943,5 @@
 		data: {
 		    jsonpath: selectpath
-  },
+		},
 		dataType: 'text',
 		success : function(sparql) {
@@ -843,9 +949,12 @@
 			document.getElementById("showpath").style.display = "none";
 			window.scrollTo(0, 0);
+			ajaxload("hide");
 		},
 		error : function(XMLHttpRequest, textStatus, errorThrown) {
 			alert("繝ｪ繧ｯ繧ｨ繧ｹ繝域凾縺ｫ縺ｪ繧薙ｉ縺九�繧ｨ繝ｩ繝ｼ縺檎匱逕溘＠縺ｾ縺励◆�� + textStatus +":\n" + errorThrown);
+			ajaxload("hide");
 		}
 	});
+
 }
 
@@ -880,12 +989,10 @@
 		<div id="endpoint">
 			<form name="endpoint">
-				<input type="text" style="width: 200px;" name="inputendpoint"><br>
 				<select size=1 name="selectendpoint" style="width: 200px;">
-					<option value="input">Textbox
 				</select><br>
 				<input type="button" name="setendpoint" value="SetEndPoint" onClick="setEndpoint()">
 			</form>
 		</div>
-		<div id="seclass" style="margin-top: 30px;">
+		<div id="seclass" style="margin-top: 20px; display: none;">
 			<form name="seclass">
 				StartClass<br>
@@ -898,4 +1005,7 @@
 			</form>
 		</div>
+		<div id="resultmessage" style="margin-top: 20px; display: none;">
+			<span id="pathnum"></span> Path<span id="plural"></span> found.<input id="viewall" type="button" name="viewall" value="View all path" onClick="viewAll()" style="display: none;">
+		</div>
 	</div>
 
@@ -907,5 +1017,5 @@
 	</div>
 </div>
-<div id="graph" style="position: absolute; top:0px; left:0px;">
+<div id="graph" style="position: absolute; top: 0px; left: 0px;">
 </div>
 <div id="showpath" style="display: none;">
@@ -914,4 +1024,9 @@
 	<input type="button" id="getsparqlbutton" name="getsparql" value="Get SPARQL" onClick="getSPARQL()">
 </div>
+<div id="ajaxload" style="position: absolute; top: 0; left:0; background: white; opacity: 0.7;">
+	<div style="position: absolute; top: 0; left:0; right: 0; bottom: 0; margin: auto; width: 100px; height: 100px;">
+		<img src="ajax-loader.gif">
+	</div>
+</div>
 </body>
 </html>
