| 1 |
// $Id$
|
| 2 |
|
| 3 |
$(document).ready(
|
| 4 |
function() {
|
| 5 |
$('select[@id$=-country]').change(
|
| 6 |
function() {
|
| 7 |
uc_update_zone_select(this.id, '');
|
| 8 |
}
|
| 9 |
);
|
| 10 |
}
|
| 11 |
);
|
| 12 |
|
| 13 |
function uc_update_zone_select(country_select, default_zone) {
|
| 14 |
var zone_select = country_select.substr(0, country_select.length - 8) + '-zone';
|
| 15 |
|
| 16 |
var options = { 'country_id' : $('#' + country_select).val() };
|
| 17 |
|
| 18 |
$('#' + zone_select).parent().siblings('.zone-throbber').attr('style', 'background-image: url(' + Drupal.settings.basePath + 'misc/throbber.gif); background-repeat: no-repeat; background-position: 100% -20px;').html(' ');
|
| 19 |
|
| 20 |
$.post(Drupal.settings.basePath + 'uc_js_util/zone_select', options,
|
| 21 |
function (contents) {
|
| 22 |
if (contents.match('value="-1"') != null) {
|
| 23 |
$('#' + zone_select).attr('disabled', 'disabled');
|
| 24 |
}
|
| 25 |
else {
|
| 26 |
$('#' + zone_select).removeAttr('disabled');
|
| 27 |
}
|
| 28 |
$('#' + zone_select).empty().append(contents).val(default_zone).change();
|
| 29 |
$('#' + zone_select).parent().siblings('.zone-throbber').removeAttr('style').empty();
|
| 30 |
}
|
| 31 |
);
|
| 32 |
}
|