positioning dialog
<p>I'm trying to position a dialog in jQuery and I have the following code. It doesn't seem to be doing what I expect it to do. I just need the dialog to either be centered or appear at the top left corner of my body.</p>

<p>Here is the code I have</p>

<pre><code>    agreeDialog = $j('#termsOfAgreementConfirm').dialog({
                modal: true,
                autoOpen:false,
                resizable:false,
                width : 1000,
                height :400,
                stack:false,
                closeOnEscape:false,
                title:"Terms of Usage",
                open: function(event, ui) {

                    $j('.ui-dialog-titlebar-close').hide();

                },
                buttons: {

                    Disagree: function() {
                        disagree.dialog('open');
                        disagree.dialog('moveToTop');

                    },


                    Agree: function() {
                        $j(this).dialog('close');
                        $j.cookie("agree", "Y");
                        new Ajax.Request('/myballback/user/ajaxUpdateAgreementForUser',
                                {
                                    onSuccess:function(resp) {
                                    },
                                    onError: function(resp) {
                                        alert("Error:" + resp.toJSON());
                                        return;
                                    },
                                    asynchronous:true,
                                    evalScripts:true
                                });
                        $j(this).dialog('close');

                    }
                }
            });


var x = jQuery(agreeDialog).position().left + jQuery(agreeDialog).outerWidth();
            var y = jQuery(agreeDialog).position().top - jQuery(document).scrollTop();               //agreeDialog.dialog({width:width, height:height ,position:[posX, posY]});


            agreeDialog.dialog('option', 'position',[x, y]);
</code></pre>
