app/soc/content/js/map-090307.js
changeset 1720 33e34c4716d2
parent 1719 328db0964f86
child 1759 94b64c07f7ce
equal deleted inserted replaced
1719:328db0964f86 1720:33e34c4716d2
    15   // is used when showing the map if lat and lon page fields are set
    15   // is used when showing the map if lat and lon page fields are set
    16   var world_zoom = 0;
    16   var world_zoom = 0;
    17   var country_zoom = 4;
    17   var country_zoom = 4;
    18   var state_zoom = 6;
    18   var state_zoom = 6;
    19   var city_zoom = 10;
    19   var city_zoom = 10;
    20   var address_zoom = 13;
    20   var postalcode_zoom = 12;
    21 
    21 
    22   // Do not add a starting # as this JQuery selector seems 
    22   // Do not add a starting # as this JQuery selector seems 
    23   // incompatible with GMap API
    23   // incompatible with GMap API
    24   var map_div = "role_profile_map";
    24   var map_div = "role_profile_map";
    25 
    25 
    26   var field_lat = "#id_latitude";
    26   var field_lat = "#id_latitude";
    27   var field_lng = "#id_longitude";
    27   var field_lng = "#id_longitude";
    28   // Need to save old values to avoid unwanted updating 
    28   // Need to save old values to avoid unwanted updating 
    29   // of lat and lot if marker dragged and blur another time an address field
    29   // of lat and lot if marker dragged and blur another time an address field
    30   var address = {
    30   var address = {
    31     street: {
       
    32       id: "#id_res_street",
       
    33       old_value: ""
       
    34     },
       
    35     city: {
    31     city: {
    36       id: "#id_res_city",
    32       id: "#id_res_city",
    37       old_value: ""
    33       old_value: ""
    38     },
    34     },
    39     state: {
    35     state: {
    98           if (point) {
    94           if (point) {
    99             // Save the current address in the JSON object
    95             // Save the current address in the JSON object
   100             saveOldAddress();
    96             saveOldAddress();
   101             // Set the new zoom, map center and marker coords
    97             // Set the new zoom, map center and marker coords
   102             var zoom_set = world_zoom;
    98             var zoom_set = world_zoom;
   103             if ($(address.street.id).val()!="") zoom_set = address_zoom;
    99             if ($(address.postalcode.id).val()!="") zoom_set = postalcode_zoom;
   104             else if ($(address.city.id).val()!="") zoom_set = city_zoom;
   100             else if ($(address.city.id).val()!="") zoom_set = city_zoom;
   105             else if ($(address.state.id).val()!="") zoom_set = state_zoom;
   101             else if ($(address.state.id).val()!="") zoom_set = state_zoom;
   106             else if ($(address.country.id).val()!="") zoom_set = country_zoom;
   102             else if ($(address.country.id).val()!="") zoom_set = country_zoom;
   107             map.setCenter(point, zoom_set);
   103             map.setCenter(point, zoom_set);
   108             marker.setPoint(point);
   104             marker.setPoint(point);