Popup custom Alignment for stand-alone initialisation

How to force popup to appear preferably on the right or left of an element in a stand alone initialisation.
I am using jQuery to find the element position.

var popup = new dhtmlXPopup();
var element = $(".color-box");
var x = element.offset().left;
var y = element.offset().top;
var w = element.width();
var h = element.height();
popup.show(x,y,w,h);

popup.show(x,y,w,h); Please, note, that the w and h - are the width and height of your popUp.
So you should calculate your popUp position knowing sizes and the position of your element and the sizes of your popUp.

Thanks. Figured it out,

var myPop = new dhtmlXPopup({ 
    toolbar: myToolbar,
    id: "button_open",
    mode: "right"
});