var Head = {
  animating: {
  },

  resize: function(event) {
    var hovering = event ? Head.mouseInside(event) : false;
    var body = $(document.body);
    if (Head.animating[body] != hovering) {
      Head.animating[body] = hovering;
      body.stop();
      if (hovering) {
        body.animate({ fontSize: '25px' }, 'slow');
      } else {
        body.animate({ fontSize: '10px' }, 'slow');
      }
    }
  },

  mouseInside: function(event) {
    var head = $('#head');
    var radius = head.width() / 2;
    var offset = head.offset();
    var centerX = offset.left + head.width() / 2;
    var centerY = offset.top + head.height() / 2;
    var mouseRadius = Math.sqrt(Math.pow(event.pageX - centerX, 2) + Math.pow(event.pageY - centerY, 2));
    return mouseRadius <= radius;
  }
};

$('html').mousemove(function(event) {
  Head.resize(event);
});

$('html').mouseout(function() {
  Head.resize(false);
});

