function suggestGeoLocations(a){var b=a;$j(a.id).bind("keyup",function(g){if((40===g.keyCode||38===g.keyCode)&&undefined!==b.locations_ok&&true===b.locations_ok){if(0===$j("li.selected","ul#AM_locations_list").length){$j("li:first","ul#AM_locations_list").addClass("selected")}else{var f=$j("li.selected:first","ul#AM_locations_list");$j("li.selected","ul#AM_locations_list").removeClass("selected");switch(g.keyCode){case 40:f.next().addClass("selected");break;case 38:f.prev().addClass("selected");break}}}else{if(13===g.keyCode&&undefined!==b.locations_ok&&true===b.locations_ok){if(0!==$j("li.selected","ul#AM_locations_list").length){selectLocation($j("li.selected:first","ul#AM_locations_list").attr("title"),a)}}else{if((g.keyCode>47&&g.keyCode<59)||(g.keyCode>95&&g.keyCode<123)){var c=$j.trim($j(this).val());if(c.length>4){if(undefined!==a.country&&true!==$j("#search_extended","#AM_suggest_locations").attr("checked")){c+=", "+a.country}$j(a.id).addClass("load");var d=$j(a.id).val();$j.post(a.getListUrl,{querystring:d},function(h){$j(a.id).removeClass("load");if(0===h.length){resetLocation(b);if(undefined!==b.placemarks&&b.placemarks.length>0){return}else{$j("#AM_suggest_locations").hide();b.locations_ok=false;return}}else{if(1===h.length){b.placemarks=h;b.locations_ok=true;selectLocation(0,a)}else{if(0===$j("#AM_suggest_locations").length){b.suggestBubble=new AM_bubble(a.id,{id:"AM_suggest_locations",height:110,width:250,offsetTop:2,align:"tcenter",title:a.suggestLabel,removeOnClose:true,data:'<ul id="AM_locations_list"></ul><p class="options"><input type="checkbox" name="search_extended" id="search_extended" value="yes"><label for="search_extended">'+AM_msg.dashboard.meta.extentedGeoSearch+"</label></p>",zindex:10001})}else{$j("#AM_suggest_locations").show()}b.locations_ok=true;var j=new Array();b.placemarks=h;for(var e in b.placemarks){if(parseInt(e,10)>=10){break}j.push('<li title="'+e+'">'+b.placemarks[e].postalCode+" "+b.placemarks[e].city+" </li>")}$j("li","ul#AM_locations_list").unbind("click");$j("ul#AM_locations_list","#AM_suggest_locations").empty().append(j.join(""));$j("li","ul#AM_locations_list").bind("click",function(){$j("li.selected","ul#AM_locations_list").removeClass("selected");$j(this).addClass("selected");selectLocation($j(this).attr("title"),b)});b.suggestBubble.setDim(null,($j("ul#AM_locations_list","#AM_suggest_locations").outerHeight()+50))}}},"json")}else{if(c.length<=5){$j("#AM_suggest_locations").hide();b.locations_ok=false}}b.old_location=c}}}})}function suggestGeoLocations2(a,d){var c=a;a.id;if(0===$j("#AM_suggest_locations").length){c.suggestBubble=new AM_bubble(a.id,{id:"AM_suggest_locations",height:110,width:250,offsetTop:2,align:"tcenter",title:a.suggestLabel,removeOnClose:true,data:'<ul id="AM_locations_list"></ul><p class="options"><input type="checkbox" name="search_extended" id="search_extended" value="yes"><label for="search_extended">'+AM_msg.dashboard.meta.extentedGeoSearch+"</label></p>",zindex:10001})}else{$j("#AM_suggest_locations").show()}c.locations_ok=true;var e=new Array();c.placemarks=d;for(var b in c.placemarks){if(parseInt(b,10)>=10){break}e.push('<li title="'+b+'">'+c.placemarks[b].postalCode+" "+c.placemarks[b].city+" </li>")}$j("li","ul#AM_locations_list").unbind("click");$j("ul#AM_locations_list","#AM_suggest_locations").empty().append(e.join(""));$j("li","ul#AM_locations_list").bind("click",function(){$j("li.selected","ul#AM_locations_list").removeClass("selected");$j(this).addClass("selected");selectLocation($j(this).attr("title"),c)});c.suggestBubble.setDim(null,($j("ul#AM_locations_list","#AM_suggest_locations").outerHeight()+50))}selectLocation:function selectLocation(b,a){var c=a.placemarks[b];lastselect=c;a.current_location={geo_city:"",geo_zipcode:""};a.current_location.geo_city=c.city;a.current_location.geo_zipcode=c.postalCode;$j(a.datatId).val(a.current_location.geo_city);$j(a.displayId).html(a.current_location.geo_city);$j(a.hiddenDataId).val(a.current_location.geo_zipcode);$j("#AM_suggest_locations").hide()}function resetLocation(a){$j(a.datatId).val("");$j(a.hiddenDataId).val("");$j(a.displayId).html("Unknown")}function fill(a){$("#places_city_name").val(a);setTimeout("$('#suggestions').hide();",200)}function fillSelect(a){codepostaux=a.split("_");form=document.forms.form;form.places_postal_code.options.length=codepostaux.length;for(i=0;i<codepostaux.length;i++){form.places_postal_code.options[i].value=codepostaux[i];form.places_postal_code.options[i].text=codepostaux[i]}};