jQuery(function($){
  $(window).resize(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');
   // $(this).css('margin-bottom',  Math.floor(((cHeight) - (bHeight))/2) + 'px');
    }
    else {
    $(this).css('margin-top', 20 + 'px');
    $(this).css('margin-bottom', 20 + 'px');
    }
  });
   marginTop = parseInt($('#slide').css('margin-top'), 10);  
   
  });

  $(window).resize();
    
    setTimeout("$(window).resize();",500);
    
});
