One Demo like this:
$(window).resize(function() {
var leftDistance=(jQuery(document).width() - jQuery("#dialogVersatile"+dialogSelectedIndex).width())/2+"px";jQuery("#dialogVersatile"+dialogSelectedIndex).css("margin-left",leftDistance);
});
One Demo like this:
$(window).resize(function() {
var leftDistance=(jQuery(document).width() - jQuery("#dialogVersatile"+dialogSelectedIndex).width())/2+"px";