/*		Èæ³Ó±é»»»Ò¤ÎÁÞÆþ		*/
function setOperator( mode )
{
	if ( mode == 1 )
		document.search.txtWord.value += "&";
	else if ( mode == 2 )
		document.search.txtWord.value += "+";
	else if ( mode == 3 )
		document.search.txtWord.value += "#";
	document.search.txtWord.focus();
}


/*		Submit¤ò¼Â¹Ô¤¹¤ë¡Ê´ØÏ¢¥­¡¼¥ï¡¼¥ÉÍÑ¡Ë		*/

function setKeyword( actn )
{
	document.search.action = actn;
	document.search.target = "Sub";
	document.search.submit();
}


/*		»ØÄêÇ¯·î¤ÎºÇ½ªÆü¤ò¼èÆÀ¤¹¤ë		*/

function getMonthFinalDate( year, month )
{
	var tblLastDate = new Array( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 );
	var lastDate;

	if ( month == 2 && ( year % 400 == 0 || ( year % 100 != 0 && year % 4 == 0 ) ) )
		lastDate = 29;
	else
		lastDate = tblLastDate[month - 1];

	return lastDate;
}


/*		¸¡º÷¤ò¼Â¹Ô¤¹¤ë¡Ê¸¡º÷²èÌÌÍÑ¡Ë		*/

function execSearchSubmit( actn, srch )
{
	var nRet = 0;
	var type;

	document.search.btnSearch.disabled = true;
	switch ( srch ) {
		case 1:
			initTopicSimpleCond();
			nRet = checkTopicSimpleCond();
			if ( nRet )
				break;
			setTopicSimpleRonri();
			nRet = setCond( srch );
			break;
		case 2:
			nRet = checkTextFieldCond_Date( document.search.txtDate.value );
			if ( nRet ) {
				ErrMsg( nRet, "È¯¹ÔÆü" );
				break;
			}
			initTopicPowerCond();
			nRet = checkTopicPowerCond();
			if ( nRet )
				break;
			setTopicPowerRonri();
			nRet = setCond( srch );
			break;
		case 3:
			initChiezoCond();
			nRet = checkChiezoCond();
			if ( nRet )
				break;
			setChiezoRonri();
			nRet = setCond( srch );
			break;
		case 4:
			initJinbutuCond();
			nRet = checkJinbutuCond();
			break;
		case 5:
			initOudanCond();
			nRet = checkOudanCond();
			if ( nRet )
				break;
			for ( type=0; type<5; type++ ) {
				nRet = 0;
				document.search.hdnShishi.value = "";
				if ( ( type == 0 ) && ( document.search.hdnAsahi.value.length != 0 ) ) {
					document.search.hdnShishi.value = document.search.hdnAsahi.value;
					setTopicSimpleRonri();
					nRet = setCond2( type );
				}
				else if ( ( type == 1 ) && ( document.search.hdnAera.value.length != 0 ) ) {
					document.search.hdnShishi.value = document.search.hdnAera.value;
					setTopicSimpleRonri();
					nRet = setCond2( type );
				}
				else if ( ( type == 2 ) && ( document.search.hdnWeekly.value.length != 0 ) ) {
					document.search.hdnShishi.value = document.search.hdnWeekly.value;
					setTopicSimpleRonri();
					nRet = setCond2( type );
				}
				else if ( ( type == 3 ) && ( document.search.hdnChiezo.value == 1 ) ) {
					setChiezoRonri();
					nRet = setCond2( type );
				}
				else if ( ( type == 4 ) && ( document.search.hdnJinbutu.value == 1 ) ) {
					setJinbutuRonri();
					nRet = setCond2( type );
				}
				if ( nRet )
					break;
			}
			break;
		case 6:
			initTopicSimpleCond_Cal();
			nRet = checkTopicSimpleCond();
			if ( nRet )
				break;
			setTopicSimpleRonri();
			nRet = setCond( srch );
			break;
		case 11:
			initSmenDBCond();
			nRet = checkSmenDBCond();
			if ( nRet )
				break;
			setSmenDBRonri();
			nRet = setCond( srch );
			break;
		case 12:
			initTopicCond();
			nRet = checkTopicCond();
			if ( nRet )
				break;
			setTopicRonri();
			nRet = setCond( srch );
			break;
		default:
			break;
	}
	if ( nRet ) {
		document.search.btnSearch.disabled = false;
		return false;
	}
	else {
		document.search.target = "Introduce";
		document.search.action = actn;
		return true;
	}
}


/*		¸¡º÷¤ò¼Â¹Ô¤¹¤ë¡Ê»æÌÌ¥¤¥á¡¼¥¸¥«¥ì¥ó¥À¡¼ÍÑ¡Ë		*/

function execCalSearchSubmit( actn, srch, date )
{
	var pDate;
	var pYear, pMonth;

	if ( date != "" ) {
		pDate = new Date();
		pYear = pDate.getYear();
		pMonth = pDate.getMonth() + 1;
		document.search.calYear.value = pYear;
		document.search.calMonth.value = pMonth;

		setIssueDate_Cal( date );
		execSearchSubmit( actn, srch );
	}
}


/*		¸¡º÷¤ò¼Â¹Ô¤¹¤ë( °ìÍ÷²èÌÌÍÑ )		*/

function execResearchSubmit( actn, srch )
{
	var nRet = 0;

	document.search.btnSearch.disabled = true;
	document.search.srchflg.value = "ON";
	switch ( srch ) {
		case 1:
			initTopicSimpleCondR();
			nRet = checkTopicSimpleCond();
			if ( nRet )
				break;
			nRet = setTopicSimpleRonri();
			if ( nRet )
				break;
			nRet = setCond( srch );
			break;
		case 2:
			initTopicPowerCondR();
			nRet = checkTopicPowerCondR();
			if ( nRet )
				break;
			nRet = setTopicPowerRonri();
			if ( nRet )
				break;
			nRet = setCond( srch );
			break;
		case 3:
			initChiezoCondR();
			nRet = checkChiezoCond();
			if ( nRet )
				break;
			nRet = setChiezoRonri();
			if ( nRet )
				break;
			nRet = setCond( srch );
			break;
		case 6:
			initTopicSimpleCondR();
			nRet = checkTopicSimpleCond();
			if ( nRet )
				break;
			nRet = setTopicSimpleRonri();
			if ( nRet )
				break;
			nRet = setCond( srch );
			break;
		case 11:
			initSmenDBCondR();
			nRet = checkSmenDBCondR();
			if ( nRet )
				break;
			nRet = setSmenDBRonri();
			if ( nRet )
				break;
			nRet = setCond( srch );
			break;
		case 12:
			initTopicCondR();
			nRet = checkTopicCondR();
			if ( nRet )
				break;
			nRet = setTopicRonri();
			if ( nRet )
				break;
			setTopicRonri();
			nRet = setCond( srch );
			break;
		default:
			break;
	}
	if ( nRet ) {
		document.search.btnSearch.disabled = false;
		return false;
	}
	else {
		document.search.target = "Introduce";
		document.search.action = actn;
		return true;
	}
}


/*		¸¡º÷¾ò·ï¤òHIDDEN¥Õ¥£¡¼¥ë¥É¤Ë¥»¥Ã¥È¤¹¤ë¡Ê·ÇºÜµ­»ö¥·¥ó¥×¥ëÍÑ¡Ë		*/

function initTopicSimpleCond()
{
	document.search.ronri.value = "";
	document.search.hdnSrchItem.value = "M_H";
	setWord();
	makeParamKeyword();
	if ( document.search.rdoSrchTerm[0].checked )
		document.search.hdnSrchTerm.value = document.search.rdoSrchTerm[0].value;
	else if ( document.search.rdoSrchTerm[1].checked )
		document.search.hdnSrchTerm.value = document.search.rdoSrchTerm[1].value;
	else if ( document.search.rdoSrchTerm[2].checked )
		document.search.hdnSrchTerm.value = document.search.rdoSrchTerm[2].value;
	else if ( document.search.rdoSrchTerm[3].checked )
		document.search.hdnSrchTerm.value = document.search.rdoSrchTerm[3].value;
	setIssueDate(0);
	document.search.hdnDspNum.value = document.search.cmbDspNum.value;
	if ( document.search.rdoDspOrder[0].checked )
		document.search.hdnDspOrder.value = document.search.rdoDspOrder[0].value;
	else
		document.search.hdnDspOrder.value = document.search.rdoDspOrder[1].value;

}


/*		¸¡º÷¾ò·ï¤òHIDDEN¥Õ¥£¡¼¥ë¥É¤Ë¥»¥Ã¥È¤¹¤ë¡Ê·ÇºÜµ­»ö¥·¥ó¥×¥ë¥«¥ì¥ó¥À¡¼ÍÑ¡Ë		*/

function initTopicSimpleCond_Cal()
{
	document.search.ronri.value = "";
	setWord();
	makeParamKeyword();
	setShishi();
	document.search.hdnDspNum.value = document.search.cmbDspNum.value;
	document.search.hdnDspOrder.value = document.search.cmbDspOrder.value;
}


/*		¸¡º÷¾ò·ï¤òHIDDEN¥Õ¥£¡¼¥ë¥É¤Ë¥»¥Ã¥È¤¹¤ë¡Ê·ÇºÜµ­»ö¥Ñ¥ï¥Õ¥ëÍÑ¡Ë		*/

function initTopicPowerCond()
{
	document.search.ronri.value = "";
	if ( document.search.rdoSrchItem[0].checked )
		document.search.hdnSrchItem.value = document.search.rdoSrchItem[0].value;
	else if ( document.search.rdoSrchItem[1].checked )
		document.search.hdnSrchItem.value = document.search.rdoSrchItem[1].value;
	else if ( document.search.rdoSrchItem[2].checked )
		document.search.hdnSrchItem.value = document.search.rdoSrchItem[2].value;
	setWord();
	makeParamKeyword();
	document.search.hdnDate.value = document.search.txtDate.value;
	setIssueDate(1);
	document.search.hdnBunrui.value = document.search.txtBunrui.value;
	setShishi();
	setKan(0);
	setIssueS();
	document.search.hdnMenmei.value = document.search.txtMenmei.value;
	setHochi();
	document.search.hdnDspNum.value = document.search.cmbDspNum.value;
	if ( document.search.rdoDspOrder[0].checked )
		document.search.hdnDspOrder.value = document.search.rdoDspOrder[0].value;
	else
		document.search.hdnDspOrder.value = document.search.rdoDspOrder[1].value;
}


/*		¸¡º÷¾ò·ï¤òHIDDEN¥Õ¥£¡¼¥ë¥É¤Ë¥»¥Ã¥È¤¹¤ë¡ÊÃÎ·ÃÂ¢ÍÑ¡Ë		*/

function initChiezoCond()
{
	document.search.ronri.value = "";
	document.search.hdnSrchItem.value = "M_H";
	setWord();
	makeParamKeyword();
	if ( ( document.search.chkKind[0].checked ) && ( document.search.chkKind[1].checked ) )
		document.search.hdnKind.value = "";
	else if ( document.search.chkKind[0].checked )
		document.search.hdnKind.value = document.search.chkKind[0].value;
	else if ( document.search.chkKind[1].checked )
		document.search.hdnKind.value = document.search.chkKind[1].value;
	else
		document.search.hdnKind.value = "";
	document.search.hdnBunya.value = document.search.txtBunya.value;
	document.search.hdnDspNum.value = document.search.cmbDspNum.value;
}


/*		¸¡º÷¾ò·ï¤òHIDDEN¥Õ¥£¡¼¥ë¥É¤Ë¥»¥Ã¥È¤¹¤ë¡Ê¿ÍÊª£Ä£ÂÍÑ¡Ë		*/

function initJinbutuCond()
{
	document.search.ronri.value = "";
	document.search.hdnSrchItem.value = "M_H";
	setKanji();
	setRuby();
	document.search.hdnKojin.value = "";
	if ( document.search.chkKojin.checked )
		document.search.hdnKojin.value = document.search.chkKojin.value;
	document.search.hdnKatagaki.value = document.search.txtKatagaki.value;
	setBunya();
	document.search.hdnAddress.value = document.search.txtAddress.value;
	document.search.hdnFreeword.value = document.search.txtFreeword.value;
	document.search.hdnBirthday.value = document.search.txtBirthday.value;
	document.search.hdnDspNum.value = document.search.cmbDspNum.value;
	if ( document.search.rdoDspOrder[0].checked )
		document.search.hdnDspOrder.value = document.search.rdoDspOrder[0].value;
	else
		document.search.hdnDspOrder.value = document.search.rdoDspOrder[1].value;
}

/*		¸¡º÷¾ò·ï¤òHIDDEN¥Õ¥£¡¼¥ë¥É¤Ë¥»¥Ã¥È¤¹¤ë¡Ê²£ÃÇ¸¡º÷ÍÑ¡Ë		*/

function initOudanCond()
{
	document.search.ronri.value = "";
	document.search.hdnSrchItem.value = "M_H";
	setWord();
	makeParamKeyword();
	setIssueDate(0);
	document.search.hdnAsahi.value = "";
	document.search.hdnAera.value = "";
	document.search.hdnWeekly.value = "";
	document.search.hdnChiezo.value = "";
	document.search.hdnJinbutu.value = "";
	if ( document.search.chkAsahi.checked )
		document.search.hdnAsahi.value = document.search.chkAsahi.value;
	if ( document.search.chkAera.checked )
		document.search.hdnAera.value = document.search.chkAera.value;
	if ( document.search.chkWeekly.checked )
		document.search.hdnWeekly.value = document.search.chkWeekly.value;
	if ( document.search.chkChiezo.checked )
		document.search.hdnChiezo.value = document.search.chkChiezo.value;
	if ( document.search.chkJinbutu.checked )
		document.search.hdnJinbutu.value = document.search.chkJinbutu.value;
	document.search.hdnDspNum.value = 5;
}

