//<![CDATA[
Event.observe(window,'load',function(){
	if ($("plan_tag") != undefined && $("medium_tag") == undefined) {
		dispReportListBox('1');
		ConnectedSelect(['plist','glist']);
		Event.observe('btnreport','click',function(){
			if ($("glist").value != "") {
				window.location.href = "./greport.php?gid="+$("glist").value;
			}else{
				alert("測定グループが選択されていません。");
			}
		});
	}
	if ($("plan_tag") == undefined && $("medium_tag") != undefined) {
		dispReportListBox('2');
		ConnectedSelect(['glist','mlist']);
		Event.observe('btnreport','click',function(){
			if ($("glist").value != "") {
				if ($("mlist").value != "") {
					window.location.href = "./mreport.php?gid="+$("glist").value+"&mid="+$("mlist").value;
				}else{
					window.location.href = "./greport.php?gid="+$("glist").value;
				}
			}else{
				alert("測定グループが選択されていません。");
			}
		});
	}
	if ($("plan_tag") != undefined && $("medium_tag") != undefined) {
		dispReportListBox('0');
		ConnectedSelect(['plist','glist','mlist']);
		Event.observe('btnreport','click',function(){
			if ($("glist").value != "") {
				if ($("mlist").value != "") {
					window.location.href = "./mreport.php?gid="+$("glist").value+"&mid="+$("mlist").value;
				}else{
					window.location.href = "./greport.php?gid="+$("glist").value;
				}
			}else{
				alert("測定グループが選択されていません。");
			}
		});
	}
});
//]]>

function dispReportListBox(mode) {
	sendRequest(dispReportListBoxCallback, "mode="+mode, 'POST', "./bloc/reportlist.php", false, false);
}

function dispReportListBoxCallback(resJSON) {
	eval('var jsonData = ' + decodeURIComponent(resJSON.responseText));
	if(jsonData.error == "") {
		if ($("plan_tag") != undefined) $("plan_tag").innerHTML = jsonData.plan_tag;
		if ($("mgroup_tag") != undefined) $("mgroup_tag").innerHTML = jsonData.mgroup_tag;
		if ($("medium_tag") != undefined) $("medium_tag").innerHTML = jsonData.medium_tag;
	}
}

