How can I get the current windows size. I want to centre a windows when it displays, currently I developed the following method but I have to put the window size in myself, I want it to be able to retrieve the current windows size automatically.

Code:
<script language="JavaScript">
    self.resizeTo(640,480)
    
    xWidth = ( screen.availWidth - 640 ) / 2;
    yHeight = ( screen.availHeight - 480 ) / 2;
    
    self.moveTo(xWidth,yHeight)
</script>