// ------------------------------------------------------------------------------------------
// De Kommunale Nøgletal - Fælles funktioner, aug. 2009
// ------------------------------------------------------------------------------------------

   var sClassMenu = "";
   var sClassNyt  = "";

// ------------------------------------------------------------------------------------------
   function nwSelectCss(pPath) {
// ------------------------------------------------------------------------------------------

//   Vælg opsætning
     if ( screen.width > 800 )
       document.write('<link rel="stylesheet" href="'+pPath+'nwCss1024.css" type="text/css">');
     return;
   }

// ------------------------------------------------------------------------------------------
   function nwWriteHeader(pPath) {
// ------------------------------------------------------------------------------------------

     document.write('<table width="100%" cellspacing=0 cellpadding=0 border=0>');
     document.write('  <tr>');
     document.write('    <td class="nwLogo" width=135><br><a href="http://www.ism.dk/" title="Til Indenrigs- og Sundhedsministeriets hjemmeside"><img src="'+pPath+'nwTopBarMin.jpg" border=0 width=135></a></td>');
     document.write('    <td><img src="'+pPath+'nwS.gif" width=50 height=5 ></td>');

//   document.write('    <td class="nwHead" width="90%">De Kommunale Nøgletal</td>');
//   document.write('    <td class="nwHead" width="90%"><a href="'+pPath+'nwIndex'+ntVers+'ekr.html" class="nwButtonBlue" title="Gå til startsiden for De Kommunale Nøgletal" onmouseover="window.status=\'Gå til startsiden for De Kommunale Nøgletal\'; return true;" onmouseout="window.status=\'\'; return true;"><nobr>&nbsp;De Kommunale Nøgletal&nbsp;</nobr></a></td>');

     if ( ntVers == "10B" ) {
       document.write('    <td class="nwHead" width="90%">');
       document.write('      <span class="nwErrTop">TESTSIDE FOR</span>');
       document.write('      <a href="'+pPath+'nwIndex'+ntVers+'ekr.html" title="Gå til startsiden for De Kommunale Nøgletal" onmouseover="window.status=\'Gå til startsiden for De Kommunale Nøgletal\'; return true;" onmouseout="window.status=\'\'; return true;">De Kommunale Nøgletal</a>');
       document.write('      <span class="nwErrTop">(referer ikke til data, tak!)</span>');

       document.write('    <td><img src="'+pPath+'nwS.gif" width=30 height=5 ></td>');
       document.write('    </td>');
     }
     else {
       document.write('    <td class="nwHead" width="90%"><a href="'+pPath+'nwIndex'+ntVers+'ekr.html" title="Gå til startsiden for De Kommunale Nøgletal" onmouseover="window.status=\'Gå til startsiden for De Kommunale Nøgletal\'; return true;" onmouseout="window.status=\'\'; return true;">De Kommunale Nøgletal</a></td>');

       // document.write('    <td><img src="'+pPath+'nwS.gif" width=167 height=5 ></td>');
       document.write('    <td><img src="'+pPath+'nwS.gif" width=117 height=5 ></td>');
     }

     document.write('    <td width=50><a href="javascript:window.print()" onmouseover="window.status=\'Print denne side\'; return true;" onmouseout="window.status=\'\'; return true;"><img src="'+pPath+'nwButtonPrint.gif" width=50 border=0 class="noprt" title="Print denne side"></a></td>');
//   document.write('    <td><img src="'+pPath+'nwS.gif" width=167 height=5 ></td>');
//   <a href="javascript:self.close()" class="nScreenTxt" onmouseover="window.status='Luk denne side'; return true;" onmouseout="window.status=''; return true;" title="Luk denne side">[Luk]</a>
     document.write('  </tr>');
     document.write('</table>');
     return;
   }

