Remove these lines
win.closeBtn = win.add('button', undefined, 'Close');
and
win.closeBtn.onClick = function() {
this.parent.close(1);
}
to get rid of the Close button.
You can get rid of the border by making this change:
var win = new Window(type, title || "Preview: " + decodeURI(file.name),
undefined, { borderless : true });
-X