/* アクション種別：検索での階層化チェックボックスのchecked 設定 */
function setup_category_check()
{
	$(function (){
		$('div.categories_table input').click(function (){
			var name = $(this).attr("name");
			var checked = $(this).attr("checked");
			if(name == 'business_type_1[]')
			{
				$("input:checkbox",$(this).parent('div')).attr("checked", checked);
			}
			else if(name == 'business_type_2[]')
			{
				$("input:checkbox",$(this).parent('div')).attr("checked", checked);
				if(checked) $("input:checkbox[value='"+$(this).attr("parent")+"']").attr("checked", checked);
			}
			else
			{
				if(checked)
				{
					$("input:checkbox[value='"+$(this).attr("parent")+"']").each(function(){
						$(this).attr("checked",checked);
						$("input:checkbox[value='"+$(this).attr("parent")+"']").attr("checked", checked);
					});
				}
			}
		});
	});
}
/* 二重送信防止(参照) http://abui.nowa.jp/entry/b71f21bdf3 */
$(function(){
	$("form.entry_form").submit(function (){
		var buttons = $(this).find(":image, :submit");
		setTimeout(function (){
			buttons.attr("disabled",true);
			setTimeout(function (){buttons.attr("disabled", false);},3000);
		},1);
	}).find(":image, :submit").attr("disabled", false);
});
$(function(){
	$("form.entry_form :image, :submit").click(function (){
		var submit_proc = $(this).attr('name');
		if(submit_proc)
		{
			now_proc = $('form.entry_form #process').val();
			if(now_proc.substring(0,4) == 'edit') submit_proc = 'edit_' + submit_proc;
			$('form.entry_form #process').val(submit_proc);
		}
	});
});
// ページング送信
function paging_link(url, page_num){
	var paging_form = document.getElementById('paging');
	if(url != null){
		paging_form.action = url;
	}
	paging_form.page_num.value = page_num;
	paging_form.method = 'post';
	paging_form.submit();
	return false;
}
