
var CTRL = false;

window.document.onkeydown = checkCTRLDown;
window.document.onkeyup = checkCTRLUp;

function checkCTRLDown(e)
{
	var event = e;
	if (document.all)
	{
		event = window.event;
	}
	if (event.keyCode == 17)
	{
		CTRL = true;
	}
}

function checkCTRLUp(e)
{
	var event = e;
	if (document.all)
	{
		event = window.event;
	}
	if (event.keyCode == 17)
	{
		CTRL = false;
	}
}

function openURL(u)
{
	window.open(u, "_blank");
}

function openComment(u)
{
	var url = u;
	if (CTRL == true)
	{
		url = url + "&normal=1";
	}
	CTRL = false;
	var ret = window.showModalDialog(
		url,   //移動先
		this,  
		"dialogWidth:800px; dialogHeight:600px; center: 1; status: 0; scroll: 1; resizable: 0; help: 0; minimize: 0; maximize: 0;"
	);
	if (ret == true)
	{
		var pos, ed;
		var yy, mm;
		url = "";
		pos = u.indexOf("date=");
		if (pos >= 0)
		{
			u = u + " ";
			yy = u.substring(pos + 5, pos + 9);
			mm = u.substring(pos + 9, pos + 11);
			url = "&y="+yy+"&m="+mm;
		}
		document.clear();
		document.writeln("<html><body>しばらくお待ちください・・・</body></html>");
		document.close();
		url = 'window.open("calendar.cgi?reload=yes'+url+'", "_self")';
		setTimeout(url, 3000);
		//setTimeout('document.location.reload()', 3000);
	}
	return true;
}

function executeWrite()
{
	var completeWindow = window.open("", "complete", "width=200,height=80,top=200,left=200,scrollbars=no,resizable=no,menubar=no,toolbar=no,location=no,directories=no,status=0");
	completeWindow.focus();
	document.writeForm.target="complete";
	document.writeForm.submit();
	window.returnValue = true;
	window.close();
}

function executePublish0()
{
	var completeWindow = window.open("", "complete", "width=200,height=80,top=200,left=200,scrollbars=no,resizable=no,menubar=no,toolbar=no,location=no,directories=no,status=0");
	completeWindow.focus();
	document.publishForm0.target="complete";
	document.publishForm0.submit();
	window.returnValue = true;
	window.close();
}

function executePublish1()
{
	var completeWindow = window.open("", "complete", "width=200,height=80,top=200,left=200,scrollbars=no,resizable=no,menubar=no,toolbar=no,location=no,directories=no,status=0");
	completeWindow.focus();
	document.publishForm1.target="complete";
	document.publishForm1.submit();
	window.returnValue = true;
	window.close();
}

function executeUnPublish0()
{
	var completeWindow = window.open("", "complete", "width=200,height=80,top=200,left=200,scrollbars=no,resizable=no,menubar=no,toolbar=no,location=no,directories=no,status=0");
	completeWindow.focus();
	document.unpublishForm0.target="complete";
	document.unpublishForm0.submit();
	window.returnValue = true;
	window.close();
}

function executeUnPublish1()
{
	var completeWindow = window.open("", "complete", "width=200,height=80,top=200,left=200,scrollbars=no,resizable=no,menubar=no,toolbar=no,location=no,directories=no,status=0");
	completeWindow.focus();
	document.unpublishForm1.target="complete";
	document.unpublishForm1.submit();
	window.returnValue = true;
	window.close();
}

function openContents(mode)
{
	document.dummy.action="calendar.cgi";
	document.dummy.mode.value = mode;
	document.dummy.submit();
}

function openContents2(mode, dt)
{
	document.dummy.action="calendar.cgi";
	document.dummy.mode.value = mode;
	document.dummy.date.value = dt;
	document.dummy.submit();
}

function openContentsPost(mode)
{
	document.dummy.action="calendar.cgi";
	document.dummy.method="post";
	document.dummy.mode.value = mode;
	document.dummy.submit();
}

function openContentsPost2(mode, dt)
{
	document.dummy.action="calendar.cgi";
	document.dummy.method="post";
	document.dummy.mode.value = mode;
	document.dummy.date.value = dt;
	document.dummy.submit();
}

