var windowOpen = false;
var filsave = "";
function OpenDoc(fil, width, height, scrollbars) {
    if (windowOpen && !newwin.closed && fil == filsave) {
    newwin.focus(); 
    }
    else {
    var left = parseInt((screen.availWidth/2) - (width/2));
    var top = parseInt((screen.availHeight/2) - (height/2));
    var windowFeatures = "width=" + width + ",height=" + height + ",scrollbars=" + scrollbars + ",toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,left=" + left +",top=" + top + ",screenX=" + left +",screenY=" + top;
    newwin = open (fil, "",windowFeatures);
    newwin.focus(); 
    windowOpen = true;
    filsave = fil;
    }
}

