2 var doCancelFunction = 0;
3 var doButton2Function = 0;
4 var doButton3Function = 0;
6 // call this from dialog onload() to allow ok and cancel to call your code
7 // functions should return true if they want the dialog to close
8 function doSetOKCancel(okFunc, cancelFunc, button2Func, button3Func )
10 //dump("top.window.navigator.platform: " + top.window.navigator.platform + "\n");
12 doOKFunction = okFunc;
13 doCancelFunction = cancelFunc;
14 doButton2Function = button2Func;
15 doButton3Function = button3Func;
23 close = doOKFunction();
29 function doCancelButton()
33 if ( doCancelFunction )
34 close = doCancelFunction();
44 if ( doButton2Function )
45 close = doButton2Function();
55 if ( doButton3Function )
56 close = doButton3Function();
62 function moveToAlertPosition()
64 // hack. we need this so the window has something like its final size
65 if (window.outerWidth == 1) {
66 dump("Trying to position a sizeless window; caller should have called sizeToContent() or sizeTo(). See bug 75649.\n");
70 var xOffset = (opener.outerWidth - window.outerWidth) / 2;
71 var yOffset = opener.outerHeight / 5;
73 var newX = opener.screenX + xOffset;
74 var newY = opener.screenY + yOffset;
76 // ensure the window is fully onscreen (if smaller than the screen)
77 if (newX < screen.availLeft)
78 newX = screen.availLeft + 20;
79 if ((newX + window.outerWidth) > (screen.availLeft + screen.availWidth))
80 newX = (screen.availLeft + screen.availWidth) - window.outerWidth - 20;
82 if (newY < screen.availTop)
83 newY = screen.availTop + 20;
84 if ((newY + window.outerHeight) > (screen.availTop + screen.availHeight))
85 newY = (screen.availTop + screen.availHeight) - window.outerHeight - 60;
87 window.moveTo( newX, newY );
90 function centerWindowOnScreen()
92 var xOffset = screen.availWidth/2 - window.outerWidth/2;
93 var yOffset = screen.availHeight/2 - window.outerHeight/2; //(opener.outerHeight *2)/10;
95 xOffset = ( xOffset > 0 ) ? xOffset : 0;
96 yOffset = ( yOffset > 0 ) ? yOffset : 0;
97 window.moveTo( xOffset, yOffset);