// ------------------------------------------------------------------------------------------
   function nwWriteMenu(pSide,pTest,pPath) {
// ------------------------------------------------------------------------------------------

     sClassMenu = "nwMenuTop";

     document.write('<table width="100%" cellspacing=0 cellpadding=0 border=0>');
     document.write('  <tr>');
     document.write('    <td width="98%"></td>');

//   Swoosh-grafik
     document.write('    <td class="'+sClassMenu+'" width="10%"><img src="'+pPath+'nwSwooshTop3.gif" width=120 height=11 border=0></td>');

     document.write('    <td width="98%"></td>');

     // Ny startside
     document.write('        <td class="'+sClassMenu+'">');
     document.write('          <table cellspacing=0 cellpadding=2 border=0>');
     if ( pSide != 1 )
       document.write('          <tr><td class="nwButtonBlue"><a href="'+pPath+'nwIndex'+ntVers+'ekr.html" class="nwButtonBlue" title="Skift til startsiden for kommuner og nøgletal, som de ser ud efter kommunalreformen" onmouseover="window.status=\'Skift til startsiden for kommuner og nøgletal, som de ser ud efter kommunalreformen\'; return true;" onmouseout="window.status=\'\'; return true;"><nobr>&nbsp;Nye kommuner&nbsp;</nobr></a></td></tr>');
     else
       document.write('          <tr><td class="nwButtonBluex"><nobr>&nbsp;Nye kommuner&nbsp;</nobr></td></tr>');
     document.write('          </table>');
     document.write('        </td>');

     // Gammel startside
     document.write('        <td class="'+sClassMenu+'">');
     document.write('          <table cellspacing=0 cellpadding=2 border=0>');
     if ( pSide != 2 )
       document.write('          <tr><td class="nwButtonBlue"><a href="'+pPath+'nwIndex'+ntVers+'fkr.html" class="nwButtonBlue" title="Skift til startsiden for kommuner og nøgletal, som de så ud før kommunalreformen" onmouseover="window.status=\'Skift til startsiden for kommuner og nøgletal, som de så ud før kommunalreformen\'; return true;" onmouseout="window.status=\'\'; return true;"><nobr>&nbsp;Gamle kom.&nbsp;</nobr></a></td></tr>');
     else
       document.write('          <tr><td class="nwButtonBluex"><nobr>&nbsp;Gamle kom.&nbsp;</nobr></td></tr>');
     document.write('          </table>');
     document.write('        </td>');

//   Adskille-grafik
     document.write('    <td class="'+sClassMenu+'"><img src="'+pPath+'nwSwooshRect1.gif" width=20 height=11 border=0></td>');

//   FAQ
/*
     document.write('        <td class="'+sClassMenu+'">');
     document.write('          <table cellspacing=0 cellpadding=2 border=0>');
     if ( pSide != 3 )
       document.write('          <tr><td class="nwButtonBlue"><a href="'+pPath+'nwSpgm'+ntVers+'.html" class="nwButtonBlue" title="Ofte stillede spørgsmål" onmouseover="window.status=\'Ofte stillede spørgsmål\'; return true;" onmouseout="window.status=\'\'; return true;"><nobr>&nbsp;&nbsp;FAQ&nbsp;&nbsp;</nobr></a></td></tr>');
     else
       document.write('          <tr><td class="nwButtonBluex"><nobr>&nbsp;&nbsp;FAQ&nbsp;&nbsp;</nobr></td></tr>');
     document.write('          </table>');
     document.write('        </td>');
*/

//   Hjælp
     document.write('        <td class="'+sClassMenu+'">');
     document.write('          <table cellspacing=0 cellpadding=2 border=0>');
     if ( pSide != 3 )
       document.write('          <tr><td class="nwButtonBlue"><a href="'+pPath+'nwHelp'+ntVers+'.html" class="nwButtonBlue" title="Hjælp til og vejledning i brugen af De Kommunale Nøgletal" onmouseover="window.status=\'Hjælp til og vejledning i brugen af De Kommunale Nøgletal\'; return true;" onmouseout="window.status=\'\'; return true;"><nobr>&nbsp;&nbsp;Hjælp/kontakt&nbsp;&nbsp;</nobr></a></td></tr>');
     else
       document.write('          <tr><td class="nwButtonBluex"><nobr>&nbsp;&nbsp;Hjælp/kontakt&nbsp;&nbsp;</nobr></td></tr>');
     document.write('          </table>');
     document.write('        </td>');

//   Nyheder
     document.write('        <td class="'+sClassMenu+'">');
     document.write('          <table cellspacing=0 cellpadding=2 border=0>');
     if ( pSide != 4 )
       document.write('          <tr><td class="nwButtonBlue"><a href="'+pPath+'nwNnyt'+ntVers+'.html" class="nwButtonBlue" title="Seneste nyt i De Kommunale Nøgletal" onmouseover="window.status=\'Seneste nyt i De Kommunale Nøgletal\'; return true;" onmouseout="window.status=\'\'; return true;"><nobr>&nbsp;&nbsp;Nyheder&nbsp;&nbsp;</nobr></a></td></tr>');
     else
       document.write('          <tr><td class="nwButtonBluex"><nobr>&nbsp;&nbsp;Nyheder&nbsp;&nbsp;</nobr></td></tr>');
     document.write('          </table>');
     document.write('        </td>');

//   Definitioner
     document.write('        <td class="'+sClassMenu+'">');
     document.write('          <table cellspacing=0 cellpadding=2 border=0>');
     if ( pSide != 5 )
       document.write('          <tr><td class="nwButtonBlue"><a href="'+pPath+'nwInfo'+ntVers+'.html" class="nwButtonBlue" title="Definitioner på alle nøgletal" onmouseover="window.status=\'Definitioner på alle nøgletal\'; return true;" onmouseout="window.status=\'\'; return true;"><nobr>&nbsp;&nbsp;Definitioner&nbsp;&nbsp;</nobr></a></td></tr>');
     else
       document.write('          <tr><td class="nwButtonBluex"><nobr>&nbsp;&nbsp;Definitioner&nbsp;&nbsp;</nobr></td></tr>');
     document.write('          </table>');
     document.write('        </td>');

//   Vejledning
//   title="Vejledning i brugen af De Kommunale Nøgletal"

     return
   }

