var pie = function() {
	var canvas = $('c1');
	return {
		clear:function(v, c) {
		},
		start:function(id, val) {
			pie.draw(id);
		},
		draw:function(id) {
			if(!canvas || !canvas.getContext) {
				return false;
			}
			var ctx = canvas.getContext('2d');
			ctx.beginPath();
			/* グラデーション領域をセット */
			var grad  = ctx.createRadialGradient(70,70,20,70,70,70);
			/* グラデーション終点のオフセットと色をセット */
			grad.addColorStop(0,'red');      // 赤
			grad.addColorStop(0.5,'yellow'); // 黄
			grad.addColorStop(1,'blue');     // 青
			/* グラデーションをfillStyleプロパティにセット */
			ctx.fillStyle = grad;
			/* 矩形を描画 */
			ctx.rect(0,0, 140,140);
			ctx.fill();
		}
	};
}();
var W = new Array(), W2 = new Array();
/* http://jsajax.com/ShowHelpArticle681.aspx */
var ns6 = document.getElementById && !document.all;
var ie = document.all;
var pop = function() {
	var speed = 20;
	var timer = 200;
	var timer_end = 200;
	var alpha = 60;
	var alphaend = 93;
	var horizontal_offset = vertical_offset = 10;
	var objpop, checkType;
	return {
		pop_getOffset:function(what, type) {
			var totaloffset = (type=="left") ? what.offsetLeft : what.offsetTop;
			var parentEl = what.offsetParent;
			while(parentEl!=null) {
				totaloffset = (type=="left") ? totaloffset + parentEl.offsetLeft : totaloffset + parentEl.offsetTop;
				parentEl = parentEl.offsetParent;
			}
			return totaloffset;
		},
		pop_ieTest:function() {
			return (document.compatMode && document.compatMode!="BackCompat") ? document.documentElement : document.body;
		},
		pop_clearEdge:function(obj, whichedge) {
			var edgeoffset = (whichedge=="rightedge") ? parseInt(horizontal_offset) * -1 : parseInt(vertical_offset) * -1;
			if(whichedge=="rightedge") {
				var windowedge = (ie && !window.opera) ? pop.pop_ieTest().scrollLeft + pop.pop_ieTest().clientWidth - 30 : window.pageXOffset + window.innerWidth - 40;
				objpop.contentmeasure = objpop.offsetWidth;
				if(windowedge - objpop.x < objpop.contentmeasure) {
					edgeoffset = objpop.contentmeasure + obj.offsetWidth + parseInt(horizontal_offset);
				}
			}else {
				var windowedge = (ie && !window.opera) ? pop.pop_ieTest().scrollTop + pop.pop_ieTest().clientHeight - 15 : window.pageYOffset + window.innerHeight - 18;
				objpop.contentmeasure = objpop.offsetHeight;
				if(windowedge - objpop.y < objpop.contentmeasure) {
					edgeoffset = objpop.contentmeasure - obj.offsetHeight;
				}
			}
			return edgeoffset
		},
		pop_createBox:function() {
			objpop = document.createElement("div");
			objpop.setAttribute("id", "hintbox");
			document.body.appendChild(objpop);
			objpop.style.opacity = 0;
			objpop.style.filter = 'alpha(opacity=0)';
		},
		pop_show:function(text, obj, e, tipwidth, jd, mid, money) {
			if((ie || ns6) && $("hintbox") && pop.pop_showcheck()) {
				title = W["HELP_1"];
				tipwidth = (tipwidth) ? tipwidth : '300px';
				objpop.style.width = tipwidth;
				objpop.x = pop.pop_getOffset(obj, "left");
				objpop.y = pop.pop_getOffset(obj, "top");
				objpop.style.left = (objpop.x - pop.pop_clearEdge(obj, "rightedge") + obj.offsetWidth) + "px";
				objpop.style.right = null;
				objpop.style.top = (objpop.y - pop.pop_clearEdge(obj, "bottomedge")) + "px";
				checkType = (jd!=9) ? 0 : 1;
				if(jd==W["TUUKAKIRIKAE"]) {
					title = jd + " *" + W["POINT_08b"];
					text = Rate_Echo(mid, money, text);
					mid = 1;
				}else if(jd==1) {
					if(W2[text]) {
						text = W2[text];
						if(mid) {
							text += W2[mid];
						}
					}else {
						return loadCode(text, e);
					}
				}else if(jd==2) {
					text = W[text];
				}else if(jd==9) {
					title = '<img src="./sub/oh.gif" alt="mail" /> ' + W["EDIUNET_E17"];
				}
				pop.pop_echo(title, text, e, jd, mid);
			}
		},
		pop_echo:function(title, text, e, jd, cid) {
			if(jd!=9) {
				objpop.innerHTML = "<strong>[" + title + "]</strong> [<a href=\"javascript:void(0);\" onmouseover=\"pop.pop_fadeOut();\">" + W["HELP_2"] + "</a>]<br />" + text;
				document.body.onclick = (cid!=1) ? pop.pop_fadeOut : null;
			}else {
				objpop.innerHTML = new Array('<strong><img src="./sub/oh.gif" alt="mail" /> ' + W["EDIUNET_E17"] + '</strong> [<a href="javascript:void(0);" onclick="pop.pop_fadeOut();" onkeypress="pop.pop_fadeOut();">' + W["HELP_2"] + '</a>]<br />' + W["EDIUNET_E18"],
'<form>',
'<div>',
'<textarea id="rbody" cols="30" rows="4" onkeyup="ediutterRepoPost();" onmouseup="ediutterRepoPost();"></textarea><br />',
'<input type="hidden" id="rtid" value="' + text + '" />',
'<input type="hidden" id="rcid" value="' + cid + '" />',
'<input type="button" value="' + W["EDIUNET_09"] + '" id="rsubmit" disabled="disabled" onclick="pop.pop_ediutterStart();" onkeypress="pop.pop_ediutterStart();"  /> ',
'<img src="./sub/mail.png" alt="mail" />',
'</div>',
'</form>').join("");
				document.body.onclick = null;
			}
			pop.pop_fadeStart(e, 1);
			objpop.style.visibility = "visible";
/*
			objpop.onmouseout = pop.pop_fadeOut;
*/
		},
		pop_ediutterStart:function(text) {
			checkType = 1;
			ediutterRepoSend();
		},
		pop_ediutterEnd:function(text) {
			$("hintbox").innerHTML = text + '<input value="1" type="hidden" id="rbody" /><p>[<a href="javascript:void(0);" onclick="pop.pop_fadeOut();" onkeypress="pop.pop_fadeOut();">' + W["HELP_2"] + '</a>]</p>';
			return;
		},
/* http://www.leigeber.com/2008/06/javascript-tooltip/ */
		pop_fadeStart:function(e, sx) {
			sx = (sx) ? sx : -1;
			clearInterval(objpop.timer);
			objpop.timer = setInterval(
				function() {
					pop.pop_fade(sx);
				}, timer
			);
		},
		pop_fadeOut:function(e) {
			checkType = 0;
			clearInterval(objpop.timer_end);
			pop.timer_end = setTimeout('pop.pop_fadeStart()', timer_end)
		},
		pop_showcheck:function() {
			if(checkType!=1) {
				return 1;
			}
			if(!$("rbody")) {
				return 1;
			}else {
				if(!$("rbody").value) {
					return 1;
				}
			}
		},
		pop_fade:function(d) {
			var ids = objpop.style;
			if((alpha!=alphaend && d==1) || (alpha!=0 && d==-1)) {
				var i = (d==-1) ? speed : speed*3;
				if(alphaend - alpha < i && d==1) {
					i = alphaend - alpha;
				}else if(alpha < i && d==-1) {
					i = alpha;
				}
				alpha = alpha + (i * d);
				ids.opacity = alpha * 0.01;
				ids.filter = 'alpha(opacity=' + alpha + ')';
			}else if(d==-1) {
				ids.visibility = "hidden";
			}
		}
	};
}();
if(window.addEventListener) {
	window.addEventListener("load", pop.pop_createBox, false);
}else if(window.attachEvent) {
	window.attachEvent("onload", pop.pop_createBox);
}else if(document.getElementById) {
	window.onload = pop.pop_createBox;
}

