jQuery(function($){
  $('.ui-accordion-header').click(function(){

setTimeout(function(){
     //vertical middle
    var wHeight = $(window).height();
    var hHeight = $('#header').height();
    var cHeight = wHeight - hHeight;
    $('#slide').each(function(){
    var bHeight = $(this).height();

    if ( cHeight > bHeight ){
      $(this).css('margin-top',  Math.floor(((cHeight) - (bHeight))/2) + 'px');
    }
    else {
      $(this).css('margin-top', 20 + 'px');
      $(this).css('margin-bottom', 20 + 'px');
    }
    

    })
      }, 200);;
  });

});
