var path = "";
var rubriek = new Array();
var adres = new Array();
var menu_txt_nl = new Array();
var menu_txt_en = new Array();
var kop_txt_nl = new Array();
var kop_txt_en = new Array();
var i = 0;

vul_menu( "home",     "index.htm?id=home", "Home<br>Thuis", "Home", "theatrale acrobatiek van Hollandse bodem", "comical acrobatics from the land of the windmills" );
vul_menu( "show",     "show.htm", "Shows", "Shows", "shows", "shows" );
vul_menu( "animatie", "animatie.htm", "Animaties", "Walk acts", "animatie", "skits and walk acts" );
vul_menu( "hollandpromo",  "hollandpromo.htm", "Holland<br>Promo", "Holland<br>Promo", "Holland Promo", "Holland Promo" );
vul_menu( "special",  "special.htm", "Sint & Kerst", "Sint & Christmas", "Sint & Kerst", "Sint & Christmas" );
vul_menu( "workshop", "workshop.htm", "Workshops", "Workshops", "workshops", "workshops" );
vul_menu( "contact",  "contact.htm", "Contact", "Contact", "contact", "contact" );
vul_menu( "foto",     "foto/index.htm", "Foto's", "Photo<br>album", "foto's", "photos" );
vul_menu( "video",    "video.htm", "Video", "Video", "video", "video" );

function vul_menu( rubr, adr, opt_nl, opt_en, kop_nl, kop_en )
{
  rubriek[i] = rubr;
  adres[i] = adr;
  menu_txt_nl[i] = opt_nl;
  menu_txt_en[i] = opt_en;
  kop_txt_nl[i]  = kop_nl;
  kop_txt_en[i]  = kop_en;
  i++;
}

function menu( language, depth, this_is )
{
  path = set_path( depth );
  var link;
  var linkto;
  var str = "";

  if ( language == "nl" )
  {
    menu_txt = menu_txt_nl;
  }
  if ( language == "en" )
  {
    menu_txt = menu_txt_en;
  }

  str +=
    "<table width=100% cellspacing=0 cellpadding=0 border=0>" +
    "  <tr valign=middle align=center>"
    "";

  for ( idx = 0; idx < rubriek.length; idx++ )
  {
    if ( idx > 0 )
    {
      str += "    <td width=4%></td>";
    }
    str += "    <td width=7.5%>";

    if ( this_is == rubriek[idx] )
    {
      str += begin_kader( "" );
    }

    linkto = rubriek[idx] + "/index.htm";
    if ( adres[idx] != "" )
    {
      linkto = adres[idx];
    }

    if ( linkto.indexOf( "?") > -1 )
    {
      linkto += ",";
    }
    else
    {
      linkto += "?";
    }
    linkto += "taal=" + language;

    link = 
      "<a href=" + path + linkto + 
      "  onMouseOver=\"self.status='';return true\">" +
      menu_txt[idx] + "</a>";

    str += link;
    if ( this_is == rubriek[idx] )
    {
      str += eind_kader( "" );
    }
    str += "    </td>";
  }

  str +=
    "  </tr>" +
    "  <tr><td>&nbsp</td></tr>" +
    "</table>"
    "";

//  document.write( str );
  return( str );
}

function set_path( depth )
{
  var pth = "";
  for( i = 1; i < depth; i++)
  {
    pth = pth + "../";
  }
  return( pth );
}

function begin_kader( rubriek )
{
  var uitlijn = "";

  if ( rubriek != "foto" )
  {
    uitlijn = " align=center";
  }

  return (
    "<table width=100% cellspacing=0 cellpadding=0 border=1 bordercolor=ef9a31>" +
    "  <tr valign=middle" + uitlijn + ">" +
    "    <td>"
    );
}

function eind_kader()
{
  return (
    "    </td>" +
    "  </tr>" +
    "</table>"
    );
}

