
  //User variables
  var menuRows = 4;
  var menuCols = 4;
  var windowHeight = menuRows * 137;
  var windowWidth = menuCols * 225;
  var contentHeight = windowHeight - 50;
  var contentWidth = windowWidth - 60;
  var windowTotalStep = 25;
  var tipMarginLeft = 0;
  var tipMarginTop = 20;
  var host = location.href.substring(0, location.href.indexOf('/', 8) ); 
  host = host + '';

  var photoWidth = 800;  //Breedte in pixels, bij een gedraaide foto is dit de hoogte
  var photoHeight = 600; //Hoogte in pixels, bij een gedraaide foto is dit de breedte
  var photoTime = 3500;  //Pauze in microseconde tussen elke foto in play modus

  ///////////////////////////////////////////////////////////////////////////////////////////////////////////
  //                                  A L G E M E N E   F U N C T I E S                                    //
  //                                                                                                       //
  // 28-08-2007                                                                                 GvR Studio //
  ///////////////////////////////////////////////////////////////////////////////////////////////////////////

  //Browser afhakelijkheden variables
  var ie = (document.all) ? 1:0;
  var ie6 = (navigator.appVersion.indexOf('MSIE 6.') > 0 ? true : false);
  var ie7 = (navigator.appVersion.indexOf('MSIE 7.') > 0 ? true : false);
  var className = (ie && (ie6 || ie7)) ? 'className':'class';
  var winSize = new Array();
  var mousePos = null;
  var toolTip = null;
  var winScroll = new Array();
  var xmlObject = new Array();
  var XMLajaxRequest = new Array();

  //Functie met de standaart gegevens die geladen moeten worden
  function windowOnLoad() {
    windowResize();
    windowScroll();
    preLoadToolBar();
  }

  //Werk de winSize variable bij, en voer vervolgens de events uit
  function windowResize() {
    winSize = {
      x: document.documentElement.clientWidth,
      y: document.documentElement.clientHeight
    }

    //Events
    posMenu();
    posContent();
    setFooter();
  }

