function getmetaContents(mn)
{
  var m = top.frame1.document.getElementsByTagName('meta');
  for(var i in m)
  {
    //alert(m[i].name + " = "+m[i].content);
    if(m[i].name == mn)
    {
      return m[i].content;
    }
  }
  return "";
}

function aanpassenicoon()
{
  var tabel;
  var cel;
  var i;




  tabel=top.frame1.document.getElementsByTagName("td");

  for (i=0;i<tabel.length;i++)
  {
    cel=tabel[i];

    if (cel.childNodes.length==1)
   
      if (cel.childNodes[0].tagName=="A" && cel.childNodes[0].className=="icoon")
      {
        cel.childNodes[0].onmouseover=new Function ("top.aanicoon(this,true);");
        cel.childNodes[0].onmouseout= new Function ("top.aanicoon(this,false);");
      }
  }

}



function maaktabel(tabdef, volledig)
{
  var html="";
  var r;
  var stijl;
  if (volledig)
  {
    html=html + "<table class='tab'>";
    html=html + "<tbody>";

    html=html + "<tr>";
    html=html + "<td class= 'tab1' id='tab_b'></td>";
    html=html + "</tr>";

    html=html + "</tbody>";
    html=html + "</table>";

    html=html + "<table class='tab'>";
    html=html + "<tbody>";

    html=html + "<tr>";
    html=html + "<td class='tab2'></td>";
  }

  for (r=1;r<=tabdef.length;r++)
  {
    if (islink(tabdef[r+"l"],top.frame1.location.href))
      stijl="tab3a";
    else
      stijl="tab3";

    if (volledig)
      html=html + "<td class='"+stijl+"' id='tab_"+r+"' link='"+tabdef[r+"l"]+"' onmouseover='top.aantab(this,true);' onmouseout='top.aantab(this,false);' onclick='top.volglink(this);'>"+tabdef[r+"n"]+"</td>";
    else
    {
      document.all["tab_"+r].className=stijl;
    }
  }

  if (volledig)
  {
    html=html + "<td class='tab4'></td>";
    html=html + "</tr>";
    html=html + "</tbody>";
    html=html + "</table>";

    return html;

  }
  else
    return "";

}


function toon(a)
{
  
  c="";
  for (b in a)
  {
    c=c+b+"="+a[b]+" : ";
    if (c.length>1000)
    {
      alert(c);
      c="";
    }
  }
  if (c!="")
    alert(c);
}

function islink(a,b)
{

  if (b.indexOf("/"+a)>=0 || b.indexOf("\\"+a)>=0 || b==a)
    return true;
  else
    return false;

}

function gettabs(tabcontent)
{

  var nr;
  var pos1=0;
  var pos2=0;
  var pos3=0;
  var tabs;

  if (tabcontent!="" && tabcontent!="undefined")
  {
    tabs=1*tabcontent.substring(0,1);
    if (tabcontent.substring(1,2)!=",")
      tabs=1*tabcontent.substring(0,2);

    var tabdef = new Array(tabs);
    for (nr=1;nr<=tabs;nr++)
    {


       pos1=tabcontent.indexOf(",",pos1);
       pos2=tabcontent.indexOf("=",pos1);
       pos3=tabcontent.indexOf(",",pos2);
       if (pos3<0)
         pos3=tabcontent.length;

       tabdef[nr+"n"]=tabcontent.substring(pos1+1,pos2);
       tabdef[nr+"l"]=tabcontent.substring(pos2+1,pos3);



       pos1=pos2;
    }
  }
  else
  {
    var tabdef = new Array(0);
    tabdef.length=0;
  }


  return tabdef;
  
}

