var winModalWindow
 
function IgnoreEvents(e)
{
  return false
}
 
function ShowWindow(UrlLink,Width,Height)
{
  if (window.showModalDialog)
  {
    window.showModalDialog(UrlLink,null,
    "dialogWidth="+Width+"px;dialogHeight="+Height+"px")
  }
  else
  {
    window.top.captureEvents (Event.CLICK|Event.FOCUS)
    window.top.onclick=IgnoreEvents
    window.top.onfocus=HandleFocus 
    winModalWindow = 
    window.open (UrlLink,"ModalChild",
       "dependent=yes,width="+Width+",height="+Height)
    winModalWindow.focus()
  }
}

 
function HandleFocus()
{
  if (winModalWindow)
  {
    if (!winModalWindow.closed)
    {
      winModalWindow.focus()
    }
    else
    {
      window.top.releaseEvents (Event.CLICK|Event.FOCUS)
      window.top.onclick = ""
    }
  }
  return false
}
