void getCommonAncestor(BinaryTreeNode* root, BinaryTreeNode* firstNode, BinaryTreeNode* secondNode)
{
	if (root == NULL || firstNode == NULL || secondNode == NULL)
	{
		return ;
	}
	
	if ( includeTwoNodes(root, firstNode, secondNode) )
	{
		g_CommonNode = root;
		getCommonAncestor(root->left, firstNode, secondNode);
		getCommonAncestor(root->right, firstNode, secondNode);
	}
	
}
	void localToTarget(float &x, float& y, IFlashDisplayObject* target)
	{
		if ( target == 0 ){
			//по определению
			localToGlobal(x, y);

		//Несколько частных случаев для ускорения работы (getCommonAncestor дорогой)
		}else if ( target == this ){
			return;
		}else if ( target == parent ){
			return localToParent(x, y);
		}else if ( target->getParent() == parent ){
			localToParent(x, y);
			target->parentToLocal(x, y);
		}else{
			IFlashDisplayObject* commonAncestor = getCommonAncestor(target);

			if ( !commonAncestor ){
				localToGlobal(x, y);
				target->globalToLocal(x, y);
			}else{
				IFlashDisplayObject* current = this;
				while ( current != commonAncestor ){
					current->localToParent(x, y);
					current = current->getParent();
				}
				__ancestorToLocal(x, y, current, target);
			}
		}
	};