$z function switches the state of the dialog from "normal" to "maximized". The $S_0 variable is set to true when the dialog is already maximized. Checking if this is the case avoids from switching the state of the dialog at each page refresh.
function maximizeWindow() {
var currentDialog = SP.UI.ModalDialog.get_childDialog();
if(currentDialog != null) {
if(!currentDialog.$S_0) {
currentDialog.$z();
}
}
}
ExecuteOrDelayUntilScriptLoaded(maximizeWindow, 'sp.ui.dialog.js');
Source : http://www.wawawum.com/blog/post/SharePoint-2010-How-to-maximize-a-Modal-Dialog-in-JavaScript.aspx