tagged.namespace("util.locationselector");(function(){var a;tagged.util.locationselector={stateAbbrevs:{Alabama:"AL",Alaska:"AK","American Samoa":"AS",Arizona:"AZ",Arkansas:"AR",California:"CA",Colorado:"CO",Connecticut:"CT",Delaware:"DE","District of Columbia":"DC",Florida:"FL",Georgia:"GA",Hawaii:"HI",Idaho:"ID",Illinois:"IL",Indiana:"IN",Iowa:"IA",Kansas:"KS",Kentucky:"KY",Louisiana:"LA",Maine:"ME",Maryland:"MD",Massachusetts:"MA",Michigan:"MI",Minnesota:"MN",Mississippi:"MS",Missouri:"MO",Montana:"MT",Nebraska:"NE",Nevada:"NV","New Hampshire":"NH","New Jersey":"NJ","New Mexico":"NM","New York":"NY","North Carolina":"NC","North Dakota":"ND",Ohio:"OH",Oklahoma:"OK",Oregon:"OR",Palau:"PW",Pennsylvania:"PA","Rhode Island":"RI","South Carolina":"SC","South Dakota":"SD",Tennessee:"TN",Texas:"TX",Utah:"UT",Vermont:"VT",Virginia:"VA",Washington:"WA","West Virginia":"WV",Wisconsin:"WI",Wyoming:"WY",Alberta:"AB","British Columbia":"BC",Manitoba:"MB","New Brunswick":"NB",Newfoundland:"NL","Northwest Territories":"NT","Nova Scotia":"NS",Ontario:"ON","Prince Edward Island":"PE",Quebec:"QC",Saskatchewan:"SK",Yukon:"YT"},locationHTML:'<div id="location_search_ac"><input id="location" name="location" class="fields-text" /><span id="location_span"></span><div id="location_results" class="location_container"></div></div><input id="location_nd" name="location_nd" type="hidden" value="" /><div class="clearBoth"/>',create:function(i,d,e,j){var h=D.get("location_selector");h.innerHTML=this.strings.countryHTML+this.strings.distanceHTML+this.locationHTML;var k=tagged.util.locationselector.strings.allCountries;if(i!=""){k=i}if(!j){tagged.util.countries.getCountries("country_span","country","country","fields-wide",k);D.get("country").onchange=function(){tagged.util.locationselector.countryChange(this.options[this.selectedIndex].value)}}else{tagged.util.countries.forceCountry("country_span","country","country","select_wide",k)}D.get("location").value=d;TAGGED.util.hintinput.attach("location",e,tagged.util.locationselector.getDefaultLocation(k));var c="location";var f="location_results";var b=new YAHOO.util.XHRDataSource("/proxy/l.php");b.responseType=YAHOO.util.XHRDataSource.TYPE_JSON;b.responseSchema={resultsList:"results",fields:["placeName","placeAdm1","placeId","placeCountryName","placeNameND"]};var g=this.AC=new YAHOO.widget.AutoComplete(c,f,b);g.resultTypeList=false;g.generateRequest=function(l){return"?cc_iso="+e.country.value+"&str="+l};g.useIFrame=true;g.maxResultsDisplayed=10;g.autoHighlight=true;g.allowBrowserAutocomplete=false;g.minQueryLength=3;g.forceSelection=false},countryChange:function(c){var e=tagged.util.locationselector.strings.distanceMiles;if(!(c=="US"||c=="GB")){e=tagged.util.locationselector.strings.distanceKilometers}var d=[5,10,20,50,100];var b='<select class="fields-wide" id="distance" name="distance">';b+='<option value="0">'+tagged.util.locationselector.strings.distanceMatches+"</option>";for(var f=0;f<d.length;++f){b+='<option value="'+d[f]+'">'+sprintf(e,d[f])+"</option>"}b+="</select>";D.get("distance_span").innerHTML=b;D.get("location_nd").value="";D.get("location").setAttribute("defaultText",tagged.util.locationselector.getDefaultLocation(c));D.get("location").clearValue();if(c=="US"||c=="CA"){this.AC.formatResult=function(g,i){var j=tagged.util.locationselector._highlightString(g.placeName,i);var h=tagged.util.locationselector._abbrevState(g.placeAdm1);return j+h};this.AC.itemSelectEvent.unsubscribeAll();this.AC.itemSelectEvent.subscribe(function(i,h){var g=tagged.util.locationselector._abbrevState(h[2].placeAdm1);D.get("location").value=h[2].placeName+g;D.get("location_nd").value=h[2].placeNameND+g})}else{this.AC.formatResult=function(g,h){return tagged.util.locationselector._highlightString(g.placeName,h)};this.AC.itemSelectEvent.unsubscribeAll();this.AC.itemSelectEvent.subscribe(function(h,g){D.get("location").value=g[2].placeName;D.get("location_nd").value=g[2].placeNameND})}},getDefaultLocation:function(b){var c=tagged.util.locationselector.strings.defaultDefaultCity;if(b=="CA"){c=tagged.util.locationselector.strings.defaultCanadaCity}else{if(b=="US"){c=tagged.util.locationselector.strings.defaultUSCity}}return c},_highlightString:function(e,d){var c=new RegExp("("+d+")","ig");var b=e.replace(c,"<strong>$1</strong>");return b.replace("$1",d)},_abbrevState:function(b){return(typeof(this.stateAbbrevs[b])=="undefined")?"":(", "+this.stateAbbrevs[b])}}})();tagged.loadStringsDirect({"tagged.util.countries":{englishCountries:{US:"United States",AU:"Australia",CA:"Canada",GB:"United Kingdom"},otherCountries:{AF:"Afghanistan",AL:"Albania",DZ:"Algeria",AD:"Andorra",AO:"Angola",AI:"Anguilla",AG:"Antigua and Barbuda",AR:"Argentina",AM:"Armenia",AW:"Aruba",AU:"Australia",AT:"Austria",AZ:"Azerbaijan",BH:"Bahrain",BD:"Bangladesh",BB:"Barbados",BY:"Belarus",BE:"Belgium",BZ:"Belize",BJ:"Benin",BM:"Bermuda",BT:"Bhutan",BO:"Bolivia",BA:"Bosnia and Herzegovina",BW:"Botswana",BR:"Brazil",IO:"British Indian Ocean Territory",VG:"British Virgin Islands",BN:"Brunei",BG:"Bulgaria",BF:"Burkina Faso",BI:"Burundi",KH:"Cambodia",CM:"Cameroon",CA:"Canada",CV:"Cape Verde",KY:"Cayman Islands",CF:"Central African Republic",TD:"Chad",CL:"Chile",CN:"China",CX:"Christmas Island",CC:"Cocos (Keeling) Islands",CO:"Colombia",KM:"Comoros",CG:"Congo (Brazzaville)",CD:"Congo (Kinshasa)",CK:"Cook Islands",CR:"Costa Rica",CI:"Cote D'Ivoire",HR:"Croatia",CU:"Cuba",CY:"Cyprus",CZ:"Czech Republic",DK:"Denmark",DJ:"Djibouti",DM:"Dominica",DO:"Dominican Republic",TL:"East Timor",EC:"Ecuador",EG:"Egypt",SV:"El Salvador",GQ:"Equatorial Guinea",ER:"Eritrea",EE:"Estonia",ET:"Ethiopia",FK:"Falkland Islands (Islas Malvinas)",FO:"Faroe Islands",FJ:"Fiji",FI:"Finland",FR:"France",GF:"French Guiana",PF:"French Polynesia",TF:"French Southern and Antarctic Lands",GA:"Gabon",GE:"Georgia",DE:"Germany",GH:"Ghana",GI:"Gibraltar",GR:"Greece",GL:"Greenland",GD:"Grenada",GP:"Guadeloupe",GT:"Guatemala",GN:"Guinea",GW:"Guinea-Bissau",GY:"Guyana",HT:"Haiti",VA:"Holy See (Vatican City)",HN:"Honduras",HK:"Hong Kong",HU:"Hungary",IS:"Iceland",IN:"India",ID:"Indonesia",IR:"Iran",IQ:"Iraq",IE:"Ireland",IL:"Israel",IT:"Italy",JM:"Jamaica",JP:"Japan",JO:"Jordan",KZ:"Kazakhstan",KE:"Kenya",KI:"Kiribati",KW:"Kuwait",KG:"Kyrgyzstan",LA:"Laos",LV:"Latvia",LB:"Lebanon",LS:"Lesotho",LR:"Liberia",LY:"Libya",LI:"Liechtenstein",LT:"Lithuania",LU:"Luxembourg",MO:"Macau",MK:"Macedonia",MG:"Madagascar",MW:"Malawi",MY:"Malaysia",MV:"Maldives",ML:"Mali",MT:"Malta",MQ:"Martinique",MR:"Mauritania",MU:"Mauritius",YT:"Mayotte",MX:"Mexico",FM:"Micronesia,Federated States of",MD:"Moldova",MC:"Monaco",MN:"Mongolia",ME:"Montenegro",MS:"Montserrat",MA:"Morocco",MZ:"Mozambique",MM:"Myanmar (Burma)",NA:"Namibia",NR:"Nauru",NP:"Nepal",NL:"Netherlands",AN:"Netherlands Antilles",NC:"New Caledonia",NZ:"New Zealand",NI:"Nicaragua",NE:"Niger",NG:"Nigeria",NU:"Niue",NF:"Norfolk Island",KP:"North Korea",NO:"Norway",OM:"Oman",PK:"Pakistan",PW:"Paluau",PA:"Panama",PG:"Papua New Guinea",PY:"Paraguay",PE:"Peru",PH:"Philippines",PN:"Pitcairn Islands",PL:"Poland",PT:"Portugal",QA:"Qatar",RE:"Reunion",RO:"Romania",RU:"Russia",RW:"Rwanda",SH:"Saint Helena",KN:"Saint Kitts and Nevis",LC:"Saint Lucia",PM:"Saint Pierre and Miquelon",VC:"Saint Vincent and the Grenadines",WS:"Samoa",SM:"San Marino",ST:"Sao Tome and Principe",SA:"Saudi Arabia",SN:"Senegal",RS:"Serbia",SC:"Seychelles",SL:"Sierra Leone",SG:"Singapore",SK:"Slovakia",SI:"Slovenia",SB:"Solomon Islands",SO:"Somalia",ZA:"South Africa",GS:"South Georgia and the South Sandwich Islands",KR:"South Korea",ES:"Spain",LK:"Sri Lanka",SD:"Sudan",SR:"Suriname",SJ:"Svalbard",SZ:"Swaziland",SE:"Sweden",CH:"Switzerland",SY:"Syria",TW:"Taiwan",TJ:"Tajikistan",TZ:"Tanzania",TH:"Thailand",BS:"The Bahamas",GM:"The Gambia",TG:"Togo",TK:"Tokelau",TO:"Tonga",TT:"Trinidad and Tobago",TN:"Tunisia",TR:"Turkey",TM:"Turkmenistan",TC:"Turks and Caicos Islands",TV:"Tuvalu",UG:"Uganda",UA:"Ukraine",AE:"United Arab Emirates",GB:"United Kingdom",US:"United States",UY:"Uruguay",UZ:"Uzbekistan",VU:"Vanuatu",VE:"Venezuela",VN:"Vietnam",WF:"Wallis and Futuna",EH:"Western Sahara",YE:"Yemen",ZM:"Zambia",ZW:"Zimbabwe"}}});tagged.loadStringsDirect({"tagged.util.locationselector.strings":{countryHTML:'<div class="location_row"><label for="country">Country</label><span id="country_span"></span></div>',distanceHTML:'<div class="location_row"><label for="location">Location</label><span id="distance_span"></span></div>',defaultDefaultCity:"City name",defaultCanadaCity:"City or Postal Code",defaultUSCity:"City, State or Zip Code",distanceMatches:"matches",distanceMiles:"within %d miles",distanceKilometers:"within %d kilometers",allCountries:"All Countries"}});