StreetCatalog={}
StreetCatalog.Popup={show:function(cityId)
{this.hideAll();var popupContainer=$('#popupContainerCity_'+cityId);if(popupContainer.find('.popup').length)
popupContainer.show();else
this.loadContent(cityId);},hide:function(cityId)
{$('#popupContainerCity_'+cityId).hide();},hideAll:function()
{$('.popupContainerCity').hide();},loadContent:function(cityId)
{$('#popupContainerCity_'+cityId).load('/streetCatalog/popup',{cityId:cityId},function()
{$('#popupContainerCity_'+cityId).show();});}}
StreetCatalog.Search={initialize:function()
{options={cacheLength:0,minChars:3,max:100,width:'320px'};$('#streetCatalogSearchField').autocomplete('/streetCatalog/getAutocompletedStreets',options);$('#streetCatalogSearchField').result(function(event,data,formatted)
{if(data)
setTimeout(function(){$('#streetCatalogStreetId').val(data[1]);$('#streetCatalogStreetName').val(data[2]);$('#streetCatalogButton').focus();},300);});$('#streetCatalogSearchField').change(function(){$('#streetCatalogStreetId').val('');$('#streetCatalogStreetName').val('');});$('#streetCatalogSearchField').focus(function(){if($('#streetCatalogStreetName').val())
{$('#streetCatalogSearchField').val($('#streetCatalogStreetName').val());$('#streetCatalogStreetName').val('');$('#streetCatalogStreetId').val('');}});},performSearch:function()
{var streetId=$('#streetCatalogStreetId').val();if(!parseInt(streetId))
{$('#srchByStreetMessage').slideDown('Fast');}
else
{$('#srchByStreetMessage').slideUp('Fast');document.location='/catalog/houses/houses/'+streetId+'/';}}}
