 package mx.controls.dataGridClasses
 {
 
+import flash.display.DisplayObject;
 import flash.geom.Point;
 import flash.geom.Rectangle;
 import flash.utils.getQualifiedSuperclassName;

import mx.core.UITextField;
import mx.core.mx_internal;
import mx.events.FlexEvent;
import mx.events.ToolTipEvent;
import mx.managers.ILayoutManagerClient;
import mx.styles.CSSStyleDeclaration;
import mx.styles.IStyleClient;
import mx.styles.StyleManager;

		var toolTip:IToolTip = event.toolTip;

		// Calculate global position of label.
        var sm:ISystemManager = systemManager.topLevelSystemManager;
        var sbRoot:DisplayObject = sm.getSandboxRoot();
        var screen:Rectangle;
		var pt:Point = new Point(0, 0);
		pt = localToGlobal(pt);
		pt = sbRoot.globalToLocal(pt);			
		
		toolTip.move(pt.x, pt.y + (height - toolTip.height) / 2);

        if (sm != sbRoot)
        {
            var request:InterManagerRequest = new InterManagerRequest(InterManagerRequest.SYSTEM_MANAGER_REQUEST, 
                                    false, false,
                                    "getVisibleApplicationRect"); 
            sbRoot.dispatchEvent(request);
            screen = Rectangle(request.value);
        }
        else
            screen = sm.getVisibleApplicationRect();

		var screenRight:Number = screen.x + screen.width;
		pt.x = toolTip.x;
		pt.y = toolTip.y;
        pt = sbRoot.localToGlobal(pt);
		if (pt.x + toolTip.width > screenRight)
			toolTip.move(toolTip.x - (pt.x + toolTip.width - screenRight), toolTip.y);
	}
}

