$(function(){
	$("[name=btnExportCommon]").click(function(e){
		e.preventDefault()
		$("#type").val("export")
	})

	$("#btnSearch").click(function() {
		$('#type').val('search');
		
		var pager = undefined;
		if(window.location.href.includes("target_page"))
			pager = window.location.href.replace(/target_page=[0-9]+/g, "target_page=1");
		
		submitForm('searchForm', pager);
	});
	
	$("#btnSearchAll").click(function() {
		$('#s_user_account').val('');
		$('#s_ip_address').val('');
		$('#type').val('search');
		
		$('#login_flg').prop('checked', false);
		
		var pager = undefined;
		if(window.location.href.includes("target_page"))
			pager = window.location.href.replace(/target_page=[0-9]+/g, "target_page=1");
		
		submitForm('searchForm', pager);
	});

	$("#btnSearchToday").click(function() {
		$('#s_user_account').val('');
		$('#s_ip_address').val('');
		$('#login_flg').prop('checked', true);

		$('#s_from:text').datepicker().datepicker('setDate','today');
		$('#s_to:text').datepicker().datepicker('setDate','today');

		$('#type').val('search');
		
		var pager = undefined;
		if(window.location.href.includes("target_page"))
			pager = window.location.href.replace(/target_page=[0-9]+/g, "target_page=1");
		
		submitForm('searchForm', pager);
	});
	
	$('#s_from').datepicker({
		// カレンダーの設定
		dateFormat	: 'yy/mm/dd'
	});
	
	$('#s_to').datepicker({
		// カレンダーの設定
		dateFormat	: 'yy/mm/dd'
	});

	if($('#s_from').val() == '') {
		$('#s_from:text').datepicker('setDate', nowStr);
	}

	if($('#s_to').val() == '') {
		$('#s_to:text').datepicker('setDate','today');
	}
});