+ if (j == 3) {
+ $('tr#locality_text').hide()
+ $("select[name='localityTxt']").attr('value', '');
+ }
+
+ $("[name='" + next_type + "']").parent().load(baseurl + 'list/' + next_type, { previous:prev_type, value:value }, function() {
+ $("select[name='" + next_type + "']").attr('value', '');
+ if ($("select[name='" + next_type + "']").children("option").size() > 1) {
+ $("tr#" + next_list).show();
+ } else {
+ $("tr#" + next_list).hide();
+ if (j < 6) {
+ displayNextAddressComponent(i, j + 1, value);
+ }
+ }
+ });
+ }
+
+ function changeAddressComponents(type, value)
+ {
+ var types = new Array('country', 'administrative_area_level_1', 'administrative_area_level_2', 'administrative_area_level_3', 'locality', 'sublocality');
+ var i = 0, j = 0;
+
+ while (types[i] != type && i < 6) {
+ ++i;
+ }
+
+ j = i + 1;
+ while (j < 6) {
+ $("select[name='" + types[j] + "']").attr('value', '');
+ $("tr#" + types[j] + "_list").hide();
+ ++j;
+ }