// Java routines for 911truth.dk

//-- This function opens a URL in a new window named linkWindow

function openWindow(url) {
   linkWin=window.open( "", "LinkWindow","");
   if ((linkWin) && (!linkWin.closed)) {
      linkWin.close();
   }
   linkWin=window.open(url,"LinkWindow","")     
}

//--------------------------------------------------------------
function displayTopMenu( lang, location) {
//--------------------------------------------------------------
   // ukLabels = "Home|News|Key points|911 truth FAQ|Links|Webshop|Take action|Contact us";
   ukLabels = "Home|Key points|911 truth FAQ|Articles|Links|Contact us|Dansk version";
   //dkLabels = "Forside|Nyheder|Nøgler|911 truth FAQ|Links|Webshop|Aktion|Kontakt os";
   dkLabels = "Forside|Hovedpunkter|911 truth FAQ|Artikler|Links|Kontakt os|English version";
   // filenames = "home|news|keypoints|faq|links|webshop|action|contact"; // also used to determine index number of location
   filenames = "home|keypoints|faq|articles|links|contact|"; // also used to determine index number of location
   altText = (lang == "dk" ? "WTC stålsøjle skåret over på 45 grader med 'thermite'" : "WTC central steel column cut at 45 degrees using thermite");
   
   // colors = "#D9D4B4|#D9D4B4|#D9D4B4|#D9D4B4|#D9D4B4|#D9D4B4|#D9D4B4";  
   colors = "#D9D4B4|#D9D4B4|#D9D4B4|#D9D4B4|#D9D4B4|#D9D4B4|#D9D4B4";  
   headerImage = "wtc2Bar.jpg";
   
   switch (lang) {
       case "dk": label = dkLabels.split("|"); break;
       default:  label = ukLabels.split("|");
   }

   filename=filenames.split("|");
   locIndex = 0;
   while ((locIndex < filename.length) && (filename[ locIndex] != location)) {
      locIndex++;
   }
//   color = colors.split("|");
   color = "#6C6A5A"; // "#D9D4B4";

  // preamble
  document.writeln(" <table  valign=bottom border=0 cellpadding=0 cellspacing=0 width=\"100%\">");
  document.writeln(" <tr><td class=noPadding bgcolor=white><img border=0 src=\"../spacer.gif\" height=1></td></tr>");
  document.writeln(" <tr><td class=noPadding>"); //  bgcolor=white
  document.writeln("     <img valign=top border=0 src=\"../" +headerImage + "\"alt=\"" + altText + "\">");
  document.writeln(" </td></tr>");
  document.writeln(" <tr><td bgcolor=white><img border=0 src=\"../spacer.gif\" height=1></td></tr>");
  document.writeln(" <tr><td bgcolor=#68311B>");   // #B3AB7D beige
  document.writeln("     <table border=0 cellpadding=0 cellspacing=0 width=\"100%\">");
  document.writeln("     <tr>");
  if ((navigator.appName=="Netscape") && (navigator.appVersion.charAt(0) <= "4"))
     document.writeln("     &nbsp;<br>&nbsp;"); 
     // workaround bug in Netscape 4.08 (and lower?) versions - make menu visible!
  // document.writeln(  navigator.appName +"|"+ navigator.appVersion +"<br>");


   // buttons
   num=0;
   while (num < (filename.length-1)) {
      url = filename[num] + ".htm";
      bgcol = (num == locIndex ? "bgcolor=" + color : "");
      document.writeln( "<td height=23 class=Topmenu " +bgcol+ "><a class=Topmenu href=\"" +url+  "\">"  + label[num] + "</a></td>");
      // if (num < (filename.length-1))  // not necessary after added change language button at end
         document.writeln( "<td width=1 bgcolor=white><img src=\"../spacer.gif\" border=0></td>");
       num++; 
   }

   // code for language change button
   prefix = (lang == "dk" ? "en" : "da");
   url = "../" + prefix + "/" + filename[locIndex] + ".htm";
   document.writeln( "<td height=23 class=Topmenu><a class=Topmenu href=\"" +url+  "\">"  + label[num] + "</a></td>");

  // close
  document.writeln("     </tr>");
  document.writeln("     </table>");
  document.writeln("   </td>");
  document.writeln(" </tr>");
  document.writeln(" </table>");
}

//--------------------------------------------------------------
function displayTitle( title) {
//--------------------------------------------------------------
  document.writeln("<table border=0 cellpadding=0 cellspacing=20 width=\"100%\"><tr><td>");  // padding
  document.writeln(" <table border=0 cellpadding=0 cellspacing=0 width=\"100%\">");
  document.writeln(" <tr><td colspan=2><img src=\"../spacer.gif\" height=1></td></tr>");   // spacer
  document.writeln(" <tr>");
  document.writeln("   <td align=left valign=center class=logoText>");
  document.writeln("     <img border=0 src=\"../911truthLogo.bmp\" alt=\"911truth.dk\">"); 
  document.writeln("   </td>");
  document.writeln("   <td valign=bottom width=\"100%\" class=headerText>" + title +"</td>");
  document.writeln(" </tr>");
  document.writeln(" <tr><td align=right colspan=2><img src=\"../beigeRule.gif\" height=1 width=520></td></tr>");
  document.writeln(" </table>");
  document.writeln("<div class=copyrightNotice>© 911truth.dk 2006</div>");
  document.writeln("</tr></table>");  // </td>
}
