   function popupFile(filePath)
/* 
   21-feb-2005 / Karel Altmann
   show file in a popup window format A4H
   01-nov-2009 / code review
*/ 
   {
   var Popup;                  // extract file title from path
   var file = new Image;
   file.src = filePath;
   fileTitl = "";
   for (var i=file.src.length ; i>=0 ; i--)
   {
       if (file.src.substring(i-1,i) == "/")
       {
          fileTitl = file.src.slice(i,file.src.length);
          break;
       }
   }
   var suff = file.src.substring((file.src.length-4),file.src.length);
   fileTitl = fileTitl.replace(/.html/g,"");
   fileTitl = fileTitl.replace(/.txt/g,"");
   fileTitl = fileTitl.replace(/.pdf/g,"");
   fileTitl = fileTitl.replace(/.ppt/g,"");
   fileTitl = fileTitl.replace(/.htm/g,"");
   fileTitl = fileTitl.replace(/.xls/g,"");
   fileTitl = fileTitl.replace(/./g,"");
   fileTitl = fileTitl.replace(/~/g,"");

   var pictW = 680;            // set picture size & position
   var pictH = 750;
   pictL = (screen.width  - pictW) / 2;
   pictT = (screen.height - pictH) / 2;
   if (pictL < 0) { pictL = 0; pictW = screen.width-10;  }
   if (pictT < 0) { pictT = 0; pictH = screen.height-60; }

   pictStrg = "width="+pictW+",height="+pictH+",left="+pictL+",top="+pictT;
   pictStrg = pictStrg+",scrollbars=no, resizable=yes";

   Popup = window.open('',fileTitl,pictStrg);
   Prog = Popup.document;
   fileTitl = fileTitl.replace(/_/g," ");
   var Input  = '<HTML><HEAD><TITLE>' + fileTitl + '</TITLE></HEAD>        \n'
       Input += '<script type="text/javascript" language="JavaScript">     \n'
       Input += 'function printInput()                                     \n'
       Input += '{                                                         \n'
       Input += '  window.parent.Inhalt.focus();                           \n'
       Input += '  window.print();                                         \n'
       Input += '}                                                         \n'
       Input += '</script>                                                 \n'
       Input += '<BODY>                                                    \n'
       Input += '<IFRAME SRC=' + filePath + ' NAME="Inhalt" SCROLLBARS=yes \n'
       Input += ' FRAMEBORDER=0 HEIGHT=90% WIDTH=100% MARGINWIDTH=0>       \n'
       Input += '</IFRAME>                                                 \n'
       Input += '<FORM>                                                    \n'
       Input += '<H4 ALIGN=center parent.Inhalt.focus()>                   \n'
       if (suff != ".pdf")
       {
          Input += '<INPUT TYPE="button"                                   \n'
          Input += ' VALUE="              Drucken              "           \n'
          Input += ' onClick="printInput()">                               \n'
       }
       Input += '<INPUT TYPE="button"                                      \n'
       Input += ' VALUE="            Schliessen             "              \n'
       Input += ' onClick="parent.window.close()"></H4>                    \n'
       Input += '</FORM>                                                   \n'
       Input += '<P ALIGN="center"><FONT SIZE="1" FACE="Arial">            \n'
       if (suff != ".pdf")
       {
          Input += 'vor dem Drucken : Hintergrundfarben und -bilder        \n'
          Input += 'drucken : &gt; Extras &gt; Erweitert &gt; Drucken      \n'
       }
       Input += '</FONT></P>                                               \n'
       Input += '</BODY>                                                   \n'
       Input += '</HTML>                                                   \n'
       Input += '<!-- code written by popupFile.js -->'
   Prog.open();
   Prog.clear();
   Prog.write(Input);
   Prog.close();
   Popup.focus();
   }

