  var offset = 0;
  var iThumbs = 4;

  function thumbOver(imgPath, comment) {
    //obj = document.getElementById('img_photobig');
    //obj.src = imgPath;
    obj = document.getElementById('div_photocontent');
    obj.innerHTML = '<img src="'+imgPath+'" alt="" /><br style="clear: both;" />';
    obj = document.getElementById('div_photocomment');
    obj.innerHTML = comment;
  }  
  
  function ajax( p_sUrl, P_eId, P_sType ) {
    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();
    }
    xmlhttp.open('GET', p_sUrl, true);
    xmlhttp.onreadystatechange=function() {
      if( xmlhttp.readyState == 4 ) {
        if( P_sType == 'value' ) {
          document.getElementById(P_eId).value = xmlhttp.responseText;
        } else {
          sResponese = xmlhttp.responseText;
          //show thumbs
          aHtml = sResponese.split('||');
          document.getElementById(P_eId).innerHTML = aHtml[0];
          //for preloading images
          aJavascript = aHtml[1].split('|');
          for(i in aJavascript) {
            if(aJavascript[i]) {
              preload(i, aJavascript[i]);
            }
          }
        }
      }
    }
    xmlhttp.send(null);
  }
  function fotoPrevious(galid) {
    if(offset <= 0) {
    } else {
      offset = offset - iThumbs;
      ajax('ajax/fotos.php?galid='+galid+'&offset='+offset, 'div_thumbs', '');
    }
  }

  function fotoNext(galid) {
    if(iTotal > offset + iThumbs) {
      offset = offset + iThumbs;
      ajax('ajax/fotos.php?galid='+galid+'&offset='+offset, 'div_thumbs', '');
    }
  }

  function init(galid) {
    ajax('ajax/fotos.php?galid='+galid, 'div_thumbs', '');
  }
  
  function preload(id, img) {
    eval('pic'+id+' = new Image()');
    eval('pic'+id+'.src = "'+img+'";');
  }
  
  //voor het gelijk maken van de drie blokken
  function blockHeights() {
    var divs = document.getElementsByTagName('div');
    var iHighest = 0;
    //kijk even welk blok het hoogst is
    for(var i = 0; i < divs.length; i ++) {
      if(divs[i].className == 'div_contentblock') {
        if(divs[i].offsetHeight > iHighest) {
          iHighest = divs[i].offsetHeight;
        }
      }
    }
    var divs = document.getElementsByTagName('div');
    //loop door alle 2 of 3 contenblokken
    for(var i = 0; i < divs.length; i ++) {
      if(divs[i].className == 'div_contentblock') {
        if(divs[i].offsetHeight < iHighest) {
          divNodes = document.getElementById(divs[i].id).childNodes;
          //bekijk de hoogte van de eerste child-div
          var first = true;
          for(var j = 0; j < divNodes.length; j ++) {
            if(divNodes[j].nodeName == 'DIV' && first) {
              //-2 ivm de border-bottom van 2 px
              iContentHeight = (iHighest - document.getElementById(divs[i].id).childNodes[j].offsetHeight) -2;
              first = false;
            } else if(divNodes[j].nodeName == 'DIV' && !first) {
              //min-height ivm met fotogallerij en ajax
              document.getElementById(divs[i].id).childNodes[j].style.minHeight = iContentHeight+'px';
              //min-height wordt niet ondersteund door IE6
              /*@cc_on @*/
              /*@if (@_jscript_version < 5.7) {
                document.getElementById(divs[i].id).childNodes[j].style.height = iContentHeight+'px';
              }
              /*@end @*/ 
            }
          }
        }
      }
    }
  }
