$(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('');

		$('#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('');

		$('#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');
	}


});

var revertTransaction = (lang == "en" ? "Revert the transaction?" : "取引を元に戻す？");
var reallyRevertTransaction = (lang == "en" ? "Proceed to revert the transaction?" : "取引を元に戻しますか？");

function actionDetail (num, type){
	if(confirm(revertTransaction)){
		if(confirm(reallyRevertTransaction)){
			$('#type').val('delete');
			$('#revert_number').val(num);
			$('#revert_type').val(type);
			submitForm('searchForm');
		}
	}
}
