String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}

function isEmpty(s) {
	s = s.trim();
	return ((s == null) || (s.length == 0));
}

function checkUserData(){
	if (isEmpty($('nom').value)) {
		alert(msg_check_name);
		$('nom').activate();
		return false;
	}
	else if (isEmpty($('cognoms').value)) {
		alert(msg_check_surname);
		$('cognoms').activate();
		return false;	
	}
	else if (isEmpty($('direccio').value)) {
		alert(msg_check_address);
		$('direccio').activate();
		return false;	
	}
	else if (isEmpty($('pais').value)) {
		alert(msg_check_pais);
		$('pais').activate();
		return false;
	}
	else if ($('pais').value == 11 && isEmpty($('provincia').value)) {
		alert(msg_check_prov);
		$('provincia').activate();
		return false;
	}
	else if (isEmpty($('ciutat').value)) {
		alert(msg_check_city);
		$('ciutat').activate();
		return false;	
	}
	else if (isEmpty($('cp').value)) {
		alert(msg_check_cp);
		$('cp').activate();
		return false;	
	}		
	else if (isEmpty($('telefon').value)) {
		alert(msg_check_telef);
		$('telefon').activate();
		return false;	
	}
	else if (isEmpty($('email').value)) {
		alert(msg_check_email);
		$('email').activate();
		return false;	
	}
	else {
		return true;
	}
}

function changePais() {
	
	if ($('pais').getValue() != 11) {
		$('provincia').disable();
	}
	else {
		$('provincia').enable();
	}

}
