code: function (state, source, target, points, result)
  	{
  		var pt = (points != null && points.length > 0) ? points[0] : null;
  
  		var vertical = false;
  		var horizontal = false;
  		
  		if (source != null && target != null)
  		{
  			if (pt != null)
  			{
  				var left = Math.min(source.x, target.x);
  				var right = Math.max(source.x + source.width,
  					target.x + target.width);
  	
  				var top = Math.min(source.y, target.y);
  				var bottom = Math.max(source.y + source.height,
  					target.y + target.height);
  
  				pt = state.view.transformControlPoint(state, pt);
  					
  				vertical = pt.y < top || pt.y > bottom;
  				horizontal = pt.x < left || pt.x > right;
  			}
  			else
  			{
  				var left = Math.max(source.x, target.x);
  				var right = Math.min(source.x + source.width,
  					target.x + target.width);
  					
  				vertical = left == right;
  				
  				if (!vertical)
  				{
  					var top = Math.max(source.y, target.y);
  					var bottom = Math.min(source.y + source.height,
  						target.y + target.height);
  						
  					horizontal = top == bottom;
  				}
  			}
  		}
  
  		if (!horizontal && (vertical ||
  			state.style[mxConstants.STYLE_ELBOW] == mxConstants.ELBOW_VERTICAL))
  		{
  			mxEdgeStyle.TopToBottom(state, source, target, points, result);
  		}
  		else
  		{
  			mxEdgeStyle.SideToSide(state, source, target, points, result);
  		}
  	}
docs: Function: ElbowConnector
  
  Uses either <SideToSide> or <TopToBottom> depending on the horizontal
  flag in the cell style. <SideToSide> is used if horizontal is true or
  unspecified. See <EntityRelation> for a description of the
  parameters.