

function StartSet()
{
	//theForm.DocLimiteSel.selectedIndex = theForm.DocLimiteNo.value;
	var cnt=document.QueryForm.DocLimiteNo.value;
	document.QueryForm.DocLimiteSel[cnt].checked = "true";

	if(document.QueryForm.DispLink.value == "ON")
		document.QueryForm.ChkDispLink.checked = true;

	if(document.QueryForm.DispImg.value == "ON")
		document.QueryForm.ChkImgLink.checked = true;

}

function SetTextRestriction(theForm)
{
	// 期限の設定
	var i;
	for(var i=0; i <= 3; i++){
		if(theForm.DocLimiteSel[i].checked){
			theForm.DocLimiteNo.value = theForm.DocLimiteSel[i].value;
		}
	}

	if(theForm.DocLimiteNo.value == 1)			// １ヶ月前
		//theForm.DocLimite.value = "@write > " + GetBeforeDateByMonth(1);
		theForm.DocLimite.value = " and (write > '" + GetBeforeDateByMonth(1) + "')";
	else if(theForm.DocLimiteNo.value == 2)		// １週間前
		//theForm.DocLimite.value = "@write > " + GetBeforeDateByDay(7);
		theForm.DocLimite.value = " and (write > '" + GetBeforeDateByDay(7) + "')";
	else if(theForm.DocLimiteNo.value == 3)		// 当日
		//theForm.DocLimite.value = "@write > " + GetBeforeDateByDay(0);
		theForm.DocLimite.value = " and (write > '" + GetBeforeDateByDay(0) + "')";
	else
	{
		theForm.DocLimiteNo.value = 0;
		theForm.DocLimite.value = "";
	}

	var string = Trim(theForm.DispKeyword.value);
	theForm.Keyword.value = "";

	// スペースで区切られていたら分解して、andで結合
	while(true)
	{
		var iIndex1 = string.indexOf(" ");			// " "を検索
		var iIndex2 = string.indexOf("　");			// "　"を検索
		if(iIndex1 == -1 && iIndex2 == -1)
		{
			if(theForm.Keyword.value != "")
				theForm.Keyword.value += " and ";
			theForm.Keyword.value += string;
			break;
		}
		else if(iIndex2 == -1)
			iIndex1 = iIndex1;
		else if(iIndex1 == -1 || iIndex1 > iIndex2)
			iIndex1 = iIndex2;

		if(theForm.Keyword.value != "")
			theForm.Keyword.value += " and ";
		theForm.Keyword.value += string.substring(0, iIndex1);
		string = Trim(string.substring(iIndex1, string.length));
	}

	if(theForm.ChkDispLink.checked)
		theForm.DispLink.value = "ON";
	else
		theForm.DispLink.value = "";

	if(theForm.ChkImgLink.checked)
		theForm.DispImg.value = "ON";
	else
		theForm.DispImg.value = "";

	//return true;
	theForm.submit();
}

function Clear(theForm)
{
	//theForm.DocLimiteNo.value = 1;
	//var cnt = theForm.DocLimiteNo.value;
	var cnt = theForm.DefLimNo.value;
	theForm.DocLimiteSel[cnt].checked="true";
	theForm.DispKeyword.value = "";
	theForm.ChkDispLink.checked = true;
	theForm.ChkImgLink.checked = "";
}


function SetLimiteText()
{
	if(document.QueryForm.DocLimiteNo.value == "0")
		return "全掲示中";
	else if(document.QueryForm.DocLimiteNo.value == "1")
		return "最近１ヶ月以内に貼られた掲示のうち";
	else if(document.QueryForm.DocLimiteNo.value == "2")
		return "最近１週間以内に貼られた掲示のうち";
	else if(document.QueryForm.DocLimiteNo.value == "3")
		return "今日、貼られた掲示のうち";
}

function ImgWin(ImgURL)
{
	var strImgURL = "http://" + window.location.host + ImgURL;
	var win = window.open(strImgURL,"","width=100,height=100,scrollbars=1,resizable=1");
}

