var ModalDialogWindow;
var ModalDialogInterval;
var ModalDialog = new Object;

ModalDialog.value = '';
ModalDialog.value2 = '';
ModalDialog.eventhandler = '';
 

function ModalDialogMaintainFocus()
{
  try
  {
    if (ModalDialogWindow.closed)
     {
        window.clearInterval(ModalDialogInterval);
        eval(ModalDialog.eventhandler);       
        return;
     }
    ModalDialogWindow.focus(); 
  }
  catch (everything) {   }
}

function ModalDialogMaintainFocus_nofocus()
{
  try
  {
    if (ModalDialogWindow.closed)
     {
        window.clearInterval(ModalDialogInterval);
        eval(ModalDialog.eventhandler);       
        return;
     }
  }
  catch (everything) {   }
}
        
 function ModalDialogRemoveWatch()
 {
    ModalDialog.value = '';
    ModalDialog.value2 = '';
    ModalDialog.eventhandler = '';
 }
        
 function ModalDialogShow(Title,BodyText,Buttons,EventHandler,Width,Height)
 {

   ModalDialogRemoveWatch();
   ModalDialog.eventhandler = EventHandler;

   var args='width='+ Width + ',height=' + Height +',toolbar=0,';
       args+='location=0,status=0,menubar=0,scrollbars=1,resizable=1';  

   ModalDialogWindow=window.open("","",args); 
   ModalDialogWindow.document.open(); 
   ModalDialogWindow.document.write('<html>');
   ModalDialogWindow.document.write('<head>'); 
   ModalDialogWindow.document.write('<title>' + Title + '</title>');
   ModalDialogWindow.document.write('<link rel="stylesheet" type="text/css" href="/dl/styles/page.css"/>');
   ModalDialogWindow.document.write('<script' + ' type="text/JavaScript">');
   ModalDialogWindow.document.write('function CloseForm(Response, Response2) ');
   ModalDialogWindow.document.write('{ ');
   ModalDialogWindow.document.write(' window.opener.ModalDialog.value = Response; ');
   ModalDialogWindow.document.write(' window.opener.ModalDialog.value2 = Response2; ');
   ModalDialogWindow.document.write(' window.close(); ');
   ModalDialogWindow.document.write('} ');
   ModalDialogWindow.document.write('</script' + '>');        
   ModalDialogWindow.document.write('</head>');   
   ModalDialogWindow.document.write('<body style="background-image:none;" onblur="window.focus();">');
   ModalDialogWindow.document.write('<div style="padding:10px;"><h3>' + BodyText + '</h3></div><br\>');
   ModalDialogWindow.document.write('<div>' + Buttons + '</div>');
   ModalDialogWindow.document.write('</html>'); 
   ModalDialogWindow.document.close(); 
   ModalDialogWindow.focus(); 
   ModalDialogInterval = window.setInterval("ModalDialogMaintainFocus()",5);
 }

 function ModalDialogShow_nofocus(Title,BodyText,Buttons,EventHandler,Width,Height)
 {

   ModalDialogRemoveWatch();
   ModalDialog.eventhandler = EventHandler;

   var args='width='+ Width + ',height=' + Height +',toolbar=0,';
       args+='location=0,status=0,menubar=0,scrollbars=1,resizable=1';  

   ModalDialogWindow=window.open("","",args); 
   ModalDialogWindow.document.open(); 
   ModalDialogWindow.document.write('<html>');
   ModalDialogWindow.document.write('<head>'); 
   ModalDialogWindow.document.write('<title>' + Title + '</title>');
   ModalDialogWindow.document.write('<link rel="stylesheet" type="text/css" href="/dl/styles/page.css"/>');
   ModalDialogWindow.document.write('<script' + ' type="text/JavaScript">');
   ModalDialogWindow.document.write('function CloseForm(Response, Response2) ');
   ModalDialogWindow.document.write('{ ');
   ModalDialogWindow.document.write(' window.opener.ModalDialog.value = Response; ');
   ModalDialogWindow.document.write(' window.opener.ModalDialog.value2 = Response2; ');
   ModalDialogWindow.document.write(' window.close(); ');
   ModalDialogWindow.document.write('} ');
   ModalDialogWindow.document.write('</script' + '>');        
   ModalDialogWindow.document.write('</head>');   
   ModalDialogWindow.document.write('<body style="background-image:none;" onblur="window.focus();">');
   ModalDialogWindow.document.write('<div style="padding:10px;"><h3>' + BodyText + '</h3></div><br\>');
   ModalDialogWindow.document.write('<div>' + Buttons + '</div>');
   ModalDialogWindow.document.write('</html>'); 
   ModalDialogWindow.document.close(); 
   ModalDialogWindow.focus(); 
   ModalDialogInterval = window.setInterval("ModalDialogMaintainFocus_nofocus()",5);
 }

/*<!--
<BODY >

  <table border=1 cellpadding=2 cellspacing=2 align=center width="60%">
    <tr><td align=left></td></tr>
    <tr><td align=left></td></tr>
    <tr><td align=left></td></tr>
    <tr>
	   <td align=left><a href="javascript:YesNoCancel('Yes, no, or cancel me',
                                                                     'YesNoCancelReturnMethod()');">Show Modal #1</a>   
          1. <input type=text id=modalreturn1 name=modalreturn1 value=''></td>
  	</tr>
    <tr>
	   <td align=left><a href="javascript:YesNoMaybe('Yes, no, or maybe me',
                              'YesNoMaybeReturnMethod()');">Show Modal #2</a>   
         2. <input type=text id=modalreturn2 name=modalreturn2 value=''></td>
  	</tr>
 
  </table>

</BODY>
-->*/