var popupCount = 0;

function showPopup(elementId) {
	if (el = document.getElementById(elementId)) {

		popupCount++;

		// Overlay tonen
		document.getElementById('overlay').style.display = 'block';
		document.getElementById('overlay').style.height = Math.max(document.documentElement.clientHeight,document.body.clientHeight) + 'px';
		el.style.display = 'block';

		inputs = el.getElementsByTagName('INPUT');
		for (i = 0; i < inputs.length; i++) {
			if (inputs[i].className == 'field') {
				inputs[i].focus();
				break;
			}
		}

		window.scroll(0,0);
	}
}

function hidePopup(elementId) {
	if (el = document.getElementById(elementId)) {
		popupCount--;
		if (popupCount<1) {
			// Overlay wissen
			document.getElementById('overlay').style.display = 'none';
		}
		el.style.display = 'none';
	}
}

function OpenPopup(url) {
  Popup = window.open(url,"help","width=730,height=450,top=100,left=100,toolbar=0,resizable=1,scrollbars=1,status=0.menubar=0,location=0,directories=0");
  Popup.focus();
}


function showContent(n) {
	for(var i = 1; i<=2; i++) {
    	document.getElementById('content'+i).style.display = (i==n)?'block':'none';
  	}
}

function showSubtitel(n) {
	for(var i = 1; i<=2; i++) {
    	document.getElementById('subtitel'+i).style.display = (i==n)?'block':'none';
  	}
}

function showfototitel(n) {
	for(var i = 1; i<=2; i++) {
    	document.getElementById('fototitel'+i).style.display = (i==n)?'block':'none';
  	}
}

function showfotoOmschrijving(n) {
	for(var i = 1; i<=2; i++) {
    	document.getElementById('fotoOmschrijving'+i).style.display = (i==n)?'block':'none';
  	}
}

function showMsg() {
  document.getElementById('msgForm').style.display = 'block';
}

function showLogin() {
  document.getElementById('loginForm').style.display = 'block';
  f=document.getElementById('loginFormForm');
  if (f.postcodehuisnr.value>'') {
  	f.password.focus();
  } else {
  	f.postcodehuisnr.focus();
  }
}

function showChangePw() {
  document.getElementById('changepwForm').style.display = 'block';
}

function showZoek() {
  document.getElementById('zoekForm').style.display = 'block';
}

function showForm(id) {
 document.getElementById(id).style.display = 'block';
}

function hideForm(id) {
  document.getElementById(id).style.display = 'none';
}
