$("#error_explanation").html("")
<% if @cash_out.errors.any? %>
	$('#error_explanation').removeClass('hidden');
    <% @cash_out.errors.values.each do |message| %>
        $("#error_explanation").append($("<li />").html("<%= message.first.to_s %>"));
    <% end %>
    window.scrollTo(0,0);
<% else %>
  	window.location = "<%= root_path %>"; 
	$("#notice").html("<%= flash[:notice] %>");
	var ticket_window = window.open("<%= print_cash_out_receipt_path(@cash_out.id, format: 'pdf') %>", 'New tab', '' );
	ticket_window.print();	
<% end %>
