﻿var ModalDialogWindow;
var ModalDialogInterval;
var ModalDialog = new Object;

ModalDialog.value = '';
ModalDialog.eventhandler = '';

function ModalDialogMaintainFocus()
{
  try
  {
    if (ModalDialogWindow.closed)
     {
        window.clearInterval(ModalDialogInterval);
        eval(ModalDialog.eventhandler);       
        return;
     }
    ModalDialogWindow.focus(); 
  }
  catch (everything) {   }
}

function ModalDialogRemoveWatch()
{
   ModalDialog.value = '';
   ModalDialog.eventhandler = '';
}

 function ModalDialogShow(url,w,h)
 {
   ModalDialogRemoveWatch();
   //ModalDialog.eventhandler = EventHandler;
   ModalDialogWindow=window.open(url,"","width="+w+",height="+h+"")
   ModalDialogWindow.focus();
   //ModalDialogInterval = window.setInterval("ModalDialogMaintainFocus()",1);
 }