code: function(element) {
      var c={};
      try {
        var rect = element.getBoundingClientRect();
        c.x = Math.floor((rect.left + rect.right) / 2);
        c.y = Math.floor((rect.top + rect.bottom) / 2);
      } catch(e) {
        c.x = 1;
        c.y = 1;
      }
      return c;
    }
docs: Find the center of an element