/*		¸¡º÷¾ò·ï¤òHIDDEN¥Õ¥£¡¼¥ë¥É¤Ë¥»¥Ã¥È¤¹¤ë¡Ê»æÌÌ£Ä£ÂÍÑ¡Ë		*/

function initSmenDBCond()
{
	document.search.ronri.value = "";
	if ( document.search.rdoSrchItem[0].checked )
		document.search.hdnSrchItem.value = document.search.rdoSrchItem[0].value;
	else if ( document.search.rdoSrchItem[1].checked )
		document.search.hdnSrchItem.value = document.search.rdoSrchItem[1].value;
	else if ( document.search.rdoSrchItem[2].checked )
		document.search.hdnSrchItem.value = document.search.rdoSrchItem[2].value;
	setWord();
	makeParamKeyword();

	setIssueDate2();
	document.search.hdnBunruiL.value = document.search.txtBunruiL.value;
	document.search.hdnBunruiM.value = document.search.txtBunruiM.value;
	if ( document.search.rdoBunrui[0].checked )
		document.search.hdnBunrui.value = document.search.rdoBunrui[0].value;
	else
		document.search.hdnBunrui.value = document.search.rdoBunrui[1].value;
	setKan(1);
/* DEL 06.02.15
	setKiji();
*/
	document.search.hdnDspNum.value = document.search.cmbDspNum.value;
	if ( document.search.rdoDspOrder[0].checked )
		document.search.hdnDspOrder.value = document.search.rdoDspOrder[0].value;
	else
		document.search.hdnDspOrder.value = document.search.rdoDspOrder[1].value;
}


/*		¸¡º÷¾ò·ï¤òHIDDEN¥Õ¥£¡¼¥ë¥É¤Ë¥»¥Ã¥È¤¹¤ë¡ÊÊ¹Â¢­¶·ÇºÜµ­»öÍÑ¡Ë		*/

function initTopicCond()
{
	document.search.ronri.value = "";
	if ( document.search.rdoSrchMode[0].checked )
		document.search.hdnSrchMode.value = document.search.rdoSrchMode[0].value;
	else
		document.search.hdnSrchMode.value = document.search.rdoSrchMode[1].value;
	setShishi();
	setWord();
	makeParamKeyword();
	if ( document.search.rdoSrchTerm[0].checked )
		document.search.hdnSrchTerm.value = document.search.rdoSrchTerm[0].value;
	else if ( document.search.rdoSrchTerm[1].checked )
		document.search.hdnSrchTerm.value = document.search.rdoSrchTerm[1].value;
	else if ( document.search.rdoSrchTerm[2].checked )
		document.search.hdnSrchTerm.value = document.search.rdoSrchTerm[2].value;
	else if ( document.search.rdoSrchTerm[3].checked )
		document.search.hdnSrchTerm.value = document.search.rdoSrchTerm[3].value;
	setIssueDate(0);
	if ( document.search.hdnSrchMode.value == "0" )
		document.search.hdnSrchItem.value = "M_H";
	else {
		if ( document.search.rdoSrchItem[0].checked )
			document.search.hdnSrchItem.value = document.search.rdoSrchItem[0].value;
		else if ( document.search.rdoSrchItem[1].checked )
			document.search.hdnSrchItem.value = document.search.rdoSrchItem[1].value;
		else if ( document.search.rdoSrchItem[2].checked )
			document.search.hdnSrchItem.value = document.search.rdoSrchItem[2].value;
	}
	document.search.hdnBunrui.value = document.search.txtBunrui.value;
	setKan(0);
	document.search.hdnMenmei.value = document.search.txtMenmei.value;
	setHochi();
	setIssueS();
	document.search.hdnDspNum.value = document.search.cmbDspNum.value;
	if ( document.search.rdoDspOrder[0].checked )
		document.search.hdnDspOrder.value = document.search.rdoDspOrder[0].value;
	else
		document.search.hdnDspOrder.value = document.search.rdoDspOrder[1].value;

	chkSuperfluity();

}


/*		¸¡º÷¾ò·ï¤òHIDDEN¥Õ¥£¡¼¥ë¥É¤Ë¥»¥Ã¥È¤¹¤ë¡Ê·ÇºÜµ­»ö¥·¥ó¥×¥ëºÆ¸¡º÷ÍÑ¡Ë		*/

function initTopicSimpleCondR()
{
	document.search.ronri.value = "";
	setWord();
	makeParamKeyword();
}


/*		¸¡º÷¾ò·ï¤òHIDDEN¥Õ¥£¡¼¥ë¥É¤Ë¥»¥Ã¥È¤¹¤ë¡Ê·ÇºÜµ­»ö¥Ñ¥ï¥Õ¥ëºÆ¸¡º÷ÍÑ¡Ë		*/

function initTopicPowerCondR()
{
	document.search.ronri.value = "";
	setWord();
	makeParamKeyword();
}


/*		¸¡º÷¾ò·ï¤òHIDDEN¥Õ¥£¡¼¥ë¥É¤Ë¥»¥Ã¥È¤¹¤ë¡ÊÃÎ·ÃÂ¢ºÆ¸¡º÷ÍÑ¡Ë		*/

function initChiezoCondR()
{
	document.search.ronri.value = "";
	setWord();
	makeParamKeyword();
}


/*		¸¡º÷¾ò·ï¤òHIDDEN¥Õ¥£¡¼¥ë¥É¤Ë¥»¥Ã¥È¤¹¤ë¡Ê»æÌÌ£Ä£ÂºÆ¸¡º÷ÍÑ¡Ë		*/

function initSmenDBCondR()
{
	document.search.ronri.value = "";
	if ( document.search.rdoSrchItem[0].checked )
		document.search.hdnSrchItem.value = document.search.rdoSrchItem[0].value;
	else if ( document.search.rdoSrchItem[1].checked )
		document.search.hdnSrchItem.value = document.search.rdoSrchItem[1].value;
	else if ( document.search.rdoSrchItem[2].checked )
		document.search.hdnSrchItem.value = document.search.rdoSrchItem[2].value;
	setWord();
	makeParamKeyword();
}


/*		¸¡º÷¾ò·ï¤òHIDDEN¥Õ¥£¡¼¥ë¥É¤Ë¥»¥Ã¥È¤¹¤ë¡ÊÊ¹Â¢­¶·ÇºÜµ­»öºÆ¸¡º÷ÍÑ¡Ë		*/

function initTopicCondR()
{
	document.search.ronri.value = "";
	setWord();
	makeParamKeyword();
}


/*		¹âÉé²Ù¸¡º÷ÍÞ»ß											*/
/*			¢¨¸¡º÷¥­¡¼¥ï¡¼¥É¤Ê¤·¤Î¸¡º÷¤Ï¡¢						*/
/*			¡¡È¯¹ÔÆü¤Î¸¡º÷¾ò·ï¤¬£±Æü¸ÂÄê¤Ç¤¢¤Ã¤¿¾ì¹ç¤Ë¸Â¤ë		*/
function HeavyParaDateCheck()
{
	today = new Date();
	tyy = today.getYear();
	tmm = today.getMonth()+1;
	tdd = today.getDate();
	if ( tmm < 10 )
		todaystr = tyy + "0" + tmm;
	else
		todaystr = tyy + tmm;
	if ( tdd < 10 )
		todaystr = todaystr + "0" + tdd;
	else
		todaystr = todaystr + tdd;

	ret = false;
	issuedate = document.search.hdnIssueDate.value;
	switch ( issuedate.length ) {
		// YYYYMMDD: or :YYYYMMDD
		case 9:
			if ( issuedate.match( /[0-9]{8}:/ ) ) {
				start = issuedate.substring( 0, 8 );
				if ( start == todaystr )
					ret = true;
			}
			break;
		// YYYYMMDD:YYYYMMDD
		case 17:
			start = issuedate.substring( 0, 8 );
			end = issuedate.substring( 9, 18 );
			if ( start == end )
				ret = true;
			break;
		// YYYYMMDD
		case 8:
			ret = true;
			break;
		default:
			break;
	}

	return ret;
}


/*		É¬¿Ü¾ò·ï¤ÎÌ¤ÆþÎÏ¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡Ê·ÇºÜµ­»öÍÑ¡Ë		*/

function checkTopicIndispCond()
{
	var nRet = 0;
	var str;

	if ( document.search.srchKind.value == "rui" ) {
		if ( document.search.hdnWord.value == "" )
			nRet = 10;
	}
	else {
		str = document.search.hdnWord.value;
		str += document.search.hdnIssueDate.value;
		if ( str == "" )
			nRet = 1;
		else if ( document.search.hdnWord.value == "" ) {
			if ( !HeavyParaDateCheck() )
				nRet = 17;
		}
	}

	return nRet;
}


/*		É¬¿Ü¾ò·ï¤ÎÌ¤ÆþÎÏ¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡ÊÃÎ·ÃÂ¢ÍÑ¡Ë		*/

function checkChiezoIndispCond()
{
	var nRet = 0;
	var str;

	str = document.search.hdnWord.value;
	str += document.search.hdnBunya.value;
	if ( str == "" )
		nRet = 15;

	return nRet;
}


/*		É¬¿Ü¾ò·ï¤ÎÌ¤ÆþÎÏ¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡Ê¿ÍÊª£Ä£ÂÍÑ¡Ë		*/

function checkJinbutuIndispCond()
{
	var nRet = 0;
	var str;

	str = document.search.hdnKanji.value;
	str += document.search.hdnRuby.value;
	if ( str == "" )
		nRet = 12;

	return nRet;
}


/*		É¬¿Ü¾ò·ï¤ÎÌ¤ÆþÎÏ¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡Ê²£ÃÇ¸¡º÷ÍÑ¡Ë		*/

function checkOudanIndispCond()
{
	var nRet = 0;
	var str;

	str = document.search.hdnWord.value;
	str += document.search.hdnIssueDate.value;
	if ( str == "" ) {
		if ( ( document.search.hdnAsahi.value.length == 0 ) &&
			( document.search.hdnAera.value.length == 0 ) &&
			( document.search.hdnWeekly.value.length == 0 ) &&
			( ( document.search.hdnChiezo.value == 1 ) ||
			( document.search.hdnJinbutu.value == 1 ) ) )
			nRet = 10;
		else
			nRet = 1;
	}
	else if ( ( document.search.hdnAsahi.value.length == 0 ) &&
		( document.search.hdnAera.value.length == 0 ) &&
		( document.search.hdnWeekly.value.length == 0 ) &&
		( document.search.hdnChiezo.value != 1 ) &&
		( document.search.hdnJinbutu.value != 1 ) )
		nRet = 11;
	else if ( document.search.hdnChiezo.value == 1 ) {
		if ( document.search.hdnWord.value == "" )
			nRet = 10;
	}
	else if ( document.search.hdnJinbutu.value == 1 ) {
		if ( document.search.hdnWord.value == "" )
			nRet = 10;
	}

	return nRet;
}


/*		É¬¿Ü¾ò·ï¤ÎÌ¤ÆþÎÏ¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡Ê»æÌÌ£Ä£ÂÍÑ¡Ë		*/

function checkSmenDBIndispCond()
{
	var nRet = 0;

	str = document.search.hdnWord.value;
	fy = document.search.hdnIDFy.value;
	fm = document.search.hdnIDFm.value;
	fd = document.search.hdnIDFd.value;
	dm = document.search.hdnIDDm.value;
	ty = document.search.hdnIDTy.value;
	tm = document.search.hdnIDTm.value;
	td = document.search.hdnIDTd.value;
	issue = setDate( fy, fm, fd, dm, ty, tm, td );
	str += issue;
	str += document.search.hdnBunruiL.value;
	str += document.search.hdnBunruiM.value;
	if ( str == "" )
		nRet = 16;

	return nRet;
}


/*		¥Æ¥­¥¹¥È¥Õ¥£¡¼¥ë¥É¤ÎÆþÎÏÊ¸»ú¤ò¥Á¥§¥Ã¥¯¤¹¤ë			*/
/*			kind :	1=£±Ê¸»úÆþÎÏ¤òµö²Ä						*/
/*					2=£±Ê¸»úÆþÎÏ¤òµö²Ä¤·¤Ê¤¤¡Ê¸¡º÷¸ìÍÑ¡Ë	*/
/*			mode :	0=ASCII¥³¡¼¥É¤Ï¥¨¥é¡¼ÆþÎÏ				*/

