//<script>

// Variables
var base = "/files/picturelists";
var days = ["Zondag", "Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrijdag", "Zaterdag"];
var months = ["januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"]; 


// Functions
    function closePage () {
      self.clearTimeout(self.resizing);
      var div = document.getElementById("main_frame");
      var h;
      if (document.all) {
        h = div.clientHeight;
      } else { 
        h = div.offsetHeight;
      } 
      div.style.overflow = "hidden";
      resizer(h,1,3,10000);
      //div.style.height = h+"px";
      }
    
    function resizer (h,x,y,m) {
      var div = document.getElementById("main_frame");
      x = x + y;
      h -= x;
      if (h < 1) h = 1;  
      if (h > m) h = m;  
      div.style.height = h + "px";
      if (h == 1) return;
      if (h == m) {
        div.style.overflow = "";
        //div.style.height = "";
        return;
        }
      self.clearTimeout(self.resizing);
      self.resizing = self.setTimeout("resizer(" + h + "," + x + "," + y + "," + m + ");",40);
      }
    
    var PointingMenuItem;
    function PointMenuItem (menu_id) {
      UnPointMenuItem();
      PointingMenuItem = self.setTimeout("PointMenuItem2('" + menu_id + "')",150);
      }
    function UnPointMenuItem () {
      if(PointingMenuItem) self.clearTimeout(PointingMenuItem);
      }

    function PointMenuItem2 (menu_id) {
      document.getElementById("submenu").innerHTML = MenuStruct[menu_id]["html"];
      for (var other_menu_id in MenuStruct) {
        if (other_menu_id == menu_id) {
          document.getElementById("mmnu_" + other_menu_id + "_img_l").src = "/pics/mmnu_over_l.gif";
          document.getElementById("mmnu_" + other_menu_id + "_img_r").src = "/pics/mmnu_over_r.gif";
          document.getElementById("mmnu_" + other_menu_id + "_main" ).bgColor = "#552515";
          document.getElementById("mmnu_" + other_menu_id + "_img_t").style.backgroundImage = "url(/pics/mmnu_over_t.gif)";
          document.getElementById("mmnu_" + other_menu_id + "_img_b").style.backgroundImage = "url(/pics/mmnu_over_b.gif)";
          document.getElementById("mmnu_" + other_menu_id + "_ahref").style.color = 'white';
          }
        else {
          document.getElementById("mmnu_" + other_menu_id + "_img_l").src = "/pics/mmnu_up_l.gif";
          document.getElementById("mmnu_" + other_menu_id + "_img_r").src = "/pics/mmnu_up_r.gif";
          document.getElementById("mmnu_" + other_menu_id + "_main" ).bgColor = "#B61F20";
          document.getElementById("mmnu_" + other_menu_id + "_img_t").style.backgroundImage = "url(/pics/mmnu_up_t.gif)";
          document.getElementById("mmnu_" + other_menu_id + "_img_b").style.backgroundImage = "url(/pics/mmnu_up_b.gif)";
          document.getElementById("mmnu_" + other_menu_id + "_ahref").style.color = '';
          }
        }
      }

    function ClickMenuItem (menu_id,url) {
      if (!url) url = MenuStruct[menu_id].url;
      closePage();
      document.getElementById("willy_main").src = url;
      return false;
      }

    function PointSubMenuItem (menu_id,submenu_id) {
      for (var i in SubMenus[menu_id]) {
        var other_menu_id = SubMenus[menu_id][i];
        //alert(other_menu_id + " == " + submenu_id);
        if (submenu_id && other_menu_id == submenu_id) {
          document.getElementById("smnu_" + menu_id + "_" + other_menu_id + "_img_l").src = "/pics/smnu_over_l.gif";
          document.getElementById("smnu_" + menu_id + "_" + other_menu_id + "_img_r").src = "/pics/smnu_over_r.gif";
          document.getElementById("smnu_" + menu_id + "_" + other_menu_id + "_main" ).bgColor = "#B61F20";
          document.getElementById("smnu_" + menu_id + "_" + other_menu_id + "_img_t").style.backgroundImage = "url(/pics/smnu_over_t.gif)";
          document.getElementById("smnu_" + menu_id + "_" + other_menu_id + "_ahref").style.color = '#FFFFAF';
          }
        else {
          document.getElementById("smnu_" + menu_id + "_" + other_menu_id + "_img_l").src = "/pics/smnu_up_l.gif";
          document.getElementById("smnu_" + menu_id + "_" + other_menu_id + "_img_r").src = "/pics/smnu_up_r.gif";
          document.getElementById("smnu_" + menu_id + "_" + other_menu_id + "_main" ).bgColor = "#552515";
          document.getElementById("smnu_" + menu_id + "_" + other_menu_id + "_img_t").style.backgroundImage = "url(/pics/smnu_up_t.gif)";
          document.getElementById("smnu_" + menu_id + "_" + other_menu_id + "_ahref").style.color = 'white';
          }
        }
      }

    var MenuMenus = {};
    function PointMenuMenuItem (menu_id) {
      for (var other_menu_id in MenuMenus) {
        //var other_menu_id = MenuMenus[i];
        //alert(other_menu_id + " == " + menu_id);
        if (other_menu_id == menu_id) {
          document.getElementById(other_menu_id + "_img_l").src = "/pics/smnu_over_l.gif";
          document.getElementById(other_menu_id + "_img_r").src = "/pics/smnu_over_r.gif";
          document.getElementById(other_menu_id + "_main" ).bgColor = "#B61F20";
          document.getElementById(other_menu_id + "_img_t").style.backgroundImage = "url(/pics/smnu_over_t.gif)";
          //document.getElementById(other_menu_id + "_ahref").style.color = '#FFFFAF';
          }
        else {
          document.getElementById(other_menu_id + "_img_l").src = "/pics/smnu_up_l.gif";
          document.getElementById(other_menu_id + "_img_r").src = "/pics/smnu_up_r.gif";
          document.getElementById(other_menu_id + "_main" ).bgColor = "#552515";
          document.getElementById(other_menu_id + "_img_t").style.backgroundImage = "url(/pics/smnu_up_t.gif)";
          //document.getElementById(other_menu_id + "_ahref").style.color = 'white';
          }
        }
      }



    // Calculate four digit year.
    function fourdigits (number)	{
	  return (number < 1000) ? number + 1900 : number;
      }
      	
    function clock() {
      //if (!document.layers && !document.all) return;
      if (!document.getElementById) return;
      var digital = new Date();
      var hours = digital.getHours();
      var minutes = digital.getMinutes();
      var seconds = digital.getSeconds();
      //var amOrPm = "AM";
      //if (hours > 11) amOrPm = "PM";
      //if (hours > 12) hours = hours - 12;
      //if (hours == 0) hours = 12;
      if (minutes <= 9) minutes = "0" + minutes;
      if (seconds <= 9) seconds = "0" + seconds;
      // Calculate the number of the current day in the week.
      var date = ((digital.getDate()<10) ? "0" : "")+ digital.getDate();
      var dispTime = days[digital.getDay()] + ", " +
         date + " " + months[digital.getMonth()] + " " +
         (fourdigits(digital.getYear())) + ", " +
         hours + ":" + minutes + ":" + seconds;
      
      /*if (document.layers) {
        document.layers.pendule.document.write(dispTime);
        document.layers.pendule.document.close();
        }
      else if (document.all) pendule.innerHTML = dispTime;*/
      document.getElementById("pendule").innerHTML = dispTime;
    
      setTimeout("clock()", 1000);
      }

