﻿
  
lastmenu = "-1";
waitformenufade=false;
derdelastmenu = "-1";
derdewaitformenufade=false;
uitklapper1visible = false;
uitklapper2visible = false;

function ssm(layername){ // dit heete startshowmenu, maar leverde teveel html op
  
  submenu_toshow = layername;
  changeOpac(0, submenu_toshow);
  obj = document.getElementById(submenu_toshow);
  obj.style.visibility = "visible";
  obj.style.display = "block";
  waitformenufade=true; 
  hidemenu();
  lastmenu = submenu_toshow;
  showmenu();
  
  derdehidemenu();
  
  document.getElementById('uitklapper1').style.display="block";
  //document.getElementById('uitklapper2').style.display="block";
  
  changeOpac(0, 'uitklapper2');
  uitklapper2visible = false;
}

function ss3m(layername){ //naam niet meer omschrijvend vanwege teveel html

  //alert(layername);

  derdesubmenu_toshow = layername;
  //changeOpac(0, derdesubmenu_toshow);
  obj = document.getElementById(derdesubmenu_toshow);
  obj.style.visibility = "visible";
  obj.style.display = "block";
  derdewaitformenufade=true; 
  derdehidemenu();
  derdelastmenu = derdesubmenu_toshow;
  
  //document.getElementById('uitklapper1').style.display="block";
  document.getElementById('uitklapper2').style.display="block";
  
 // changeOpac(0, 'uitklapper2');
  showderdemenu();
 
}

function showderdemenu(){
  opac += 4;
  changeOpac(opac, derdesubmenu_toshow);
  document.getElementById("menudivje").style.width = "930px";
    
  if (uitklapper2visible == false){
    changeOpac(opac, 'uitklapper2');
  }
  
  if (opac < 100){
    t = setTimeout('showderdemenu()', 25)
     
   }else{
   opac=0;
   derdewaitformenufade=false;
   uitklapper2visible = true;
   //hidemenu(); // dit is voor als er snel wordt geklikt
   //obj = document.getElementById(lastmenu);
  
   //alert(obj.style.left);
   
   }
}

opac=0;
function showmenu(){
  opac += 4;
  changeOpac(opac, submenu_toshow);
  
  document.getElementById("menudivje").style.width = "930px";
 
  if (uitklapper1visible == false){
    changeOpac(opac, 'uitklapper1');
    ///changeOpac(opac, 'uitklapper2'); ///
  }
  
  if (opac < 100){
     t = setTimeout('showmenu()', 25)
     
   }else{
   
     opac=0;
     waitformenufade=false;
     uitklapper1visible = true;
     //hidemenu(); // dit is voor als er snel wordt geklikt
   
   }
}

function hidemenu(){
  if (lastmenu != "-1" && lastmenu != submenu_toshow){
    changeOpac(0, lastmenu);
  //alert(lastmenu);
  
  obj = document.getElementById(lastmenu);
  obj.style.visibility = "hidden";
  
  obj.style.display = "none";
  }else{
  //changeOpac(0, 'uitklapper1');
 
  }
  
  document.getElementById('uitklapper1').style.display="none";
  
}

function derdehidemenu(){

  if (derdelastmenu != "-1"){
    changeOpac(0, derdelastmenu);
  //alert(lastmenu);
    obj = document.getElementById(derdelastmenu);
    obj.style.visibility = "hidden";
    obj.style.display = "none";
  }
  
  document.getElementById('uitklapper2').style.display="none";
}

var lastobj = null;
function ci(name, src){ // deze heette change image: te veel html
    //alert("name: " + name + ",  src: " + src);
    obj = document.getElementById("rolloverimage");
    
    if (obj == null) return; // op de homepage;
    
    obj.name = name 
    obj.onerror = handleErr; 
    obj.src = src 
    lastobj = obj;
}

function handleErr()
{
   
   try
  {
      //adddlert("Welcome guest!");
      if (lastobj != null){
      //alert(lastobj);
       seAfbeeldingError(lastobj);
       //iets();
      }else{
      //  alert("obj is null");
      }
  }
  catch(err)
  {
      txt="There was an error on this page.\n\n";
      txt+="Error description: " + err.description + "\n\n";
      txt+="Click OK to continue.\n\n";
      //alert(txt);
  }


}

//var lastrolloverid = null;

//function showroll(id){

