var winModalWindow
 
function IgnoreEvents(e)
{
  return false
}
 
function ShowWindow(urltoshow, winwidth, winheight)
{
  if (window.showModalDialog)
  {
//old    window.showModalDialog(urltoshow,null, "dialogWidth=" + winwidth + "px; dialogHeight=" + winheight + "px")
	window.showModalDialog(urltoshow, window, "dialogWidth=" + winwidth + "px; dialogHeight=" + winheight + "px")

  }
  else
  {

    window.top.captureEvents (Event.CLICK|Event.FOCUS)
    window.top.onclick=IgnoreEvents
    window.top.onfocus=HandleFocus 
    winModalWindow = 
    window.open ("ModalChild.htm","ModalChild", "dependent=yes,width=" + winwidth + ",height=" + winheight)
    winModalWindow.focus()
  }
}

 
function HandleFocus()
{
  if (winModalWindow)
  {
    if (!winModalWindow.closed)
    {
      winModalWindow.focus()
    }
    else
    {
      window.top.releaseEvents (Event.CLICK|Event.FOCUS)
    }
  }
  return false
}