function getOffset(objID) {
    if (objID) {
      var x = objID.offsetLeft;
      var y = objID.offsetTop + objID.offsetHeight;
     
      var parent = objID;
      while (parent.offsetParent) {
        parent = parent.offsetParent;
        x += parent.offsetLeft;
        y += parent.offsetTop ;
       }
       return new Array(x,y);
     }
   }

  function tooltips () {
    if(toolTip && !menuObj) {
      if (!document.getElementById('menuDescription')) {
        var menuDescription = document.createElement('div');
        menuDescription.appendChild(document.createTextNode(toolTip.getAttribute('menuTitle')));
        menuDescription.setAttribute('id', 'menuDescription');
        document.body.appendChild(menuDescription);
      }
      if (document.getElementById('menuDescription')) {
        document.getElementById('menuDescription').style.left = parseInt(tipMarginLeft + mousePos['x']) + 'px';
        document.getElementById('menuDescription').style.top = parseInt(tipMarginTop + mousePos['y']) + 'px';
      }
    } else if (document.getElementById('menuDescription')) {
      document.body.removeChild(document.getElementById('menuDescription'));
    }
  }

  function mouseCoords(ev)
  {
    if(ev.pageX || ev.pageY) {
      return{x:ev.pageX, y:ev.pageY};
    }
    if (ev.clientX && document.body) {
      return{x:ev.clientX + document.body.scrollLeft - document.body.clientLeft, y:ev.clientY + document.body.scrollTop - document.body.clientTop};
    }
  }

  function mouseMoveMents(ev) {
  ev = ev || window.event;
    mousePos = mouseCoords(ev);
    tooltips();
  }

 //Werk de winScroll variable bij, en voer vervolgens de events uit
  function windowScroll() {
    winScroll = {
      x: document.documentElement.scrollLeft,
      y: document.documentElement.scrollTop
    }

    //Events
    setFooter();
  }

  function setFooter() {
    var obj = document.getElementById('footer');
    if (obj) {
      var posY = (winScroll['y'] > 0 ? winScroll['y'] : 0);
      posY += winSize['y'] -  90;
      obj.style.top = posY + 'px';
    }
    var obj = document.getElementById('BGfooter');
    if (obj) {
      var posX = winSize['x'] - 250;
      obj.style.width = posX + 'px';
    }
  }

  //Functie voor het instellen van de opacity van een object
  function opacObj(opacity, obj) {
    if (obj) {
      obj.style.opacity = (opacity / 100); 
      obj.style.MozOpacity = (opacity / 100); 
      obj.style.KhtmlOpacity = (opacity / 100); 
      obj.style.filter = "alpha(opacity=" + opacity + ")";
    }
  } 

  window.onresize = windowResize;
  window.onload = windowOnLoad;
  window.onscroll = windowScroll;
  document.onmousemove = mouseMoveMents;
    
  ///////////////////////////////////////////////////////////////////////////////////////////////////////////
  //                                        A J A X   F U N C T I E S                                      //
  //                                                                                                       //
  // 28-08-2007                                                                                 GvR Studio //
  ///////////////////////////////////////////////////////////////////////////////////////////////////////////

  //Voor het leegmaken van een object
  function cleanNode(obj) {
    var childs = obj.childNodes.length;
    for (i=0;i<childs;i++) {
      obj.removeChild(obj.firstChild, true);
    }
  }

  //Ajax handler
  function createHTTPHandler() {
    var xmlhttp=false;
    /*@cc_on @*/
    /*@if (@_jscript_version >= 5)
    // JScript gives us Conditional compilation, we can cope with old IE versions.
    // and security blocked creation of the objects.
     try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
     } catch (e) {
      try {
       xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
       xmlhttp = false;
      }
     }
    @end @*/
    if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
      xmlhttp = new XMLHttpRequest();
    }
    return xmlhttp;
  }

  function getNodeValue(obj, tag) {
    var tempObj = obj.getElementsByTagName(tag);
    if (tempObj.length > 0 && tempObj[0].firstChild) {
//      alert(tempObj[0].firstChild.nodeValue + '  -  ' + tag);
      return tempObj[0].firstChild.nodeValue;
    } else {
      return "";
    }
  }

  function openHTTPHandler(url, obj) {
    obj.open("GET", host + "/functions/ajaxHandler.php?" + url, true);
    obj.setRequestHeader("Cache-Control", "no-cache");
    obj.setRequestHeader("X_USERAGENT", "GvRStudio");
    obj.setRequestHeader("Content-type", "application/xml");
    if (document.getElementById('debug')) {
      document.getElementById('debug').appendChild(document.createTextNode(host + "/functions/ajaxHandler.php?" + url));
      document.getElementById('debug').appendChild(document.createElement('br'));
    }
    obj.send(null);
  }

  function openHTTPHandlerHTML(url, obj, page) {
    obj.open("GET", host + '/' + url, true);
    obj.setRequestHeader("Cache-Control", "no-cache");
    obj.setRequestHeader("X_USERAGENT", "GvRStudio");
    obj.setRequestHeader("Content-type", "application/xml");
    if (document.getElementById('debug')) {
      document.getElementById('debug').appendChild(document.createTextNode(host + "/functions/ajaxHandler.php?" + url));
      document.getElementById('debug').appendChild(document.createElement('br'));
    }
    obj.send(null);
  }

  //Ajax opener
   function ajaxRequest(action, link, placeID, functionVar) {
    XMLajaxRequest[action] = createHTTPHandler();
    XMLajaxRequest[action].onreadystatechange=function() {
      if (XMLajaxRequest[action].readyState==1) {
        if (!document.getElementById('ajaxLoader['+action+']')) {
          var div = document.createElement('div');
          div.setAttribute('id', 'ajaxLoader['+action+']');
          div.setAttribute(className, 'ajaxLoader');
          var img = document.createElement('img');
          img.setAttribute('src', host + '/images/loader.gif');
          img.setAttribute('alt', 'Loading');
          div.appendChild(img);
		      var span = document.createElement('span');
          span.appendChild(document.createTextNode('Een ogenblik geduld..'));
		      div.appendChild(span);
          document.getElementById(placeID).appendChild(div);
          var obj = document.getElementById('ajaxLoader['+action+']');
          obj.style.top = parseInt(document.getElementById(placeID).offsetTop + 20) + 'px';
          obj.style.left = parseInt(document.getElementById(placeID).offsetLeft + 15) + 'px';
        }
      }
      else if (XMLajaxRequest[action].readyState==4) {
        if (document.getElementById('ajaxLoader['+action+']')) {
          document.getElementById(placeID).removeChild(document.getElementById('ajaxLoader['+action+']'));
        }
        xmlObject[action] = XMLajaxRequest[action].responseXML;
        XMLajaxRequest[action] = null;
    		eval(action + "(placeID, " + functionVar + ");");
      }
    }
    openHTTPHandler(link, XMLajaxRequest[action]);
  }


  ///////////////////////////////////////////////////////////////////////////////////////////////////////////
  //                                          M E N U   F U N C T I E S                                    //
  //                                                                                                       //
  // 20-02-2008                                                                                 GvR Studio //
  ///////////////////////////////////////////////////////////////////////////////////////////////////////////
  var menuObj = null;
  var menuObjPos = new Array();
  var contentObj = null;
  var contentObjBG = null;
  function initMenu(first) {
    var yRow = 0;
    var xRow = 0;
    for (i=0;i<menuCols * menuRows;i++) {
      var obj = document.getElementById('menuItem' + i);
      if (obj) {
        if (obj.getAttribute(className) == 'menu') {
          if (first) {
            obj.onclick = function() {
              if (!menuObj) {
                clickMenu(this);
              }
            }
            obj.onmouseover = function() {
              if (document.getElementById('menuDescription')) {
                document.body.removeChild(document.getElementById('menuDescription'));
              }
              toolTip = this;
            }
            obj.onmouseout = function() {
              toolTip = null;
            }
          }
        }
        obj.style.width = windowWidth / menuCols + 'px';
        obj.style.height = windowHeight / menuRows + 'px';
        obj.style.left = windowWidth / menuCols * xRow + 'px';
        obj.style.top = windowHeight / menuRows * yRow + 'px';
        obj.style.zIndex = 1;
        xRow++;
        if (xRow > 3) {
          xRow = 0;
          yRow++;
        }
      }
    }
  }

  function IE6BugFix() {
    if (ie) {
      for (i=0;i<15;i++) {
    	  setTimeout("document.getElementById('menuItem"+i+"').style.height = windowHeight + 'px';", 20);
	      setTimeout("document.getElementById('menuItem"+i+"').style.width = windowWidth + 'px';", 20);
	      setTimeout("document.getElementById('menuItem"+i+"').style.height = '137px';", 100);
  	    setTimeout("document.getElementById('menuItem"+i+"').style.width = '225px';", 100);
      }
    }
  }

  function posMenu() {
    var obj = document.getElementById('content');
    if (obj) {
      obj.style.width = windowWidth + 'px';
      obj.style.height = windowHeight + 'px';
      obj.style.left = (winSize['x'] / 2) - (windowWidth / 2) + 'px';
      obj.style.top = (winSize['y'] / 2) - (windowHeight / 2) + 'px';
    }
  }

  function clickMenu(obj) {
    if (obj) {
      if (parseInt(obj.style.width) > windowWidth / menuCols) {
        menuObjPos['dir'] = 'down';
        timerMenu();
      } else {
        menuObj = obj;
        menuObjPos['x'] = parseInt(obj.style.left);
        menuObjPos['y'] = parseInt(obj.style.top);
        menuObjPos['width'] = parseInt(menuObj.style.width);
        menuObjPos['height'] = parseInt(menuObj.style.height);
        menuObjPos['colom'] = (menuObjPos['x'] == 0) ? 0 : menuObjPos['x'] / menuObjPos['width'];
        menuObjPos['row'] = (menuObjPos['y'] == 0) ? 0 : menuObjPos['y'] / menuObjPos['height'];
        menuObjPos['dir'] = 'up';
        menuObj.style.zIndex = 3;
        timerMenu();
      }
    }
  }

  function timerMenu() {
    if (menuObj) {
      if (menuObjPos['dir'] == 'up') {
        var scaleWidth = (windowWidth - (windowWidth / menuCols)) / windowTotalStep;
        menuObjPos['width'] += scaleWidth;
        var posX = ((windowWidth / menuCols) * menuObjPos['colom']) / windowTotalStep;
        menuObjPos['x'] -= posX;
        var scaleHeight = (windowHeight - (windowHeight / menuRows)) / windowTotalStep;
        menuObjPos['height'] += scaleHeight;
        var posY = ((windowHeight / menuRows) * menuObjPos['row']) / windowTotalStep;
        menuObjPos['y'] -= posY;
      } 
      else if (menuObjPos['dir'] == 'down') {
        var scaleWidth = (windowWidth - (windowWidth / menuCols)) / windowTotalStep;
        menuObjPos['width'] -= scaleWidth;
        var posX = ((windowWidth / menuCols) * menuObjPos['colom']) / windowTotalStep;
        menuObjPos['x'] += posX;
        var scaleHeight = (windowHeight - (windowHeight / menuRows)) / windowTotalStep;
        menuObjPos['height'] -= scaleHeight;
        var posY = ((windowHeight / menuRows) * menuObjPos['row']) / windowTotalStep;
        menuObjPos['y'] += posY;
      }
      menuObj.style.width = menuObjPos['width'] + 'px';
      menuObj.style.left = menuObjPos['x'] + 'px';
      menuObj.style.height = parseInt(1+menuObjPos['height']) + 'px';

      if (menuObjPos['y'] < 0) {
        menuObj.style.top = '0px';
      } else {
        menuObj.style.top = parseInt(menuObjPos['y']) + 'px';
      }

      if (menuObjPos['dir'] == 'up') {
        if (menuObjPos['width'] < windowWidth) {
          setTimeout("timerMenu()", 25);
        } else {
          menuObj.style.top = '0px';
          loadContent();
        }
      } else {
        if (menuObjPos['width'] > windowWidth / menuCols) {
          if (contentObj) {
            if (document.getElementById('contentPage')) {
              document.getElementById('contentPage').style.display = 'none';
            }
            fadeDownMenu(75,0,25);
          }
          setTimeout("timerMenu()", 25);
        } else {
          initMenu(false);
          menuObj.style.zIndex = 1;
          menuObj = null;
        }
      }
    }
  }

  function loadContent() {
    if (!contentObj) {
      var div = document.createElement('div');
      div.setAttribute('id', 'showContent');
      document.body.appendChild(div);
      var div = document.createElement('div');
      div.setAttribute('id', 'showContentBG');
      document.body.appendChild(div);
      contentObj = document.getElementById('showContent');
      contentObjBG = document.getElementById('showContentBG');
    }
    if (menuObj) {
      posContent();
      fadeUpMenu(0,75,15);
      ajaxContent(menuObj.getAttribute('name'));
    }
  }

  function loadLocationPage(page) {
    window.location = page;
  }