function doemenu()
{

  var tabcontent=getmetaContents("tabs");
  var menu=getmetaContents("menu");
  var description=getmetaContents("description");
  var tabdef = new Array();

  tabdef=gettabs(tabcontent);


  document.all["titel"].innerHTML=top.frame1.document.title;


  if (tabdef.length>0)
  {
    if (document.all["beschrijving"].tabcontent!=tabcontent)
      document.all["beschrijving"].innerHTML=maaktabel(tabdef,true);
    else
      maaktabel(tabdef,false);
      
    document.all["tab_b"].innerHTML=description;
  }
  else
  {
    document.all["beschrijving"].innerHTML=description;
  }

  document.all["beschrijving"].tabcontent=tabcontent;

  if (islink(menu,top.frame2.location.href))
    aanpassenmenu(false);
  else
    top.frame2.location.href=menu;

}


function aanpassenmenu(volledig)
{
  var tabel;
  var cel;
  var i;

  tabel=top.frame2.document.getElementsByTagName("td");

  for (i=0;i<tabel.length;i++)
  {
    cel=tabel[i];

    if (volledig)
    {
      cel.onmouseover=new Function ("top.aan(this,true);");
      cel.onmouseout= new Function ("top.aan(this,false);");
      cel.onclick= new Function ("top.volglink(this);");
    }

    if (islink(cel.link,top.frame1.location.href))
    {
      if (cel.className=="menubutton" || cel.className=="menubutton1")
        cel.className="menubutton2";
      if (cel.className=="menubuttonx" || cel.className=="menubutton1x")
        cel.className="menubuttonx2";
    }
    else
    {
      if (cel.className=="menubutton2" || cel.className=="menubutton1")
        cel.className="menubutton";
      if (cel.className=="menubuttonx2" || cel.className=="menubutton1x")
        cel.className="menubuttonx";
    }
  }
}

function aan(object,actie)
{
  if (actie)
  {
    if (object.className=="menubutton" || object.className=="menubutton2")
      object.className="menubutton1";
    if (object.className=="menubuttonx" || object.className=="menubuttonx2")
      object.className="menubuttonx1";
  }
  else
  {
    if (islink(object.link,top.frame1.location.href))
    {
      if (object.className=="menubutton1")
        object.className="menubutton2";
      if (object.className=="menubuttonx1")
        object.className="menubuttonx2";
    }
    else
    {
      if (object.className=="menubutton1")
        object.className="menubutton";
      if (object.className=="menubuttonx1")
        object.className="menubuttonx";
    }
  }

}


function aantab(object,actie)
{
  if (actie)
  {
    object.className="tab3s";
  }
  else
  {
    if (islink(object.link,top.frame1.location.href))
      object.className="tab3a";
    else
      object.className="tab3";
  }
}


function aanicoon(object,actie)
{
  if (actie)
    object.parentNode.className="icoon1";
  else
    object.parentNode.className="icoon";

}


function volglink(link)
{

  var lnk;
  lnk=link.link;
  //firefox
  if (lnk==undefined)
    lnk=link.getAttribute("link");

  if(islink(lnk,top.frame1.location.href)!=true)
  {
    top.frame1.location.href=lnk;
  }
}

function leescookie(naam)
{
//lees cookie
  var koek=this.document.cookie
  var pos=koek.indexOf(naam+"=")
  var len=naam.length+1

  if (pos>=0)
  {
    koek=koek.substring(pos+len)
    pos=koek.indexOf(";")
    if (pos>=0)
      koek=koek.substr(0,pos)
  }
  else
    koek=""

  return koek
}

function schrijfcookie(naam,waarde)
{
  //schrijf een cookie

  var expdate = new Date();

  //2 maanden houdbaar
  expdate.setTime(expdate.getTime() +  (60* 24 * 60 * 60 * 1000)); 

  this.document.cookie=naam+"="+waarde+"; expires=" + expdate.toGMTString() + ";"
}


function wisselpagina()
{

  var a=leescookie("pagina");

  if (a!="")
  {
     schrijfcookie("pagina","");
     top.frame1.location.href=a;
  }



}

