//2000/12/11追加　デフォルト検索期間変更
function SetTextRestriction(theForm)
{
	var i;
	i = theForm.DocLimiteNo.value;
	
	if(i==1)	//1ヶ月前
		theForm.DocLimite.value = " and (write > '" + GetBeforeDateByMonth(1) + "')";
	else if(i==2)	//1週間前
		theForm.DocLimite.value = " and (write > '" + GetBeforeDateByDay(7) + "')";
	else if(i==3)	//当日
		theForm.DocLimite.value = " and (write > '" + GetBeforeDateByDay(0) + "')";
	else
		theForm.DocLimite.value ="";

	var iIndex = theForm.BbsCategory.selectedIndex;
	var strChar = theForm.BbsCategory.options[iIndex].value;

	if(strChar == "")
	{
		theForm.DispCategory.value = "すべての掲示";
		theForm.SearchFolder1.value = "";
		return true;
	}
	else
	{
		iIndex = strChar.indexOf(",");
		if(iIndex == -1)
		{
			strChar = Trim(strChar);
			theForm.DispCategory.value = strChar;
			theForm.SearchFolder1.value = strChar;
		}
		else
		{
			theForm.DispCategory.value = Trim(strChar.substring(0,iIndex));
			var iLen = strChar.length;
			theForm.SearchFolder1.value = Trim(strChar.substring(iIndex + 1 ,iLen));
		}
		return true;
	}
}

// 3/8追加　サーバーシステムVer3.10
function AllRestrictionBBS()
{
	//すべての掲示の表示
	//var DocLimiteNo = 1;
	//var DocLimite = " and (write > '" + GetBeforeDateByMonth(1) + "')";
	var DocLimiteNo = Const_DocLimNoAllBbs;
	var DocLimite;
	if(DocLimiteNo == 1)
		DocLimite = " and (write > '" + GetBeforeDateByMonth(1) + "')";
	else if(DocLimiteNo == 2)
		DocLimite = " and (write > '" + GetBeforeDateByDay(7) + "')";
	else if(DocLimiteNo == 3)
		DocLimite = " and (write > '" + GetBeforeDateByDay(0) + "')";
	else if(DocLimiteNo == 0)
		DocLimite = "";
	var DispCategory = "すべての掲示";
	var SearchFolder1 = "";
	var SearchFolder2 = "";
	var DispLink = "ON";
	var DispImg = "";
	var fmtc = document.topfrm.fmtc.value;
	

	var strURL = "http://" + window.location.host + "/" + Const_ALIAS + "/scr/board/QBoard.asp";
	strURL = strURL + "?DocLimiteNo=" + DocLimiteNo + "&DocLimite=" + DocLimite;
	strURL = strURL + "&Dispcategory=" + escape(DispCategory) + "&DispLink=" + DispLink + "&DispImg=" + DispImg;
	strURL = strURL + "&SearchFolder1=" + SearchFolder1 + "&SearchFolder2=" + SearchFolder2;
	strURL = strURL + "&fmtc=" + fmtc;

	window.location = strURL;
}