//Functie voor het laten in fade van een object
  function fadeUpMenu(fadeStart, fadeStop, fadeStep)  {
    var intFade = fadeStart + fadeStep;
    if (intFade > fadeStop) {
      intFade = fadeStop;
    }
    var temp = 'fadeUpMenu(' + intFade + ',' + fadeStop + ',' + fadeStep + ')';
    opacObj(intFade, contentObjBG);
    if (intFade < fadeStop) {
      setTimeout(temp, 20);
    }
  }

  //Functie voor het laten uit fade van een object
  function fadeDownMenu(fadeStart, fadeStop, fadeStep) {
    var intFade = fadeStart - fadeStep;
    if (intFade < fadeStop) {
      intFade = fadeStop;
    }
    var temp = 'fadeDownMenu(' + intFade + ',' + fadeStop + ',' + fadeStep + ')';
    opacObj(intFade, contentObjBG);
    if (intFade > fadeStop) {
      setTimeout(temp, 20);
    } else {
      removeContent();
    }
  }

  function removeContent() {
    if (contentObj) {
      document.body.removeChild(document.getElementById('showContent'));
      document.body.removeChild(document.getElementById('showContentBG'));
      contentObj = null;
      contentObjBG = null;
    }
    if (document.getElementById('contentPage')) {
      document.body.removeChild(document.getElementById('contentPage'));
    }
  }

  function posContent() {
    if (contentObjBG) {
      contentObjBG.style.width = contentWidth + 'px';
      contentObjBG.style.height = contentHeight + 'px';
      contentObjBG.style.left = (winSize['x'] / 2) - (contentWidth / 2) + 'px';
      contentObjBG.style.top = (winSize['y'] / 2) - (contentHeight / 2) + 'px';
    }
    if (contentObj) {
      contentObj.style.width = contentWidth + 'px';
      contentObj.style.height = contentHeight + 'px';
      contentObj.style.left = (winSize['x'] / 2) - (contentWidth / 2) + 'px';
      contentObj.style.top = (winSize['y'] / 2) - (contentHeight / 2) + 'px';
    }
  }

  function setContent() {
    if (contentObj) {
      var close = document.createElement('div');
      close.setAttribute('id', 'closeContent');
      contentObj.appendChild(close);
      var close = document.getElementById('closeContent');
      if (close) {
        close.onclick = function() {
          clickMenu(menuObj);
        }
      }
    }
  }

  function ajaxContent(link) {
    XMLajaxRequest['content'] = createHTTPHandler();
    XMLajaxRequest['content'].onreadystatechange=function() {
      if (XMLajaxRequest['content'].readyState==4) {
        if (contentObj) {
          cleanNode(contentObj);
          var div = document.createElement('div');
          div.setAttribute('id', 'contentPage');
          div.innerHTML = XMLajaxRequest['content'].responseText;
          contentObj.appendChild(div);
          setContent();
        }
      }
    }
    openHTTPHandlerHTML('ajaxHTML.php?'+link, XMLajaxRequest['content']);
  }
 

  ///////////////////////////////////////////////////////////////////////////////////////////////////////////
  //                                        P H O T O   F U N C T I E S                                    //
  //                                                                                                       //
  // 12-02-2008                                                                                 GvR Studio //
  ///////////////////////////////////////////////////////////////////////////////////////////////////////////

  //System settings
  var photoID = '';
  var playMode = false;
  var newsPhoto = false;
  var teamPhoto = false;

  //Deze functie aanroepen als het fotoalbum geopend moet worden
  function showPhoto(id) {
    photoID = id;
    if (!document.getElementById('showBox')) {
      var boxDiv = document.createElement('div');
      boxDiv.setAttribute('id', 'showBox');
      document.body.appendChild(boxDiv);
      object = document.getElementById('showBox');
      resizeShowBox();
      fadeUp(0, 75, 75);
    } else {
      fadeDown(75, 0, 75);
    }
  }

  //Functie voor het verwijderen van de box
  function removeBoxInfo() {
    document.body.removeChild(document.getElementById('toolbar'));
    document.body.removeChild(document.getElementById('photoLayer'));
    document.body.removeChild(document.getElementById('showBox'));
  }

   //Functie voor het laten in fade van een object
  function fadeUp(fadeStart, fadeStop, fadeStep)  {
    var intFade = fadeStart + fadeStep;
    if (intFade > fadeStop) {
      intFade = fadeStop;
    }
    var temp = 'fadeUp(' + intFade + ',' + fadeStop + ',' + fadeStep + ')';
    opacObj(intFade, object);
    if (intFade < fadeStop) {
      setTimeout(temp, 20);
    } else {
      getPhoto();
    }
  }

  //Functie voor het laten uit fade van een object
  function fadeDown(fadeStart, fadeStop, fadeStep) {
    var intFade = fadeStart - fadeStep;
    if (intFade < fadeStop) {
      intFade = fadeStop;
    }
    var temp = 'fadeDown(' + intFade + ',' + fadeStop + ',' + fadeStep + ')';
    opacObj(intFade, object);
    if (intFade > fadeStop) {
      setTimeout(temp, 20);
    } else {
      removeBoxInfo();
    }
  }

   function preLoadToolBar() {
    var imgStart = document.createElement('img');
    imgStart.src = host + '/images/photo/' + 'start.gif';
    var imgBack = document.createElement('img');
    imgBack.src = host + '/images/photo/' + 'back.gif';
    var imgPlay = document.createElement('img');
    imgPlay.src = host + '/images/photo/' + 'play.gif';
    var imgNext = document.createElement('img');
    imgNext.src = host + '/images/photo/' + 'next.gif';
    var imgEnd = document.createElement('img');
    imgEnd.src = host + '/images/photo/' + 'end.gif';
    var imgLoader = document.createElement('img');
    imgLoader.src = host + '/images/photo/' + 'loader.gif';
    var imgPause = document.createElement('img');
    imgPause.src = host + '/images/photo/' + 'pause.gif';
    var imgBG = document.createElement('img');
    imgBG.src = host + '/images/photo/' + 'bg.gif';
    var imgClose = document.createElement('img');
    imgBG.src = host + '/images/photo/' + 'close.gif';
  }

  //Maak het object aan met toolbar waar de foto's in getoond worden
  function getPhoto() {
    //De foto layer
    var photoLayer = document.createElement('div');
    photoLayer.setAttribute('id', 'photoLayer');
    photoLayer.style.width = photoWidth + 'px';
    photoLayer.style.height = photoHeight + 'px';
    var img = document.createElement('img');
    img.setAttribute('src', host + '/images/photo/loader.gif');
    img.setAttribute('id', 'imgPhoto');
    photoLayer.appendChild(img);
    document.body.appendChild(photoLayer);
    replacePhotoLayer();

    //En de toolbar als top layer
    toolbar = document.createElement('div');
    toolbar.setAttribute('id', 'toolbar');
    toolbar.appendChild(createToolbarButton('Begin', 'toolbarStart', 'start.gif', 'playMode = false; loadPhoto(this.getAttribute(\'photoID\'))'));
    toolbar.appendChild(createToolbarButton('Vorige', 'toolbarBack', 'back.gif', 'playMode = false; loadPhoto(this.getAttribute(\'photoID\'))'));
    toolbar.appendChild(createToolbarButton('Play', 'toolbarPlay', 'play.gif', 'playMode = (playMode ? false : true); if(playMode) {loadPhoto(this.getAttribute(\'photoID\')); document.getElementById(\'toolbarPlay_img\').setAttribute(\'src\', host + \'/images/photo/pause.gif\');} else { document.getElementById(\'toolbarPlay_img\').setAttribute(\'src\', host + \'/images/photo/play.gif\'); }'));
    toolbar.appendChild(createToolbarButton('Volgende', 'toolbarNext', 'next.gif', 'playMode = false; loadPhoto(this.getAttribute(\'photoID\'))'));
    toolbar.appendChild(createToolbarButton('Eind', 'toolbarEnd', 'end.gif', 'playMode = false; loadPhoto(this.getAttribute(\'photoID\'))'));
    var div = document.createElement('div');
    div.setAttribute('id', 'toolbarLoader');
    toolbar.appendChild(div);
    toolbar.appendChild(createToolbarButton('Sluiten', 'toolbarClose', 'close.gif', 'newsPhoto = false; playMode = false; showPhoto();'));
    var div = document.createElement('div');
    div.setAttribute('id', 'toolbarInfo');
    div.appendChild(document.createTextNode('Foto: 0 van 0'));
    toolbar.appendChild(div);
    div = document.createElement('div');
    div.setAttribute(className, 'clear');
    toolbar.appendChild(div);
    document.body.appendChild(toolbar);
    opacObj(50, toolbar);
    toolbar.style.left = parseInt(parseInt(winSize['x'] / 2) - parseInt(toolbar.offsetWidth / 2)) + 'px';
    toolbar.style.top = parseInt(winSize['y'] - toolbar.offsetHeight - 50) + 'px';

    //Laad de openings foto
    loadPhoto(photoID);
  }

  //Functie voor het aanmaken van buttons, Hierbij wordt de naam van de button opgegeven, het plaatje die hij moet krijgen en het event voor als er op geklikt wordt
  function createToolbarButton(name, id, src, event) {
    var a = document.createElement('a');
    a.setAttribute('href', 'javascript:;');
    a.onclick = function() {
      eval(event);
    }
    a.setAttribute('id', id);
    a.setAttribute('photoID', '0');
    var img = document.createElement('img');
    img.setAttribute('id', id + '_img');
    img.setAttribute('src', host + '/images/photo/' + src);
    img.setAttribute('alt', name);
    img.setAttribute('title', name);
    a.appendChild(img);
    return a;
  }

  //Zet de toolbar weer in het midden van het scherm
  function replaceToolbar() {
    if (document.getElementById('toolbar')) {
      document.getElementById('toolbar').style.left = parseInt(parseInt(winSize['x'] / 2) - parseInt(toolbar.offsetWidth / 2) + winScroll['x']) + 'px';
      document.getElementById('toolbar').style.top = parseInt(winSize['y'] - toolbar.offsetHeight - 50 + winScroll['y']) + 'px';
    }
  }

  //Functie om de de Showbox op de juiste grote te zetten
  function resizeShowBox() {
    if (document.getElementById('showBox')) {
      obj = document.getElementById('showBox');
      obj.style.height = (document.documentElement.scrollHeight > document.documentElement.clientHeight ? document.documentElement.scrollHeight : document.documentElement.clientHeight) + 'px';
      obj.style.width = (document.documentElement.scrollWidth > document.documentElement.clientWidth ? document.documentElement.scrollWidth : document.documentElement.clientWidth) + 'px';
    }
  }

  //Zet de toolbar weer in het midden van het scherm
  function replacePhotoLayer() {
    if (document.getElementById('photoLayer')) {
      document.getElementById('photoLayer').style.left = parseInt(parseInt(winSize['x'] / 2) - parseInt(document.getElementById('photoLayer').offsetWidth / 2)) + 'px';
      document.getElementById('photoLayer').style.top = parseInt(parseInt(winSize['y'] / 2)  - parseInt(document.getElementById('photoLayer').offsetHeight / 2)) + 'px';
    }
  }

  //Functie voor het laden van de foto's
  function loadPhoto(id) {
    if (document.getElementById('toolbar')) {
      XMLRequestPhoto = createHTTPHandler();
      XMLRequestPhoto.onreadystatechange=function() {
        if (XMLRequestPhoto.readyState==1) {
          if (!document.getElementById('imgToolbarLoader')) {
            objLoader = document.getElementById('toolbarLoader');
            var img = document.createElement('img');
            img.setAttribute('id', 'imgToolbarLoader');
            img.setAttribute('src', host + '/images/photo/loader.gif');
            img.setAttribute('title', 'Photo Loader');
            img.setAttribute('alt', 'load');
            objLoader.appendChild(img);
          }
        }
        else if (XMLRequestPhoto.readyState==4) {
          var root = XMLRequestPhoto.responseXML;
          var photo = root.getElementsByTagName('photo');
          var imgPhoto = document.getElementById('imgPhoto');
          if (photo.length != 1) {
            var toolbarInfo = document.getElementById('toolbarInfo');
            cleanNode(toolbarInfo);
            toolbarInfo.appendChild(document.createTextNode('Error: Geen foto met dit ID'));
          } else {
            imgPhoto.onload = function () {
              if (document.getElementById('imgToolbarLoader')) {
                cleanNode(document.getElementById('toolbarLoader'));
              }
              imgPhoto.style.width = getNodeValue(photo[0], 'width') + 'px';
              imgPhoto.style.height = getNodeValue(photo[0], 'height') + 'px';
              if (document.getElementById('photoLayer')) {
                var photoLayer = document.getElementById('photoLayer');
                photoLayer.style.width = getNodeValue(photo[0], 'width') + 'px';
                photoLayer.style.height = getNodeValue(photo[0], 'height') + 'px';
              }
              document.getElementById('toolbarStart').setAttribute('photoID', getNodeValue(photo[0], 'start_id'));
              document.getElementById('toolbarBack').setAttribute('photoID', getNodeValue(photo[0], 'back_id'));
              document.getElementById('toolbarPlay').setAttribute('photoID', getNodeValue(photo[0], 'next_id'));
              document.getElementById('toolbarNext').setAttribute('photoID', getNodeValue(photo[0], 'next_id'));
              document.getElementById('toolbarEnd').setAttribute('photoID', getNodeValue(photo[0], 'end_id'));
              var toolbarInfo = document.getElementById('toolbarInfo');
              cleanNode(toolbarInfo);
              toolbarInfo.appendChild(document.createTextNode('Foto: ' + getNodeValue(photo[0], 'count') + ' van ' + getNodeValue(photo[0], 'total')));
              if (playMode) {
                setTimeout("loadPhoto('"+getNodeValue(photo[0], 'next_id')+"')", photoTime);
              }
              replacePhotoLayer();
            }
            if (newsPhoto) {
              imgPhoto.setAttribute('src', host + '/images/news/' + getNodeValue(photo[0], 'src'));
              imgPhoto.setAttribute('height', getNodeValue(photo[0], 'height'));
              imgPhoto.setAttribute('width', getNodeValue(photo[0], 'width'));
            }
            else if (teamPhoto) {
              imgPhoto.setAttribute('src', host + '/images/team/' + getNodeValue(photo[0], 'src'));            
            } else {
              imgPhoto.setAttribute('src', host + '/images/photos/' + getNodeValue(photo[0], 'src'));
              imgPhoto.setAttribute('height', getNodeValue(photo[0], 'height'));
              imgPhoto.setAttribute('width', getNodeValue(photo[0], 'width'));
            }
          }
        }
      }
      if (newsPhoto) {
        var url = "getNewsPhoto/" + id;
      } 
      else if (teamPhoto) {
        var url = "getTeamPhoto/" + id;
      } else {
        var url = "getPhoto/" + id;
      }
      openHTTPHandler(url, XMLRequestPhoto);
    }
  }
