function doRegionSelect(contextPath) {
	var regionId = jQuery('select#regionId').val();

	var serviceUrl = contextPath
			+ "/address/address.action?getMunicipalitiesByRegionId=&id="
			+ escape(regionId);

	jQuery('select#municipalityId').empty();
	jQuery('select#municipalityId').append(
			"<option value=\"\">concelho...</option>");

	jQuery.ajax( {
		type : "GET",
		url : serviceUrl,
		dataType : "xml",
		success : function(xml) {
			jQuery('entry', xml).each(
					function() {
						var id = jQuery('id', this).text();
						var name = jQuery('name', this).text();

						var optionHtml = "<option value=\"" + id + "\">" + name
								+ "</option>";

						jQuery('select#municipalityId').append(optionHtml);
					});
		}
	});
}

function doMunicipalitySelect(contextPath) {
	var municipalityId = jQuery('select#municipalityId').val();

	var serviceUrl = contextPath
			+ "/address/address.action?getCivilParishesByMunicipalityId=&id="
			+ escape(municipalityId);

	jQuery('select#civilParishId').empty();
	jQuery('select#civilParishId').append(
			"<option value=\"\">freguesia...</option>");

	jQuery.ajax( {
		type : "GET",
		url : serviceUrl,
		dataType : "xml",
		success : function(xml) {
			jQuery('entry', xml).each(
					function() {
						var id = jQuery('id', this).text();
						var name = jQuery('name', this).text();

						var optionHtml = "<option value=\"" + id + "\">" + name
								+ "</option>";
						jQuery('select#civilParishId').append(optionHtml);
					});
		}
	});
}