function maak_top( taal, depth, this_is, subtxt )
{
  path = set_path( depth );
  var head = "";
  var str = "";
  var width;
  var w = winWidth();

  if ( w == -1 ) { width = "100%"; } else { w = w - 270; width = w + "px"; }

  for ( idx=0; idx < rubriek.length; idx++ )
  {
    if ( rubriek[idx] == this_is )
    {
      if ( taal == "nl" ) { head = kop_txt_nl[idx]; }
      if ( taal == "en" ) { head = kop_txt_en[idx]; }
      break;
    }
  }

  if ( subtxt != null )
  {
    head += ": " + subtxt;
  }

  str =
    "<div style='position: absolute; top: 125px; left: 0px; width: " + width + "; border: solid 0px;'>" +
    "  <div style='position: absolute; width: 400px; left: 50%; margin-left: -200px; height: 25px; text-align: center; background: url(" + path + "gfx/strepen.jpg) 0 0 repeat-x;'>" +
    "  <table class='w100' cellspacing=0 cellpadding=0 border=0>" +
    "    <tr valign=middle><td height=25>" +
    "    <div class='pagehead'>" + head + "</div>" +
    "    </td></tr>" +
    "  </table>" +
    "  </div>" +
    "</div>" +



    "<div style='position: absolute; left: 0px; width: " + width + "; border: solid 0px;'>" +
    "<center>" +

//    "  <a href='" + path + "foto/index.htm?map=kerst,taal=" + taal + "'" +
//    "    onMouseOver=\"self.status='';return true\"><img " +
//    "    src='" + path + "foto/special/kerst/kerstman en vrouw zwaaien.jpg' alt='Kerst' width=60 height=80 hspace=40></a>" +

    "  <font size=+3 color=white><b>circus</b></font>" +
    "  <img src='" + path + "gfx/kietelen.gif' alt='Circus Klomp' width=200 height=120 border=0>" +
    "  <font size=+3 color=white><b>KLOMP</b></font>" +

//    "  <a href='" + path + "foto/index.htm?map=kerst,taal=" + taal + "'" +
//    "    onMouseOver=\"self.status='';return true\"><img " +
//    "    src='" + path + "foto/special/kerst/kerstacro.jpg' alt='Kerst' width=60 height=80 hspace=40></a>" +

    "</center>" +
    "</div>" +

    "<div style='position: absolute; top: 0px; left: 5px; width: 100px; height: 40px;'>" +
    "  <table cellspacing=0 cellpadding=0 border=0>" +
    "    <tr>" +
    maak_vlag( 'nl' ) + " " +
    maak_vlag( 'en' ) +
    "    </tr>" +
    "  </table>" +
    "</div>" +

    "<div style='position: absolute; top: 0px; right: 0px; width: 100px; height: 40px;'>" +
    "  <img src='" + path + "gfx/logo.jpg' alt='Circus Klomp logo' width=67 height=100 border=0><br>" +
    "</div>" +
    "";

//  document.write( str );
  return( str );
}

function maak_vlag( taal )
{
  var link;
  var str = "a" + window.location;
  var pos = str.indexOf('taal=');

  if ( pos > -1 )
  {
    link = str.substr(1,pos-1) + "taal=" + taal;
  }
  else
  {
    if ( str.indexOf('?') > -1 )
    {
      link = str.substr(1) + ",taal=" + taal;
    }
    else
    {
      link = str.substr(1) + "?taal=" + taal;
    }
  }

  var vlag = "vlag_" + taal + ".gif";
  var stat = "";
  if ( taal == "nl" ) { stat = "naar Nederlandse versie"; }
  if ( taal == "en" ) { stat = "to English version"; }

  return (
    "    <td width=13 height=40 align=right>" +
    "      <img src='" + path + "gfx/mast.gif' width=3 height=30 border=0>" +
    "    </td>" +
    "    <td>" +
    "      <a href=" + link +
    "    onMouseOver=\"self.status='';return true\"" +
    "  ><img class='geenrand' src='" + path + "gfx/" + vlag + "' alt=\" " + stat + " \" width=32 height=24></a>" +
    "    </td>" +
    "" );
}

function zet_param( loc, param, def )
{
  var locationstring = "a"+loc;
  var pos, str, param_pos;
  var val = def;
  param += "=";

  pos = locationstring.indexOf('?');
  if ( pos != -1 )
  {
    str = locationstring.substr(pos);
    param_pos  = str.indexOf( param );

    if ( param_pos != -1 )
    {
      val = str.substring(param_pos+param.length)
      pos = val.indexOf(',');
      if ( pos != -1 )
      {
        val = val.substring(0, pos);
      }
    }
  }

  return( val );
}

function winWidth() {
  if( document.documentElement && document.documentElement.clientWidth ) {
    //IE 6+ in 'standards compliant mode'
    //alert( "IE 6+");
    return( document.documentElement.clientWidth );
  }

  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    //alert( "Non-IE");
    return( window.innerWidth );
  }

  if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    //alert( "IE 4");
    return( document.body.clientWidth );
  }
  return( -1 );
}

function winHeight() {
  if( document.documentElement && document.documentElement.clientHeight ) {
    //IE 6+ in 'standards compliant mode'
    //alert( "IE 6+");
    return( document.documentElement.clientHeight );
  }

  if( typeof( window.innerHeight ) == 'number' ) {
    //Non-IE
    //alert( "Non-IE");
    return( window.innerHeight );
  }

  if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    //alert( "IE 4");
    return( document.body.clientHeight );
  }

  return ( -1 );
}


