You'll need to caculate the distances based on the width of the visible page.
Something like (note: Typed code into the reply window and didn't test it, so there could be typing errors):
code:
posCenter(obj) {
if (document.documentElement && document.documentElement.offsetHeight != null && document.documentElement.offsetWidth != null) {
obj.style.left = (document.documentElement.offsetWidth/2) + (obj.offsetWidth/2) +"px";
obj.style.top = (document.documentElement.offsetHeight/2) + (obj.offsetHeight/2) + "px";
}
}
posCenter(document.getElementById("myElement"));
Although, that'll only work for recent browsers and for IE in standards compliant mode. For older browsers getting the visible page bounds can be tricky, and when IE is in quirks mode all of the document.documentElement properties return null or undefined (can't remember which, so those checks for null above might not pick up IE in quicks mode), instead you'd have to use documen.body.offsetHeight or something like that, not really sure as I always use IE in standards mode by providing a valid XHTML doctype.
Hope that helps.
[This message has been edited by Cameron (edited 02-09-2004).]