--- address.js.orig	2007-05-01 12:31:57.000000000 -0300
+++ address.js	2007-05-01 13:05:13.000000000 -0300
@@ -1,26 +1,30 @@
 // $Id: address.js,v 1.1.2.3.4.1 2007/02/03 11:04:45 gordon Exp $
 
-if (Drupal.jsEnabled) {
-  $(document).ready( function () {
-    $('#edit-country').each( function () {
-      Drupal.addressToggleFields(this.options[this.selectedIndex].value);
-    });
-    $('#edit-state').each( function () {
-      this.remove(this.length-1);
-    });
-    $('#edit-country').change( function() {
-      Drupal.addressToggleFields(this.options[this.selectedIndex].value);
-    });
+$(function () {
+  $('#edit-country').change( function() {
+    Drupal.addressToggleFields($('#edit-country').val());
   });
-}
+  Drupal.addressToggleFields($('#edit-country').val());
+});
 
 Drupal.addressToggleFields = function(country) {
-  if (country == 'us') {
+  if (Drupal.settings.states[country]) {
+    var states = '<option value="0">Please choose...</option>';
+    for (state in Drupal.settings.states[country]) {
+      states = states + '<option value="'+ state +'">'+ Drupal.settings.states[country][state] +"</option>";
+    }
+    $('#edit-state').html(states);
+    if (Drupal.settings.current_state[0] == country) {
+      $('#edit-state').val(Drupal.settings.current_state[1]);
+      Drupal.settings.current_state[0] = "";
+    }
     $('#wrapper-province').hide();
     $('#wrapper-state').show();
+    $('#edit-province').val('');
   }
   else {
     $('#wrapper-province').show();
     $('#wrapper-state').hide();
+    $('#edit-state').val(0);
   }
-}
+}
\ No newline at end of file
