function updateItems()
{
  var centerHeight = 700;
  var minMargin = 30;
  var margin = 0;
  var width  = $(window).width();
  var height = $(window).height();

  if(height-centerHeight<=0)
  {
    margin = minMargin;
  }
  else
  {
    var m = (height-centerHeight)/2;
    margin = m<minMargin?minMargin:m;
  }

  if(height<=centerHeight)
  {
    height=centerHeight;
  }

  $('#header').css({'margin-top':margin + 'px'});
  $('#center').css({'height':height + 'px'});
  $('#left').css({'height':height + 'px'});
  $('#right').css({'height':height + 'px'});

  if(width<=1024)
  {
    $('#left').css({'width':'0','display':'none'});
    $('#right').css({'width':'0','display':'none'});
  }
  else
  {
    var w = (width-1024)/2;

    $('#left').css({'width':w + 'px','display':'block'});
    $('#right').css({'width':w + 'px','display':'block'});
  }
}

$(document).ready(function () {
  updateItems();
  $(window).resize(updateItems);

  $('div.view').each(function(index,Element) {
        $(Element).hover(
            function() { $(Element).children('.description').slideDown(); },
            function() { $(Element).children('.description').slideUp(); }
          );
      }
    );
  $('#contact').hover(
      function() { $('#contact').css({'background':'url(images/contact_a.png)'}); },
      function() { $('#contact').css({'background':'url(images/contact.png)'}); }
    );
  $('#contact').click(function() {
       document.location.href='mailto:mail@valerievanderwal.nl'; 
    });
});

