form = document.forms.registration;
//ajax = new sack();

/*
function performPostalCodeMiner() {
	ajax.setVar('postalCode', form.postalCode.value);
	ajax.runAJAX();
}

ajax.requestFile = "/utils/postalCodeMiner.xml.php";
ajax.method = 'GET';
ajax.setVar('countryCode', locale.countryCode);
ajax.onCompletion = function () {
	var doc = new XMLDoc(ajax.response, null).docNode;
	
	function getValue(key) {
		var temp = doc.getElements(key)[0];
		if (temp) return temp.getText();
	}

	if (getValue("postalcode")) {
		with (form) {
			postalCode.value = getValue("postalcode");
			
			region.value = getValue("region");
			region.parentNode.parentNode.style.visibility = 'visible';
			
			subregion.value = getValue("subregion");
			subregion.parentNode.parentNode.style.visibility = 'visible';
			
			place.value = getValue("place");
			place.readOnly = false;
			if (place.onchange) place.onchange();
			place.parentNode.parentNode.style.visibility = 'visible';
		}
	}
};
*/

function checkNIP(n){
	nipRE=/^\d{10}$/;
	if(!nipRE.test(n)) return false;
	if(((6*n.charAt(0)+5*n.charAt(1)+7*n.charAt(2)+2*n.charAt(3)+3*n.charAt(4)+4*n.charAt(5)+5*n.charAt(6)+6*n.charAt(7)+7*n.charAt(8))%11)%10 == n.charAt(9)) return true;
	return false;
}


if (form) {
	/*
	with (form) {
		region.readOnly = true;
		subregion.readOnly = true;
		place.readOnly = true;
		
		if (postalCode.value) {
			region.parentNode.parentNode.style.visibility = 'visible';
			subregion.parentNode.parentNode.style.visibility = 'visible';
			place.readOnly = false;
			place.parentNode.parentNode.style.visibility = 'visible';
		}
	}
	
	form.postalCode.onchange = performPostalCodeMiner;
	*/
	form.userPasswordRepeated.onchange = function() {
		if (this.value != this.form.userPassword.value) {
			alert(this.getAttribute('invalidTxt'));
			this.value = this.form.userPassword.value = "";
			form.userPassword.onchange();
			form.userPassword.focus();
		}
	}
	
	//form.companyPhoneNumber.beforeValidation = getDigits;
	//form.revenueNo.beforeValidation = getDigits;
}