// ------------------------------------------------------------------------------------------
   function nwWriteGo(pTop,pGo,pTest,pTxt) {
// ------------------------------------------------------------------------------------------

     pPath = "";
     sClassMenu = "nwMenuTop";
     if ( pTop == 0 ) sClassMenu = "nwMenuBot";

     if ( pTop == 1 )
       document.write('    <td class="'+sClassMenu+'"><img src="'+pPath+'nwSwooshRect1.gif" width=20 height=11 border=0></td>');
     else {
       document.write('<table width="100%" cellspacing=0 cellpadding=0 border=0>');
       document.write('  <tr>');

//     Nyheder
       document.write('    <td width="98%" class="nwL"><img src="'+pPath+'nwS.gif" height=5><br><b>Seneste nyt</b>:');
       for ( i=1; i<ntNyhedCnt+1; i++ ) {
         sClassNyt = "nwNot";
         if ( ntNyhedHot[i] == 1 ) sClassNyt = "nwHot";

         document.write('    <br><a class="'+sClassNyt+'" href="'+pPath+'nwNnyt'+ntVers+'.html#'+ntNyhedLnk[i]+'">'+ntNyhedTxt[i]+'</a>');
       }

//     Adgang til testsiden
       if ( pTest == 1 )
         document.write('    <br><img src="'+pPath+'nwS.gif" height=5><br><input type="text" name="ntTestingPassword" value="" size=10>');

       document.write('    </td>');
     }

     document.write('      <td valign="top">');
     document.write('        <table width="100%" cellspacing=0 cellpadding=0 border=0>');
     document.write('          <tr>');

//   Swoosh-grafik
     if ( pTop == 0 )
       document.write('            <td class="'+sClassMenu+'" width="10%"><img src="'+pPath+'nwSwooshBot3.gif" width=120 height=11 border=0 valign="top"></td>');

     if ( pGo == 1 ) {

//     Reset
       document.write('          <td class="'+sClassMenu+'">');
       document.write('            <table cellspacing=0 cellpadding=2 border=0>');
       document.write('              <tr><td class="nwButtonBlue"><a href="javascript:void nwReset()" class="nwButtonBlue" title="Ret til standardvalg" onmouseover="window.status=\'Ret til standardvalg\'; return true;" onmouseout="window.status=\'\'; return true;"><nobr>&nbsp;&nbsp;Nulstil&nbsp;&nbsp;</nobr></a></td></tr>');
       document.write('            </table>');
       document.write('          </td>');

//     Hent nøgletal
       document.write('          <td class="'+sClassMenu+'">');
       document.write('            <table cellspacing=0 cellpadding=2 border=0>');
       document.write('              <tr><td class="nwButtonRed"><a href="javascript:nwSend(4)" class="nwButtonRed" title="Hent de valgte nøgletal" onmouseover="window.status=\'Hent de valgte nøgletal\'; return true;" onmouseout="window.status=\'\'; return true;"><nobr>&nbsp;&nbsp;Hent nøgletal&nbsp;&nbsp;</nobr></a></td></tr>');
       document.write('            </table>');
       document.write('          </td>');

     }
     else {

//     Reset og Hent erstattes af grafikker på output-siden
       document.write('          <td class="'+sClassMenu+'"><img src="'+pPath+'nwSwooshRect1.gif" width=48 height=16 border=0></td>');
       document.write('          <td class="'+sClassMenu+'"><img src="'+pPath+'nwSwooshRect1.gif" width=84 height=16 border=0></td>');

     }

//   Afsluttende grafik
     document.write('            <td class="'+sClassMenu+'"><img src="'+pPath+'nwSwooshRect1.gif" width=20 height=11 border=0></td>');

     document.write('        </td>');
     document.write('      </tr>');
     if ( pTop == 0 ) {
       document.write('      <tr>');
       document.write('        <td colspan=4 align="top">');
       nwWriteCopyright();

       if ( pTxt != null )
         document.write('<br>'+pTxt);

       document.write('        </td>');
       document.write('      </tr>');
     }
     document.write('    </table>');

     document.write('  </tr>');
     document.write('</table>');
     return;
   }

