$(function(){
	$("#btnSearch").click(function() {
		$('#type').val('search');
		submitForm('searchForm');
	});

	$("#btnSearchAll").click(function() {
		$('#s_withdraw_account_name').val('');
		$('#s_withdraw_account_number').val('');
		$('#s_deposit_account_name').val('');
		$('#s_deposit_account_number').val('');
		$('#s_agent_code').val('');
		$('#s_type').val('');
		$('#s_currency').val('');
		$('#s_min_amount').val('');
		$('#s_max_amount').val('');
		$('#transaction_number').val('');
		$('input:checkbox').prop('checked', true);  

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

		$('#type').val('search');
		submitForm('searchForm');
	});

	$("#btnSearchToday").click(function() {

		$('#s_withdraw_account_name').val('');
		$('#s_withdraw_account_number').val('');
		$('#s_deposit_account_name').val('');
		$('#s_deposit_account_number').val('');
		$('#s_agent_code').val('');
		$('#s_type').val('');
		$('#s_currency').val('');
		$('#s_min_amount').val('');
		$('#s_max_amount').val('');
		$('#transaction_number').val('');
		$('input:checkbox').prop('checked', true);  

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

		$('#type').val('search');
		submitForm('searchForm');
	});

    $("#btnExportCommonHigh, #btnExportCommonLow").click(function() {
        $('#type').val('export');
		submitForm('searchForm');
    });

	$('#s_from').datepicker({
		// カレンダーの設定
		dateFormat	: 'yy/mm/dd'
	});

	$('#s_to').datepicker({
		// カレンダーの設定
		dateFormat	: 'yy/mm/dd'
	});

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

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


function actionDetail(tId, target, transactionType) {
	var type = '';
	if(transactionType == 1){
		$('#d_id').val(tId);
		type = 'deposit';
	}else if(transactionType == 3){
		$('#t_id').val(tId);
		type = 'transfer';
	}else if(transactionType == 4){
		target = '';
		type = '';
	}else if(transactionType == 5){
		$('#r_id').val(tId);
		type = 'request';
	}else{
		$('#w_id').val(tId);
		type = 'withdraw';
	}

	$('#acForm').attr('action', type);
	$('#acForm input[id=type]').val('detail');
	$('#action').val('detail');
	
	
	// ターゲットがない場合
	if(target != undefined) {
		getForm().attr('target', target);
	} else {
		getForm().attr('target', '');
	}

	submitForm();

}

