function clsAJAXAddress() {
	this.m_oCityObj = null;
	this.m_oStreetObj = null;
	
	
	this.getAddress  = function (p_sPostalcode, p_sNumber, p_sCityObj, p_sStreetObj) {
		var oRequest = new clsHTTPRequest();
		this.m_oCityObj = document.getElementById(p_sCityObj);
		this.m_oStreetObj = document.getElementById(p_sStreetObj);
		var self = this;
		if (p_sPostalcode.toString() != '' && p_sNumber.toString() != '') {
			oRequest.setRequestURI('/ajax_exec/getAddressByPostalcode.php');
			oRequest.addParam('postalcode', encodeURIComponent(p_sPostalcode));
			oRequest.addParam('number', encodeURIComponent(p_sNumber));
			oRequest.postXML(self.setAddress);
		}
	}
	
	this.setAddress = function (p_oDOM) {
		if (p_oDOM) {
			var oRoot = p_oDOM.getElementsByTagName('response').item(0);
			var oError = oRoot.getElementsByTagName('error').item(0);
			if (oError && oError.childNodes.length >0) {
				
				switch(oError.getAttribute('code')) {
					case "1": 
						//alert('Ongeldige postcode'); 
						break;
					case "2": 
						//alert('Geen huisnummer opgegeven'); 
						break;
					case "3": 
						document.getElementById('city').value = "";
						document.getElementById('city').readOnly = false;
						document.getElementById('address_street').value = "";
						document.getElementById('address_street').readOnly = false;
						document.getElementById('address_street').focus(); 
						alert('Onbekende huisnummer en postcode combinatie'); break;
						
					case "4":
						alert(oError.firstChild.firstChild.nodeValue); break;
					default:
						alert('onbekende fout ' + oError.getAttribute('code'));
				}
				
			} else {
				//update address
				var oAddress= oRoot.getElementsByTagName('address').item(0);
				if (oAddress.getElementsByTagName('city').length) {
					if (oAddress.getElementsByTagName('city').item(0).childNodes.length) {
					document.getElementById('city').value = oAddress.getElementsByTagName('city').item(0).firstChild.nodeValue;
					//document.getElementById('city').readOnly = true;
					document.getElementById('address_street').value = oAddress.getElementsByTagName('street').item(0).firstChild.nodeValue;
					//document.getElementById('address_street').readOnly = true;
					}
				}
			}
		}
	}

}