function search_res() {
	key = $('#k').val();
	cn_n = $('#cn').val();
	ao_n = $('#ao').val();
	st_n = $('input[@name=st]:checked').val();
	sp_n = $('input[@name=sp]:checked').val();
	
	if (key == 'キーワード') key = '';
	where = '';
	for (i=0; i < cn_n; i=i+1) {
		chct_n = '#ct' + i;
		ct_f = $(chct_n).attr('checked');
		if (ct_f) where = where + '`category` LIKE " ' + $(chct_n).val() + '," OR `category` LIKE "' + $(chct_n).val() + '" OR ';
	}
	
	if (where) where = '(' + where + ')';
	$('#sea_btn').replaceWith('<img src="./images/preloader.gif" width="60" height="20" alt="お待ちください..." id="preg_bar" /> ');
	$('#se_re').load("./include/search_plus_row.php", {
		sql: where,
		key: key,
		ao: ao_n,
		st: st_n,
		sp: sp_n
	}, function(){
		$('#preg_bar').replaceWith('<button tabindex="9" accesskey="s" onclick="search_res()" id="sea_btn">再検索</button>')
	});
}

function check_group_box( n ) {
	th_ch = "#ct_e" + n;
	th_fl = $(th_ch).attr('checked');
	if (n == 1) {
		$("input:checkbox[value='アカハネムシ']").attr("checked", th_fl);
		$("input:checkbox[value='オオキノコムシ']").attr("checked", th_fl);
		$("input:checkbox[value='オサムシ']").attr("checked", th_fl);
		$("input:checkbox[value='オトシブミ']").attr("checked", th_fl);
		$("input:checkbox[value='カツオブシムシ']").attr("checked", th_fl);
		$("input:checkbox[value='カミキリ']").attr("checked", th_fl);
		$("input:checkbox[value='カミキリモドキ']").attr("checked", th_fl);
		$("input:checkbox[value='ガムシ']").attr("checked", th_fl);
		$("input:checkbox[value='クチキムシ']").attr("checked", th_fl);
		$("input:checkbox[value='クワガタ']").attr("checked", th_fl);
		$("input:checkbox[value='ケシキスイ']").attr("checked", th_fl);
		$("input:checkbox[value='ゲンゴロウ']").attr("checked", th_fl);
		$("input:checkbox[value='コガネムシ']").attr("checked", th_fl);
		$("input:checkbox[value='コメツキ']").attr("checked", th_fl);
		$("input:checkbox[value='コメツキモドキ']").attr("checked", th_fl);
		$("input:checkbox[value='ゴミムシ']").attr("checked", th_fl);
		$("input:checkbox[value='ゴミムシダマシ']").attr("checked", th_fl);
		$("input:checkbox[value='シデムシ']").attr("checked", th_fl);
		$("input:checkbox[value='ジョウカイボン']").attr("checked", th_fl);
		$("input:checkbox[value='ゾウムシ']").attr("checked", th_fl);
		$("input:checkbox[value='タマムシ']").attr("checked", th_fl);
		$("input:checkbox[value='チョッキリ']").attr("checked", th_fl);
		$("input:checkbox[value='ツチハンミョウ']").attr("checked", th_fl);
		$("input:checkbox[value='テントウムシ']").attr("checked", th_fl);
		$("input:checkbox[value='テントウムシダマシ']").attr("checked", th_fl);
		$("input:checkbox[value='ハネカクシ']").attr("checked", th_fl);
		$("input:checkbox[value='ハムシ']").attr("checked", th_fl);
		$("input:checkbox[value='ハムシダマシ']").attr("checked", th_fl);
		$("input:checkbox[value='ハンミョウ']").attr("checked", th_fl);
		$("input:checkbox[value='ヒラタムシ']").attr("checked", th_fl);
		$("input:checkbox[value='ホタル']").attr("checked", th_fl);
	} else if (n == 2) {
		$("input:checkbox[value='チョウ']").attr("checked", th_fl);
	} else if (n == 3) {
		$("input:checkbox[value='ガ']").attr("checked", th_fl);
	} else if (n == 4) {
		$("input:checkbox[value='トンボ']").attr("checked", th_fl);
	} else if (n == 5) {
		$("input:checkbox[value='バッタ']").attr("checked", th_fl);
		$("input:checkbox[value='キリギリス']").attr("checked", th_fl);
		$("input:checkbox[value='マツモムシ']").attr("checked", th_fl);
	} else if (n == 7) {
		$("input:checkbox[value='アブラムシ']").attr("checked", th_fl);
		$("input:checkbox[value='アメンボ']").attr("checked", th_fl);
		$("input:checkbox[value='アワフキムシ']").attr("checked", th_fl);
		$("input:checkbox[value='ウンカ']").attr("checked", th_fl);
		$("input:checkbox[value='カメムシ']").attr("checked", th_fl);
		$("input:checkbox[value='セミ']").attr("checked", th_fl);
		$("input:checkbox[value='ツノゼミ']").attr("checked", th_fl);
		$("input:checkbox[value='ハゴロモ']").attr("checked", th_fl);
		$("input:checkbox[value='マツモムシ']").attr("checked", th_fl);
		$("input:checkbox[value='カメムシ']").attr("checked", th_fl);
		$("input:checkbox[value='ミズカマキリ']").attr("checked", th_fl);
		$("input:checkbox[value='ヨコバイ']").attr("checked", th_fl);
	} else if (n == 8) {
		$("input:checkbox[value='アリ']").attr("checked", th_fl);
		$("input:checkbox[value='ハチ']").attr("checked", th_fl);
	} else if (n == 9) {
		$("input:checkbox[value='アブ']").attr("checked", th_fl);
	} else if (n == 10) {
		$("input:checkbox[value='カ']").attr("checked", th_fl);
		$("input:checkbox[value='ガガンボ']").attr("checked", th_fl);
	} else if (n == 11) {
		$("input:checkbox[value='カマキリ']").attr("checked", th_fl);
	}
}
