function year_cal_common ( y )

%*****************************************************************************80
%
%% year_cal_common() prints out a calendar for a Common year.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    10 April 2013
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer Y, the year.
%

%
%  Check the year.
%
  ierror = y_check_common ( y );

  if ( ierror ~= 0 )
    return
  end
%
%  Make the year heading.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, '                        COMMON CALENDAR\n' );
  s4 = y_to_s_common ( y );
  fprintf ( 1, '                            %s\n', s4 );
%
%  Print out the month headings.
%
  for m1 = 1 : 3 : 12

    m2 = m1 + 1;
    m3 = m2 + 1;

    s1 = month_to_month_name_common ( m1 );
    s2 = month_to_month_name_common ( m2 );
    s3 = month_to_month_name_common ( m3 );

    fprintf ( 1, '\n' );
    fprintf ( 1, '     %10s            %10s             %10s\n', s1, s2, s3 );
    fprintf ( 1, '\n' );
%
%  Get the days of the week.
%
    for i = 1 : 3
      for w = 1 : 7
        s = weekday_to_name_common2 ( w );
        fprintf ( 1, '%2s ', s );
      end
      fprintf ( 1, ' ' );
    end
    fprintf ( 1, '\n' );
    fprintf ( 1, '\n' );

    lines1 = month_cal_store_common ( y, m1 );
    lines2 = month_cal_store_common ( y, m2 );
    lines3 = month_cal_store_common ( y, m3 );

    for i = 1 : 6
      fprintf ( 1, '%20s  %20s  %20s\n', lines1(i,:), lines2(i,:), lines3(i,:) );
    end

  end

  return
end