function checkTextFieldCond( text, kind, mode )
{
	var nRet = 0;
	var flg;
	var i, sp;
	var str;

	while ( !nRet ) {
		flg = text.match( /^[#&+)]/ );
		if ( flg ) {
			nRet = 4;
			break;
		}
		flg = text.match( /[#&+(]$/ );
		if ( flg ) {
			nRet = 4;
			break;
		}
		nRet = checkRonri( text );
		if ( nRet )
			break;
		sp = 0;
		str = text.charAt( 0 );
		if ( str == "(" )
			sp = 1;
		for ( i=sp; i<text.length; i++ ) {
			str = text.charAt( i );
			if ( str == "+" || str == "&" || str == "#" || str == "(" || str == ")" ) {
				if ( i != sp ) {
					term = text.substring( sp, i );
					if ( kind == 1 )
						nRet = checkText( term, mode );
					else if ( kind == 2 )
						nRet = checkWord( term, mode );
					if ( nRet )
						break;
				}
				sp = i + 1;
			}
		}

		if ( !nRet && str != ")" ) {
			term = text.substring( sp, i );
			if ( kind == 1 )
				nRet = checkText( term, mode );
			else if ( kind == 2 )
				nRet = checkWord( term, mode );
		}
		break;
	}
	return nRet;
}


/*		ÆþÎÏÊ¸»ú¤ò¥Á¥§¥Ã¥¯¤¹¤ë					*/
/*			mode :	0=ASCII¥³¡¼¥É¤Ï¥¨¥é¡¼ÆþÎÏ	*/

function checkText( text, mode )
{
	var nRet = 0;
	var len, j;
	var c;

	len = text.length;
	for ( j=0; j<len; j++ ) {
		c = text.charCodeAt(j);
		if ( ( c >= 0x00 && c <= 0x1F ) || ( c == 0x7F ) || ( c == 0x3C ) || ( c == 0x3E ) ) {
			nRet = 2;
			break;
		}
		else if ( c >= 0x20 && c <= 0x7E ) {
			if ( mode == 0 ) {
				nRet = 2;
				break;
			}
		}
		else if ( c >= 0xFF61 && c <= 0xFF9F ) {
			nRet = 2;
			break;
		}
	}
	return nRet;
}


/*		ÆþÎÏÊ¸»ú¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡Ê¸¡º÷¸ìÍÑ¡Ë		*/
/*			mode :	0=ASCII¥³¡¼¥É¤Ï¥¨¥é¡¼ÆþÎÏ	*/

function checkWord( text, mode )
{
	var nRet = 0;
	var len, j;
	var c;

	len = text.length;
	if ( len == 1 ) {
		c = text.charCodeAt(0);
		if ( ( !( c >= 0x4E00 && c <= 0xFA2D ) ) && ( c != 0xFF1D ) && ( c != 0xFF0F ) ) {
			nRet = 3;
		}
	}
	else {
		for ( j=0; j<len; j++ ) {
			c = text.charCodeAt(j);
			if ( ( c >= 0x00 && c <= 0x1F ) || ( c == 0x7F ) || ( c == 0x3C ) || ( c == 0x3E ) ) {
				nRet = 2;
				break;
			}
			else if ( c >= 0x20 && c <= 0x7E ) {
				if ( mode == 0 ) {
					nRet = 2;
					break;
				}
			}
			else if ( c >= 0xFF61 && c <= 0xFF9F ) {
				nRet = 2;
				break;
			}
		}
	}
	return nRet;
}


/*		ÏÀÍý¼°¤ò¥Á¥§¥Ã¥¯¤¹¤ë		*/

function checkRonri( text )
{
	var nRet = 0;
	var len, kcnt = 0;
	var str, aft;

	len = text.length - 1;

	for ( i=0; i<len; i++ ) {
		str = text.charAt( i );
		aft = text.charAt( i+1 );
		if ( str == "+" ) {
			if ( aft == "+" || aft == "&" || aft == "#" || aft == ")" ) {
				nRet = 4;
				break;
			}
		}
		else if ( str == "&" ) {
			if ( aft == "+" || aft == "&" || aft == "#" || aft == ")" ) {
				nRet = 4;
				break;
			}
		}
		else if ( str == "#" ) {
			if ( aft == "+" || aft == "&" || aft == "#" || aft == ")" ) {
				nRet = 4;
				break;
			}
		}
		else if ( str == "(" ) {
			if ( aft == "+" || aft == "&" || aft == ")" ) {
				nRet = 4;
				break;
			}
			if ( kcnt >= 2 ) {
				nRet = 9;
				break;
			}
			kcnt++;
		}
		else if ( str == ")" ) {
			if ( aft == "(" ) {
				nRet = 4;
				break;
			}
			kcnt--;
			if ( kcnt < 0 ) {
				nRet = 5;
				break;
			}
		}
	}
	str = text.charAt( i );
	if ( str == ")" )
		kcnt--;
	if ( kcnt )
		nRet = 5;
	return nRet;
}


/*		ÏÀÍý¼°¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡ÊÆüÉÕ¡¦Ê¸»ú¿ôÍÑ¡Ë		*/

function checkRonri2( text )
{
	var nRet = 0;
	var len, kcnt = 0;
	var str, aft;

	len = text.length - 1;
	for ( i=0; i<len; i++ ) {
		str = text.charAt( i );
		aft = text.charAt( i+1 );
		if ( str == "+" ) {
			if ( aft == "+" || aft == "&" || aft == "#" || aft == ":" ) {
				nRet = 4;
				break;
			}
			kcnt = 0;
		}
		else if ( str == "&" ) {
			if ( aft == "+" || aft == "&" || aft == "#" || aft == ":" ) {
				nRet = 4;
				break;
			}
			kcnt = 0;
		}
		else if ( str == "#" ) {
			if ( aft == "+" || aft == "&" || aft == "#" || aft == ":" ) {
				nRet = 4;
				break;
			}
			kcnt = 0;
		}
		else if ( str == ":" ) {
			if ( aft == "+" || aft == "&" || aft == "#" || aft == ":" ) {
				nRet = 4;
				break;
			}
			kcnt++;
			if ( kcnt > 1 ) {
				nRet = 8;
				break;
			}
		}
	}
	str = text.charAt( i );
	if ( kcnt > 1 )
		nRet = 8;
	return nRet;
}


/*		Â¸ºß¤¹¤ëÆüÉÕ¤«¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡ÊÆüÉÕÍÑ¡Ë		*/

function checkDate( str )
{
	var nRet;
	var buf;
	var year, month, date, lastdate;

	buf = str.substring( 0, 4 );
	year = eval( buf );
	buf = str.substring( 4, 6 );
	month = eval( buf );
	buf = str.substring( 6, 8 );
	date = eval( buf );
	if ( month != 0 && date != 0 ) {
		if ( month < 1 || month > 12 )
			nRet = 6;
		lastdate = getMonthFinalDate( year, month );
		if ( date < 1 || date > lastdate )
			nRet = 6;
	}
	return nRet;
}

/*		¿ôÃÍ¤Î·å¿ô¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡ÊÆüÉÕÍÑ¡Ë		*/

function checkNumLen( text )
{
	var nRet =0;
	var i, sp = 0;
	var from = "", to = "", str;

	for ( i=sp; i<text.length; i++ ) {
		str = text.charAt( i );
		if ( str == "+" || str == "&" || str == "#" || str == ":" ) {
			if ( i != sp ) {
				str = text.substring( sp, i );
				if ( str.length != 8 ) {
					nRet = 6;
					break;
				}
				else if ( str.length == 8 ) {
					checkDate( str );
					from = str.substring( 0, 4 ) + "/" + str.substring( 4, 6 ) + "/" + str.substring( 6, 8 );
				}
			}
			sp = i + 1;
		}
	}

	if ( !nRet && sp < text.length ) {
		str = text.substring( sp, i );
		if ( str.length != 8 )
			nRet = 6;
		else if ( str.length == 8 ) {
			checkDate( str );
			to = str.substring( 0, 4 ) + "/" + str.substring( 4, 6 ) + "/" + str.substring( 6, 8 );
			if ( Date.parse(from) > Date.parse(to) )
				nRet = 6;
		}
	}

	if ( ( text.length != 0 ) && ( from.length == 0 ) && ( to.length == 0 ) )
		nRet = 6;

	return nRet;
}

/*		¥Æ¥­¥¹¥È¥Õ¥£¡¼¥ë¥É¤ÎÆþÎÏÊ¸»ú¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡ÊÆüÉÕÍÑ¡Ë		*/

function checkTextFieldCond_Date( text )
{
	var nRet = 0;
	var flg;

	while ( 1 ) {
		flg = text.match(/[^0-9:#&+]/);
		if ( flg ) {
			nRet = 2;
			break;
		}
		flg = text.match(/^[#&+]/);
		if ( flg ) {
			nRet = 4;
			break;
		}
		flg = text.match(/[#&+]$/);
		if ( flg ) {
			nRet = 4;
			break;
		}
		nRet = checkRonri2( text );
		if ( nRet )
			break;
		nRet = checkNumLen( text );
		break;
	}
	return nRet;
}


/*		¥Æ¥­¥¹¥È¥Õ¥£¡¼¥ë¥É¤ÎÆþÎÏÊ¸»ú¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡Ê¿ÍÊª£Ä£Â¡¦À¸Ç¯·îÆüÍÑ¡Ë		*/

function checkTextFieldCond_Date2( text )
{
	var nRet = 0;
	if ( ( text.length == 2 ) && ( text.match(/[0-9]{2}/) ) )
		nRet = 0;
	else if ( ( text.length == 4 ) && ( text.match(/[0-9]{4}/) ) )
		nRet = 0;
	else if ( ( text.length == 5 ) && ( text.match(/[0-9]{2}\.[0-9]{2}/) ) )
		nRet = 0;
	else if ( ( text.length == 7 ) && ( text.match(/[0-9]{4}\.[0-9]{2}/) ) )
		nRet = 0;
	else if ( ( text.length == 10 ) && ( text.match(/[0-9]{4}\.[0-9]{2}\.[0-9]{2}/) ) )
		nRet = 0;
	else
		nRet = 6;

	return nRet;
}


/*		¥Æ¥­¥¹¥È¥Õ¥£¡¼¥ë¥É¤ÎÆþÎÏÊ¸»ú¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡Ê¿ÍÊª£Ä£Â¡¦Ê¬Ìî¥³¡¼¥ÉÍÑ¡Ë		*/

function checkTextFieldCond_Code( text )
{
	var nRet = 0;
	var i;

	if ( text.match(/[^0-9 ]/) ) {
		nRet = 13;
		return nRet;
	}
	var code_array = text.split(" ");
	for ( i=0; i<code_array.length; i++ ) {
		if ( code_array[i].length != 3 ) {
			nRet = 13;
			return nRet;
		}
	}
	return nRet;
}


/*		¸¡º÷¾ò·ï¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡Ê·ÇºÜµ­»ö¥·¥ó¥×¥ëÍÑ¡Ë		*/

function checkTopicSimpleCond()
{
	var nRet = 0;

	while ( 1 ) {
		nRet = checkTopicIndispCond();
		if ( nRet ) {
			ErrMsg( nRet, "" );
			break;
		}
		if ( document.search.hdnWord.value.length > 0 ) {
			nRet = checkTextFieldCond( document.search.hdnWord.value, 2, 1 );
			if ( nRet ) {
				ErrMsg( nRet, "¸¡º÷¸ì" );
				break;
			}
		}
		if ( document.search.hdnIssueDate.value.length > 0 ) {
			nRet = checkTextFieldCond_Date( document.search.hdnIssueDate.value );
			if ( nRet ) {
				ErrMsg( nRet, "È¯¹ÔÆü" );
				break;
			}
		}

		break;
	}
	return nRet;
}


/*		¸¡º÷¾ò·ï¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡Ê·ÇºÜµ­»ö¥Ñ¥ï¥Õ¥ëÍÑ¡Ë		*/

function checkTopicPowerCond()
{
	var nRet = 0;

	while ( 1 ) {
		nRet = checkTopicIndispCond();
		if ( nRet ) {
			ErrMsg( nRet, "" );
			break;
		}
		if ( document.search.srchKind.value == "rui" ) {
			if ( document.search.hdnWord.value.length > 512 ) {
				nRet = 7;
				ErrMsg( nRet, "¸¡º÷¸ì-Îà»÷¸¡º÷" );
				break;
			}
			nRet = checkText( document.search.hdnWord.value, 0 );
			if ( nRet ) {
				ErrMsg( nRet, "¸¡º÷¸ì-Îà»÷¸¡º÷" );
				break;
			}
		}
		else {
			if ( document.search.hdnWord.value.length > 0 ) {
				nRet = checkTextFieldCond( document.search.hdnWord.value, 2, 1 );
				if ( nRet ) {
					ErrMsg( nRet, "¸¡º÷¸ì" );
					break;
				}
			}
			if ( document.search.hdnIssueDate.value.length > 0 ) {
				nRet = checkTextFieldCond_Date( document.search.hdnIssueDate.value );
				if ( nRet ) {
					ErrMsg( nRet, "È¯¹ÔÆü" );
					break;
				}
			}
			if ( document.search.hdnBunrui.value.length > 0 ) {
				nRet = checkTextFieldCond( document.search.hdnBunrui.value, 1, 0 );
				if ( nRet ) {
					ErrMsg( nRet, "Ê¬Îà" );
					break;
                }
            }
			if ( document.search.hdnMenmei.value.length > 0 ) {
				nRet = checkTextFieldCond( document.search.hdnMenmei.value, 1, 0 );
				if ( nRet ) {
					ErrMsg( nRet, "ÌÌÌ¾" );
					break;
				}
			}
		}

		break;
	}
	return nRet;
}


/*		¸¡º÷¾ò·ï¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡ÊÃÎ·ÃÂ¢ÍÑ¡Ë		*/

function checkChiezoCond()
{
	var nRet = 0;

	while ( 1 ) {
		nRet = checkChiezoIndispCond();
		if ( nRet ) {
			ErrMsg( nRet, "" );
			break;
		}
		if ( document.search.hdnWord.value.length > 0 ) {
			nRet = checkTextFieldCond( document.search.hdnWord.value, 2, 1 );
			if ( nRet ) {
				ErrMsg( nRet, "¸¡º÷¸ì" );
				break;
			}
		}
		if ( document.search.hdnBunya.value.length > 0 ) {
			nRet = checkTextFieldCond( document.search.hdnBunya.value, 1, 0 );
			if ( nRet ) {
				ErrMsg( nRet, "Ê¬Ìî¡¦ÉôÌç" );
				break;
			}
		}

		break;
	}
	return nRet;
}


/*		¸¡º÷¾ò·ï¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡Ê¿ÍÊª£Ä£ÂÍÑ¡Ë		*/

function checkJinbutuCond()
{
	var nRet = 0;

	while ( 1 ) {
		nRet = checkJinbutuIndispCond();
		if ( nRet ) {
			ErrMsg( nRet, "" );
			break;
		}
		if ( document.search.hdnKanji.value.length > 0 ) {
			nRet = checkTextFieldCond( document.search.hdnKanji.value, 1, 0 );
			if ( nRet ) {
				ErrMsg( nRet, "»áÌ¾¡Ê´Á»ú¡Ë" );
				break;
			}
		}
		if ( document.search.hdnRuby.value.length > 0 ) {
			nRet = checkTextFieldCond( document.search.hdnRuby.value, 1, 0 );
			if ( nRet ) {
				ErrMsg( nRet, "»áÌ¾¡Ê¤Ò¤é¤¬¤Ê¡Ë" );
				break;
			}
		}
		if ( document.search.hdnBunya.value.length > 0 ) {
			nRet = checkTextFieldCond_Code( document.search.hdnBunya.value );
			if ( nRet ) {
				ErrMsg( nRet, "Ê¬Ìî¥³¡¼¥É" );
				break;
			}
		}
		if ( document.search.hdnKatagaki.value.length > 0 ) {
			nRet = checkTextFieldCond( document.search.hdnKatagaki.value, 2, 1 );
			if ( nRet ) {
				ErrMsg( nRet, "¸ª½ñ¤­" );
				break;
			}
		}
		if ( document.search.hdnAddress.value.length > 0 ) {
			nRet = checkTextFieldCond( document.search.hdnAddress.value, 2, 1 );
			if ( nRet ) {
				ErrMsg( nRet, "½»½ê" );
				break;
			}
		}
		if ( document.search.hdnFreeword.value.length > 0 ) {
			nRet = checkTextFieldCond( document.search.hdnFreeword.value, 2, 1 );
			if ( nRet ) {
				ErrMsg( nRet, "¥Õ¥ê¡¼¥ï¡¼¥É" );
				break;
			}
		}
		if ( document.search.hdnBirthday.value.length > 0 ) {
			nRet = checkTextFieldCond_Date2( document.search.hdnBirthday.value );
			if ( nRet ) {
				ErrMsg( nRet, "À¸Ç¯·îÆü" );
				break;
			}
		}

		break;
	}
	return nRet;
}


/*		¸¡º÷¾ò·ï¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡Ê²£ÃÇ¸¡º÷ÍÑ¡Ë		*/

function checkOudanCond()
{
	var nRet = 0;

	while ( 1 ) {
		nRet = checkOudanIndispCond();
		if ( nRet ) {
			ErrMsg( nRet, "" );
			break;
		}
		if ( document.search.hdnWord.value.length > 0 ) {
			nRet = checkTextFieldCond( document.search.hdnWord.value, 2, 1 );
			if ( nRet ) {
				ErrMsg( nRet, "¸¡º÷¸ì" );
				break;
			}
		}
		if ( document.search.hdnIssueDate.value.length > 0 ) {
			nRet = checkTextFieldCond_Date( document.search.hdnIssueDate.value );
			if ( nRet ) {
				ErrMsg( nRet, "È¯¹ÔÆü" );
				break;
			}
		}

		break;
	}
	return nRet;
}


/*		¸¡º÷¾ò·ï¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡Ê»æÌÌ£Ä£ÂÍÑ¡Ë		*/

function checkSmenDBCond()
{
	var nRet = 0;

	while ( 1 ) {
		nRet = checkSmenDBIndispCond();
		if ( nRet ) {
			ErrMsg( nRet, "" );
			break;
		}
		if ( document.search.hdnWord.value.length > 0 ) {
			nRet = checkTextFieldCond( document.search.hdnWord.value, 2, 1 );
			if ( nRet ) {
				ErrMsg( nRet, "¸¡º÷¸ì" );
				break;
			}
		}
		if ( document.search.hdnIssueDate.value.length > 0 ) {
			nRet = checkTextFieldCond_Date( document.search.hdnIssueDate.value );
			if ( nRet ) {
				ErrMsg( nRet, "È¯¹ÔÆü" );
				break;
			}
		}
		if ( document.search.hdnIssueDate2.value.length > 0 ) {
			nRet = checkTextFieldCond_Date( document.search.hdnIssueDate2.value );
			if ( nRet ) {
				ErrMsg( nRet, "È¯¹ÔÆü" );
				break;
			}
		}
		if ( document.search.hdnBunruiL.value.length > 0 ) {
			nRet = checkTextFieldCond( document.search.hdnBunruiL.value, 1, 0 );
			if ( nRet ) {
				ErrMsg( nRet, "ÂçÊ¬Îà" );
				break;
			}
		}
		if ( document.search.hdnBunruiM.value.length > 0 ) {
			nRet = checkTextFieldCond( document.search.hdnBunruiM.value, 1, 0 );
			if ( nRet ) {
				ErrMsg( nRet, "ÃæÊ¬Îà" );
				break;
			}
		}

		break;
	}
	return nRet;
}


/*		¸¡º÷¾ò·ï¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡ÊÊ¹Â¢­¶·ÇºÜµ­»öÍÑ¡Ë		*/

function checkTopicCond()
{
	var nRet = 0;

	while ( 1 ) {
		nRet = checkTopicIndispCond();
		if ( nRet ) {
			ErrMsg( nRet, "" );
			break;
		}
		if ( document.search.hdnWord.value.length > 0 ) {
			nRet = checkTextFieldCond( document.search.hdnWord.value, 2, 1 );
			if ( nRet ) {
				ErrMsg( nRet, "¸¡º÷¸ì" );
				break;
			}
		}
		if ( document.search.hdnIssueDate.value.length > 0 ) {
			nRet = checkTextFieldCond_Date( document.search.hdnIssueDate.value );
			if ( nRet ) {
				ErrMsg( nRet, "È¯¹ÔÆü" );
				break;
			}
		}
		if ( document.search.hdnBunrui.value.length > 0 ) {
			nRet = checkTextFieldCond( document.search.hdnBunrui.value, 1, 0 );
			if ( nRet ) {
				if ( document.search.hdnSrchMode.value == "0" ) {
					document.search.hdnBunrui.value = "";
					nRet = 0;
				}
				else {
					ErrMsg( nRet, "Ê¬Îà" );
					break;
				}
			}
		}
		if ( document.search.hdnMenmei.value.length > 0 ) {
			nRet = checkTextFieldCond( document.search.hdnMenmei.value, 1, 0 );
			if ( nRet ) {
				if ( document.search.hdnSrchMode.value == "0" ) {
					document.search.hdnMenmei.value = "";
					nRet = 0;
				}
				else {
					ErrMsg( nRet, "ÌÌÌ¾" );
					break;
				}
			}
		}

		break;
	}
	return nRet;
}


/*		¸¡º÷¾ò·ï¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡Ê·ÇºÜµ­»öºÆ¸¡º÷ÍÑ¡Ë		*/

function checkTopicPowerCondR()
{
	var nRet = 0;

	while ( 1 ) {
		nRet = checkTopicIndispCond();
		if ( nRet ) {
			ErrMsg( nRet, "" );
			break;
		}
		if ( document.search.srchKind.value == "rui" ) {
			if ( document.search.hdnWord.value.length > 512 ) {
				nRet = 7;
				ErrMsg( nRet, "¸¡º÷¸ì-Îà»÷¸¡º÷" );
				break;
			}
			nRet = checkText( document.search.hdnWord.value, 0 );
			if ( nRet ) {
				ErrMsg( nRet, "¸¡º÷¸ì-Îà»÷¸¡º÷" );
				break;
			}
		}
		else {
			if ( document.search.hdnWord.value.length > 0 ) {
				nRet = checkTextFieldCond( document.search.hdnWord.value, 2, 1 );
				if ( nRet ) {
					ErrMsg( nRet, "¸¡º÷¸ì-Á´Ê¸¸¡º÷" );
					break;
				}
			}
		}

		break;
	}
	return nRet;
}


/*		¸¡º÷¾ò·ï¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡Ê»æÌÌ£Ä£ÂºÆ¸¡º÷ÍÑ¡Ë		*/

function checkSmenDBCondR()
{
	var nRet = 0;

	while ( 1 ) {
		nRet = checkSmenDBIndispCond();
		if ( nRet ) {
			ErrMsg( nRet, "" );
			break;
		}
		if ( document.search.hdnWord.value.length > 0 ) {
			nRet = checkTextFieldCond( document.search.hdnWord.value, 2, 1 );
			if ( nRet ) {
				ErrMsg( nRet, "¸¡º÷¸ì" );
				break;
			}
		}
		if ( document.search.hdnIssueDate.value.length > 0 ) {
			nRet = checkTextFieldCond_Date( document.search.hdnIssueDate.value );
			if ( nRet ) {
				ErrMsg( nRet, "È¯¹ÔÆü" );
				break;
			}
		}

		break;
	}
	return nRet;
}


/*		¸¡º÷¾ò·ï¤ò¥Á¥§¥Ã¥¯¤¹¤ë¡ÊÊ¹Â¢­¶·ÇºÜµ­»öºÆ¸¡º÷ÍÑ¡Ë		*/

function checkTopicCondR()
{
	var nRet = 0;

	while ( 1 ) {
		nRet = checkTopicIndispCond();
		if ( nRet ) {
			ErrMsg( nRet, "" );
			break;
		}
		if ( document.search.hdnWord.value.length > 0 ) {
			nRet = checkTextFieldCond( document.search.hdnWord.value, 2, 1 );
			if ( nRet ) {
				ErrMsg( nRet, "¸¡º÷¸ì" );
				break;
			}
		}

		break;
	}
	return nRet;
}


/*		È¯¹ÔÆü¤ò¥³¥ó¥Ü¥Ü¥Ã¥¯¥¹¤«¤é¥Æ¥­¥¹¥È·Á¼°¤ËÊÑ´¹¤¹¤ë		*/

function setIssueDate(mode)
{
	var fy, fm, fd, dm, ty, tm, td;
	var issue, new_issue, new_issue2, term, str;
	var start, end, _start, _end;
	var from, to, _from, _to;
	var sp, flag, i;
	var today;
	var t_year, t_mon, t_day;

	if ( mode == 0 ) {
		document.search.hdnIDFy.value = document.search.cmbIDFy.value;
		document.search.hdnIDFm.value = document.search.cmbIDFm.value;
		document.search.hdnIDFd.value = document.search.cmbIDFd.value;
		document.search.hdnIDDm.value = document.search.cmbIDDm.value;
		document.search.hdnIDTy.value = document.search.cmbIDTy.value;
		document.search.hdnIDTm.value = document.search.cmbIDTm.value;
		document.search.hdnIDTd.value = document.search.cmbIDTd.value;
		fy = document.search.cmbIDFy.value;
		fm = document.search.cmbIDFm.value;
		fd = document.search.cmbIDFd.value;
		dm = document.search.cmbIDDm.value;
		ty = document.search.cmbIDTy.value;
		tm = document.search.cmbIDTm.value;
		td = document.search.cmbIDTd.value;

		if ( dm == "FROM" && fy != "default" && fm == "default" && fd == "default" ) {
			fm = "01";
			fd = "01";
		}
		if ( dm == "FROM" && ty != "default" && tm == "default" && td == "default" ) {
			tm = "12";
			td = "31";
		}
		if ( dm == "ONLY" && fy != "default" && fm == "default" && fd == "default" ) {
			fm = "01";
			fd = "01";
			dm = "FROM";
			ty = fy;
			tm = "12";
			td = "31";
		}
		if ( dm == "TILL" && fy != "default" && fm == "default" && fd == "default" ) {
			fm = "12";
			fd = "31";
		}

		if ( dm == "FROM" && fy != "default" && fm != "default" && fd == "default" ) {
			fd = "01";
		}
		if ( dm == "FROM" && ty != "default" && tm != "default" && td == "default" ) {
			td = getMonthFinalDate( ty, tm );
		}
		if ( dm == "ONLY" && fy != "default" && fm != "default" && fd == "default" ) {
			fd = "01";
			dm = "FROM";
			ty = fy;
			tm = fm;
			td = getMonthFinalDate( ty, tm );
		}
		if ( dm == "TILL" && fy != "default" && fm != "default" && fd == "default" ) {
			fd = getMonthFinalDate( fy, fm );
		}

		issue = setDate( fy, fm, fd, dm, ty, tm, td );
	}
	else
		issue = document.search.hdnDate.value;

	new_issue = "";
	if ( ( document.search.srchId.value == "1" ) || ( document.search.srchId.value == "12" ) )
		term = document.search.hdnSrchTerm.value;
	else
		term = "0";
	if ( issue.length != 0 )
		term = "0";
	start = document.search.hdnSrchStart.value;
	end = document.search.hdnSrchEnd.value;

	sp = 0;
	flag = 0;
	str = "";
	from = "";
	to = "";
	if ( issue.length == 8 ) {
		from = issue.substring( 0, 8 );
		sp = 8 + 1;
	}
	else {
		for ( i=0; i<issue.length; i++ ) {
			str = issue.charAt( i );
			if ( str == ":" ) {
				flag = 1;
				from = issue.substring( sp, i );
				sp = i + 1;
				break;
			}
		}
	}
	if ( sp < issue.length )
		to = issue.substring( sp, issue.length );

	_from = "";
	_to = "";
	_start = "";
	_end = "";
	if ( from.length == 8 )
		_from = from.substring( 0, 4 ) + "/" + from.substring( 4, 6 ) + "/" + from.substring( 6, 8 );
	if ( to.length == 8 )
		_to = to.substring( 0, 4 ) + "/" + to.substring( 4, 6 ) + "/" + to.substring( 6, 8 );
	if ( start.length == 8 )
		_start = start.substring( 0, 4 ) + "/" + start.substring( 4, 6 ) + "/" + start.substring( 6, 8 );
	if ( end.length == 8 )
		_end = end.substring( 0, 4 ) + "/" + end.substring( 4, 6 ) + "/" + end.substring( 6, 8 );

	switch ( term ) {
		case "0":
			if ( from.length == 0 && start.length == 0 )
				;
			else if ( from.length == 0 && start.length == 8 )
				new_issue = start;
			else if ( from.length == 8 && start.length == 0 ) {
				if ( end.length == 8 && ( Date.parse(_from) >= Date.parse(_end) ) )
					new_issue = end;
				else
					new_issue = from;
			}
			else if ( from.length == 8 && start.length == 8 ) {
				if ( Date.parse(_from) <= Date.parse(_start) )
					new_issue = start;
				else if ( end.length == 8 && ( Date.parse(_from) >= Date.parse(_end) ) )
					new_issue = end;
				else
					new_issue = from;
			}
			else if ( from.length != 0 && from.length != 8 )
				new_issue = from;

			if ( to.length == 0 && end.length == 0 ) {
				if ( flag == 1 )
					new_issue = new_issue + ":";
				else if ( mode == 1 && issue.length == 0 && new_issue.length == 8 )
					new_issue = new_issue + ":";
			}
			else if ( to.length == 0 && end.length == 8 ) {
				if ( flag == 1 )
					new_issue = new_issue + ":" + end;
				else if ( issue.length == 0 )
					new_issue = new_issue + ":" + end;
			}
			else if ( to.length == 8 && end.length == 0 ) {
				if ( start.length == 8 && ( Date.parse(_to) <= Date.parse(_start) ) )
					new_issue = new_issue + ":" + start;
				else
					new_issue = new_issue + ":" + to;
			}
			else if ( to.length == 8 && end.length == 8 ) {
				if ( Date.parse(_to) >= Date.parse(_end) )
					new_issue = new_issue + ":" + end;
				else if ( start.length == 8 && ( Date.parse(_to) <= Date.parse(_start) ) )
					new_issue = new_issue + ":" + start;
				else
					new_issue = new_issue + ":" + to;
			}
			else if ( to.length != 0 && to.length != 8 ) {
				new_issue = new_issue + ":" + to;
			}

			break;
		case "1":
			today = new Date();
			t_year = today.getFullYear();
			t_mon = today.getMonth()-3+1;
			if ( t_mon <= 0 ) {
				t_mon = t_mon + 12;
				t_year--;
			}
			if ( t_mon < 10 )
				t_mon = "0" + t_mon;
			t_day = today.getDate();
			if ( t_day < 10 )
				t_day = "0" + t_day;
			new_issue2 = t_year + "/" + t_mon + "/" + t_day;
			if ( start.length == 8 && ( Date.parse(new_issue2) <= Date.parse(_start) ) )
				new_issue = start;
			else
				new_issue = t_year + "" + t_mon + "" + t_day;

			if ( end.length == 8 )
				new_issue = new_issue + ":" + end;
			else if ( new_issue.length == 8 && end.length == 0 )
				new_issue = new_issue + ":";

			break;
		case "2":
			today = new Date();
			t_year = today.getFullYear();
			t_mon = today.getMonth()-6+1;
			if ( t_mon <= 0 ) {
				t_mon = t_mon + 12;
				t_year--;
			}
			if ( t_mon < 10 )
				t_mon = "0" + t_mon;
			t_day = today.getDate();
			if ( t_day < 10 )
				t_day = "0" + t_day;
			new_issue2 = t_year + "/" + t_mon + "/" + t_day;
			if ( start.length == 8 && ( Date.parse(new_issue2) <= Date.parse(_start) ) )
				new_issue = start;
			else
				new_issue = t_year + "" + t_mon + "" + t_day;

			if ( end.length == 8 )
				new_issue = new_issue + ":" + end;
			else if ( new_issue.length == 8 && end.length == 0 )
				new_issue = new_issue + ":";

			break;
		case "3":
			today = new Date();
			t_year = today.getFullYear()-1;
			t_mon = today.getMonth()+1;
			if ( t_mon < 10 )
				t_mon = "0" + t_mon;
			t_day = today.getDate();
			if ( t_day < 10 )
				t_day = "0" + t_day;
			new_issue2 = t_year + "/" + t_mon + "/" + t_day;
			if ( start.length == 8 && ( Date.parse(new_issue2) <= Date.parse(_start) ) )
				new_issue = start;
			else
				new_issue = t_year + "" + t_mon + "" + t_day;

			if ( end.length == 8 )
				new_issue = new_issue + ":" + end;
			else if ( new_issue.length == 8 && end.length == 0 )
				new_issue = new_issue + ":";

			break;
		case "4":
			if ( start.length == 8 )
				new_issue = start;

			if ( end.length == 8 )
				new_issue = new_issue + ":" + end;
			else if ( new_issue.length == 8 && end.length == 0 )
				new_issue = new_issue + ":";

			break;
		default:
			break;
	}

	document.search.hdnIssueDate.value = new_issue;

}


/*		È¯¹ÔÆü¤ò¥³¥ó¥Ü¥Ü¥Ã¥¯¥¹¤«¤é¥Æ¥­¥¹¥È·Á¼°¤ËÊÑ´¹¤¹¤ë¡Ê»æÌÌ£Ä£ÂÍÑ¡Ë		*/

function setIssueDate2()
{
	var fy, fm, fd, dm, ty, tm, td;
	var issue, new_issue, new_issue2, str;
	var s1, e1, s2, e2;
	var from, to, _from, _to;
	var sp, flag, i;
	var today;
	var t_year, t_mon, t_day;

	document.search.hdnIDFy.value = document.search.cmbIDFy.value;
	document.search.hdnIDFm.value = document.search.cmbIDFm.value;
	document.search.hdnIDFd.value = document.search.cmbIDFd.value;
	document.search.hdnIDDm.value = document.search.cmbIDDm.value;
	document.search.hdnIDTy.value = document.search.cmbIDTy.value;
	document.search.hdnIDTm.value = document.search.cmbIDTm.value;
	document.search.hdnIDTd.value = document.search.cmbIDTd.value;
	fy = document.search.cmbIDFy.value;
	fm = document.search.cmbIDFm.value;
	fd = document.search.cmbIDFd.value;
	dm = document.search.cmbIDDm.value;
	ty = document.search.cmbIDTy.value;
	tm = document.search.cmbIDTm.value;
	td = document.search.cmbIDTd.value;

	if ( dm == "FROM" && fy != "default" && fm == "default" && fd == "default" ) {
		fm = "01";
		fd = "01";
	}
	if ( dm == "FROM" && ty != "default" && tm == "default" && td == "default" ) {
		tm = "12";
		td = "31";
	}
	if ( dm == "ONLY" && fy != "default" && fm == "default" && fd == "default" ) {
		fm = "01";
		fd = "01";
		dm = "FROM";
		ty = fy;
		tm = "12";
		td = "31";
	}
	if ( dm == "TILL" && fy != "default" && fm == "default" && fd == "default" ) {
		fm = "12";
		fd = "31";
	}

	if ( dm == "FROM" && fy != "default" && fm != "default" && fd == "default" ) {
		fd = "01";
	}
	if ( dm == "FROM" && ty != "default" && tm != "default" && td == "default" ) {
		td = getMonthFinalDate( ty, tm );
	}
	if ( dm == "ONLY" && fy != "default" && fm != "default" && fd == "default" ) {
		fd = "01";
		dm = "FROM";
		ty = fy;
		tm = fm;
		td = getMonthFinalDate( ty, tm );
	}
	if ( dm == "TILL" && fy != "default" && fm != "default" && fd == "default" ) {
		fd = getMonthFinalDate( fy, fm );
	}

	issue = setDate( fy, fm, fd, dm, ty, tm, td );

	new_issue = "";
	new_issue2 = "";
	s1 = document.search.hdnSrchStart1.value;
	e1 = document.search.hdnSrchEnd1.value;
	s2 = document.search.hdnSrchStart2.value;
	e2 = document.search.hdnSrchEnd2.value;
	if ( s1 == "0" )
		s1 = "";
	if ( e1 == "0" )
		e1 = "";
	if ( s2 == "0" )
		s2 = "";
	if ( e2 == "0" )
		e2 = "";

	sp = 0;
	flag = 0;
	str = "";
	from = "";
	to = "";
	if ( issue.length == 8 ) {
		from = issue.substring( 0, 8 );
		sp = 8 + 1;
	}
	else {
		for ( i=0; i<issue.length; i++ ) {
			str = issue.charAt( i );
			if ( str == ":" ) {
				flag = 1;
				from = issue.substring( sp, i );
				sp = i + 1;
				break;
			}
		}
	}
	if ( sp < issue.length )
		to = issue.substring( sp, issue.length );

	if ( ( from != "" ) && ( to == "" ) ) {						/* ÆþÎÏÆüÉÕ£±!=""¡¢ÆþÎÏÆüÉÕ£²=="" */
		if ( ( s1 != "" ) && ( e1 != "" ) ) {					/* SrchStart1!="",SrchEnd1!="" */
			if ( ( s1 <= fy ) && ( fy <= e1 ) ) {				/* SrchStart1<ÆþÎÏÆüÉÕ£±<SrchEnd1 */
				if ( dm == "FROM" )
					new_issue = from + ":" + e1 + "1231";
				else if ( dm == "ONLY" )
					new_issue = from;
				document.search.hdnIssueDate.value = new_issue;
				if ( dm == "FROM" ) {
					if ( ( s2 != "" ) && ( e2 != "" ) ) {		/* SrchStart2!="",SrchEnd2!="" */
						new_issue2 = s2 + "0101:" + e2 + "1231";
						document.search.hdnIssueDate2.value = new_issue2;
					}
				}
			}
		}
		if ( ( s2 != "" ) && ( e2 != "" ) ) {					/* SrchStart2!="",SrchEnd2!="" */
			if ( ( s2 <= fy ) && ( fy <= e2 ) ) {				/* SrchStart2<ÆþÎÏÆüÉÕ£±<SrchEnd2 */
				if ( dm == "FROM" )
					new_issue = from + ":" + e2 + "1231";
				else if ( dm == "ONLY" )
					new_issue = from;
				document.search.hdnIssueDate.value = new_issue;
			}
		}
		if ( ( s1 == "" ) && ( e1 == "" ) && ( s2 == "" ) && ( e2 == "" ) ) {
			document.search.hdnIssueDate.value = issue;
		}
	}
	else if ( ( from == "" ) && ( to != "" ) ) {				/* ÆþÎÏÆüÉÕ£±==""¡¢ÆþÎÏÆüÉÕ!="" */
		if ( ( s1 != "" ) && ( e1 != "" ) ) {					/* SrchStart1!="",SrchEnd1!="" */
			if ( ( s1 <= fy ) && ( fy <= e1 ) ) {				/* SrchStart1<ÆþÎÏÆüÉÕ£±<SrchEnd1 */
				if ( dm == "TILL" ) {
					new_issue = s1 + "0101:" + to;
					document.search.hdnIssueDate.value = new_issue;
				}
			}
		}
		if ( ( s2 != "" ) && ( e2 != "" ) ) {					/* SrchStart2!="",SrchEnd2!="" */
			if ( ( s2 <= fy ) && ( fy <= e2 ) ) {				/* SrchStart2<ÆþÎÏÆüÉÕ£±<SrchEnd2 */
				if ( dm == "TILL" ) {
					new_issue = s2 + "0101:" + to;
					document.search.hdnIssueDate.value = new_issue;
					if ( ( s1 != "" ) && ( e1 != "" ) ) {		/* SrchStart1!="",SrchEnd1!="" */
						new_issue2 = s1 + "0101:" + e1 + "1231";
						document.search.hdnIssueDate2.value = new_issue2;
					}
				}
			}
		}
		if ( ( s1 == "" ) && ( e1 == "" ) && ( s2 == "" ) && ( e2 == "" ) ) {
			document.search.hdnIssueDate.value = issue;
		}
	}
	else if ( ( from == "" ) && ( to == "" ) ) {				/* ÆþÎÏÆüÉÕ£±==""¡¢ÆþÎÏÆüÉÕ=="" */
		if ( ( s1 != "" ) && ( e1 != "" ) ) {					/* SrchStart1!="",SrchEnd1!="" */
			new_issue = s1 + "0101:" + e1 + "1231";
			document.search.hdnIssueDate.value = new_issue;
		}
		if ( ( s2 != "" ) && ( e2 != "" ) ) {					/* SrchStart2!="",SrchEnd2!="" */
			new_issue = s2 + "0101:" + e2 + "1231";
			document.search.hdnIssueDate2.value = new_issue;
		}
	}
	else {														/* ÆþÎÏÆüÉÕ£±!=""¡¢ÆþÎÏÆüÉÕ!="" */
		document.search.hdnIssueDate.value = issue;
	}

}


/*		ÁªÂò¤µ¤ì¤¿È¯¹ÔÆü¤ò¥Æ¥­¥¹¥È·Á¼°¤ËÊÑ´¹¤¹¤ë		*/

function setIssueDate_Cal( date )
{
	var str,  month;
	var fy, fm, fd, dm, ty, tm, td;

	str = cal.rows[0].cells[0].innerHTML.split( "Ç¯" );
	fy = str[0];
	month = str[1].split( "·î" );
	if ( month[0] < 10 )
		fm = "0" + month[0];
	else
		fm = month[0];
	if ( date < 10 )
		fd = "0" + date;
	else
		fd = date;
	dm = "default";
	ty = "default";
	tm = "default";
	td = "default";
	document.search.hdnIssueDate.value = setDate( fy, fm, fd, dm, ty, tm, td );
}


/*		ÆüÉÕ¤Î¥³¥ó¥Ü¥Ü¥Ã¥¯¥¹¤ËÆþÎÏ¤µ¤ì¤¿¥Ç¡¼¥¿¤ò¥Æ¥­¥¹¥È·Á¼°¤ËÊÑ´¹¤¹¤ë		*/

function setDate( fy, fm, fd, dm, ty, tm, td )
{
	var date;

	if ( fy == "default" )
		fy = "";
	if ( fm == "default" )
		fm = "";
	if ( fd == "default" )
		fd = "";

	if ( fy == "" && fm == "" && fd == "" ) {
		dm = "";
		ty = "";
		tm = "";
		td = "";
	}
	if ( ty == "default" )
		ty = "";
	if ( tm == "default" )
		tm = "";
	if ( td == "default" )
		td = "";

	if ( dm == "ONLY" || dm == "TILL" ) {
		ty = "";
		tm = "";
		td = "";
	}

	if ( td == "UP" )
		td = "10";
	else if ( td == "MID" )
		td = "20";
	else if ( td == "BOT" )
		td = getMonthFinalDate( ty, tm );

	if ( dm == "FROM" ) {
		if ( fd == "UP" )
			fd = "01";
		else if ( fd == "MID" )
			fd = "11";
		else if ( fd == "BOT" )
			fd = "21";
		fd = fd + ":";
	}
	else if ( dm == "ONLY" ) {
		ty = "";
		tm = "";
		td = "";
		if ( fd == "UP" ) {
			fd = "01:";
			ty = fy;
			tm = fm;
			td = "10";
		}
		else if ( fd == "MID" ) {
			fd = "11:";
			ty = fy;
			tm = fm;
			td = "20";
		}
		else if ( fd == "BOT" ) {
			fd = "21:";
			ty = fy;
			tm = fm;
			td = getMonthFinalDate( ty, tm );
		}
	}
	else if ( dm == "TILL" ) {
		ty = "";
		tm = "";
		td = "";
		if ( fd == "UP" )
			fd = "10";
		else if ( fd == "MID" )
			fd = "20";
		else if ( fd == "BOT" )
			fd = getMonthFinalDate( fy, fm );

		fy = ":" + fy;
	}

	date = fy + fm + fd + ty + tm + td;

	return date;
}


/*		ÏÀÍý±é»»¤ò¥»¥Ã¥È¤¹¤ë¡Ê·ÇºÜµ­»ö¥·¥ó¥×¥ëÍÑ¡Ë		*/

function setTopicSimpleRonri()
{
	var j;

	document.search.ronri.value = "";
	setWordToRonri();
	j = 2;
	setShishiToRonri( j++ );
	setIssueDateToRonri( j++ );
}


/*		ÏÀÍý±é»»¤ò¥»¥Ã¥È¤¹¤ë¡Ê·ÇºÜµ­»ö¥Ñ¥ï¥Õ¥ëÍÑ¡Ë		*/

function setTopicPowerRonri()
{
	var j;

	if ( document.search.srchKind.value == "rui" )
		setTxaRuiToRonri();
	else if ( document.search.srchKind.value == "zenp" ) {
		setWordToRonri();
		j = 2;
		setKanToRonri( j++ );
		setShishiToRonri( j++ );
		setIssueSToRonri( j++ );
		setMenmeiToRonri( j++ );
		setHochiToRonri( j++ );
		setBunruiToRonri( j++ );
		setIssueDateToRonri( j++ );
	}
}


/*		ÏÀÍý±é»»¤ò¥»¥Ã¥È¤¹¤ë¡ÊÃÎ·ÃÂ¢ÍÑ¡Ë		*/

function setChiezoRonri()
{
	var j;

	document.search.ronri.value = "";
	setWordToRonri();
	j = 2;
	setKindToRonri( j++ );
	setBunyaToRonri( j++ );
}


/*		ÏÀÍý±é»»¤ò¥»¥Ã¥È¤¹¤ë¡Ê¿ÍÊª£Ä£Â¡¦²£ÃÇ¸¡º÷ÍÑ¡Ë		*/

function setJinbutuRonri()
{
	document.search.ronri.value = "";
	setWordToRonri();
}


/*		ÏÀÍý±é»»¤ò¥»¥Ã¥È¤¹¤ë¡Ê»æÌÌ£Ä£Â¸¡º÷ÍÑ¡Ë		*/

function setSmenDBRonri()
{
	var j;

	document.search.ronri.value = "";
	setWordToRonri();
	setBunruiLMToRonri(2,3);
	j = 4;
	setKanToRonri( j++ );
	setKijiToRonri( j++ );
	setIssueDateToRonri2( j++ );
}


/*		ÏÀÍý±é»»¤ò¥»¥Ã¥È¤¹¤ë¡ÊÊ¹Â¢­¶·ÇºÜµ­»öÍÑ¡Ë		*/

function setTopicRonri()
{
	var j;

	document.search.ronri.value = "";
	setWordToRonri();
	j = 2;
	if ( document.search.hdnSrchMode.value == "0" ) {
		setShishiToRonri( j++ );
		setIssueDateToRonri( j++ );
	}
	else {
		setKanToRonri( j++ );
		setShishiToRonri( j++ );
		setIssueSToRonri( j++ );
		setMenmeiToRonri( j++ );
		setHochiToRonri( j++ );
		setBunruiToRonri( j++ );
		setIssueDateToRonri( j++ );
	}
}


/*		ÆÃÄê¤ÎÊ¸»úÎó¤ò»ØÄê¤·¤¿Ê¸»úÎó¤ÇÁ´¤ÆÃÖ´¹¤¹¤ë		*/

function replaceAllChar( str, sText, rText )
{
	var str1, str2, text;
	var index;

	str1 = "";
	str2 = str;

	while ( true ) {
		index = str2.indexOf( sText, 0 );
		if (index == -1)
			break;

		text = str2.replace( sText, rText );
		str1 += text.substring( 0, index + rText.length );
		str2 =  text.substring( index + rText.length, text.length );
	}

	return str1 + str2;
}


/*		¸¡º÷¥­¡¼¥ï¡¼¥É¤Î¥¹¥Ú¡¼¥¹¤òÊÑ´¹¤¹¤ë		*/

function setWord()
{
	var str;

	str = document.search.txtWord.value;
	str = replaceAllChar( str, "¡¡", "&" );
	str = replaceAllChar( str, " ", "&" );
	str = replaceAllChar( str, "\\&", "¡õ" );
	str = replaceAllChar( str, "\\'", "¡Ç" );
	str = replaceAllChar( str, "\\\"", "¡É" );
	str = replaceAllChar( str, "\\<", "¡ã" );
	str = replaceAllChar( str, "\\>", "¡ä" );
	str = replaceAllChar( str, "\\+", "¡Ü" );
	str = replaceAllChar( str, "\\#", "¡ô" );
	str = replaceAllChar( str, "\\(", "¡Ê" );
	str = replaceAllChar( str, "\\)", "¡Ë" );
	document.search.hdnWord.value = str;
}


/*		¸¡º÷»áÌ¾¡Ê´Á»ú¡Ë¤Î¥¹¥Ú¡¼¥¹¤òÊÑ´¹¤¹¤ë		*/

function setKanji()
{
	var str;

	str = document.search.txtKanji.value;
	str = replaceAllChar( str, " ", "¡¡" );
	document.search.hdnKanji.value = str;
}


/*		¸¡º÷»áÌ¾¡Ê¤Ò¤é¤¬¤Ê¡Ë¤Î¥¹¥Ú¡¼¥¹¤òÊÑ´¹¤¹¤ë		*/

function setRuby()
{
	var str;

	str = document.search.txtRuby.value;
	str = replaceAllChar( str, "¡¡", "¡¦" );
	str = replaceAllChar( str, " ", "¡¦" );
	document.search.hdnRuby.value = str;
}


/*		Ê¬Ìî¥³¡¼¥É¤Î¥¹¥Ú¡¼¥¹¤òÊÑ´¹¤¹¤ë		*/

function setBunya()
{
	var str;

	str = document.search.txtBunya.value;
	str = replaceAllChar( str, "¡¡", " " );
	document.search.hdnBunya.value = str;
}

/*		¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹¤ÎÃÍ¤ò¥Æ¥­¥¹¥È·Á¼°¤Ç¥»¥Ã¥È¤¹¤ë¡Ê»æ»ïÌ¾ÍÑ¡Ë¡Ê¥Ñ¥ï¥Õ¥ë¤Î¤ß¡Ë		*/

function setShishi()
{
	var i;
	var Shishi, notAsahi, notAera, notWeekly;
	var chknotAsahi, chknotAera, chknotWeekly;
	var chkAsahi, chkAera, chkWeekly;
	var strAsahi, strAera, strWeekly;

	document.search.hdnShishi.value = "";
	document.search.hdnShishiOrg.value = "";

	chkAsahi = document.search.chkShishi[0].checked;
	chkAera = document.search.chkShishi[1].checked;
	chkWeekly = document.search.chkShishi[2].checked;
	strAsahi = document.search.chkShishi[0].value;
	strAera = document.search.chkShishi[1].value;
	strWeekly = document.search.chkShishi[2].value;

	notAsahi = document.search.hdnAsahi.value;
	notAera = document.search.hdnAera.value;
	notWeekly = document.search.hdnWeekly.value;
	if ( notAsahi != "" )
		chknotAsahi = false;
	else
		chknotAsahi = true;
	if ( notAera != "" )
		chknotAera = false;
	else
		chknotAera = true;
	if ( notWeekly != "" )
		chknotWeekly = false;
	else
		chknotWeekly = true;

	if ( chkAsahi )
		document.search.hdnShishiOrg.value = strAsahi;
	if ( chkAera ) {
		if ( document.search.hdnShishiOrg.value == "" )
			document.search.hdnShishiOrg.value = strAera;
		else
			document.search.hdnShishiOrg.value += "+" + strAera;
	}
	if ( chkWeekly ) {
		if ( document.search.hdnShishiOrg.value == "" )
			document.search.hdnShishiOrg.value = strWeekly;
		else
			document.search.hdnShishiOrg.value += "+" + strWeekly;
	}

	document.search.hdnShishi.value = document.search.hdnShishiOrg.value;
	if ( ( chkAsahi && chkAera && chkWeekly && chknotAsahi && chknotAera && chknotWeekly ) ||
		( !chkAsahi && chkAera && chkWeekly && !chknotAsahi && chknotAera && chknotWeekly ) ||
		( chkAsahi && !chkAera && chkWeekly && chknotAsahi && !chknotAera && chknotWeekly ) ||
		( !chkAsahi && !chkAera && chkWeekly && !chknotAsahi && !chknotAera && chknotWeekly ) ||
		( chkAsahi && chkAera && !chkWeekly && chknotAsahi && chknotAera && !chknotWeekly ) ||
		( !chkAsahi && chkAera && !chkWeekly && !chknotAsahi && chknotAera && !chknotWeekly ) ||
		( chkAsahi && !chkAera && !chkWeekly && chknotAsahi && !chknotAera && !chknotWeekly ) )
		document.search.hdnShishi.value = "";

	Shishi = document.search.hdnShishi.value;
	if ( !chknotAsahi ) {
		if ( Shishi != "" )
			Shishi = "(" + Shishi + ")" + notAsahi;
		else
			Shishi = notAsahi;
	}
	if ( !chknotAera ) {
		if ( Shishi != "" )
			Shishi = "(" + Shishi + ")" + notAera;
		else
			Shishi = notAera;
	}
	if ( !chknotWeekly ) {
		if ( Shishi != "" )
			Shishi = "(" + Shishi + ")" + notWeekly;
		else
			Shishi = notWeekly;
	}
	document.search.hdnShishi.value = Shishi;
}


/*		¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹¤ÎÃÍ¤ò¥Æ¥­¥¹¥È·Á¼°¤Ç¥»¥Ã¥È¤¹¤ë¡ÊÈ¯¹Ô¼ÒÍÑ¡Ë		*/

function setIssueS()
{
	var i;

	document.search.hdnIssueS.value = "";
	document.search.hdnIssueSOrg.value = "";
	for ( i=0; i<5; i++ ) {
		if ( document.search.chkIssueS[i].checked ) {
			if ( document.search.hdnIssueSOrg.value == "" )
				document.search.hdnIssueSOrg.value = document.search.chkIssueS[i].value;
			else
				document.search.hdnIssueSOrg.value += "+" + document.search.chkIssueS[i].value;
		}
	}
	if ( !( ( document.search.chkIssueS[0].checked ) &&
		( document.search.chkIssueS[1].checked ) &&
		( document.search.chkIssueS[2].checked ) &&
		( document.search.chkIssueS[3].checked ) &&
		( document.search.chkIssueS[4].checked ) ) )
		document.search.hdnIssueS.value = document.search.hdnIssueSOrg.value;
}


/*		¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹¤ÎÃÍ¤ò¥Æ¥­¥¹¥È·Á¼°¤Ç¥»¥Ã¥È¤¹¤ë¡ÊÌÌ¼ï£ÁÍÑ¡Ë		*/

function setHochi()
{
	var i;

	document.search.hdnHochi.value = "";
	document.search.hdnHochiOrg.value = "";
	for ( i=0; i<2; i++ ) {
		if ( document.search.chkHochi[i].checked ) {
			if ( document.search.hdnHochiOrg.value == "" )
				document.search.hdnHochiOrg.value = document.search.chkHochi[i].value;
			else
				document.search.hdnHochiOrg.value += "+" + document.search.chkHochi[i].value;
		}
	}
	if ( !( ( document.search.chkHochi[0].checked ) && ( document.search.chkHochi[1].checked ) ) )
		document.search.hdnHochi.value = document.search.hdnHochiOrg.value;
}


/*		¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹¤ÎÃÍ¤ò¥Æ¥­¥¹¥È·Á¼°¤Ç¥»¥Ã¥È¤¹¤ë¡Ê´©¼ïÊÌÍÑ¡Ë		*/

function setKan(mode)
{
	var i;

	document.search.hdnKan.value = "";
	if ( mode == 0 ) {
		document.search.hdnKanOrg.value = "";
		for ( i=0; i<2; i++ ) {
			if ( document.search.chkKan[i].checked ) {
				if ( document.search.hdnKanOrg.value == "" )
					document.search.hdnKanOrg.value = document.search.chkKan[i].value;
				else
					document.search.hdnKanOrg.value += "+" + document.search.chkKan[i].value;
			}
		}
		if ( !( ( document.search.chkKan[0].checked ) && ( document.search.chkKan[1].checked ) ) )
			document.search.hdnKan.value = document.search.hdnKanOrg.value;
	}
	else {
		for ( i=0; i<3; i++ ) {
			if ( document.search.chkKan[i].checked ) {
				if ( document.search.hdnKan.value == "" )
					document.search.hdnKan.value = document.search.chkKan[i].value;
				else
					document.search.hdnKan.value += "+" + document.search.chkKan[i].value;
			}
		}
	}
}


/*		¥Á¥§¥Ã¥¯¥Ü¥Ã¥¯¥¹¤ÎÃÍ¤ò¥Æ¥­¥¹¥È·Á¼°¤Ç¥»¥Ã¥È¤¹¤ë¡Êµ­»ö/¹­¹ð¥Õ¥é¥°¡Ë		*/

function setKiji()
{
	var i;

	document.search.hdnKiji.value = "";
	for ( i=0; i<2; i++ ) {
		if ( document.search.chkKiji[i].checked ) {
			if ( document.search.hdnKiji.value == "" )
				document.search.hdnKiji.value = document.search.chkKiji[i].value;
			else
				document.search.hdnKiji.value += "+" + document.search.chkKiji[i].value;
		}
	}
}


/*		½ñ»ïÁÈ¤ß¹ç¤ï¤»¥Á¥§¥Ã¥¯		*/

function chkSuperfluity()
{
	var chkAsahi, chkAera, chkWeekly;

	if ( document.search.hdnAsahi.value.length != 0 ) {
		document.search.hdnKan.value = "";
		document.search.hdnHochi.value = "";
		document.search.hdnIssueS.value = "";
	}
	else {
		chkAsahi = document.search.chkShishi[0].checked;
		chkAera = document.search.chkShishi[1].checked;
		chkWeekly = document.search.chkShishi[2].checked;
		if ( !( ( chkAsahi ) || ( ( !chkAsahi ) && ( !chkAera ) && ( !chkWeekly ) ) ) ) {
			document.search.hdnKan.value = "";
			document.search.hdnHochi.value = "";
			document.search.hdnIssueS.value = "";
		}
	}
}



/*		ÏÀÍý±é»»¤ò¥»¥Ã¥È¤¹¤ë		*/

function setRonri( txt )
{
	if ( document.search.ronri.value == "" )
		document.search.ronri.value = txt;
	else
		document.search.ronri.value += txt;
}


/*		ÏÀÍý±é»»¤ò¥»¥Ã¥È¤¹¤ë¡Ê³µÇ°¸¡º÷ÍÑ¡Ë		*/

function setTxaRuiToRonri()
{
	setRonri( "1CS" );
}


/*		ÏÀÍý±é»»¤ò¥»¥Ã¥È¤¹¤ë¡Ê¸¡º÷¸ìÍÑ¡Ë		*/

function setWordToRonri()
{
	if ( document.search.hdnWord.value != "" ) {
		if ( document.search.hdnSrchItem.value == "M_H" )
			setRonri( "MH" );
		else if ( document.search.hdnSrchItem.value == "MI" )
			setRonri( "1M" );
		else if ( document.search.hdnSrchItem.value == "HO" )
			setRonri( "1H" );
		else if ( document.search.hdnSrchItem.value == "M_K" )
			setRonri( "MK" );
		else if ( document.search.hdnSrchItem.value == "M_K_B" )
			setRonri( "MKB" );
	}
}


/*		ÏÀÍý±é»»¤ò¥»¥Ã¥È¤¹¤ë¡ÊÈ¯¹ÔÆüÍÑ¡Ë		*/

function setIssueDateToRonri( num )
{
	if ( document.search.hdnIssueDate.value != "" ) {
		if ( document.search.ronri.value != "" )
			setRonri( "&" );
		setRonri( num );
	}
}


/*		ÏÀÍý±é»»¤ò¥»¥Ã¥È¤¹¤ë¡Ê»æ»ïÌ¾ÍÑ¡Ë		*/

function setShishiToRonri( num )
{
	if ( document.search.hdnShishi.value != "" ) {
		if ( document.search.ronri.value != "" )
			setRonri( "&" );
		setRonri( num );
	}
}


/*		ÏÀÍý±é»»¤ò¥»¥Ã¥È¤¹¤ë¡ÊÊ¬ÎàÍÑ¡Ë		*/

function setBunruiToRonri( num )
{
	if ( document.search.hdnBunrui.value != "" ) {
		if ( document.search.ronri.value != "" )
			setRonri( "&" );
		setRonri( num );
	}
}


/*		ÏÀÍý±é»»¤ò¥»¥Ã¥È¤¹¤ë¡Ê»æÌÌ£Ä£Â¸¡º÷¡¦È¯¹ÔÆüÍÑ¡Ë		*/

function setIssueDateToRonri2( num )
{
	if ( ( document.search.hdnIssueDate.value != "" ) &&
		( document.search.hdnIssueDate2.value != "" ) ) {
		if ( document.search.ronri.value != "" )
			setRonri( "&" );
		setRonri( "(" );
		setRonri( num );
		setRonri( "+" );
		setRonri( num+1 );
		setRonri( ")" );
	}
	else if ( document.search.hdnIssueDate.value != "" ) {
		if ( document.search.ronri.value != "" )
			setRonri( "&" );
		setRonri( num );
	}
}


/*		ÏÀÍý±é»»¤ò¥»¥Ã¥È¤¹¤ë¡Ê»æÌÌ£Ä£Â¸¡º÷¡¦Ê¬ÎàÍÑ¡Ë		*/

function setBunruiLMToRonri( numL, numM )
{
	if ( ( document.search.hdnBunruiL.value != "" ) &&
		( document.search.hdnBunruiM.value != "" ) ) {
		if ( document.search.ronri.value != "" )
			setRonri( "&" );
		setRonri( "(" );
		setRonri( numL );
		setRonri( document.search.hdnBunrui.value );
		setRonri( numM );
		setRonri( ")" );
	}
	else if ( document.search.hdnBunruiL.value != "" ) {
		if ( document.search.ronri.value != "" )
			setRonri( "&" );
		setRonri( numL );
	}
	else if ( document.search.hdnBunruiM.value != "" ) {
		if ( document.search.ronri.value != "" )
			setRonri( "&" );
		setRonri( numM );
	}
}


/*		ÏÀÍý±é»»¤ò¥»¥Ã¥È¤¹¤ë¡ÊÈ¯¹Ô¼ÒÍÑ¡Ë		*/

function setIssueSToRonri( num )
{
	if ( document.search.hdnIssueS.value != "" ) {
		if ( document.search.ronri.value != "" )
			setRonri( "&" );
		setRonri( num );
	}
}


/*		ÏÀÍý±é»»¤ò¥»¥Ã¥È¤¹¤ë¡Ê´©¼ïÊÌÍÑ¡Ë		*/

function setKanToRonri( num )
{
	if ( document.search.hdnKan.value != "" ) {
		if ( document.search.ronri.value != "" )
			setRonri( "&" );
		setRonri( num );
	}
}


/*		ÏÀÍý±é»»¤ò¥»¥Ã¥È¤¹¤ë¡ÊÌÌ¼ï£ÁÍÑ¡Ë		*/

function setHochiToRonri( num )
{
	if ( document.search.hdnHochi.value != "" ) {
		if ( document.search.ronri.value != "" )
			setRonri( "&" );
		setRonri( num );
	}
}


/*		ÏÀÍý±é»»¤ò¥»¥Ã¥È¤¹¤ë¡ÊÌÌÌ¾ÍÑ¡Ë		*/

function setMenmeiToRonri( num )
{
	if ( document.search.hdnMenmei.value != "" ) {
		if ( document.search.ronri.value != "" )
			setRonri( "&" );
		setRonri( num );
	}
}


/*		ÏÀÍý±é»»¤ò¥»¥Ã¥È¤¹¤ë¡Ê¼ïÊÌÍÑ¡Ë		*/

function setKindToRonri( num )
{
	if ( document.search.hdnKind.value != "" ) {
		if ( document.search.ronri.value != "" )
			setRonri( "&" );
		setRonri( num );
	}
}


/*		ÏÀÍý±é»»¤ò¥»¥Ã¥È¤¹¤ë¡ÊÊ¬Ìî¡¦ÉôÌçÍÑ¡Ë		*/

function setBunyaToRonri( num )
{
	if ( document.search.hdnBunya.value != "" ) {
		if ( document.search.ronri.value != "" )
			setRonri( "&" );
		setRonri( num );
	}
}


/*		ÏÀÍý±é»»¤ò¥»¥Ã¥È¤¹¤ë¡Êµ­»ö/¹­¹ðÍÑ¡Ë		*/

function setKijiToRonri( num )
{
	if ( document.search.hdnKiji.value != "" ) {
		if ( document.search.ronri.value != "" )
			setRonri( "&" );
		setRonri( num );
	}
}


/*		¸¡º÷¾ò·ï¤òµ¬Äê¥Õ¥©¡¼¥Þ¥Ã¥È¤Ç¥»¥Ã¥È¤¹¤ë		*/

function setCond( srch )
{
	var nRet = 0;
	var sp, i;
	var ronri, str, id;

	ronri = document.search.ronri.value;
	document.search.cond.value = ronri;
	sp = 0;
	str = ronri.charAt(0);
	if ( str == "(" )
		sp = 1;
	for ( i=sp; i<ronri.length; i++ ) {
		str = ronri.charAt(i);
		if ( str == "+" || str == "&" || str == "#" || str == "(" || str == ")" ) {
			if ( i != sp ) {
				id = ronri.substring( sp, i );
				switch ( srch ) {
					case 1:
						nRet = setTopicSimpleData( id );
						break;
					case 2:
						nRet = setTopicPowerData( id );
						break;
					case 3:
						nRet = setChiezoData( id );
						break;
					case 6:
						nRet = setTopicSimpleData( id );
						break;
					case 11:
						nRet = setSmenDBData( id );
						break;
					case 12:
						if ( document.search.hdnSrchMode.value == "0" )
							nRet = setTopicSimpleData( id );
						else
							nRet = setTopicPowerData( id );
						break;
					default:
						break;
				}
				if ( nRet ) {
					break;
				}
			}
			sp = i + 1;
		}
	}
	if ( !nRet && str != ")" ) {
		id = ronri.substring( sp, i );
		switch ( srch ) {
			case 1:
				nRet = setTopicSimpleData( id );
				break;
			case 2:
				nRet = setTopicPowerData( id );
				break;
			case 3:
				nRet = setChiezoData( id );
				break;
			case 6:
				nRet = setTopicSimpleData( id );
				break;
			case 11:
				nRet = setSmenDBData( id );
				break;
			case 12:
				if ( document.search.hdnSrchMode.value == "0" )
					nRet = setTopicSimpleData( id );
				else
					nRet = setTopicPowerData( id );
				break;
			default:
				break;
		}
	}

	return nRet;
}


/*		¸¡º÷¾ò·ï¤òµ¬Äê¥Õ¥©¡¼¥Þ¥Ã¥È¤Ç¥»¥Ã¥È¤¹¤ë¡Ê²£ÃÇ¸¡º÷ÍÑ¡Ë		*/

function setCond2( type )
{
	var nRet = 0;
	var sp, i;
	var ronri, str, id;

	ronri = document.search.ronri.value;
	document.search.cond.value = ronri;
	sp = 0;
	str = ronri.charAt(0);
	if ( str == "(" )
		sp = 1;
	for ( i=sp; i<ronri.length; i++ ) {
		str = ronri.charAt(i);
		if ( str == "+" || str == "&" || str == "#" || str == "(" || str == ")" ) {
			if ( i != sp ) {
				id = ronri.substring( sp, i );
				switch ( type ) {
					case 0:
						nRet = setTopicSimpleData( id );
						break;
					case 1:
						nRet = setTopicSimpleData( id );
						break;
					case 2:
						nRet = setTopicSimpleData( id );
						break;
					case 3:
						nRet = setChiezoData( id );
						break;
					case 4:
						nRet = setJinbutuData( id );
						break;
					default:
						break;
				}
				if ( nRet ) {
					break;
				}
			}
			sp = i + 1;
		}
	}
	if ( !nRet && str != ")" ) {
		id = ronri.substring( sp, i );
		switch ( type ) {
			case 0:
				nRet = setTopicSimpleData( id );
				break;
			case 1:
				nRet = setTopicSimpleData( id );
				break;
			case 2:
				nRet = setTopicSimpleData( id );
				break;
			case 3:
				nRet = setChiezoData( id );
				break;
			case 4:
				nRet = setJinbutuData( id );
				break;
			default:
				break;
		}
	}

	if ( type == 0 )
		document.search.conds.value = document.search.cond.value;
	else if ( type == 1 )
		document.search.conda.value = document.search.cond.value;
	else if ( type == 2 )
		document.search.condw.value = document.search.cond.value;
	else if ( type == 3 )
		document.search.condc.value = document.search.cond.value;
	else if ( type == 4 )
		document.search.condj.value = document.search.cond.value;
	document.search.cond.value = "";

	return nRet;
}


/*		»ØÄê£É£Ä¤Î¸¡º÷¾ò·ï¤òµ¬Äê¥Õ¥©¡¼¥Þ¥Ã¥È¤Ç¥»¥Ã¥È¤¹¤ë¡Ê·ÇºÜµ­»ö¥·¥ó¥×¥ëÍÑ¡Ë		*/

function setTopicSimpleData( id )
{
	var nRet = 0;

	switch ( id ) {
		case "MH":
			document.search.cond.value += ",MidashiHonbun,1," + document.search.hdnKeyword.value;
			break;
		case "1M":
			document.search.cond.value += ",Midashi,1," + document.search.hdnKeyword.value;
			break;
		case "1H":
			document.search.cond.value += ",Honbun,1," + document.search.hdnKeyword.value;
			break;
		case "2":
			document.search.cond.value += ",ShishiName,1," + document.search.hdnShishi.value;
			break;
		case "3":
			document.search.cond.value += ",HakkouDate,5," + document.search.hdnIssueDate.value;
			break;
		default:
			break;
	}

	return nRet;
}


/*		»ØÄê£É£Ä¤Î¸¡º÷¾ò·ï¤òµ¬Äê¥Õ¥©¡¼¥Þ¥Ã¥È¤Ç¥»¥Ã¥È¤¹¤ë¡Ê·ÇºÜµ­»ö¥Ñ¥ï¥Õ¥ëÍÑ¡Ë		*/

function setTopicPowerData( id )
{
	var nRet = 0;

	switch ( id ) {
		case "1CS":
			document.search.cond.value += ",Honbun,4," + document.search.hdnKeyword.value;
			break;
		case "MH":
			document.search.cond.value += ",MidashiHonbun,1," + document.search.hdnKeyword.value;
			break;
		case "1M":
			document.search.cond.value += ",Midashi,1," + document.search.hdnKeyword.value;
			break;
		case "1H":
			document.search.cond.value += ",Honbun,1," + document.search.hdnKeyword.value;
			break;
		case "2":
			document.search.cond.value += ",KanshuName,1," + document.search.hdnKan.value;
			break;
		case "3":
			document.search.cond.value += ",ShishiName,1," + document.search.hdnShishi.value;
			break;
		case "4":
			document.search.cond.value += ",HakkoushaName,1," + document.search.hdnIssueS.value;
			break;
		case "5":
			document.search.cond.value += ",MenName,1," + document.search.hdnMenmei.value;
			break;
		case "6":
			document.search.cond.value += ",MenshuAName,1," + document.search.hdnHochi.value;
			break;
		case "7":
			document.search.cond.value += ",Bunrui,1," + document.search.hdnBunrui.value;
			break;
		case "8":
			document.search.cond.value += ",HakkouDate,5," + document.search.hdnIssueDate.value;
			break;
		default:
			break;
	}

	return nRet;
}


/*		»ØÄê£É£Ä¤Î¸¡º÷¾ò·ï¤òµ¬Äê¥Õ¥©¡¼¥Þ¥Ã¥È¤Ç¥»¥Ã¥È¤¹¤ë¡ÊÃÎ·ÃÂ¢ÍÑ¡Ë		*/

function setChiezoData( id )
{
	var nRet = 0;

	switch ( id ) {
		case "MH":
			document.search.cond.value += ",MidashiHonbun,1," + document.search.hdnKeyword.value;
			break;
		case "1M":
			document.search.cond.value += ",Midashi,1," + document.search.hdnKeyword.value;
			break;
		case "1H":
			document.search.cond.value += ",Honbun,1," + document.search.hdnKeyword.value;
			break;
		case "2":
			document.search.cond.value += ",CzKind,1," + document.search.hdnKind.value;
			break;
		case "3":
			document.search.cond.value += ",CzBunya,1," + document.search.hdnBunya.value;
			break;
		default:
			break;
	}

	return nRet;
}


/*		»ØÄê£É£Ä¤Î¸¡º÷¾ò·ï¤òµ¬Äê¥Õ¥©¡¼¥Þ¥Ã¥È¤Ç¥»¥Ã¥È¤¹¤ë¡Ê¿ÍÊª£Ä£ÂÍÑ¡Ë¡Ê²¾ÃÖ¤­¡Ë		*/

function setJinbutuData( id )
{
	var nRet = 0;

	switch ( id ) {
		case "1M":
			document.search.cond.value += ",Midashi,1," + document.search.hdnWord.value;
			break;
		case "1H":
			document.search.cond.value += ",Honbun,1," + document.search.hdnWord.value;
			break;
		default:
			break;
	}

	return nRet;
}


/*		»ØÄê£É£Ä¤Î¸¡º÷¾ò·ï¤òµ¬Äê¥Õ¥©¡¼¥Þ¥Ã¥È¤Ç¥»¥Ã¥È¤¹¤ë¡Ê»æÌÌ£Ä£Â¸¡º÷ÍÑ¡Ë		*/

function setSmenDBData( id )
{
	var nRet = 0;

	switch ( id ) {
		case "MK":
			document.search.cond.value += ",MidashiKW,1," + document.search.hdnKeyword.value;
			break;
		case "1M":
			document.search.cond.value += ",Midashi,1," + document.search.hdnKeyword.value;
			break;
		case "MKB":
			document.search.cond.value += ",MidashiKWBunruiS,1," + document.search.hdnKeyword.value;
			break;
		case "2":
			document.search.cond.value += ",BunruiL,1," + document.search.hdnBunruiL.value;
			break;
		case "3":
			document.search.cond.value += ",BunruiM,1," + document.search.hdnBunruiM.value;
			break;
		case "4":
			document.search.cond.value += ",KanshuName,1," + document.search.hdnKan.value;
			break;
		case "5":
			document.search.cond.value += ",KijiKind,1," + document.search.hdnKiji.value;
			break;
		case "6":
			document.search.cond.value += ",HakkouDate,5," + document.search.hdnIssueDate.value;
			break;
		case "7":
			document.search.cond.value += ",HakkouDate,5," + document.search.hdnIssueDate2.value;
			break;
		default:
			break;
	}

	return nRet;
}


/*		È¾³Ñ¤Î¸¡º÷¸ì¤òÈ¾³Ñ¡ÜÁ´³Ñ¤Ë¤¹¤ë		*/

function makeParamKeyword( text )
{
	var han = new Array( "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
						"a", "b", "c", "d", "e", "f", "g", "h", "i", "j",
						"k", "l", "m", "n", "o", "p", "q", "r", "s", "t",
						"u", "v", "w", "x", "y", "z",
						"A", "B", "C", "D", "E", "F", "G", "H", "I", "J",
						"K", "L", "M", "N", "O", "P", "Q", "R", "S", "T",
						"U", "V", "W", "X", "Y", "Z" );
	var zen = new Array( "£°", "£±", "£²", "£³", "£´", "£µ", "£¶", "£·", "£¸", "£¹",
						"£á", "£â", "£ã", "£ä", "£å", "£æ", "£ç", "£è", "£é", "£ê",
						"£ë", "£ì", "£í", "£î", "£ï", "£ð", "£ñ", "£ò", "£ó", "£ô",
						"£õ", "£ö", "£÷", "£ø", "£ù", "£ú",
						"£Á", "£Â", "£Ã", "£Ä", "£Å", "£Æ", "£Ç", "£È", "£É", "£Ê",
						"£Ë", "£Ì", "£Í", "£Î", "£Ï", "£Ð", "£Ñ", "£Ò", "£Ó", "£Ô",
						"£Õ", "£Ö", "£×", "£Ø", "£Ù", "£Ú" );
	var i,j;
	var tmp = "", target = "";
	var text;

	text = document.search.hdnWord.value;
	for ( i=0; i<text.length; i++ ) {
		var str = text.charAt(i);
		if ( str == "&" || str == "+" || str == "#" || str == "(" || str == ")" ) {
			if ( target.length ) {
				if ( target.match( /[0-9a-zA-Z]/ ) ) {
					tmp += "(" + target + "+";
					while ( target.match( /[0-9a-zA-Z]/ ) ) {
						for ( j=0; j<han.length; j++ )
							target = target.replace( han[j], zen[j] );
					}
					tmp += target + ")";
				}
				else
					tmp += target;
				target = "";
			}
			tmp += str;
		}
		else
			target += str;
	}
	if ( target.length ) {
		if ( target.match( /[0-9a-zA-Z]/ ) ) {
			tmp += "(" + target + "+";
			while ( target.match( /[0-9a-zA-Z]/ ) ) {
				for ( j=0; j<han.length; j++ )
					target = target.replace( han[j], zen[j] );
			}
			tmp += target + ")";
		}
		else
			tmp += target;
	}

	document.search.hdnKeyword.value = tmp;

}

/*		¥«¥ì¥ó¥À¡¼ÍÑ¥¹¥¯¥ê¥×¥È		*/

/*		»ØÄêÇ¯·î¤Î¥«¥ì¥ó¥À¡¼¤Ë¤¹¤ë		*/

function setSelectYearCalendar()
{
	pYear = eval( document.search.selYear.value );
	pMonth = eval( document.search.selMonth.value );
	document.search.calYear.value = pYear;
	document.search.calMonth.value = pMonth;

	setCalendar( pYear, pMonth );
}


/*		£±Ç¯Á°¤Î¥«¥ì¥ó¥À¡¼¤Ë¤¹¤ë		*/

function setLastYearCalendar()
{
	pYear = eval( document.search.calYear.value );
	pMonth = eval( document.search.calMonth.value );
	cnt = document.forms["search"].elements["selYear"].length;
	for( i=0; i<cnt; i++ ) {
		if( document.forms["search"].elements["selYear"].options[i].value == pYear )
			pcnt = i;
	}
	tcnt = pcnt+1;
	if( tcnt < cnt )
		pcnt++;
	document.search.calYear.value = document.forms["search"].elements["selYear"].options[pcnt].value;
	document.forms["search"].elements["selYear"].options[pcnt].selected = true;

	setSelectYearCalendar();
}


/*		£±Ç¯¸å¤Î¥«¥ì¥ó¥À¡¼¤Ë¤¹¤ë		*/

function setNextYearCalendar()
{
	pYear = eval( document.search.calYear.value );
	pMonth = eval( document.search.calMonth.value );
	cnt = document.forms["search"].elements["selYear"].length;
	for( i=0; i<cnt; i++ ) {
		if( document.forms["search"].elements["selYear"].options[i].value == pYear )
			pcnt = i;
	}
	tcnt = pcnt-1;
	if( tcnt >= 0 )
		pcnt--;
	document.search.calYear.value = document.forms["search"].elements["selYear"].options[pcnt].value;
	document.forms["search"].elements["selYear"].options[pcnt].selected = true;

	setSelectYearCalendar();
}


/*		£±¥ö·îÁ°¤Î¥«¥ì¥ó¥À¡¼¤Ë¤¹¤ë		*/

function setLastMonthCalendar()
{
	pYear = eval( document.search.calYear.value );
	pMonth = eval( document.search.calMonth.value );
	cnt = document.forms["search"].elements["selYear"].length;
	tYear = pYear-1;
	if( pMonth == 1 ){
		for( i=0; i<cnt; i++ ) {
			if( document.forms["search"].elements["selYear"].options[i].value == pYear )
				pcnt = i;
		}
		tcnt = pcnt+1;
		if( tcnt < cnt ){
			pcnt++;
			pYear = document.forms["search"].elements["selYear"].options[pcnt].value;
			pMonth = 12;
		}
	}else{
		pMonth--;
	}
	document.search.calYear.value = pYear;
	document.search.calMonth.value = pMonth;

	for( i=0; i<cnt; i++ ) {
		if ( document.forms["search"].elements["selYear"].options[i].value == pYear )
			document.forms["search"].elements["selYear"].options[i].selected = true;
	}
	for( i=0; i<document.forms["search"].elements["selMonth"].length; i++ ) {
		if ( document.forms["search"].elements["selMonth"].options[i].value == pMonth )
			document.forms["search"].elements["selMonth"].options[i].selected = true;
	}
	setSelectYearCalendar();
}


/*		£±¥ö·î¸å¤Î¥«¥ì¥ó¥À¡¼¤Ë¤¹¤ë		*/

function setNextMonthCalendar()
{
	pYear = eval( document.search.calYear.value );
	pMonth = eval( document.search.calMonth.value );
	cnt = document.forms["search"].elements["selYear"].length;
	tYear = pYear+1;
	if( pMonth == 12 ){
		for( i=0; i<cnt; i++ ) {
			if( document.forms["search"].elements["selYear"].options[i].value == pYear )
				pcnt = i;
		}
		tcnt = pcnt-1;
		if( tcnt >= 0 ){
			pcnt--;
			pYear = document.forms["search"].elements["selYear"].options[pcnt].value;
			pMonth = 1;
		}
	}else{
		pMonth++;
	}
	document.search.calYear.value = pYear;
	document.search.calMonth.value = pMonth;

	for( i=0; i<cnt; i++ ) {
		if ( document.forms["search"].elements["selYear"].options[i].value == pYear )
			document.forms["search"].elements["selYear"].options[i].selected = true;
	}
	for( i=0; i<document.forms["search"].elements["selMonth"].length; i++ ) {
		if ( document.forms["search"].elements["selMonth"].options[i].value == pMonth )
			document.forms["search"].elements["selMonth"].options[i].selected = true;
	}
	setSelectYearCalendar();
}


/*		º£·î( ¸½ºß )¤Î¥«¥ì¥ó¥À¡¼¤Ë¤¹¤ë		*/

function setPresentCalendar()
{
	pDate = new Date();
	pYear = pDate.getYear();
	pMonth = pDate.getMonth() + 1;
	document.search.calYear.value = pYear;
	document.search.calMonth.value = pMonth;

	setCalendar( pYear, pMonth );
}


/*		¥«¥ì¥ó¥À¡¼¤òÊÑ¹¹¤¹¤ë		*/

function setCalendar( year, month )
{
	eDiv = document.getElementById('cal');
	eTHList = eDiv.getElementsByTagName('TH');
	eTDList = eDiv.getElementsByTagName('TD');
	pYear = document.search.calYear.value;
	pMonth = document.search.calMonth.value;
	eTHList[0].innerHTML = pYear + "Ç¯" + pMonth + "·î";

	stdDate = new Date( year, month - 1, 1 );
	firstDay = stdDate.getDay();

	lastDate = getMonthFinalDate( year, month );

	for( i=0; i<firstDay; i++ ){
		eTDList[i+7].innerHTML = "¡¡";
	}

	date = 1;
	for( i=firstDay; i<7; i++ ){
		eTDList[i+7].innerHTML = date++;
	}

	for( i=2; i<7; i++ ){
		for( j=0; j<7; j++ ){
			if( date <= lastDate ){
				eTDList[i*7+j].innerHTML = date++;
			}else{
				eTDList[i*7+j].innerHTML = "¡¡";
			}
		}
	}
}


