Event.observe(window, 'load', initRewriter);

function checkData() {
	if ($('password').value != $('password2').value) {
		alert("Podane hasła różnią się!");
		return false;
	}
}

function initRewriter() {
	$A($('billing_data').getElementsByTagName("input")).each(function(el){
		el.onkeyup = function() {
			if ($('d_'+this.id)) {
				$('d_'+this.id).value = this.value; 
			}
		}
	});
	Event.observe($('regForm'), 'submit', checkData);
}




