             var appHeight:Number;
             var parentWidth:Number;
             var parentHeight:Number;
-            var s:Rectangle;            // the screen
             var rect:Rectangle;
             var clippingOffset:Point = new Point();
             var pt:Point;

            {
                // The sandbox root is the top level root.
                // The application width is just the screen width.
                s = systemManager.screen;
                appWidth = s.width;
                appHeight = s.height;
            }            
            else
            {
                rect = systemManager.getVisibleApplicationRect();
            
                // Offset the top, left of the window to bring it into view.        
                clippingOffset = new Point(rect.x, rect.y);
                clippingOffset = DisplayObject(systemManager).globalToLocal(clippingOffset);
                appWidth = rect.width;
                appHeight = rect.height;
            } 

        // trace("createModalWindow: drawing modal " + s);
        g.clear();
        g.beginFill(c, 100);
        g.drawRect(screen.x, screen.y, screen.width, screen.height);
        g.endFill();

        if (hasEventListener("updateModalMask"))