// ------------------------------------------------------------------------------------------
   function nwParentTest() {
// ------------------------------------------------------------------------------------------

     alert("Kaldt fra child-siden");
     return
   }

// ------------------------------------------------------------------------------------------
   function nwPrintPage() {
// ------------------------------------------------------------------------------------------

     alert("Print denne side kaldt");
     window.print();
     return
   }

// ------------------------------------------------------------------------------------------
   function nwWriteEmail(pName,p1,p2) {
// ------------------------------------------------------------------------------------------

     document.write('<a href="mailto:'+p1+'@'+p2+'" title="Send en e-mail til '+pName+'">'+p1+'@'+p2+'</a>');
   }

// ------------------------------------------------------------------------------------------
   function nwOpenInfo(nwWindowName,nwFileName) {
// ------------------------------------------------------------------------------------------

     var nwW = 0;
     var nwH = 0;

     if ( nwWindowName == "Kilde" ) {
       nwW = window.screen.width - 400;
       nwH = window.screen.height - 300;

       if ( nwW>600 ) nwW=600;
       if ( nwH>300 ) nwH=300;
     }
     else {
       nwW = window.screen.width - 200;
       nwH = window.screen.height - 200;

       if ( nwW>800 ) nwW=800;
       if ( nwH>500 ) nwH=500;
     }

     var nwWidth  = ( window.screen.width - nwW ) / 2;
     var nwHeight = ( window.screen.height - nwH ) / 2 - 40;

     var nwWindow = window.open(nwFileName,nwWindowName,"status=no, height="+nwH+", width="+nwW+
                    ", resizable=no, left="+nwWidth+", top="+nwHeight+", screenX="+nwWidth+", screenY="+nwHeight+
                    ", toolbar=no, menubar=no, scrollbars=yes, location=no, directories=no");

     nwWindow.focus();
   }

// ------------------------------------------------------------------------------------------
   function nwWriteCopyright() {
// ------------------------------------------------------------------------------------------

     document.write('<br>');
     document.write('<a href="javascript:nwOpenInfo(\'Kilde\',\'nwKilde.html\')" onmouseover="window.status=\'Om kildeangivelse\'; return true;" onmouseout="window.status=\'\'; return true;" title="Om kildeangivelse">© 2010 Indenrigs- og Sundhedsministeriet</a>');
     document.write('&nbsp;&nbsp;&nbsp;<br>&nbsp;');
   }

// ------------------------------------------------------------------------------------------
