jQuery.noConflict();jQuery(function(){if(jQuery("#mapHolderSmall").length&&jQuery("#mapHolder").length){searchResults.loadMap();jQuery("a#toggleLargeMap, a#toggleSmallMap").click(function(a){a.preventDefault();jQuery("#map").toggle("slow",function(){if(jQuery(this).css("display")=="block"){jQuery("#content").attr("class","inline");searchResults.getMap("large").zoomToMarkersExtent();searchResults.getMap("large").addPanZoomControl3();jQuery.cookie("mapSize","large")}});jQuery("#mapSmall").toggle("slow",function(){if(jQuery(this).css("display")=="block"){jQuery("#content").attr("class","");searchResults.getMap("small").zoomToMarkersExtent();searchResults.getMap("small").addPanZoomControl3();jQuery.cookie("mapSize","small")}})});searchResults.getMap("large").defaultPopup("NSZemljevid.FramedCloud2");searchResults.getMap("large").addPanZoomControl3();searchResults.getMap("small").defaultPopup("NSZemljevid.FramedCloud2");searchResults.getMap("small").addPanZoomControl3();searchResults.initMap("large");searchResults.getMap("large").zoomToMarkersExtent();searchResults.initMap("small");searchResults.getMap("small").zoomToMarkersExtent()}jQuery("#facetSort, #facetSortClose").click(function(a){a.preventDefault();jQuery("#facetCategoriesWindow").hide();jQuery("#facetSortWindow").toggle()});jQuery("#facetSortSubmit").click(function(a){a.preventDefault();jQuery("#facetSortWindow").hide();jQuery("input#searchButton").click()});jQuery("#facetCategories, #facetCategoriesClose").click(function(a){a.preventDefault();jQuery("#facetSortWindow").hide();jQuery("#facetCategoriesWindow").toggle()});jQuery("#facetCategoriesSubmit").click(function(a){a.preventDefault();jQuery("#facetCategoriesWindow").hide();jQuery("input#searchButton").click()})});var searchResults={markers:null,smallMap:null,largeMap:null,mapType:"small",loadMap:function(){searchResults.smallMap=new NSZemljevid("mapHolderSmall");searchResults.largeMap=new NSZemljevid("mapHolder")},getMap:function(a){if(undefined!=a){searchResults.mapType=a}if(searchResults.mapType=="small"){return searchResults.smallMap}else{return searchResults.largeMap}},initMap:function(b){var c=searchResults.getMap(b);if(typeof c!=undefined){if(this.markers){jQuery.each(this.markers,function(e,f){var d=new NSZemljevid.Marker(new NSZemljevid.GK(f.x_utm,f.y_utm),new NSZemljevid.Icon3(e));d.addEventListener("mouseover",searchResults.markerOver);d.addEventListener("mouseout",searchResults.markerOut);searchResults.getMap().addMarker(d)});this.placeMarkers()}if(userPrefs.locationData!=null){var a=new NSZemljevid.Marker(new NSZemljevid.GK(userPrefs.locationData.x_utm,userPrefs.locationData.y_utm),new NSZemljevid.Icon4());a.addEventListener("mouseover",searchResults.markerOver);a.addEventListener("mouseout",searchResults.markerOut);c.addMarker(a)}}},placeMarkers:function(){jQuery("#results li:not(.more) a").each(function(){jQuery(this).mouseover(function(){searchResults.getSingleMarker(this,searchResults.markerOver)}).mouseout(function(){searchResults.getSingleMarker(this,searchResults.markerOut)})})},markerOver:function(f,a){var g=searchResults.getMap();a=(f!=null)?f.object:a;a.setSelected(true);var b=a.getIndex();var d=(g.map.popups.length!=0)?g.map.popups[0].anchor.index:false;if(d!=b&&b!=null){var c="<p><strong>"+searchResults.markers[b].name+"</strong></p><p>"+searchResults.markers[b].address+'</p><p><a href="/'+searchResults.markers[b].id+'">Poglej podrobnosti</a></p>';a.openPopup(c)}if(b==null&&locationData.title){a.openPopup("Trenutna lokacija:<br/>"+locationData.title)}jQuery("div#nsPopup_contentDiv").css({cursor:"pointer"}).click(function(){window.location=jQuery("#"+this.id+" p a").attr("href")})},markerOut:function(b,a){a=(b!=null)?b.object:a;a.setSelected(false)},getSingleMarker:function(b,d){var c=searchResults.getMap();var a=jQuery(b).children("strong").text();jQuery.each(c.getMarkers(),function(){if(this.icon.index==a){return d(null,this)}})}};