function SetRestrictionBBS(BbsCate,BbsDir)
{
	var DocLimiteNo = Const_DocLimNoAllBbs;
	var DocLimite;
	if(DocLimiteNo == 1)
		DocLimite = " and (write > '" + GetBeforeDateByMonth(1) + "')";
	else if(DocLimiteNo == 2)
		DocLimite = " and (write > '" + GetBeforeDateByDay(7) + "')";
	else if(DocLimiteNo == 3)
		DocLimite = " and (write > '" + GetBeforeDateByDay(0) + "')";
	else if(DocLimiteNo == 0)
		DocLimite = "";

	var DispCategory;
	var SearchFolder1 = "";
	if(BbsCate != "" && BbsDir != ""){
		DispCategory = BbsCate;
		SearchFolder1 = BbsDir;
	}else{
		var SearchFolder3 = "";
		if(document.topfrm.BbsTyu.value == ""){
			//大分類中のすべての文書
			DispCategory = document.topfrm.BbsDai.value + "　すべての文書";
			for(var iLC = 0; iLC < document.topfrm.BbsTyu.options.length; iLC++)
			{
				strWork1 = document.topfrm.BbsTyu.options[iLC].value;
				if(strWork1 != "")
				{
					iIndex = strWork1.indexOf(",");
					if(iIndex == -1)
					{
						strWork1 = Trim(strWork1);
					}
					else
					{
						var iLen = strWork1.length;
						strWork1 = Trim(strWork1.substring(iIndex + 1, iLen));
					}
					if(SearchFolder3 != "")
						SearchFolder3 += ",";
					SearchFolder3 += "\"/" + Const_ALIAS + "/DATA/" + "BBS" + "/" + strWork1 + "\"";
				}
			}
		}else{
			var iIndex = document.topfrm.BbsDai.selectedIndex;
			var strChar = document.topfrm.BbsDai.options[iIndex].value;

			iIndex = strChar.indexOf(",");
			if(iIndex == -1)
			{
				strChar = Trim(strChar);
				DispCategory = strChar;
			}
			else
			{
				DispCategory = Trim(strChar.substring(0,iIndex));
				var iLen = strChar.length;
			}

			var iIndex = document.topfrm.BbsTyu.selectedIndex;
			var strChar = document.topfrm.BbsTyu.options[iIndex].value;
			//var strChar = document.topfrm.BbsTyu.options[iIndex].text;

			iIndex = strChar.indexOf(",");
			if(iIndex == -1)
			{
				strChar = Trim(strChar);
				DispCategory += " " + strChar;
				SearchFolder1 = strChar;
			}
			else
			{
				DispCategory += " " + Trim(strChar.substring(0,iIndex));
				var iLen = strChar.length;
				SearchFolder1 = Trim(strChar.substring(iIndex + 1 ,iLen));
			}
		}
	}

	var SearchFolder2 = "";
	var DispLink = "ON";
	var DispImg = "";
	var fmtc = document.topfrm.fmtc.value;

	var strURL = "http://" + window.location.host + "/" + Const_ALIAS + "/scr/board/QBoard.asp";
	strURL = strURL + "?DocLimiteNo=" + DocLimiteNo + "&DocLimite=" + DocLimite;
	strURL = strURL + "&Dispcategory=" + escape(DispCategory) + "&DispLink=" + DispLink + "&DispImg=" + DispImg;
	strURL = strURL + "&SearchFolder1=" + SearchFolder1 + "&SearchFolder2=" + SearchFolder2;
	strURL = strURL + "&SearchFolder3=" + SearchFolder3;
	strURL = strURL + "&fmtc=" + fmtc;

	window.location = strURL;
}

function onChange_BbsDai(theForm)
{
	var iIndex = theForm.BbsDai.selectedIndex;
	var strChar = theForm.BbsDai.options[iIndex].value;
	var strFrm = theForm.frm.value;

	if(strChar == "")
		AllRestrictionBBS(theForm);
	else{
		if(strFrm == "top"){
			var strURL = "http://" + window.location.host + "/" + Const_ALIAS + "/tc.asp";
			strURL = strURL + "?SelDai_Bbs=" + escape(strChar);
		}else if(strFrm == "hmtop"){
			//var strURL = "http://" + window.location.host + "/" + Const_ALIAS + "/";
			var strURL = "http://" + window.location.host + "/" + Const_ALIAS + "/default.asp";
			strURL = strURL + "?SelDai_Bbs=" + escape(strChar);
		}else if(strFrm == "query"){
			var fmtc = theForm.fmtc.value;
			var strURL = "http://" + window.location.host + "/" + Const_ALIAS + "/scr/board/Query.asp";
			strURL = strURL + "?SelDai_Bbs=" + escape(strChar);
			strURL = strURL + "&fmtc=" + fmtc;
		}
		window.location = strURL;
	}
}


