var xmlhttp = false;

try {
	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
	try {
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	} catch (E) {
		xmlhttp = false;
	}
}

if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	xmlhttp = new XMLHttpRequest();
}

function checkZipChange(zipcodenow){
			if(zipcode != zipcodenow){
				zipcode = zipcodenow;
				updateZipCode(zipcodenow);
			}
	}

function updateZipCode (zipCode) {
	if (xmlhttp) {
		if (xmlhttp.readyState >= 1 && xmlhttp.readyState <= 3) {
			xmlhttp.abort();
		}
		xmlhttp.open("GET", "/get_zipcode.asp?ZIP="+zipCode, true);
		xmlhttp.onreadystatechange = function () {
            if(xmlhttp.readyState == 4){
                outputDiv = document.getElementById('plaatsdiv');
                if (outputDiv)
                    outputDiv.innerHTML = xmlhttp.responseText;
            }
		}
		xmlhttp.send(null);
	}
}

    function showCity (b) {
			var tr = document.getElementById('trcity');
			var inp = document.getElementById('105');
			var inp2 = document.getElementById('huisnr105');
			var zci = document.getElementById('plaats');
			if (b) {
				if (tr) tr.style.display = '';
				if (inp) { inp.value = ''; inp.disabled = true; inp.style.backgroundColor='#eee'; zipcode = ''; }
				if (inp2) { inp2.value = ''; inp2.disabled = true; inp2.style.backgroundColor='#eee'; huisnr = ''; }
				if (zci) { zci.innerHTML = ''; }
			}
			else {
				if (tr) tr.style.display = 'none';
				if (inp) { inp.disabled = false; inp.style.backgroundColor=''; }
				if (inp2) { inp2.disabled = false; inp2.style.backgroundColor=''; }
			}
	}
	
	    function showBelg (b) {
			var inp = document.getElementById('105');
			if (b) {
				if (inp) { inp.value = 'B-'+inp.value;}
				
				checkZipChange(inp.value)
			}
			else {
				if (inp) { inp.value = ''; }
			}
	}