function print_r(obj) {
	var count_obj = 0;
	function _output(str) {
		document.writeln(str + "<br/>");
	}
	function _print_r(obj, name, level) {
		var s = "";
		if (obj == undefined || level > 4) return;
		for (var i = 0; i < level; i++) { s += " | "; }
		s += " - " + name + ":" + typeof(obj) + "=" + obj;
		_output(s);
		if (name == "document" || typeof(obj) != "object") return;
		for ( key in obj ) {
		if (count_obj++ > 10) return;
			_print_r(obj[key], key, level + 1);
		}
	}
	_print_r(obj, "*", 0);
}
function auto(jjd) {
	if($("v10").value<=0) {
		$("v10").value = 1;
	}
	var money = $("v_money").value;
	var ymd = $("v_ymd").value;
	var vp = (cId("v10")) ? (cId("v11")+100)/cId("v10") : 1;
	var jd3 = (cId("v13")>0) ? Math.floor(100*cId("v12")/(vp*cId("v13")))/100 : "- ";
	var jd4 = (cId("v14")>0) ? Math.floor(100*cId("v12")/(vp*cId("v14")))/100 : "- ";
	var jd5 = (cId("v15")>0) ? Math.floor(100*cId("v12")/(vp*cId("v15")))/100 : "- ";
	var jd3x = perChange(jd3);
	var jd4x = perChange(jd4);
	var jd5x = perChange(jd5);
	$("v24").innerHTML = jd3x[0] + '&nbsp;' + valueFormat(vp*cId("v13")*money);
	$("v25").innerHTML = jd3x[1];
	$("v26").innerHTML = jd4x[0] + '&nbsp;' + valueFormat(vp*cId("v14")*money);
	$("v27").innerHTML = jd4x[1];
	$("v28").innerHTML = jd5x[0] + '&nbsp;' + valueFormat(vp*cId("v15")*money);
	$("v29").innerHTML = jd5x[1];
}
function batch(what) {
	var i=0, el;
	while(el = $("batch" + i)) {
		el.checked = (what==1) ? "checked" : "";
		i++;
	}
	return false;
}
var oldCellColor;
function blurRow(row) {
	var cells=row.cells;
	if(!cells) return;
	for(var i=0; i<cells.length; i++) {
		cells[i].style.backgroundColor = oldCellColor;
	}
}
function focusRow(row) {
	var cells=row.cells;
	if(!cells) return;
	oldCellColor=cells[0].style.backgroundColor;
	for(var i=0; i<cells.length; i++) {
		cells[i].style.backgroundColor="pink";
	}
}
function change(kj, updown) {
	var jd = kj+9;
	var hd = $("v1" + kj).value;
	if(hd.match(/[^0-9\-.]+/)) {
		$("v1" + kj).value = 1;
	}else if(!jd && updown==1 && hd<=1) {
		$("v1" + kj).value = 1;
	}else if(updown) {
		--$("v1" + kj).value;
	}else {
		++$("v1" + kj).value;
	}
	$("v1" + kj).focus();
	return false;
}
function changeNation(nt) {
	nt = (nt) ? nt : 0;
	cookieSet('ediunet_nation', nt);
	return false;
}
function checkCh(i) {
	var cl = ($("u" + i).checked==true) ? "#fcf" : "#fff";
	$("u" + i).parentNode.style.backgroundColor = cl;
}
function checkSum(i, k) {
	i = Math.round(i);
	return (!i) ? "" : ((!k) ? String(i).replace(/[0-9]+/gm, number_format) : String(i));
}
function checkE(i, all) {
	var a=[], b=[];
	switch(i) {
	case 0 :
		a = [1,2,10,20,23];
		b = [[10,200],[12,50],[14,100]];
		break;
	case 1 :
		a = [1,2,3,4,5,6,10,24,25];
		b = [[16,20],[18,20],[24,20]];
		break;
	case 2 :
		a = [1,2,3,4,10,18,19];
		b = [[4,10],[6,15]];
	}
	resetall(all);
	for(var i=0; i<a.length; i++) {
		$("u" + a[i]).checked = true;
		$("u" + a[i]).parentNode.style.backgroundColor = "#fcf";
		if(i==a.length-1) {
			rowsort(a[i]);
		}
	}
	for(var i=0; i<b.length; i++) {
		$("per" + b[i][0]).value = b[i][1];
	}
}
function choiceClr(id, a, no, js) {
	var b = [140, 201, 301], c;
	var text = '';
	if(a.match(/,+/)) {
		var aa = a.split(",");
		for(var i=0; i<aa.length; i++) {
			if($("col" + b[no] + aa[i])) {
				tM = $("col" + b[no] + aa[i]).style;
				tM.display = (tM.display=="none") ? "block" : "none";
				c = (tM.display=="none") ? W["EDIUNET_U18"] : W["EDIUNET_U19"];
				$("clr" + aa[i] + no).innerHTML = "<img src=\"./sub/color.png\" /> <a href=\"javascript:void(0);\" onclick=\"choiceClr(" + id + ", '" + a + "', " + no + ");\" onkeypress=\"choiceClr(" + id + ", '" + a + "', " + no + ");\" title=\"" + W["EDIUNET_U28"] + c + "\">" + c + "</a>";
			}
		}
	}else {
		for(var i=0; i<b.length; i++) {
			tM = $("col" + b[i] + a).style;
			tM.display = (tM.display=="none") ? "block" : "none";
			c = (tM.display=="none") ? W["EDIUNET_U18"] : W["EDIUNET_U19"];
			$("clr" + a + i).innerHTML = "<img src=\"./sub/color.png\" /> <a href=\"javascript:void(0);\" onclick=\"choiceClr(" + id + ", '" + a + "', " + no + ", " + js + ");\" onkeypress=\"choiceClr(" + id + ", '" + a + "', " + no + ", " + js + ");\" title=\"" + W["EDIUNET_U28"] + c + "\">" + c + "</a>";
		}
	}
	cookieSet('ffe', id);
}
function choiceCircle(id, a, no, js) {
	var b = [140, 201, 301], bb;
	var c = (id==1) ? [W["EDIUNET_U16"], "plus"] : [W["EDIUNET_U17"], "minus"];
	var d = (id==1) ? 0 : 1;
	if(a.match(/,+/)) {
		var aa = a.split(",");
		for(var i=0; i<aa.length; i++) {
			if($("x_" + b[no] + aa[i] + "max")) {
				for(var j=1; j<6; j++) {
					var x = "x" + j + "_" + b[no] + aa[i];
					if($(x)!=null) {
						var valz = $(x).value.split('_');
						var valx = (id) ? valz[1] : valz[2];
						$("img" + j + b[no] + aa[i]).innerHTML = "<img src=\"./graph/?" + valz[3] + valx + valz[4] + "\" alt=\"img\" />";
					}
				}
				$("cls" + aa[i] + no).innerHTML = "<img src=\"./sub/" + c[1] + ".png\" /> <a href=\"javascript:void(0);\" onclick=\"choiceCircle(" + d + ", '" + a + "', " + no + ", " + js + ");\" onkeypress=\"choiceCircle(" + d + ", '" + a + "', " + no + ", " + js + ");\" title=\"" + W["EDIUNET_U01a"] + c[0] + "\">" + c[0] + "</a>";
			}
		}
	}else {
		for(var i=0; i<b.length; i++) {
			for(var j=1; j<6; j++) {
				var x = "x" + j + "_" + b[i] + a;
				if($(x)!=null) {
					var valz = $(x).value.split('_');
					var valx = (id) ? valz[1] : valz[2];
					$("img" + j + b[i] + a).innerHTML = "<img src=\"./graph/?" + valz[3] + valx + valz[4] + "\" alt=\"img\" />";
				}
			}
			$("cls" + a + i).innerHTML = "<img src=\"./sub/" + c[1] + ".png\" /> <a href=\"javascript:void(0);\" onclick=\"choiceCircle(" + d + ", '" + a + "', " + no + ", " + js + ");\" onkeypress=\"choiceCircle(" + d + ", '" + a + "', " + no + ", " + js + ");\" title=\"" + W["EDIUNET_U01a"] + c[0] + "\">" + c[0] + "</a>";
		}
	}
	cookieSet('p', id);
}
function choiceData(id, a, no, js) {
	var b = [140, 201, 301];
	var c = (id==1) ? "list" : "circle";
	var d = (id==1) ? "circle" : "list";
	var e = (!js) ? [W["EDIUNET_U01"], W["EDIUNET_U02"], W["EDIUNET_U03"]] : [W["EDIUNET_U01"], W["EDIUNET_25"], W["EDIUNET_26"]];
	var z = ["cls", "clt", "clr"];
	var text = '';
	if(a.match(/,+/)) {
		var aa = a.split(",");
		for(var i=0; i<aa.length; i++) {
			if($(d + b[no] + aa[i])) {
				tM = $(d + b[no] + aa[i]).style;
				tM.display = (tM.display=="none" || id==2) ? "block" : "none";
				tN = $(c + b[no] + aa[i]).style;
				tN.display = (tM.display=="none" || id==2) ? "block" : "none";
				if(!js) {
					for(var k=0; k<3; k++) {
						$(z[k] + aa[i] + no).style.visibility = "visible";
					}
					if(id==0) {
						$(z[1] + aa[i] + no).style.visibility = "hidden";
					}else if(id==1) {
						$(z[0] + aa[i] + no).style.visibility = "hidden";
						$(z[2] + aa[i] + no).style.visibility = "hidden";
					}
				}else {
					$(z[0] + aa[i] + no).style.visibility = "visible";
					$(z[2] + aa[i] + no).style.visibility = "visible";
					if(id==1) {
						$(z[0] + aa[i] + no).style.visibility = "hidden";
						$(z[2] + aa[i] + no).style.visibility = "hidden";
					}
				}
			}
		}
	}else {
		for(var i=0; i<b.length; i++) {
			tM = $(d + b[i] + a).style;
			tM.display = (tM.display=="none" || id==2) ? "block" : "none";
			tN = $(c + b[i] + a).style;
			tN.display = (tM.display=="none" || id==2) ? "block" : "none";
			if(!js) {
				for(var k=0; k<3; k++) {
					$(z[k] + a + i).style.visibility = "visible";
				}
				if(id==0) {
					$(z[1] + a + i).style.visibility = "hidden";
				}else if(id==1) {
					$(z[0] + a + i).style.visibility = "hidden";
					$(z[2] + a + i).style.visibility = "hidden";
				}
			}else {
				$(z[0] + a + i).style.visibility = "visible";
				$(z[2] + a + i).style.visibility = "visible";
				if(id==1) {
					$(z[0] + a + i).style.visibility = "hidden";
					$(z[2] + a + i).style.visibility = "hidden";
				}
			}
		}
	}
	for(var i=0; i<3; i++) {
		text += (id==i) ? "<span class=\"tabmenunon\">" + e[i] + "</span>&nbsp;" : "<a href=\"javascript:void(0);\" onclick=\"choiceData(" + i + ", '" + a + "', " + no + ", " + js + ");\" onkeypress=\"choiceData(" + i + ", '" + a + "', " + no + ", " + js + ");\" class=\"tabmenuplus\" title=\"" + e[i] + W["EDIUNET_A07"] + "\">" + e[i] + "</a>&nbsp;";
	}
	$("c1s").innerHTML = text;
	cookieSet('u', id);
}
function choiceLayout(id, a, no) {
	var b = [[140,8,[0,5]], [201,6,[0,1,3]], [301,4,[0]]];
	var c0 = W["EDIUNET_U14"] + z_money();
	var c1 = (id==1) ? 2 : 1;
	if(a.match(/,+/)) {
		var aa = a.split(',');
		for(var i=0; i<aa.length; i++) {
			for(var j=1; j<6; j++) {
				var x = "x" + j + "_" + b[no][0] + aa[i];
				if($(x)!=null) {
					var valz = $(x).value.split('_');
					var ymd = valz[0];
					for(var k=1; k<=b[no][1]; k++) {
						var yy = j + "_" + k + "_" + b[no][0] + "_" + aa[i];
						var v = $("w" + yy).value * ymd;
						v = Math.round(v) + '';
						$("y" + yy).innerHTML = (id==1) ? valueFormat(v) : number_format(v);
					}
					for(var k=0; k<b[no][2].length; k++) {
						var yz = j + "_" + b[no][2][k] + "_z" + b[no][0] + "_" + aa[i];
						var vz = $("w" + yz).value * ymd;
						vz = Math.round(vz) + '';
						$("y" + yz).innerHTML = (id==1) ? valueFormat(vz) : number_format(vz);
					}
				}
				$("clt" + aa[i] + no).innerHTML = "<img src=\"./sub/cash2.png\" /> <a href=\"javascript:void(0);\" onclick=\"choiceLayout(" + c1 + ", '" + a + "', " + no + ");\" onkeypress=\"choiceLayout(" + c1 + ", '" + a + "', " + no + ");\" title=\"" + W["EDIUNET_U29"] + "\">" + c0 + "</a>";
			}
		}
	}else {
		for(var i=0; i<3; i++) {
			for(var j=1; j<6; j++) {
				var x = "x" + j + "_" + b[i][0] + a;
				if($(x)!=null) {
					var valz = $(x).value.split('_');
					ymd = valz[0];
					for(var k=1; k<=b[i][1]; k++) {
						var yy = j + "_" + k + "_" + b[i][0] + "_" + a;
						var v = $("w" + yy).value * ymd;
						v = Math.round(v) + '';
						$("y" + yy).innerHTML = (id==1) ? valueFormat(v) : number_format(v);
					}
					for(var k=0; k<b[i][2].length; k++) {
						var yz = j + "_" + b[i][2][k] + "_z" + b[i][0] + "_" + a;
						var vz = $("w" + yz).value * ymd;
						vz = Math.round(vz) + '';
						$("y" + yz).innerHTML = (id==1) ? valueFormat(vz) : number_format(vz);
					}
				}
			}
			$("clt" + a + i).innerHTML = "<img src=\"./sub/cash2.png\" /> <a href=\"javascript:void(0);\" onclick=\"choiceLayout(" + c1 + ", '" + a + "', " + no + ");\" onkeypress=\"choiceLayout(" + c1 + ", '" + a + "', " + no + ");\" title=\"" + W["EDIUNET_U29"] + "\">" + c0 + "</a>";
		}
	}
	cookieSet('layout', id);
}
// 数値化処理
function cId(i, s) {
	var id = (s==1) ? document.forms[0][i].value : $(i).value;
	var x = ["０１２３４５６７８９，．－＋", "0123456789,.-+"];
	var str=w=n="";
	for(var i=0; i<id.length; i++) {
		w = id.charAt(i);
		n = x[0].indexOf(w, 0);
		if(w.match(/[0-9\+\-,\.]/)) {
			str += w;
		}else if(n>=0) {
			str += x[1][n];
		}
	}
	if(!str || str.match(/[^0-9\+\-,\.]+|.*[\+\-,]{2,}.*|[\+\-,]$/)) {
		return "";
	}else {
		str = eval(str.replace(/,/g, ""));
		return (str>2147483647 || str==0) ? "" : str;
	}
}
function cookieGet(key) {
	var key = key + "=", val = null;
	var str = document.cookie + ";" ;
	var ofst = str.indexOf(key);
	if(ofst != -1) {
		var start = ofst + key.length;
		var end = str.indexOf(";" , start);
		val = unescape(str.substring(start, end));
	}
	return val;
}
function cookieSet(key, val) {
	var nd = new Date();
	nd.setTime(nd.getTime() + 1000*60*60*24*30);
	var text = key + "=" + escape(val) + ";";
	text += "expires=" + nd.toGMTString() + "; path=/;";
	document.cookie = text;
}
function cookieDel(key) {
	var dt = new Date();
	document.cookie = key + "=; expires=" + dt.toGMTString() + "; path=/;";
}
function dtFocus(dt, jd) {
	dt.style.backgroundColor = (jd==1) ? "#fffffe" : "pink";
}
var postlen;
function EdiutterCount(id) {
	var id = (id) ? id : 1;
	if(!postlen) {
		postlen = $("twcount" + id).innerHTML;
	}
	var body = $("twbody" + id).value;
	var num = postlen-body.length;
	if(num>=0) {
		$("twcount" + id).innerHTML = num;
		$("twsubmit" + id).disabled = (body) ? false : true;
	}else {
		$("twcount" + id).innerHTML = "Over " + Math.abs(num) + " !";
		$("twsubmit" + id).disabled = true;
	}
}
function ediutterRE(id) {
	$("twbody1").value = "@" + $("userid" + id).innerHTML + " ";
	EdiutterCount();
}
function ediutterRT(id) {
	var body = strip_tags($("ediutter" + id).innerHTML);
	body = body.replace(/^\s+|\s+$|\r\n|\n|\r|\t/g, '').replace(/ +/g, ' ');
	if(body.indexOf("RT @")==-1) {
		$("twbody1").value = "RT @" + $("userid" + id).innerHTML + " " + body;
	}else {
		$("twbody1").value = body;
	}
	EdiutterCount();
}
function ediutterRepo(tid, cid, obj, e) {
	pop.pop_show(tid, obj, e, '', 9, cid);
}
function ediutterRepoPost() {
	$("rsubmit").disabled = (!$("rbody").value) ? true : false;
}
function ediutterRepoSend() {
	var body = new Array();
	var ary = new Array("rtid", "rcid", "rbody");
	for(var i=0; i<3; i++) {
		if(!$(ary[i]).value) {
			return 'NG';
		}
		body[i] = ary[i] + "=" + encodeURI($(ary[i]).value);
	}
	var robj = createXMLHttpRequest();
	if(robj) {
		robj.open("POST", "./js/", true);
		robj.onreadystatechange = function() { 
			if(robj.readyState==4) {
				return pop.pop_ediutterEnd(robj.responseText);
 			}
		}
		robj.setRequestHeader("content-type", "application/x-www-form-urlencoded;charset=UTF-8");
		robj.send("js=3&" + body.join("&"));
		$("hintbox").innerHTML = '<p class="c"><img src="./sub/load.gif" alt="load" /> Now Loading.</p><input value="1" type="hidden" id="rbody" />';
	}
}
//http://phpjs.org/functions/strip_tags
function strip_tags (str, allowed_tags) {
	var key = '', allowed = false;
	var matches = []; var allowed_array = [];
	var allowed_tag = '';
	var i = 0;
	var k = '';
	var html = ''; 
	var replacer = function (search, replace, str) {
		return str.split(search).join(replace);
	};
	if(allowed_tags) {
		allowed_array = allowed_tags.match(/([a-zA-Z0-9]+)/gi);
	}
	str += '';
	matches = str.match(/(<\/?[\S][^>]*>)/gi);
	for(key in matches) {
		if(isNaN(key)) {
			continue;	// IE7 Hack
		}
		html = matches[key].toString();
		allowed = false;
		for(k in allowed_array) {
			allowed_tag = allowed_array[k];
			i = -1;
			if(i!=0) {
				i = html.toLowerCase().indexOf('<'+allowed_tag+'>');
			}
			if(i!=0) {
				i = html.toLowerCase().indexOf('<'+allowed_tag+' ');
			}
			if(i!=0) {
				i = html.toLowerCase().indexOf('</'+allowed_tag);
			}
			if(i==0) {
				allowed = true;
				break;
			}
		}
		if(!allowed) {
			str = replacer(html, "", str);
		}
	}
	return str;
}
function hide(name) {
	var a = $(name).style;
	a.display = (a.display=="none") ? "block" : "none";
}
function hides(name, k) {
	var a = $(name).style;
	a.display = (a.display=="none" || k==1) ? "block" : "none";
	return false;
}
function hidex(name, prev, next) {
	tM = $(name).style;
	$(name + "1").innerHTML = (tM.display=="none") ? next : prev;
	tM.display = (tM.display=="none") ? "block" : "none";
	return false;
}
function imgChange(val) {
	var x = [0.5, 0.8, 1, 1.2, 1.5, 2, 3, 5, 10];
	for(i=0; i<x.length; i++) {
		if(val<=x[i] && val>0) {
			return (10-i)*10;
		}
	}
	return (val=="- ") ? 0 : 1;
}
function loadForm() {
	if(W2[1]) {
		$("searchmenu").innerHTML = W2[1];
	}else {
		return loadCode(1, "searchmenu");
	}
}
function loadCode(code, e) {
	var hObj = createXMLHttpRequest();
	if(e) {
		var fUrl = "./js/?js=4&word=" + code;
	}else {
		var code = (code) ? code : "jp";
		var fUrl = "./main/lang/" + code + ".json";
	}
	if(hObj) {
		hObj.open("GET", fUrl);
		hObj.onreadystatechange = function() { 
			if(hObj.readyState==4) {
				t = hObj.responseText;
				if(!t) {
					return;
				}
				t = t.replace(/\r\n|\n|\r|\t/g, '');
				if(e) {
					W2[code] = t;
					if(code==1) {
						$("searchmenu").innerHTML = W2[code];
						$("searchmenu1").innerHTML = "";
					}else {
						pop.pop_echo(W["HELP_1"], W2[code], e);
					}
				}else {
					W = eval("(" +t + ")");
				}
				return;
 			}
		}
		hObj.send(null);
	}
}
function loadUrl(code) {
	var uObj = createXMLHttpRequest(), v161 = new Array();
	var uUrl = "./js/?js=5&code=" + code;
	if(uObj) {
		uObj.open("GET", uUrl);
		uObj.onreadystatechange = function() { 
			if(uObj.readyState==4) {
				t = uObj.responseText;
				if(!t) {
					return;
				}
				data = eval("(" + t + ")");
				v161 = $("v161_" + code).value.split(",");
				if(Math.round(data[0])<=Math.round(v161[1])) {
					wari = 'A';
				}else if(Math.round(data[0])>Math.round(v161[1])*5) {
					wari = 'C';
				}else {
					wari = 'B';
				}
				dmax = (Math.round(data[0])>Math.round(v161[1])) ? Math.round(data[0]) : Math.round(v161[1]);
				vsize = Math.sqrt(dmax)/Math.sqrt($("vmax").value)*60;
				$("vrank_" + code).innerHTML = wari;
				$("vvalu_" + code).innerHTML = "<img src=\"./graph/?id=999&amp;year=" + v161[2] + "&amp;value=" + data[0] + "&amp;value2=" + v161[1] + "&amp;value3=x&amp;size=" + vsize + "a" + v161[1] + "a" + (data[0]-v161[1]) + "a" + data[0] + "\" alt=\"" + W["EDIUNET_V00"] + "\" />";
				$("v701_" + code).innerHTML = valueFormat(data[0]*v161[3]);
				$("v703_" + code).innerHTML = valueFormat((data[0]-v161[1])*v161[3]);
			}
		}
		$("vrank_" + code).innerHTML = '<img src="./sub/load.gif" alt="load" />';
		$("vvalu_" + code).innerHTML =  '<img src="./sub/load.gif" alt="load" /> Now Loading.';
		$("v701_" + code).innerHTML =  '<img src="./sub/load.gif" alt="load" /> Now Loading.';
		$("v703_" + code).innerHTML =  '<img src="./sub/load.gif" alt="load" /> Now Loading.';
		uObj.send(null);
	}
}
function loadVal(code) {
	var codes = code.split("+");
	for(var i=0; i<codes.length; i++) {
		loadUrl(codes[i]);
	}
}
function getTweet() {
	var script = document.createElement('script');
	script.type = 'text/javascript';
	script.src = 'http://api.j.mp/shorten?version=2.0.1&login=ediunet&apiKey=R_3b1f4fbfc594998c8b628a6fe9cb0301&format=json&callback=getTinyUrl&longUrl=' + encodeURIComponent(location.href);
	var head = document.getElementsByTagName("head")[0];
	head.appendChild(script);
}
function getTinyUrl(data) {
	var html='';
	if(data.errorCode==0) {
    var results = data['results'];
		for(var longurl in results) {
    	html = results[longurl]['shortUrl'];
		}
	}
	if(!html) {
		html = longurl;
	}
	html = 'http://twitter.com/home?status=' + encodeURIComponent(document.title + ' ' + html);
	window.open(html, 'twitterwindow');
	return false;
}
/*
http://blogs.yahoo.co.jp/tn7700/19808882.html
*/
var ref;
var gcode;
function logins(code) {
	gcode = code;
	gcode = "E01773";
	var url = 'http://info.edinet-fsa.go.jp/';
	var style = "top=0,left=0,width=100,height=100,resizable=no,scrollbars=no";
	ref = window.open(url, "", style);
	ref.close();
	setTimeout('show()', 2000);
	return false;
}
function market(start, end) {
	if(start) {
		resets(start, end);
	}else {
		$("um0").checked = true;
	}
}
function Rate_Echo(mid, money, pageh) {
	var item=midadd='', moneyvx = new Array();
	var h = (cookieGet('ediunet_lan')!=2) ? 1 : 3;
	for(var ii=0; ii<23; ii++) {
		item = MONEYS[ii][h] + '(*' + MONEYS[ii][0] + ')';
		if(money==ii) {
			moneyvx.push('<span class="m0a">' + item + '</span>');
		}else if(!mid) {
			moneyvx.push('<span class="s">' + item + '</span>');
			midadd = '<p><span class="m0">*' + W["LOGIN_1"] + '</span></p>';
		}else {
			moneyvx.push('<a href="./?moneyselect=1&amp;money=' + ii + pageh + '" title="' + W["TUUKAKIRIKAE"] + ': ' + MONEYS[ii][h] + '(*' + MONEYS[ii][0] + ')" class="ni2">' + item + '</a>');
		}
	}
	return midadd + moneyvx.join(' | ');
}
function number_format(v) {
	var cnt=0, n="";
	var val = Math.abs(v) + "";
	for(var i=val.length-1; i>=0; i--) {
		n = val.charAt(i) + n;
		cnt++;
		if(!(cnt%3) && i) {
			n = "," + n;
		}
	}
	return (v>=0) ? n : "-" + n;
}
function show() {
	ref.close();
/*
	document.forms.codeCorpList.code.value = gcode;
	document.forms.codeCorpList.submit();
*/
	$('edinetCode').value = gcode;
	$('documentsKind').options[5] = TRUE;
	clickSearchBtn('W1E62031');
}
function perChange(val) {
	var k = (val<=1) ? 31 : 1;
	return ["<div class=\"bi_" + Math.ceil(imgChange(val)/10) + "\">&nbsp;</div>","<span class=\"s" + k + "\">" + val + W["EDIUNET_V08"] + "&nbsp;</span>"];
}
function reset() {
	$("v10").value = $("v17").value;
	$("v11").value = $("v18").value;
	return false;
}
function reset3() {
	document.ediu6.que.value = "";
	document.ediu6.ctid.value = "";
	document.ediu6.maid.value = "";
	document.ediu6.year.value = "";
	document.ediu6.choice.value = "";
	document.ediu6.sort.checked = "";
	document.ediu6.risk.value = "";
	document.ediu6.x.value = "";
	$("nt0").checked = true;
	return false;
}
function reseti() {
	for(var i=0; i<=27; i++) {
		$("per" + i).value = "";
	}
}