// Floating menu script:
  function layerObject(id,left) {
    if (ns6) {
      this.obj = document.getElementById(id).style;
      this.obj.left = left;
      return this.obj;
      }
    else if(ie4) {
      this.obj = document.all[id].style;
      this.obj.left = left;
      return this.obj;
      }
    else if(ns4) {
      this.obj = document.layers[id];
      this.obj.left = left;
      return this.obj;
     }
    }
  
  function layerSetup() {
    floatLyr = new layerObject('floatLayer', 0 ); //pageWidth * .5
    window.setInterval("main()", 10)
    }

  function floatObject() {
    if (ns4 || ns6) {
      findHt = window.innerHeight;
      } 
    else if(ie4) {
      findHt = document.body.clientHeight;
      }
    } 

  function main() {
    if (ns4) {
      this.currentY = document.layers["floatLayer"].top;
      this.scrollTop = window.pageYOffset;
      mainTrigger();
      }
    else if(ns6) {
      this.currentY = parseInt(document.getElementById('floatLayer').style.top);
      this.scrollTop = scrollY;
      mainTrigger();
      } 
    else if(ie4) {
      this.currentY = floatLayer.style.pixelTop;
      this.scrollTop = document.body.scrollTop;
      mainTrigger();
      }
    }

  function mainTrigger() {
    var newTargetY = this.scrollTop;// + this.topMargin;
    if (newTargetY < this.topMargin) newTargetY = this.topMargin;
    if ( this.currentY != newTargetY ) {
      if ( newTargetY != this.targetY ) {
        this.targetY = newTargetY;
        floatStart();
        }
      animator();
      }
    }
  
  function floatStart() {
    var now = new Date();
    this.A = this.targetY - this.currentY;
    this.B = Math.PI / ( 2 * this.slideTime );
    this.C = now.getTime();
    if (Math.abs(this.A) > this.findHt) {
      this.D = this.A > 0 ? this.targetY - this.findHt : this.targetY + this.findHt;
      this.A = this.A > 0 ? this.findHt : -this.findHt;
      }
    else {
      this.D = this.currentY;
      }
    }
  
  function animator() {
    var now = new Date();
    var newY = this.A * Math.sin( this.B * ( now.getTime() - this.C ) ) + this.D;
    newY = Math.round(newY);
    if (( this.A > 0 && newY > this.currentY ) || ( this.A < 0 && newY < this.currentY )) {
      if ( ie4 )document.all.floatLayer.style.pixelTop = newY;
      if ( ns4 )document.layers["floatLayer"].top = newY;
      if ( ns6 )document.getElementById('floatLayer').style.top = newY + "px";
      }
    }


