var MDWin;
var MDInterval;
var MD = new Object;
MD.value = '';
MD.eventhandler = '';
function MDMaintainFocus()
{
  try
  {
    if (MDWin.closed)
     {
        window.clearInterval(MDInterval);
        eval(MD.eventhandler);
        return;
     }
    MDWin.focus();
  }
  catch (everything) {   }
}
 function MDRemoveWatch()
 {
    MD.value = '';
    MD.eventhandler = '';
 }
function MDShow(Title,BodyText,Buttons,EventHandler)
 {
   MDRemoveWatch();
   MD.eventhandler = EventHandler;

   var args='width=500,height=450,left=325,top=300,toolbar=0,';
       args+='location=0,status=0,menubar=0,scrollbars=1,resizable=0';

   MDWin=window.open("","",args);
   MDWin.document.open();
   MDWin.document.writeln('<html>');
   MDWin.document.writeln('<head>');
   MDWin.document.writeln('<title>' + Title + '</title>');
   MDWin.document.writeln('<script' + ' language=JavaScript>');
   MDWin.document.writeln('function CloseForm(Response) ');
   MDWin.document.writeln('{ ');
   MDWin.document.writeln(' window.opener.MD.value = Response; ');
   MDWin.document.writeln(' window.close(); ');
   MDWin.document.writeln('} ');
   MDWin.document.writeln('</script' + '>');
   MDWin.document.writeln('</head>');
   MDWin.document.writeln('<body onblur="window.focus();">');
   MDWin.document.writeln('<h1>Terms and conditions of Trading</h1><p>');
   MDWin.document.writeln('<b>In order to apply for an account and do business with L E West Ltd you must');
   MDWin.document.writeln(' first agree to our Terms &amp; Conditions of Trading as stated below. Please  ');
   MDWin.document.writeln('review the document and print a copy for your records. If you accept L E ');
   MDWin.document.writeln('West Ltd&rsquo;s Terms & Conditions of Trading then click &lsquo;Accept&rsquo; at the');
   MDWin.document.writeln('bottom of the page.</b><p>');
   MDWin.document.writeln('<iframe  width="100%" height="80%" align="center"');
   MDWin.document.writeln('border="1" style="overflow:visible" id="MDIframe"');
   MDWin.document.writeln(' src="/terms-trading.htm"></iframe>');
   MDWin.document.writeln('<table border=0 width="95%" align="center" cellspacing="0" cellpadding="2">');
   MDWin.document.writeln('<tr><td align=left>' + BodyText + '</td></tr>');
   MDWin.document.writeln('<tr><td align=left><br></td></tr>');
   MDWin.document.writeln('<tr><td align=center>' + Buttons + '</td></tr>');
   MDWin.document.writeln('</body>');
   MDWin.document.writeln('</html>');
   MDWin.document.close();
   MDWin.focus();
   MDInterval = window.setInterval("MDMaintainFocus()",5);

 }


  function ModalDlg(BodyText,EventHandler)
  {
     var Buttons='';
     Buttons = '<a href=javascript:CloseForm("Yes");>Accept</a>&nbsp;&nbsp;';
     Buttons += '<a href=javascript:CloseForm("No");>Decline</a>&nbsp;&nbsp;';

     MDShow("Confirmation",BodyText,Buttons,EventHandler);
  }
 function ModalDlgRtn()
 {
   var ans = MD.value;
   MDRemoveWatch();                         //drop the watch
   if (ans == "Yes")
   {
     var dest="/le-w-user/default.asp?category=le-w-runs&service=acct-apply";
     top.location.href=dest;
   }
   return;
 }