//  if (id != lastrolloverid){
//    id.style.visibility = "visible";
//    lastrolloverid = id;
//  }else{
//  alert('hide');
//    //lastrolloverid.style.visibility = "hidden";
//  }
//}

//function hideroll(id){



//  id.style.visibility = "hidden";
//  alert('hide');
// // lastrolloverid = null;
//}

 //////////////////-------------------------------- scroll functies
// gives up and down scroll buttons to images, spans, ... named up_name, down_name, respectively.
// will keep the default scroll_box's style overflow if it encounters errors (so make overflow: auto;)

// usage: put this after the scrollbox div:  var div_scroll1 = new TextScroll('div_scroll1', 'scroll_box');
function TextScroll(scrollname, div_name, up_name, down_name)
{
    this.div_name = div_name;
    this.name = scrollname;
    this.scrollCursor = 0;
    this.speed = 12;
    this.timeoutID = 0;
    this.div_obj = null;
    this.up_name = up_name;
    this.dn_name = down_name;

{
        if (document.getElementById) {
            div_obj = document.getElementById(this.div_name);
            if (div_obj) {
                this.div_obj = div_obj;
                this.div_obj.style.overflow = 'hidden';
            }
            div_up_obj = document.getElementById(this.up_name);
            div_dn_obj = document.getElementById(this.dn_name);
            if (div_up_obj && div_dn_obj) {
            
//                div_up_obj.setAttribute("onmouseover", scrollname + ".scrollUp();")
//                div_up_obj.setAttribute("onmouseout", scrollname + ".stopScroll();")

//                div_dn_obj.setAttribute("onmouseover", scrollname + ".scrollDown();")
//                div_dn_obj.setAttribute("onmouseout", scrollname + ".stopScroll();")

                  div_up_obj.onmouseover = function() { eval(scrollname + ".scrollUp();") };
                  div_up_obj.onmouseout = function() { eval(scrollname + ".stopScroll();") };

                  div_dn_obj.onmouseover = function() { eval(scrollname + ".scrollDown();") };
                  div_dn_obj.onmouseout = function() { eval(scrollname + ".stopScroll();") };

            }
        }
    }

this.stopScroll = function() {
        clearTimeout(this.timeoutID);
    }

this.scrollUp = function() {

     if (this.div_obj == null){ //.rw addition
            div_obj = document.getElementById(this.div_name);
            if (div_obj) {
                this.div_obj = div_obj;
                this.div_obj.style.overflow = 'hidden';
            }

      }
      
        if (this.div_obj) {
            this.scrollCursor = (this.scrollCursor - this.speed) < 0 ? 0 : this.scrollCursor - this.speed;
            this.div_obj.scrollTop = this.scrollCursor;
            this.timeoutID = setTimeout(this.name + ".scrollUp()", 60);
        }
    }

//this.scrollDown = function() {
//        //alert('scrolldown');
//        Obj = document.getElementById("info");
//        Obj.innerHTML = this.div_name + " " + this.div_obj;
//        
//        if (this.div_obj) {
//            this.scrollCursor += this.speed;
//            this.div_obj.scrollTop = this.scrollCursor;
//            this.timeoutID = setTimeout(this.name + ".scrollDown()", 60);
//        }
//    }

this.scrollDown = function() {

     // Obj = document.getElementById("info");
     // Obj.innerHTML = this.div_name + " " + this.div_obj;

      if (this.div_obj == null){ //.rw addition
            div_obj = document.getElementById(this.div_name);
            if (div_obj) {
                this.div_obj = div_obj;
                this.div_obj.style.overflow = 'hidden';
            }

      }
      
    if (this.div_obj) {
      this.scrollCursor += this.speed;
      this.div_obj.scrollTop = this.scrollCursor;
     
      if (this.div_obj.scrollTop == this.scrollCursor) {
        this.timeoutID = setTimeout(this.name + ".scrollDown()", 60);
      } else {
        this.scrollCursor = this.div_obj.scrollTop;
      }
    }
}

this.resetScroll = function() {
        if (this.div_obj) {
            this.div_obj.scrollTop = 0;
            this.scrollCursor = 0;
        }
    }
}

//////////////////-------------------------------- einde scroll functies

function showOrHideAllDropDowns(newState) 
{
        
        var elements = document.documentElement.getElementsByTagName('select');
     
        for (var i=0; i<elements.length; i++) {
            elements[i].style.visibility = newState;
        }
}