// Photopage script:
      function ToLeft () {
        if (CurrentI > 1) {
          ActivatePic(CurrentI-1);
          }
        return false;
        }
      
      function ToRight () {
        if (CurrentI < fotos.length) {
          ActivatePic(CurrentI+1);
          }
        return false;
        }
      
      function ClickFrame (num) {
        if (CurrentI == 1) {
          num++;
          }
        else if (CurrentI == fotos.length) {
          num--;
          }
        ActivatePic(CurrentI+num-2);
        return false;
        }
      
      
      var metplaatjes = false;
      function ActivatePic (num) {
        //document.getElementById("HrefFrame1").scrollIntoView();
        if (metplaatjes) {
          document.getElementById("CellPijlLeft").style.display = "";
          document.getElementById("CellPijlLeft_B").style.display = "none";
          document.getElementById("HrefPijlRight").style.display = "";
          }
        else {
          document.getElementById("HrefPijlRight").style.color = "";
          document.getElementById("HrefPijlLeft").style.color = "";
          document.getElementById("HrefPijlRight").style.textDecoration = "";
          document.getElementById("HrefPijlLeft").style.textDecoration = "";
          }

        
        if (metplaatjes) {
          if (fotos.length < 3) {
            document.getElementById("CellFrame3").style.display = "none";
            }
          if (fotos.length < 2) {
            document.getElementById("CellFrame2").style.display = "none";
            }
          if (fotos.length < 1) {
              document.getElementById("CellFrame1").style.display = "none";
            }
          }
        
        if (num == 1) { // left
          if (metplaatjes) {
            document.getElementById("CellFrame1").style.display = "";
            document.getElementById("CellPijlLeft").style.display = "none";
            document.getElementById("CellPijlLeft_B").style.display = "";
            }
          else {
            document.getElementById("HrefPijlLeft").style.color = "#CCCCCC";
            document.getElementById("HrefPijlLeft").style.textDecoration = "none";
            }
          //document.getElementById("HrefPijlLeft").style.display = "none";

          if (metplaatjes) {
            document.getElementById("CellFrame1").style.backgroundImage="url(/pics/frame2.gif)";
            document.getElementById("CellFrame2").style.backgroundImage="url(/pics/frame1.gif)";
            //document.getElementById("CellFrame3").style.backgroundImage="url(/pics/frame1.gif)";
            document.getElementById("CellFrame3").style.display = "none";

            document.getElementById("ImgFrame1").src = base + fotos[num-1][0];
            document.getElementById("ImgFrame1").alt = fotos[num-1][2];
            if (fotos[num]) {
              document.getElementById("ImgFrame2").src = base + fotos[num][0];
              document.getElementById("ImgFrame2").alt = fotos[num][2];
              }
            }
          //if (fotos[num+1]) document.getElementById("ImgFrame3").src = base + fotos[num+1][0];
          }
        else if (num == fotos.length) { // right
          if (metplaatjes) {
            document.getElementById("CellFrame3").style.display = "";
            document.getElementById("HrefPijlRight").style.display = "none";
            }
          else {
            document.getElementById("HrefPijlRight").style.color = "#CCCCCC";
            document.getElementById("HrefPijlRight").style.textDecoration = "none";
            }

          if (metplaatjes) {
            document.getElementById("CellFrame1").style.display = "none";
            //document.getElementById("CellFrame1").style.backgroundImage="url(/files/pics/frame1.gif)";
            document.getElementById("CellFrame2").style.backgroundImage="url(/pics/frame1.gif)";
            document.getElementById("CellFrame3").style.backgroundImage="url(/pics/frame2.gif)";

            //if (fotos[num-3]) document.getElementById("ImgFrame1").src = base + fotos[num-3][0];
            if (fotos[num-2]) {
              document.getElementById("ImgFrame2").src = base + fotos[num-2][0];
              document.getElementById("ImgFrame2").alt = fotos[num-2][2];
              }
            document.getElementById("ImgFrame3").src = base + fotos[num-1][0];
            document.getElementById("ImgFrame3").alt = fotos[num-1][2];
            }
          }
        else { // middle
          if (metplaatjes) document.getElementById("CellFrame1").style.display = "";
          if (metplaatjes) document.getElementById("CellFrame3").style.display = "";

          if (metplaatjes) document.getElementById("CellFrame1").style.backgroundImage="url(/pics/frame1.gif)";
          if (metplaatjes) document.getElementById("CellFrame2").style.backgroundImage="url(/pics/frame2.gif)";
          if (metplaatjes) document.getElementById("CellFrame3").style.backgroundImage="url(/pics/frame1.gif)";

          if (fotos[num-2]) {
            if (metplaatjes) document.getElementById("ImgFrame1").src = base + fotos[num-2][0];
            if (metplaatjes) document.getElementById("ImgFrame1").alt = fotos[num-2][2];
            }
          if (metplaatjes) document.getElementById("ImgFrame2").src = base + fotos[num-1][0];
          if (metplaatjes) document.getElementById("ImgFrame2").alt = fotos[num-1][2];
          if (fotos[num]) {
            if (metplaatjes) document.getElementById("ImgFrame3").src = base + fotos[num][0];
            if (metplaatjes) document.getElementById("ImgFrame3").alt = fotos[num][2];
            }
          }   
        document.getElementById("PLAATJE").src = base + fotos[num-1][1];
        document.getElementById("PLAATJE").alt = fotos[num-1][2];
        document.getElementById("PictureTekst").innerHTML = fotos[num-1][2];
        document.getElementById("PictureSmallTekst").innerHTML = fotos[num-1][3];
        CurrentI = num;
        }
        
        
