$(document).ready(function(){checkResults();$(".checklist label").live("click",function(){checkResults()});$("#vyhladavac select").live("change",function(){checkResults()});$("#vyhladavac input").live("change",function(){checkResults()});$("#search_lokalita").live("change",function(){var varLokalita=$("#search_lokalita").val();$.ajax({type:"POST",url:"/webservices/data.asmx/LojzoObec",data:"{'id':'"+varLokalita+"'}",dataType:"json",contentType:"application/json; charset=utf-8",error:function(XMLHttpRequest,
textStatus,errorThrown){},success:function(data){ajaxFinish(data)}});function ajaxFinish(data){var obj=data.d;$("#box_obec").html(obj);checkResults()}});$("#cena").slider({from:0,to:5E7,step:2E3,scale:["min","|","|","|","|",1E5,"|","|",3E5,"|","max"],heterogeneity:["50/100000","80/300000","95/1000000"],dimension:"&nbsp;\u20ac",callback:function(value){checkResults()}});$("#rozloha").slider({from:0,to:5E5,step:5,scale:["min","|","|",200,"|","|","|",1E3,"|","|","max"],heterogeneity:["40/200","70/1000",
"95/10000"],dimension:"&nbsp;m<small>2</small>",callback:function(value){checkResults()}});$(".checklist input:checked").parent().addClass("selected");$(".checklist input:checked").parent().find("label").addClass("strong");$(".checklist .checkbox-select").click(function(event){event.preventDefault();if($(this).parent("li").hasClass("root")==true){$(this).addClass("strong");$(this).parent().addClass("selected");$(this).parent().find(":checkbox").attr("checked","checked");$(this).parent().parent().find("li").each(function(index){if($(this).hasClass("root")==
false){$(this).find("label").removeClass("strong");$(this).removeClass("selected");$(this).find(":checkbox").removeAttr("checked")}})}else{$(this).parent().parent().find("li.root").find("label").removeClass("strong");$(this).parent().parent().find("li.root").removeClass("selected");$(this).parent().parent().find("li.root").find(":checkbox").removeAttr("checked");if($(this).parent().find(":checkbox").attr("checked")==null){$(this).addClass("strong");$(this).parent().addClass("selected");$(this).parent().find(":checkbox").attr("checked",
"checked")}else{$(this).removeClass("strong");$(this).parent().removeClass("selected");$(this).parent().find(":checkbox").removeAttr("checked")}}});$(".checklist .radio-select").click(function(event){event.preventDefault();$(this).parent().siblings().removeClass("selected");$(this).parent().siblings().find("label").removeClass("strong");$(this).parent().siblings().find(":checkbox").removeAttr("checked");$(this).parent().addClass("selected");$(this).parent().find(":checkbox").attr("checked","checked");
$(this).addClass("strong")});ShowNehnutelnosti();$("#nehnutelnost-velkost").fadeOut(0);$("#txtSearchTyp").change(function(){ShowNehnutelnosti()});$("#form-newsletter").validator({effect:"wall",container:"#error-newsletter",errorInputEvent:null})});
function ShowNehnutelnosti(){if($("#txtSearchTyp option:selected").text()!="V\u0161etky nehnute\u013enosti")$("#nehnutelnost-velkost").fadeIn("fast");else $("#nehnutelnost-velkost").fadeOut(0);if($("#txtSearchTyp option:selected").text()=="Byty")$("#nehnutelnosti-byty").fadeIn("fast");else $("#nehnutelnosti-byty").fadeOut(0);if($("#txtSearchTyp option:selected").text()=="Domy")$("#nehnutelnosti-domy").fadeIn("fast");else $("#nehnutelnosti-domy").fadeOut(0);if($("#txtSearchTyp option:selected").text()==
"Pozemky")$("#nehnutelnosti-pozemky").fadeIn("fast");else $("#nehnutelnosti-pozemky").fadeOut(0);if($("#txtSearchTyp option:selected").text()=="Komer\u010dn\u00e9 objekty")$("#nehnutelnosti-objekty").fadeIn("fast");else $("#nehnutelnosti-objekty").fadeOut(0);if($("#txtSearchTyp option:selected").text()=="Komer\u010dn\u00e9 priestory")$("#nehnutelnosti-priestory").fadeIn("fast");else $("#nehnutelnosti-priestory").fadeOut(0);if($("#txtSearchTyp option:selected").text()=="Hotely, penzi\u00f3ny, re\u0161taur\u00e1cie")$("#nehnutelnosti-hotely").fadeIn("fast");
else $("#nehnutelnosti-hotely").fadeOut(0)}function checkResults(){var str=$("form").serializeArray();$.ajax({type:"POST",url:"/webservices/data.asmx/GetTotal",data:JSON.stringify({data:str}),dataType:"json",contentType:"application/json; charset=utf-8",error:function(XMLHttpRequest,textStatus,errorThrown){},success:function(data){ajaxFinish(data)}});function ajaxFinish(data){var obj=data.d;$("#box_count").text(obj)}};