function resetall(num) {
	resets(num);
	reseti();
}
function resets(jd, jd2, jd3) {
	var a = (!jd2) ? 1 : jd;
	var b = (!jd2) ? jd : jd2;
	for(var i=a; i<=b; i++) {
		$("u" + i).checked = false;
		$("u" + i).parentNode.style.backgroundColor = "#fff";
	}
	if(jd3) {
		$("xx10" + jd3).innerHTML = '';
		$("xx11" + jd3).innerHTML = '';
	}else if(!jd2) {
		rowsort();
	}
}
function resum() {
	$("v10").focus();
	$("v11").focus();
	return false;
}
function riskset(jd, sj) {
	var risk = ['AAA','AA','A','BBB','BB','B','CCC','CC','C'];
	var sjs = (sj) ? sj : 1;
	sj = (sj) ? sj : 1;
	var r = risk[jd-sjs];
	if($("u" + jd).checked==true) {
		$("xx10" + sj).innerHTML = "*<a href=\"javascript:void(0);\" onclick=\"riskset2(" + jd + ", " + sj + ");\" onkeypress=\"riskset2(" + jd + ", " + sj + ");\">" + r + W["JS_01"] + "</a>";
		$("xx11" + sj).innerHTML = "*<a href=\"javascript:void(0);\" onclick=\"riskset2(" + jd + ", " + sj + ", 1);\" onkeypress=\"riskset2(" + jd + ", " + sj + ", 1);\">" + r + W["JS_02"] + "</a>";
	}
}
function riskset2(jd, jd1, jd2) {
	jd1 = (jd1!=1) ? [jd1, jd1+8] : [1, 9];
	for(var i=jd1[0]; i<=jd1[1]; i++) {
		$("u" + i).checked = false;
		$("u" + i).parentNode.style.backgroundColor="#fff";
	}
	var a1 = (jd2) ? jd : jd1[0];
	var a2 = (jd2) ? jd1[1] : jd;
	for(var i=a1; i<=a2; i++) {
		$("u" + i).checked = true;
		$("u" + i).parentNode.style.backgroundColor="#fcf";
	}
}
function rowsort(is) {
	var starts = 10;
	var ii=0, ary=[];
	for(var i=starts; i<starts+23; i++) {
		if($("u" + i).checked==true) {
			ii++;
			ary.push(i);
		}
	}
	for(var i=starts; i<starts+23; i++) {
		if(ii>=3) {
			if($("u" + i).checked==false) {
				$("u" + i).disabled = true;
			}else {
				$("u" + i).disabled = false;
				$("u" + i).parentNode.style.backgroundColor="#fcf";
			}
		}else {
			$("u" + i).disabled = false;
			var cl = ($("u" + i).checked==false) ? "#fff" : "#fcf";
			$("u" + i).parentNode.style.backgroundColor = cl;
		}
	}
	if(!is || !ii) {
		$("vv0").innerHTML = '<label for="v0"><input name="choice" value="201" type="radio" id="v0" checked="checked" />' + W["SUB_TOTAL_REVENUE"] + '</label>';
	}else {
		var text=[];
		for(var j=0; j<ii; j++) {
			var a = (!j) ? ' checked="checked"' : '';
			text.push('<label for="u100' + j + '"><input name="choice" value="' + $("u" + ary[j]).value + '" type="radio" id="u100' + j + '"' + a + ' />' + $("u" + ary[j]).title + '</label> ');
		}
		$("vv0").innerHTML = text.join("");
	}
}
function someother(a1, a2) {
	for(var i=a1; i<=a2; i++) {
		$("u" + i).checked = true;
		$("u" + i).parentNode.style.backgroundColor = "#fcf";
	}
}
function valueFormat(val) {
	val = Math.round(val);
	vals = val + "";
	var len2 = vals.length, t;
	var lary = (val<0) ? [len2-1, '<span class="red">', ''] : [len2, '', ''];
	if(val==0) {
		return "-";
	}else if(cookieGet('ediunet_lan')==2) {
		if(lary[0]<5) {
			vals = number_format(vals) + " Mil." + z_money();
		}else if(lary[0]<8) {
			vals = number_format(vals.slice(0, len2-3)) + " Bil." + z_money();
		}else if(lary[0]<11) {
			vals = number_format(vals.slice(0, len2-5)) + " Tril." + z_money();
		}
	}else if(lary[0]<3) {
		vals = number_format(vals + "00") + "万" + z_money();
	}else if(lary[0]<7) {
		vals = number_format(vals.slice(0, len2-2)) + "." + vals.slice(0, len2-1).substring(len2-2, len2-1) + "億" + z_money();
	}else if(lary[0]<11) {
		vals = (vals.slice(0, len2-5)/10) + "兆" + z_money();
	}
	return lary[1] + vals + lary[2];
}
function z_money(id, jds) {
	if(cookieGet('money')) {
		var m = cookieGet('money');
	}else {
		var m = (cookieGet('ediunet_lan')!=2) ? 1 : 0;
	}
	var h = (cookieGet('ediunet_lan')!=2) ? 1 : 2;
	if(jds==1) {
		return MONEYS[id][h] + "(" + MONEYS[id][0] + ")";
	}else if(!id) {
		return MONEYS[m][0];
	}else {
		var t=[], jd;
		for(var i=0; i<23; i++) {
			jd = (m==i) ? " selected=\"selected\"" : "";
			t[i] = "<option value=\"" + i + "\"" + jd + ">" + MONEYS[i][h] + " (" + MONEYS[i][0] + ")</option>\n";
		}
		return t.join("");
	}
}

