
/* -- [ AT DOCUMENT READY ] -- */
$( document ).ready(function() {
  init_post_table();
});


/* -- [ IF WINDOW RESIZE ] -- */
$( window ).resize(function() {
  init_post_table();
});

/* -- [ REMODAL IMG ] -- */

$('.show').bind('click', function(){
  $('#modal1Img').attr('src', $(this).data('img'));
});

/* -- [ FUNZIONI ] -- */

// funzione che inizializza la tabella dei post
function init_post_table(){

  var win = window.innerWidth;
  if(win <= 1000) 
  {
    _itemWidth = win-20;
  } 
  else if(win >= 1000) 
  {
    _itemWidth = 320;
  }
  else 
  {
    _itemWidth = 1000;
  }

  $('#post_table').wookmark({
    align: "center",
    outerOffset: 0, // Optional, the distance to the containers border
    itemWidth: _itemWidth, // Optional, the width of a grid item
    flexibleWidth: '100%',
    offset: 15 ,
    resizeDelay: 100,
  });

}

/* -- [ YEAR MENU ] -- */


$('.arrow').bind('click', function(){
  if ($(this).attr('status') === 'close') {
    $(this).attr('status', 'open');
    $(this).css('transform', 'rotate(90deg)');
    $(this).parents('.section_content_year').children('.content_month').show();
  } else {
    $(this).attr('status', 'close');
    $(this).css('transform', 'rotate(0deg)');
    $(this).parents('.section_content_year').children('.content_month').hide();
  }
});
