// do not position outside the Window
var cw = document.documentElement.clientWidth-5;
var ch = document.documentElement.clientHeight-5;
var bw = this.body.getTextWidth();
if(this.title) bw = Math.max(bw, this.header.child('span').getTextWidth(this.title));
bw += this.getFrameWidth() + (this.closable ? 20 : 0) + this.body.getPadding("lr");
var bh = this.getInnerHeight() + this.getFrameHeight() + this.body.getPadding("tb");
if(x + bw > cw) x = cw - bw;
if(y + bh > ch) y = ch - bh;
// do not position under mousecursor
var ay = this.targetXY[1], h = this.getSize().height;
if(this.constrainPosition && y <= ay && (y+h) >= ay){
y = ay-h-5;
}