
var lastHeight=0;
var lastClientHeight=0;
var minHeight = 0;

function handleBodyOnLoad() {
  showFooter();    
}

window.onresize = function(){
  var f = xGetElementById('footer');

  if(f!=null) {
    
    var newClientHeight = xClientHeight();
    var newY = newClientHeight - lastClientHeight;

    var leftBottom = xPageY('subnav') + xHeight('subnav');
    var middleBottom = xPageY('printbutt') + xHeight('printbutt');
    var rightBottom = xPageY('subnavrechts') + xHeight('subnavrechts');


    xHeight('subnav', xHeight('subnav') + newY);
    xHeight('subnavrechts', xHeight('subnavrechts') + newY);

    xTop(f,xTop(f)+newY);
    xTop('printbutt', xTop('printbutt')+newY)
    
    lastClientHeight = xClientHeight();
    lastHeight += newY

  }
  setBreadClip()
}

function showFooter() {
  
  var f = xGetElementById('footer');

  if(f!=null && f.className.indexOf('hiddenDiv')>0) {
	
    var leftBottom = xHeight('subnav') + xPageY('subnav');
    if(leftBottom < 535)
      leftBottom = 535;

    var middleBottom = xPageY('printbutt') + xHeight('printbutt');
    if(arguments.length == 1)
      middleBottom += arguments[0];
    
    var rightBottom = xPageY('subnavrechts') + xHeight('subnavrechts');
	
	var heighest = (leftBottom >= rightBottom)? leftBottom : rightBottom;
    
	if(heighest > middleBottom){
	  if(xClientHeight() > (heighest-27))
	    heighest = xClientHeight() - 27; //footer height
	}else {
	  heighest = middleBottom;
	}
	lastClientHeight = xClientHeight();
	lastHeight = heighest;
	minHeight = heighest;
	
    xHeight('subnav', heighest-xPageY('subnav'));
	xHeight('subnavrechts', heighest-xPageY('subnavrechts'));

	xTop(f,heighest);
    xTop('printbutt', xTop(f)-xPageY('printbutt')-xHeight('printbutt')-8)
    
	var x=null;
	if(heighest > xClientHeight()) {
      var y = xGetElementById('printonly');
      y.innerHTML = '';
      x = xGetElementById('printtop');
    }else
      x = xGetElementById('printonly');
      
    x.className = '';
	
    f.className = f.className.substring(0,f.className.indexOf('hiddenDiv'));
  }
  setBreadClip()  
}

function setBreadClip(){
  if(xHeight('padnav') > 12){
    xClip('padnav',xTop('padnav'), xLeft('padnav')+xWidth('padnav'), xTop('padnav')+24, xLeft('padnav'));
  }
}

function hideFooter() {
  var f = xGetElementById('footer');
  f.className = 'hiddenDiv';
}

function showReactions() {
  var f = xGetElementById('reactions');
  if(f.className == 'hiddenDiv'){
    hideFooter();
    f.className = '';
    
    if(xMoz)
      showFooter(xHeight('reactions'));
    else
      showFooter();
      
    document.location.href=document.location.href+'#reageer';  
  }
}
var noToggle=false;
function toggleMenu2(str) {
  if(!noToggle){
	  var f = xGetElementById(str);
	  if(f.className.indexOf('hiddenDiv')>-1){
	    f.className = f.className.substring(0, f.className.indexOf('hiddenDiv'));
	  }else{
	    f.className += ' hiddenDiv';
	  }
  }
}
function fixMenu2(str){
  var f = xGetElementById(str);
  f.className += ' showDiv';
  noToggle=true;
}


function OpenSendByMail(lang, uri){
  var opts = 'width=474,height=450,scrollbars=yes,resizable=yes,menubar=no';
  var sendform=window.open('/formulieren/sendByMail/'+lang+uri,'sendbymail', opts);
}

function clearSearchDoctypes(){
  for(i=0;i<arguments.length;i++){
    document.getElementById(arguments[i]).checked = false;
    document.getElementById(arguments[i]).disabled = true;
  }
}

function activateSearchDoctypes(){
  for(i=0;i<arguments.length;i++){
    document.getElementById(arguments[i]).disabled = false;
  }
}

function selectDocType(strId){
  if(document.getElementById(srtId).disabled)
    activateSearchDoctypes();
  document.getElementById(strId).checked = true;
}

function getMyContent(){
  var el = (window.opener.document.getElementById('contentvolg'))?window.opener.document.getElementById('contentvolg'):window.opener.document.getElementById('content')
  document.getElementById('print-content').innerHTML = el.innerHTML
  document.getElementById('printonly').className = 'hide-for-print';
  document.getElementById('printhide').className = 'hide-for-print';
}