// http://allabout.co.jp/internet/javascript/closeup/CU20050515A/
function createXMLHttpRequest() {
	if(window.ActiveXObject) {
		try {
			return new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e) {
			try {
				return new ActiveXObject("Microsoft.XMLHTTP");
			}catch (e2) {
				return null;
			}
		}
	}else if(window.XMLHttpRequest) {
		return new XMLHttpRequest();
	}else {
		return null;
	}
}
function Necho(v, x) {
	var t = (x==1) ? $("xtexts[" + v + "]").innerHTML : $("texts[" + v + "]").value;
	var n = Number(t.replace(/,/g, ""));
	return (x!=2) ? Math.abs(n) : n;
}
//http://web-sozai.up.seesaa.net/image/graph-circle.js
var graph = function() {
	var gdata = [], X = [], Y = [], Color = [], S = 0, R = 50;
	return {
		clear:function(v, c) {
			gdata.length = 0;
			X.length = 0;
			Y.length = 0;
			Color.length = 0;
			S = 0;
		},
		datas:function(v, c) {
			var i = gdata.length;
			gdata[i] = [];
			gdata[i][0] = v;
			gdata[i][1] = c;
			S += v;
		},
		start:function() {
			for(var i=0; i<3; i++) {
				$("inputu" + i).innerHTML = graph.show(i);
			}
		},
		show:function(id) {
			switch(id) {
			case 0 :
				tits = W["EDIUNET_U04"];
				graph.datas(Necho(151), "#f92500");
				graph.datas(Necho(152), "#890F65");
				graph.datas(Necho(161, 1), "#fbe731");
				graph.datas(Necho(121, 1), "#8c8c8c");
				graph.datas(Necho(113), "#47ea7e");
				graph.datas(Necho(111), "#28af78");
				graph.datas(Necho(105)-Necho(101), "#2860a3");
				graph.datas(Necho(101), "#74a9d6");
				break;
			case 1 :
				tits = W["EDIUNET_U05"];
				graph.datas(Necho(201), "#f92500");
				graph.datas(Necho(231), "#890F65");
				graph.datas(Necho(206), "#fbe731");
				graph.datas(Necho(203), "#8c8c8c");
				break;
			case 2 :
				tits = W["EDIUNET_U06"];
				var ov = Necho(301, 2)+Necho(311, 2)+Necho(321, 2)-Necho(331, 2);
				var o = [
					[Necho(301, 2), Necho(301), "#f92500"],
					[Necho(311, 2), Necho(311), "#fbe731"],
					[Necho(321, 2), Necho(321), "#2860a3"],
					[-Necho(331, 2), Necho(331), "#74a9d6"],
					[ov, Math.abs(ov), "#8c8c8c"]
				].sort(function(a, b) {return b[0]-a[0];});
				for(var i=0; i<5; i++) {
					graph.datas(o[i][1], o[i][2]);
				}
			}
			var r = s = t = 0;
			for(var i=0, glen=gdata.length; i<glen; i++) {
				gdata[i][2] = gdata[i][0]/S*2*Math.PI;
				gdata[i][3] = t;
				gdata[i][4] = t+gdata[i][2];
				t = gdata[i][4];
			}
			for(var i=R*-1; i<=R; i++) {
				if(i!=0){
					X.push(i);
					Y.push(i*-1);
				}
			}
			for(var y=0, ylen=Y.length; y<ylen; y++) {
				Color[y] = [];
				for(var x=0; x<X.length; x++) {
					r = Math.atan2(X[x], Y[y]);
					s = Math.sin(r)*R;
					if((X[x]<0 && X[x]<s) || (X[x]>0 && X[x]>s)) {
						continue;
					}
					if(r<0) {
						r += Math.PI+Math.PI;
					}
					for(var i=0, glen=gdata.length; i<glen; i++) {
						if(r>=gdata[i][3] && r<gdata[i][4]) {
							Color[y][x] = gdata[i][1];
						}
					}
				}
			}
			var c = null, text = [];
			for(var y=0, clen=Color.length; y<clen; y++) {
				for(var x=0, clen2=Color[y].length; x<=clen2; x++) {
					if(!Color[y][x] && !c) {
						continue;
					}
					if(Color[y][x]!=c) {
						if(c) {
							text.push("<div style=\"width:" + w + "px; border-top:1px solid " + c + "; top:" + t + "px; left:" + l + "px\"></div>");
						}
						c = Color[y][x];
						w = 1;
						t = y;
						l = x;
					}else {
						w++;
					}
				}
			}
			graph.clear();
			return "<div style=\"width:" + (R*2) + "px; height:" + (R*2) + "px;\" class=\"circles\">" + text.join("") + "<div style=\"width:" + (R*2) + "px; float:left; margin-top:" + (R*2) + "px;\">" + tits + "</div></div>";
		}
	};
}();
//http://phpspot.org/blog/archives/2007/11/javascript_html.html
function h(str) {
	return str.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;");
}
function $(tagId) {
	return document.getElementById(tagId);
}