  var photo = new Array();
  var req = false;
  function show(theName,target) {
    if (!target) target='self';
    eval('obj = ' + target + '.document.getElementById(theName)');
    obj.className = 'show';
  }

  function hide(theName,target) {
    if (!target) target='self';
    eval('obj = ' + target + '.document.getElementById(theName)');
    obj.className = 'hide';
  }

  function swap_button(theName) {
    obj = document.getElementById(theName);
    if (obj.className == 'show') {
        hide(theName);
        show(theName + '_act');
    } else {
        hide(theName + '_act');
        show(theName);
    }
  }
  
  function show_bg(theName) {
    obj = document.getElementById(theName);
    obj.style.backgroundPosition = '0px 20px';
  }
  
  function hide_bg(theName) {
    obj = document.getElementById(theName);
    obj.style.backgroundPosition = '0px 0px';
  }
  
  function loadPhoto(theId,tpl) {

    oldId = document.photoForm.photo_id.value;
    document.photoForm.photo_id.value = theId;
    //oldId = photo[oldId];
    //theId = photo[theId];

    obj = document.getElementById('img_' + oldId);
    obj.className = 'photo';
    obj = document.getElementById('img_' + theId);
    obj.className = 'photoactive';
    jah('template/' + tpl + '.php?action=show&id=' + theId,'photoDiv');
  }
  
  function swapCheckbox(theName,theObj) {
    prevVal = document.contactForm.brochure.value;
    if (prevVal == 0) {
      theObj.style.backgroundPosition='0px 22px';
      newVal = 1;
    } else {
      theObj.style.backgroundPosition='0px 0px';
      newVal = 0;
    }
    document.contactForm.brochure.value = newVal;
  }
  
  function init() {
    obj = document.getElementById('right');
    if (obj) {
      obj.style.width = (document.body.clientWidth - 780) + 'px';
    }
  }
  
  function jah(url,target,win,path) {
    if (!win) obj = document.getElementById(target);
    else obj = eval(win + '.document.getElementById(target)');
    obj.innerHTML = '...';

    if (window.XMLHttpRequest) {
      if (path && navigator.appName != 'Microsoft Internet Explorer') url = path + url;
      req = new XMLHttpRequest();
      if (req.overrideMimeType) {
        req.overrideMimeType('text/html');
      }
      req.onreadystatechange = function() {jahDone(target,url);};
      req.open("GET", url, true);
      req.send(null);
    } else if (window.ActiveXObject) {
      req = new ActiveXObject("Microsoft.XMLHTTP");
      if (req) {
        req.onreadystatechange = function() {jahDone(target,url);};
        req.open("GET", url, true);
        req.send();
      }
    }
  }
  
  function checkHeight() {
    h = Math.max(get_height('left'),get_height('right') + 36);
    h = Math.max(h,get_height('center') + 36);
    if (h > 480) {
      set_height('left',h);
      set_height('center',h -36);
      set_height('right',h - 36);
      set_height('parent.content',h);
      parent.document.getElementById('content').style.height = h + 'px';
    }
    else if (parent.document.getElementById('content').style.height != '480px') parent.document.getElementById('content').style.height = '480px';

  
  
  }
  
  function jahDone(target,url,obj) {
    if (req.readyState == 4) {
      if (req.status == 200) {
        results = req.responseText;
        document.getElementById(target).innerHTML = results;
        h = Math.max(get_height('left'),get_height('right') + 36);
        h = Math.max(h,get_height('center') + 36);
        if (h > 480) {
          set_height('left',h);
          set_height('center',h -36);
          set_height('right',h - 36);
          document.getElementById(target).style.height = h + 'px';
        }
        else if (document.getElementById(target).style.height != '480px') document.getElementById(target).style.height = '480px';
        window.location.hash = newHash = url.replace('maassluis.php?','');
        //dhtmlHistory.add(url, results);
      } else {
        document.getElementById(target).innerHTML="jah error:\n" + req.statusText + ': ' + url;
      }
    }
  }
  
  var jahDoc = '';

