// Java routines for KOD Vejle

//-- 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 validate_email(field)
{
  with (field)
  {
    apos=value.indexOf("@");
    dotpos=value.lastIndexOf(".");
    if (apos<1||dotpos-apos<2)
      {return false;}
    else 
      {return true;}
  }
}

//--------------------------------------------------------------
function displayTopMenu( location) {
//--------------------------------------------------------------
   altText="Danseaften";
   menuLabels = "Forside|Kalender|Hvad er Swing?|Priser/Info|Tilmelding|Danseaftener|Kontakt|Links";
   filenames = "index|kalender|swing|info|tilmeld|danseaftner|kontakt|links"; // also used to determine index number of location
   
   buttonColor = "802020"; // "#B3AB7D";
   hltButColor = "000000"; // "204080"; // "#D9D4B4";
   headerImage = "topBar.jpg";

   label = menuLabels.split("|");
   filename=filenames.split("|");
   locIndex = 0;
   while ((locIndex < filename.length) && (filename[ locIndex] != location)) {
      locIndex++;
   }

  // 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=\"images/spacer.gif\" height=1></td></tr>");
  document.writeln(" <tr><td class=noPadding>"); //  bgcolor=white
  document.writeln("     <img valign=top border=1 src=\"images/" + headerImage + "\"alt=\"" + altText + "\">");
  document.writeln(" </td></tr>");
  document.writeln(" <tr><td bgcolor=white><img border=0 src=\"images/spacer.gif\" height=1></td></tr>");
  document.writeln(" <tr><td bgcolor=" + buttonColor +">");   // #BFB685 med. 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) {
      url = filename[num] + ".htm";
      bgcol = (num == locIndex ? "bgcolor=" + hltButColor : "");
      document.writeln( "<td height=23 class=Topmenu " +bgcol+ "><a class=Topmenu href=\"" +url+  "\">"  + label[num] + "</a></td>");
      if (num < (filename.length-1))
         document.writeln( "<td width=1 bgcolor=white><img src=\"images/spacer.gif\" border=0></td>");
       num++; 
   }

  // 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=00 width=\"100%\"><tr><td>");  // padding
  document.writeln(" <table border=0 cellpadding=0 cellspacing=0 width=\"100%\">");
  document.writeln(" <tr><td colspan=2><img src=\"images/spacer.gif\" height=10></td></tr>");   // spacer
  document.writeln(" <tr>");
  // document.writeln("   <td align=left valign=center class=logoText>");
  // document.writeln("     <img border=0 src=\"images/logo.gif\" alt=\"Kom og Dans Vejle\">"); 
  // document.writeln("   </td>");
  document.writeln("   <td valign=bottom width=\"100%\" class=headerText>" + title +"<br>");
  document.writeln("   <img src=\"images/greyRule.gif\" height=1 width=450><br>");
  document.writeln("   <div class=copyrightNotice>Kom og Dans Vejle &mdash; God motion - Danseglæde - Socialt samvær</div></td>");
  document.writeln("   <td><img src=\"images/spacer.gif\" width=20></td>");
  document.writeln(" </tr>");
  document.writeln(" </table>");
  document.writeln("</tr></table>");  // </td>
}

