code: function() {
              var depth = this.getDepth(),
                  that = this,
                  index = 0,
                  nodes, len, n, child;
  
              function addChildren(children) {
                  nodes = [];
                  len = children.length;
                  for(n = 0; n < len; n++) {
                      child = children[n];
                      index++;
  
                      if(child.nodeType !== SHAPE) {
                          nodes = nodes.concat(child.getChildren().toArray());
                      }
  
                      if(child._id === that._id) {
                          n = len;
                      }
                  }
  
                  if(nodes.length > 0 && nodes[0].getDepth() <= depth) {
                      addChildren(nodes);
                  }
              }
              if(that.nodeType !== UPPER_STAGE) {
                  addChildren(that.getStage().getChildren());
              }
  
              return index;
          }
docs: get absolute z-index which takes into account sibling
  and ancestor indices
  @method
  @memberof Kinetic.Node.prototype
  @returns {Integer}