jQuery.noConflict();var suggestTable=false;var timeout=0;jQuery(function(){var b={main:{top:"34px",left:"200px"},form:{top:"165px",left:"200px"},text:{top:"150px",left:"440px"}};rotator.initRotator();feedManager.initLoader();jQuery("document").ready(function(){if(jQuery("#banner_komentarji").length>0){var d={wmode:"transparent",clickTAG:"/v/mnenja-ocene-komentarji?utm_source=firma%26utm_medium=oglas%26utm_campaign=oglas"};var c={wmode:"transparent",clickTAG:"/v/mnenja-ocene-komentarji?utm_source=firma%26utm_medium=oglas%26utm_campaign=oglas"};swfobject.embedSWF("/gui/swf/firma_benner_436x230.swf","banner_komentarji","436","230","9.0.0",{},d,c);rotator.rotateAd()}});if(jQuery("#usersLocationMap")&&jQuery("#usersLocationEditor")){userPrefs.locationMap=new NSZemljevid("usersLocationMap");userPrefs.locationMap.defaultPopup("NSZemljevid.FramedCloud2");userPrefs.locationMap.addPanZoomControl3();userPrefs.form=jQuery("#inputSelector").remove();userPrefs.locationMap.addEventListener("click",function(c){userPrefs.setLocationCoords(c);userPrefs.placeLocationMarker();jQuery("#usersLocationEditor").submit(submitLocation)});userPrefs.initLocationCoords()}submitLocation=function(c){c.preventDefault();if(jQuery("#app-x_utm").val()&&jQuery("#app-y_utm").val()){jQuery.cookie("locationSet",true,{path:"/"});jQuery.post("/users/location",{x_utm:jQuery("#app-x_utm").val(),y_utm:jQuery("#app-y_utm").val()},function(d){userPrefs.locationData=d;if(d.title.length<0){d.title="neznano"}jQuery("a#selectLocation").text("moja trenutna lokacija: "+d.title)},"json");if(jQuery("#mapPosition").attr("rel")=="main"){jQuery("a#selectLocation").click();userPrefs.locationMap.closePopup()}else{jQuery("#mapPosition").slideToggle("fast");setTimeout(function(){jQuery("input#searchButton").click()},2000)}}return false};var a=(userPrefs.locationData!=null)?true:jQuery.cookie("locationSet");if(geoLocation.initInstance()!=null){jQuery("#locatingInstructions").after('<h3>Samodejno lociranje</h3><p>Vaš brskalnik omogoča samodejno lociranje. <a href="javascript:void(0);" id="autoLocate" class="start">Sproži samodejno lociranje</a></p>');jQuery("#mapWraper #autoLocate").click(function(c){c.preventDefault();userPrefs.locateUser()})}jQuery("#search form").attr("autocomplete","off");jQuery("#searchField").focus();jQuery("#searchButton").click(function(c){jQuery(this).parents("form").submit()});jQuery("#searchLocation a").click(function(c){toggleActive(c,this);if(jQuery("#searchLocation a").hasClass("active")&&!a){if(jQuery("#mapPosition").css("display")=="none"){jQuery("#mapPosition").css({top:b.form.top});jQuery("kbd.pointMap").css({left:b.form.left});jQuery("#mapPosition").attr("rel","form");jQuery("#mapPosition").slideToggle("fast")}}else{if(jQuery("#mapPosition").css("display")!="none"){jQuery("#mapPosition").css({top:b.form.top});jQuery("#mapPosition").attr("rel","main");jQuery("kbd.pointMap").css({left:b.form.left});jQuery("#mapPosition").slideToggle("fast")}}});jQuery(".iconLogin li.dropDown a.ownedCompanies").click(function(c){toggleActive(c,jQuery(this).siblings("ul"))});toggleActive=function(d,e){d.preventDefault();var c=jQuery(e);if(c.hasClass("inactive")){c.removeClass("inactive");c.addClass("active")}else{c.removeClass("active");c.addClass("inactive")}};jQuery("#search form").submit(function(e){var c=(typeof locationData!=="undefined"&&locationData!=null)?true:jQuery.cookie("locationSet");var d=jQuery("#searchLocation a").hasClass("active")?"nearest":"best";jQuery(".sButton input[name=search]").val(d);if(!c&&d=="nearest"){if(jQuery("#mapPosition").css("display")=="none"){jQuery("#mapPosition").css({top:b.form.top});jQuery("kbd.pointMap").css({left:b.form.left});jQuery("#mapPosition").attr("rel","form");jQuery("#mapPosition").slideToggle("fast")}return false}return true});jQuery("#searchField").autocomplete("/search/suggest",{minChars:2,max:7,selectFirst:false,formatItem:function(c){out='<span class="suggest">'+c[0]+"</span>";return out}}).result(function(d,c){jQuery("#search #searchButton").click()});jQuery('#mapPosition input[name="address"]').autocomplete("/users/ehis",{max:10,matchContains:true,scrollHeight:300,width:200,formatItem:function(c){return c[1]+" "+c[0]}}).result(function(d,c){userPrefs.locationMap.setCenter(new NSZemljevid.GK(c[2],c[3]),NSZemljevid.MAX_ZOOM_LEVEL-4)});showLoginPopup=function(i){var e=500;var c=340;var h="/users/login/mode/popup";if(i==true){h="/users/before-popup"}var g=(screen.width-e)/2;var f=(screen.height-c)/2-100;var d="height="+c+",width="+e+",top="+f+",left="+g+",scroolbars=no,toolbar=no,location=yes";window.open(h,"openid_popup",d);return false};jQuery('a[rel="login"]').click(function(c){c.preventDefault();showLoginPopup()});jQuery('a[rel="claimCompany"]').click(function(f){f.preventDefault();var e=455;var c=345;var h=(screen.width-e)/2;var g=(screen.height-c)/2-100;var d="height="+c+",width="+e+",top="+g+",left="+h+",scroolbars=no,toolbar=no,location=yes";window.open(jQuery(this).attr("href"),"claiming",d);return false});tabs(".faq ol.tabs li",".faq ul",true);showMap=function(d){if(typeof d!="undefined"&&d!=true){d.preventDefault()}var c=(userPrefs.locationData!=null)?true:jQuery.cookie("locationSet");if(!c&&jQuery("#mapPosition").css("display")=="none"){userPrefs.locateUser()}jQuery("#mapPosition").css({top:b.main.top});jQuery("#mapPosition").attr("rel","main");jQuery("kbd.pointMap").css({left:b.main.left});if(d==true){jQuery("#mapPosition").show("fast")}else{jQuery("#mapPosition").slideToggle("fast")}};jQuery("a#selectLocation, a#locirajSe, a#locirajSeLarge").click(showMap);jQuery(document).keyup(function(c){if(c.keyCode==27&&jQuery("#mapPosition").css("display")!="none"){showMap(c)}});jQuery("div#mapWraper p.close").click(function(c){c.preventDefault();jQuery("#mapPosition").attr("rel","main");jQuery("#mapPosition").slideToggle("fast")});jQuery(".infoBoxTrigger").click(function(d){d.preventDefault();var c="#"+jQuery(this).attr("rel");if(jQuery("iframe",c)&&jQuery("iframe",c).attr("rel")){jQuery("iframe",c).attr({src:jQuery("iframe",c).attr("rel")})}jQuery(".close",c).one("click",c,function(e){jQuery(e.data).hide();e.preventDefault()});jQuery(c).show()})});function updateLocation(){jQuery.cookie("locationSet",true,{path:"/"});jQuery("a#selectLocation").text("moja trenutna lokacija na zemljevidu");if(jQuery("#mapPosition").attr("rel")=="main"){jQuery("a#selectLocation").click()}else{jQuery("#mapPosition").slideToggle("fast");setTimeout(function(){jQuery("input#searchButton").click()},2000)}}function tabs(b,a,c){if(c==true&&jQuery.cookie&&jQuery.cookie(b)!=null){hideTabs(b,a);showTab(jQuery(b).filter("."+jQuery.cookie(b)),a)}jQuery(b).click(function(){hideTabs(this,a);if(c==true){jQuery.cookie(b,jQuery(this).attr("class"))}showTab(this,a)})}function hideTabs(b,a){jQuery(b).siblings().andSelf().removeClass("active");jQuery(a).each(function(){jQuery(this).hide()})}function showTab(c,a){var b=jQuery(c).attr("class");if(b){while(" "==b.substr(0,1)){b=b.substr(1)}jQuery(a).filter("."+b).show()}jQuery(c).addClass("active");jQuery(c).parent().parent().find("h3").text(jQuery(c).text())}var userPrefs={locationMap:null,locationCoords:null,locationMarker:null,first:true,form:null,locationData:null,locationMsg:null,zoomFactor:{1:75,2:150,3:300,4:600,5:2000,6:10000,7:20000,8:40000},initLocationCoords:function(){if(this.locationData!=null){this.locationCoords=new NSZemljevid.GK(this.locationData.x_utm,this.locationData.y_utm);this.setLocationForm(this.locationData.x_utm,this.locationData.y_utm);this.placeLocationMarker()}},locateUser:function(){geoLocation.getCurrentPosition()},putLocationMarker:function(e,f,d){showMap(true);var b=new NSZemljevid.IMapInfo();gkCoords=b.fromWGS84ToGK({lon:f,lat:e});this.locationCoords=new NSZemljevid.GK(Math.round(gkCoords.x,0),Math.round(gkCoords.y,0));this.setLocationForm(this.locationCoords.x,this.locationCoords.y);this.placeLocationMarker();var a=9;for(var c in this.zoomFactor){if(this.zoomFactor[c]>=d){a=c;break}}this.locationMap.setCenter(this.locationCoords,NSZemljevid.MAX_ZOOM_LEVEL-a)},setLoaderIcon:function(){jQuery(".iconPointer a").css({"background-image":"url(/gui/img/location-loader.gif)","background-repeat":"no-repeat","background-position":0});this.locationMsg=jQuery(".iconPointer a").text();jQuery(".iconPointer a").text("določam tvojo trenutno lokacijo")},setPointerIcon:function(){jQuery(".iconPointer a").css({"background-image":"url(/gui/img/icons/icons1.gif)","background-repeat":"repeat-y","background-position":"0px 1329px"});jQuery(".iconPointer a").text(this.locationMsg)},setLocationCoords:function(a){this.locationCoords=a.object.getCoords(a.xy);this.setLocationForm(this.locationCoords.x,this.locationCoords.y)},setLocationForm:function(a,b){jQuery(this.form).find("#app-x_utm").val(a);jQuery(this.form).find("#app-y_utm").val(b)},placeLocationMarker:function(){if(this.locationCoords){if(this.locationMarker){this.locationMap.removeMarker(this.locationMarker)&&(this.locationMarker=null)}this.locationMarker=new NSZemljevid.Marker(this.locationCoords,new NSZemljevid.Icon4());this.locationMap.addMarker(this.locationMarker);if(this.first&&(this.locationData!=null)){this.first=false}else{this.locationMarker.openPopup(this.form.html())}}}};var geoLocation={singleton:true,initInstance:function(){var a=null;if(navigator&&navigator.geolocation){a=navigator.geolocation}else{if(window.google&&google.gears){a=google.gears.factory.create("beta.geolocation")}}return a},getCurrentPosition:function(){var a=this.initInstance();if(a!=null){userPrefs.setLoaderIcon();a.getCurrentPosition(this.setPosition,this.setError)}},setPosition:function(a){if(geoLocation.singleton==true){geoLocation.singleton=false;userPrefs.putLocationMarker(a.coords.latitude,a.coords.longitude,a.coords.accuracy);jQuery("#usersLocationEditor").submit(submitLocation);userPrefs.setPointerIcon()}return true},setError:function(a){userPrefs.setPointerIcon()}};var rotator={current:null,mouseOverOffer:false,mouseOverBlue:false,initRotator:function(){if(jQuery("#frontpage_offer").length>0){rotator.current=jQuery("#frontpage_offer div.chunk:first");setTimeout("rotator.rotate()",10000)}jQuery("#frontpage_offer").hover(function(){rotator.mouseOverOffer=true},function(){rotator.mouseOverOffer=false});jQuery("#banner_posvojitev").hover(function(){rotator.mouseOverBlue=true},function(){rotator.mouseOverBlue=false})},setNext:function(){if(!rotator.mouseOverOffer){jQuery(rotator.current).hide();if(jQuery(rotator.current).next("div.chunk").length>0){rotator.current=jQuery(rotator.current).next("div.chunk")}else{rotator.current=jQuery("#frontpage_offer div.chunk:first")}jQuery(rotator.current).fadeIn()}},rotate:function(){setTimeout("rotator.rotate()",10000);rotator.setNext()},rotateAd:function(){setTimeout(function(){if(rotator.mouseOverBlue==false){jQuery("#banner_posvojitev").fadeOut("slow")}setTimeout(function(){if(rotator.mouseOverBlue==false){jQuery("#banner_posvojitev").fadeIn("slow")}rotator.rotateAd()},15000)},7500)}};var feedManager={initLoader:function(){if(jQuery("#newsfeedContainer").length>0){feedManager.timeUpdateTimer()}jQuery("#feedLoader").one("click",function(a){a.preventDefault();jQuery("#feedLoaderAn").show();feedManager.load()})},load:function(){jQuery.get("/load-feed/feed/",function(a){jQuery("ul#newsfeedContainer > li.more").before(a);jQuery("#feedLoaderAn").hide();if(a==""){jQuery("ul#newsfeedContainer > li.more").hide()}jQuery("#feedLoader").one("click",function(b){b.preventDefault();jQuery("#feedLoaderAn").show();feedManager.load()});feedManager.updateTime()})},timeUpdateTimer:function(){setTimeout(function(){feedManager.updateTime();feedManager.timeUpdateTimer()},60000)},updateTime:function(){jQuery.get("/current-time/feed/",function(b){var a=new Date(b);jQuery("abbr.timestamp").each(function(){var c=new Date(jQuery(this).attr("title"));var d=a-c;jQuery(this).html(feedManager.simpleDate(d/1000))})})},simpleDate:function(a){if(!a){return"neznanokdaj"}else{if(a<60){return"pred manj kot minuto"}else{if(a<(60*2)){return"pred približno minuto"}else{if(a<(60*3)){return"pred približno dvema minutama"}else{if(a<(60*60)){return"pred "+Math.floor(a/60)+" minutami"}else{if(a<(60*60*2)){return"pred približno eno uro"}else{if(a<(60*60*3)){return"pred približno dvema urama"}else{if(a<(60*60*24)){return"pred približno "+Math.floor(a/(60*60))+" urami"}else{if(a<(60*60*24*2)){return"pred enim dnevom"}else{if(a<(60*60*24*3)){return"pred dvema dnevoma"}else{if(a<(60*60*24*31)){return"pred "+Math.floor(a/(60*60*24))+" dnevi"}else{if(a<(60*60*24*31*2)){return"pred več kot enim mesecom"}else{if(a<(60*60*24*31*3)){return"pred več kot dvema mesecema"}else{if(a<(60*60*24*356)){return"pred več kot "+Math.floor(a/(60*60*24*30))+" meseci"}else{return"pred več kot enim letom"}}}}}}}}}}}}}}}};jQuery.fn.extend({scrollTo:function(a,b){return this.each(function(){var c=jQuery(this).offset().top;jQuery("html,body").animate({scrollTop:c},a,b)})}});