﻿var EditorWinPopup = null;

function EditorWin(url, oDoc)
{
    var popW = 0; 
    var popH = 0;

    popW = screen.width
    popH = screen.height
     
    // Fudge factors for window decoration space.
    popW += 32;
    popH += 96;
    
    wleft = (screen.width - popW) / 2;
    //wtop = (screen.height - popH) / 2;
    wtop=0
        
    if (window.showModalDialog) 
    {  
        if (EditorWinPopup == null)
        {
            EditorWinPopup = window.showModelessDialog(url,oDoc,"dialogLeft:"+wleft+";dialogTop:"+wtop+";help:0;resizable:0;status:no;scroll:no;dialogWidth:"+popW+"px;dialogHeight:"+popH+"px");
        }
    } 
    else 
    {
        EditorWinPopup = window.open(url,
        'PopUp',
        'width=' + popW + ', height=' + popH + ', ' +
        'left=' + wleft + ', top=' + wtop + ', ' +
        'location=0, menubar=0, ' +
        'status=0, toolbar=0, scrollbars=0, resizable=0, modal=1');
        
      // Just in case width and height are ignored
      EditorWinPopup.resizeTo(w, h);
      
      // Just in case left and top are ignored
      EditorWinPopup.moveTo(wleft, wtop);
      EditorWinPopup.focus();
    }
}