// Picture fader script

//<script>

// List with faders
// Each fader has a list of images
var PictureFaders = [];

function AddPictureFader (path,pauze,speed) {
  // pauze: how long is each image displayed (including fade time) (seconds)
  // speed: how long does a fade take (seconds)

  var i = PictureFaders.length;
  PictureFaders[i] = new PictureFader(i,path,pauze,speed);
  return PictureFaders[i];
}

function PictureFader (id,path,pauze,speed) { // constructor
  this.AddPicture = PictureFader_AddPicture;
  this.Draw       = PictureFader_Draw;
  this.Play       = PictureFader_Play;
  this.Stop       = PictureFader_Stop;
  this.Forward    = PictureFader_Forward;
  this.Rewind     = PictureFader_Rewind;
  this.Schedule   = PictureFader_Schedule;
  this.Showpic    = PictureFader_Showpic;
  this.TogglePauze = PictureFader_TogglePauze;
  
  // init
  this.fader    = new crossfader(); 
  this.timeout  = null;
  this.pictures = [];
  this.showing  = -1;
  this.playing  = false;
  this.path     = path;
  this.id       = id;
  this.pauze    = pauze;
  this.speed    = speed;
  this.v        = "PictureFaders[" + id + "]";
  
  return this;
}

function PictureFader_AddPicture (file,comment) {
  var img = new Image();
  img.src = this.path + "/" + file;
  img.alt = comment.replace(/"/g,"&quot;");
  var n = this.pictures.length;
  this.pictures[n] = img;
}

function PictureFader_Forward (slow) {
  this.showing++;
  if (this.showing >= this.pictures.length) {
    this.showing = 0;
    }
  this.Showpic(this.showing,slow);
  if (this.playing) this.Schedule();
}

function PictureFader_Rewind () {
  this.showing--;
  if (this.showing < 0) {
    this.showing = this.pictures.length - 1;
    }
  this.Showpic(this.showing,true);
  // Reset schedule
  if (this.playing) this.Schedule();
}

function PictureFader_Showpic (n,slow) {
  var img = document.getElementById("PictureFaderImg" + this.id);
  this.fader.crossfade(img,  // Img object
    this.pictures[n].src,    // new src
    this.speed,              // duration
    this.pictures[n].alt     // new alt
    );
  if (slow) slow = (500 * this.speed);
  else      slow = 1;
  self.clearTimeout(this.labelclock);
  this.labelclock = self.setTimeout("document.getElementById('PictureFaderTitle" + this.id + "').innerHTML = \"" +
                  this.pictures[n].alt + "\";",slow);
}

function PictureFader_Play () {
  if (this.pictures.length > 1) {
    this.playing = true;
    this.Schedule( (1000 * this.pauze) - (1000 * this.speed) );
    }
}

function PictureFader_Stop () {
  this.playing = false;
  clearTimeout(this.timeout);
}

function PictureFader_Schedule (p) {
  if (!p || p == 0) p = (1000 * this.pauze);
  if (this.timeout) {
    clearTimeout(this.timeout);
    }
  if (this.playing) {
    this.timeout = self.setTimeout(this.v + ".Forward(true);" + this.v + ".Schedule();",p);
    }
}

function PictureFader_TogglePauze (img) {
  if (this.playing) {
    this.Stop();
    img.src = "/pics/play_up.gif";
    img.onmouseover = Function("this.src='/pics/play_over.gif';"); 
    img.onmouseout  = Function("this.src='/pics/play_up.gif';");
    }
  else {
    this.Play();
    img.src = "/pics/pauze_up.gif";
    img.onmouseover = Function("this.src='/pics/pauze_over.gif';"); 
    img.onmouseout  = Function("this.src='/pics/pauze_up.gif';");
    }
}

function PictureFader_Draw () {
  // Met image 0
  
  document.write(
    '<table cellpadding=0 cellspacing=0 border=0><tr>' +
    '<td colspan=2><img id="PictureFaderImg' + this.id + '" src="' + this.pictures[0].src + 
    '" alt="' + this.pictures[0].alt + '" border="0" ' +
    'style="filter:alpha(opacity=100);background-color:white;"></td></tr><tr>' +
    
    '<td><div class="PicFadeTitle" id="PictureFaderTitle' + this.id + '">' + this.pictures[0].alt + '</div></td>' + 
    '<td align=right><a href="#Rewind" onclick="' + this.v + '.Rewind();return false;">' + 
    '<img src="/pics/back_up.gif" width="16" height="16" vspace=2 alt="Rewind" ' +
    'border="0" onmouseover="this.src=\'/pics/back_over.gif\';" onmouseout="this.src=\'/pics/back_up.gif\';"></a>' +

    '<a href="#Pauze-Play">' + 
    '<img src="/pics/pauze_up.gif" width="16" height="16" vspace=2 alt="Pauze / Play"  ' +
    'onclick="' + this.v + '.TogglePauze(this);return false;"' +
    'border="0" onmouseover="this.src=\'/pics/pauze_over.gif\';" onmouseout="this.src=\'/pics/pauze_up.gif\';" ></a>' +

    '<a href="#Forward" onclick="' + this.v + '.Forward();return false;">' + 
    '<img src="/pics/forward_up.gif" width="16" height="16" vspace=2 alt="Forward" ' +
    'border="0" onmouseover="this.src=\'/pics/forward_over.gif\';" onmouseout="this.src=\'/pics/forward_up.gif\';" ></a>' +

    '</td></tr></table>');
  this.showing = 0;
  //this.Forward();
}



        

