Advertisement
Guest User

slovensko.sk javascript

a guest
Feb 17th, 2016
5,548
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. EJS.ext = '.txt';
  2. var deviceWidth = (window.innerWidth > 0) ? window.innerWidth : screen.width;
  3.  
  4. $(window).resize(function () {
  5.     deviceWidth = (window.innerWidth > 0) ? window.innerWidth : screen.width;
  6.     if (deviceWidth < 480) {
  7.         mobilePortraitMode();
  8.     } else {
  9.         mobileLandscapeMode();
  10.     }
  11. });
  12.  
  13. /* DOM ready */
  14. $(document).ready(function () {
  15.     $("#search .search").click(function () {
  16.         if ($(this).val() == "Chcem nájsť" || $(this).val() == "I want to find") $(this).val("");
  17.     });
  18.     $("#search input.search").keyup(function () {
  19.         ajxLoad();
  20.     });
  21.     calendarFunctions();
  22.  
  23.     if ($(".lbtDeleteProfile").length > 0) {
  24.         var dopostback = $(".lbtDeleteProfile").attr("href").replace("javascript:", "");
  25.         var message = 'Skutočne chcete zneplatniť svôj profil?';
  26.         $(".lbtDeleteProfile").attr("href", "#");
  27.         $(".lbtDeleteProfile").click(function () {
  28.             var r = confirm(message);
  29.             if (r == true) {
  30.                 eval(dopostback);
  31.             } else {
  32.                 return false;
  33.             }
  34.         });
  35.     }
  36.  
  37. });
  38.  
  39.  
  40. $("body").append("<a href=\"#\" id=\"linkTop\" class=\"backtotop\"><span></span></a>");
  41. $(".backtotop").addClass("hidden");
  42. $(window).scroll(function () {
  43.     if ($(this).scrollTop() === 0) {
  44.         $(".backtotop").addClass("hidden")
  45.     } else {
  46.         $(".backtotop").removeClass("hidden")
  47.     }
  48. });
  49. $('#linkTop').click(function () {
  50.     $('body,html').animate({
  51.         scrollTop: 0
  52.     }, 200);
  53.     return false;
  54. });
  55.  
  56.  
  57. $(".contentTabs.autoTab").each(function () {
  58.     var thisObj = $(this),
  59.         mainTabsHeading = thisObj.find("h2.tabHeading"),
  60.         mainTabs = thisObj.find(".mainTab"),
  61.         subTabs = thisObj.find(".subTab");
  62.  
  63.     if (subTabs.size() != 0) subTabs.hide().eq(0).show();
  64.  
  65.     heading = new EJS({ url: '/Scripts/Templates/main_tabs_heading.txt' }).render(mainTabsHeading);
  66.     mainTabsHeading.remove();
  67.     thisObj.prepend(heading);
  68.  
  69.     mainTabs.each(function (index) {
  70.         var thisMainTab = $(this);
  71.         var subTabsHeading = thisMainTab.find("h3.tabHeading");
  72.         if (index == 0) {
  73.             thisMainTab.show();
  74.         } else {
  75.             thisMainTab.hide();
  76.         }
  77.  
  78.         subHeading = new EJS({ url: '/Scripts/Templates/sub_tabs_heading.txt' }).render(subTabsHeading);
  79.         //subTabsHeading.remove();
  80.         thisMainTab.prepend(subHeading);
  81.     });
  82.     attachTabsEvent(thisObj);
  83.     setTabs(thisObj);
  84.     myAnchorSel();
  85. });
  86.  
  87. //vybratie otvoreneho TABu podla anchoru v linke
  88. function myAnchorSel() {
  89.     myAnchor = window.location.hash.split('#T')[1];
  90.     if (myAnchor != undefined) {
  91.         $(".contentTabs.autoTab ul.mainTabsNavi li").removeClass("selected")
  92.         $(".contentTabs.autoTab ul.mainTabsNavi li").each(function (index) {
  93.             if (index == myAnchor) {
  94.                 $(this).addClass("selected");
  95.                 $(".contentTabs .mainTab").hide();
  96.                 $(".contentTabs .mainTab").eq($(this).index()).show();
  97.             }
  98.         })
  99.     }
  100. }
  101.  
  102. // ocislovanie liniek podla poradia TAB - priradenie anchoru
  103. $(".contentTabs.autoTab.anchorList ul.mainTabsNavi li").each(function (index) {
  104.     $(this).find("a").attr("href", $(this).find("a").attr("href") + "#T" + index)
  105. })
  106.  
  107.  
  108. function attachTabsEvent(wrapperObj) {
  109.     wrapperObj.find(".mainTabsNavi li").click(function () { var thisObj = $(this); setTabs(wrapperObj, thisObj, false) });
  110.     wrapperObj.find(".subTabsNavi li").click(function () { var thisObj = $(this); setTabs(wrapperObj, thisObj, true) });
  111.     wrapperObj.find(".tabHeading").click(function () { var thisObj = $(this); setTabs(wrapperObj, thisObj, true) });
  112. }
  113.  
  114. function setTabs(wrapperObj, sourceEvt, isSubTab) {
  115.     var firstLoad = false;
  116.     if (sourceEvt == undefined) { firstLoad = true }
  117.     var mainTabsContent = wrapperObj.find(".mainTab");
  118.     var mainTabs = wrapperObj.find(".mainTabsNavi li");
  119.     var mainTabsContent = wrapperObj.find(".mainTab");
  120.  
  121.     if (!firstLoad) {
  122.         if (!isSubTab) {
  123.             mainTabs.removeClass("selected");
  124.             mainTabs.eq(sourceEvt.index()).addClass("selected");
  125.         }
  126.     }
  127.  
  128.     if (isSubTab != undefined && isSubTab) {
  129.         var subTabs = wrapperObj.find(".mainTab:visible .subTabsNavi li");
  130.         var tabHeading = wrapperObj.find(".mainTab:visible .tabHeading");
  131.         subTabs.removeClass("selected");
  132.         tabHeading.removeClass("selected");
  133.         if (sourceEvt.hasClass("tabHeading")) {
  134.             var index = 0;
  135.             if (sourceEvt.index() == 1) {
  136.                 index = 0;
  137.             } else if (sourceEvt.index() == 3) {
  138.                 index = 1;
  139.             } else if (sourceEvt.index() == 5) {
  140.                 index = 2;
  141.             }
  142.             subTabs.eq(index).addClass("selected");
  143.             tabHeading.eq(index).addClass("selected");
  144.         } else {
  145.             subTabs.eq(sourceEvt.index()).addClass("selected");
  146.             tabHeading.eq(sourceEvt.index()).addClass("selected");
  147.         }
  148.     }
  149.  
  150.     var mainTabSelectedIndex = wrapperObj.find(".mainTabsNavi li.selected").index();
  151.     mainTabsContent.hide();
  152.     mainTabsContent.eq(mainTabSelectedIndex).show();
  153.  
  154.     var subTabSelectedIndex = wrapperObj.find(".mainTab:visible .subTabsNavi li.selected").index();
  155.     var subTabsContent = wrapperObj.find(".mainTab:visible .subTab");
  156.  
  157.     subTabsContent.hide();
  158.     subTabsContent.eq(subTabSelectedIndex).show();
  159.     if (deviceWidth < 480) {
  160.         mobilePortraitMode();
  161.     } else {
  162.         mobileLandscapeMode();
  163.     }
  164. }
  165.  
  166.  
  167. function mobilePortraitMode() {
  168.     var subTabsNavi = $(".subTabsNavi");
  169.     var tabHeading = $(".tabHeading");
  170.     if (subTabsNavi.size() != 0) {
  171.         subTabsNavi.hide();
  172.         tabHeading.show();
  173.     }
  174. }
  175.  
  176. function mobileLandscapeMode() {
  177.     var subTabsNavi = $(".subTabsNavi");
  178.     var tabHeading = $(".tabHeading");
  179.     if (subTabsNavi.size() != 0) {
  180.         subTabsNavi.show();
  181.         tabHeading.hide();
  182.     }
  183. }
  184.  
  185. /* search */
  186. function hidePharmPanel(ev) {
  187.     if (ev.target != $(".findPharmPanel").get(0) && $(ev.target).parents(".findPharmPanel").size() == 0) {
  188.         $("#search_out").html("");
  189.     }
  190. }
  191. function ajxLoad() {
  192.     $.ajax({
  193.         url: "/Modules/InformationContent/Web/Search_suggest.aspx" + "?s=" + $("#search input.search").val(),
  194.         dataType: "html",
  195.         //data: data,
  196.         success: function (data) {
  197.             $("#search_out").html(data)
  198.  
  199.             $("#search_out ul li").click(function (ev) {
  200.                 ev.stopPropagation();
  201.                 $("body").unbind("click", hidePharmPanel);
  202.  
  203.                 $("#search input.search").val($(this).html())
  204.                 $("#search_out").html("");
  205.             });
  206.  
  207.             $("body").one("click", hidePharmPanel);
  208.         }
  209.     });
  210. }
  211.  
  212. /* kalendare */
  213. function calendarFunctions() {
  214.     $(".datepicker").datepicker({
  215.         date: $('.datepicker').val(),
  216.         current: $('.datepicker').val()
  217.     });
  218.  
  219.     $(".datepicker.from").datepicker({
  220.         date: $('.datepicker.from').val(),
  221.         current: $('.datepicker.from').val()
  222.     });
  223.  
  224.     $(".datepicker.to").datepicker({
  225.         date: $('.datepicker.to').val(),
  226.         current: $('.datepicker.to').val()
  227.     });
  228.  
  229.     $.datepicker.regional['sk'] = {
  230.         closeText: 'Zavrieť',
  231.         prevText: '&#x3c;Predchádzajúci',
  232.         nextText: 'Nasledujúci&#x3e;',
  233.         currentText: 'Dnes',
  234.         monthNames: ['Január', 'Február', 'Marec', 'Apríl', 'Máj', 'Jún',
  235.                 'Júl', 'August', 'September', 'Október', 'November', 'December'],
  236.         monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'Máj', 'Jún',
  237.                 'Júl', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'],
  238.         dayNames: ['Nedeľa', 'Pondelok', 'Utorok', 'Streda', 'Štvrtok', 'Piatok', 'Sobota'],
  239.         dayNamesShort: ['Ned', 'Pon', 'Uto', 'Str', 'Štv', 'Pia', 'Sob'],
  240.         dayNamesMin: ['Ne', 'Po', 'Ut', 'St', 'Št', 'Pia', 'So'],
  241.         weekHeader: 'Ty',
  242.         dateFormat: 'd.m.yy',
  243.         firstDay: 1,
  244.         isRTL: false,
  245.         showMonthAfterYear: false,
  246.         yearSuffix: ''
  247.     };
  248.  
  249.     $.datepicker.regional['en'] = {
  250.         dateFormat: 'm.d.yy',
  251.         firstDay: 7,
  252.         isRTL: false,
  253.         showMonthAfterYear: false,
  254.         yearSuffix: ''
  255.     };
  256.  
  257.     $.datepicker.setDefaults($.datepicker.regional[$("html").attr("lang")]);
  258.  
  259. }
  260.  
  261. function createLocalitySelector() {
  262.     var localityWrapper = $("#localitySelector");
  263.     var selectedLocality = $(".selectedLocality");
  264.     $("#localitySelector input").hide();
  265.     var selector = "<div id='selector'><input type='text' value='" + selectedLocality.text() + "' data-defaultval='" + selectedLocality.text() + "' /></div>"
  266.     localityWrapper.append(selector);
  267.     $("#selector input").focus(function () {
  268.         if ($(this).val() == $(this).data("defaultval")) {
  269.             $(this).val("");
  270.         }
  271.     });
  272.     $("#selector input").blur(function () {
  273.         if ($(this).val() == "" || $(this).val() == $(this).data("defaultval")) {
  274.             $(this).val($(this).data("defaultval"));
  275.         }
  276.         window.setTimeout(function () {
  277.             $("#selector input").removeClass("openSelector");
  278.             $("#selector ul").remove();
  279.         }, 200);
  280.     });
  281.     $("#selector input").keyup(function (event) {
  282.         var thisElm = $(this);
  283.         $.ajax({
  284.             url: "/AutoCompleteLocality.axd",
  285.             dataType: "json",
  286.             type: "POST",
  287.             data: { LookupPrefix: thisElm.val(), TotalResults: 20, LangId: langGuid },
  288.             success: function (data) {
  289.                 $("#selector input").removeClass("openSelector");
  290.                 $("#selector ul").remove();
  291.                 resultsList = new EJS({ url: '/Scripts/Templates/locality_selector_items.txt' }).render(data);
  292.                 $("#selector").append(resultsList);
  293.                 if (data.length > 0) {
  294.                     $("#selector input").addClass("openSelector");
  295.                     $("#selector li a").click(function () {
  296.                         var thisLink = $(this);
  297.                         $.ajax({
  298.                             url: "/SetUserLocality.axd",
  299.                             dataType: "json",
  300.                             type: "POST",
  301.                             data: { UserLocality: thisLink.find("span").text() },
  302.                             success: function (dataSave) {
  303.                                 if (dataSave) {
  304.                                     $("#selector input").val(thisLink.find("span").text());
  305.                                     $("#selector input").data("defaultval", thisLink.find("span").text())
  306.                                     $("#selector ul").remove();
  307.                                     $("#selector input").removeClass("openSelector");
  308.                                 } else {
  309.                                     $("#selector input").val($("#selector input").data("defaultval"));
  310.                                     $("#selector ul").remove();
  311.                                     $("#selector input").removeClass("openSelector");
  312.                                 }
  313.                             }
  314.                         });
  315.                         return false;
  316.                     });
  317.                 }
  318.             }
  319.         });
  320.     });
  321. }
  322. createLocalitySelector();
  323.  
  324. if ($(".base-list").size() != 0) {
  325.     var listElm = $(".base-list dd");
  326.     listElm.hide();
  327.     listElm.each(function () {
  328.         var thisElm = $(this);
  329.         thisElm.prev().find(".countRows").text($("li", thisElm).size());
  330.     });
  331.  
  332.  
  333.     $(".base-list .btn-opn").css({ "display": "block" });
  334.  
  335.     $(".base-list .txt-open").click(function () {
  336.         var thisElm = $(this);
  337.         thisElm.parent().parent().next().slideDown('fast', function () {
  338.             thisElm.parent().removeClass("btn-opn").addClass("btn-close");
  339.         });
  340.     });
  341.     $(".base-list .txt-close").click(function () {
  342.         var thisElm = $(this);
  343.         thisElm.parent().parent().next().slideUp('fast', function () {
  344.             thisElm.parent().removeClass("btn-close").addClass("btn-opn");
  345.         });
  346.     });
  347. }
  348.  
  349.  
  350. $("span.elementInfo").hover(function () {
  351.     var el = $(this);
  352.     if ($("#tooltipWrp").size() == 0) {
  353.         var $tooltipWrp = $("<div id='tooltipWrp'><span class='arrow'></span></div>").appendTo("body");
  354.     }
  355.  
  356.     // Validation messages
  357.     var $messages = el.text();
  358.     var imgOffset = el.offset();
  359.     var imgWidth = el.width();
  360.     var imgHeight = el.height();
  361.  
  362.     if ($tooltipWrp != undefined) {
  363.         $tooltipWrp
  364.         .append($messages)
  365.         .css({
  366.             top: imgOffset.top,
  367.             left: imgOffset.left + imgWidth
  368.         })
  369.         .show();
  370.     }
  371. }, function () {
  372.     $("#tooltipWrp").remove();
  373. });
  374.  
  375.  
  376.  
  377.  
  378.  
  379. $(document).ready(function () {
  380.  
  381.     $(this).find('.institutionMap').each(function (k, v) {
  382.         var thisElm = $(this);
  383.         setTimeout(function () {   //casove oneskorenie z dovodu max. 10 dotazov na GOOGLE MAPS! za 1 sekundu
  384.             var parentElm;
  385.  
  386.             if (thisElm.hasClass("secondMap")) {
  387.                 console.log("druha");
  388.                 parentElm = $(thisElm).parent().parent();
  389.             }
  390.             else {
  391.                 console.log("prva");
  392.                 parentElm = thisElm.parent();
  393.             }
  394.  
  395.             var latInst = parentElm.find("span.lat").html();
  396.             var lonInst = parentElm.find("span.lon").html();
  397.             var street = parentElm.find(".street").text();
  398.             var city = parentElm.find(".city").text();
  399.             var cityHead = parentElm.find(".cityHead").text();  // pri detaile obce
  400.             var state = ", Slovensko";
  401.  
  402.             //default krajina SK, pre medzinarodne institucie bez krajiny
  403.             if (window.location.href.slice(-36) == "8ebd2e18-14e0-4afb-8b09-130e63016ca3" || window.location.href.slice(-36) == "59e632c8-b70a-43fc-ba96-c8c15c0c0036") {
  404.                 state = "";
  405.             }
  406.  
  407.             var institution = parentElm.find("h3").text();
  408.             var lokalitaUrad = { 'address': street + ', ' + city + state }; //upravne aj pre obce - vsetky SK
  409.             var markerss = [];
  410.  
  411.             if (latInst == null || latInst == "") {
  412.                 if (cityHead != "") //ak nie su suradnice, len nazov obce
  413.                 {
  414.                     var map = new google.maps.Map(thisElm.get(0), {
  415.                         mapTypeId: google.maps.MapTypeId.ROADMAP,
  416.                         streetViewControl: false,
  417.                         zoom: 11
  418.                     });
  419.                     var geocoder = new google.maps.Geocoder();
  420.  
  421.                     geocoder.geocode({
  422.                         'address': cityHead + state
  423.                     }, function (results, status) {
  424.                         if (status == google.maps.GeocoderStatus.OK) {
  425.                             new google.maps.Marker({
  426.                                 position: results[0].geometry.location,
  427.                                 map: map
  428.                             });
  429.                             map.setCenter(results[0].geometry.location);
  430.                         }
  431.                     });
  432.                 }
  433.                 else if (city != "") //ak nie su suradnice, ale je adresa
  434.                 {
  435.                     var map = new google.maps.Map(thisElm.get(0), {
  436.                         mapTypeId: google.maps.MapTypeId.ROADMAP,
  437.                         streetViewControl: false,
  438.                         zoom: 15
  439.                     });
  440.                     var geocoder = new google.maps.Geocoder();
  441.  
  442.                     geocoder.geocode({
  443.                         'address': street + ", " + city + state
  444.                     }, function (results, status) {
  445.                         if (status == google.maps.GeocoderStatus.OK) {
  446.                             new google.maps.Marker({
  447.                                 position: results[0].geometry.location,
  448.                                 map: map
  449.                             });
  450.                             map.setCenter(results[0].geometry.location);
  451.                         }
  452.                     });
  453.                 }
  454.                 else {
  455.                     var map = new google.maps.Map(thisElm.get(0), {
  456.                         mapTypeId: google.maps.MapTypeId.ROADMAP,
  457.                         streetViewControl: false,
  458.                         zoom: 6,
  459.                         center: new google.maps.LatLng(48.652871, 19.233856)
  460.                     });
  461.                     geoCode(map, lokalitaUrad);
  462.                 }
  463.             }
  464.             else {
  465.                 var mapcenter = new google.maps.LatLng(parseFloat(latInst.replace(",", ".")), parseFloat(lonInst.replace(",", ".")));
  466.                 var map = new google.maps.Map(thisElm.get(0), {
  467.                     mapTypeId: google.maps.MapTypeId.ROADMAP,
  468.                     streetViewControl: false,
  469.                     zoom: 16,
  470.                     center: mapcenter
  471.                 });
  472.                 var marker = new google.maps.Marker({
  473.                     position: mapcenter,
  474.                     map: map,
  475.                     title: institution
  476.                 });
  477.             }
  478.  
  479.  
  480.         }, k * 140);
  481.     });
  482.  
  483.  
  484.     /*
  485.         $(".institutionMap").each(function (index) {
  486.                     var thisElm = $(this);
  487.                     var parentElm = thisElm.parent();
  488.    
  489.                     var latInst = parentElm.find("span.lat").html();
  490.                     var lonInst = parentElm.find("span.lon").html();
  491.                     var street = parentElm.find(".street").text();
  492.                     var city = parentElm.find(".city").text();
  493.                     var cityHead = parentElm.find(".cityHead").text();  // pri detaile obce
  494.                     var state = ", Slovensko";
  495.    
  496.    
  497.                     //default krajina SK, pre medzinarodne institucie bez krajiny
  498.                     if (window.location.href.slice(-36) == "8ebd2e18-14e0-4afb-8b09-130e63016ca3" || window.location.href.slice(-36) == "59e632c8-b70a-43fc-ba96-c8c15c0c0036") {
  499.                         state = "";
  500.                     }
  501.            
  502.            
  503.                     var institution = parentElm.find("h3").text();
  504.                     var lokalitaUrad = { 'address': street + ', ' + city + state }; //upravne aj pre obce - vsetky SK
  505.                     var markerss = [];
  506.    
  507.    
  508.                     if (latInst == null || latInst == "") {
  509.                         if (cityHead != "") //ak nie su suradnice, len nazov obce
  510.                         {
  511.                             var map = new google.maps.Map(thisElm.get(0), {
  512.                             mapTypeId: google.maps.MapTypeId.ROADMAP,
  513.                             streetViewControl: false,
  514.                             zoom: 11
  515.                             });
  516.                             var geocoder = new google.maps.Geocoder();
  517.    
  518.                             geocoder.geocode({
  519.                                 'address': cityHead + state,
  520.                             }, function (results, status) {
  521.                                if(status == google.maps.GeocoderStatus.OK) {
  522.                                    new google.maps.Marker({
  523.                                        position: results[0].geometry.location,
  524.                                        map: map
  525.                                    });
  526.                                    map.setCenter(results[0].geometry.location);
  527.                                }
  528.                            });
  529.                         }
  530.                         else if (city != "") //ak nie su suradnice, ale je adresa
  531.                         {
  532.                             var map = new google.maps.Map(thisElm.get(0), {
  533.                                 mapTypeId: google.maps.MapTypeId.ROADMAP,
  534.                                 streetViewControl: false,
  535.                                 zoom: 15
  536.                             });
  537.                             var geocoder = new google.maps.Geocoder();
  538.    
  539.                             geocoder.geocode({
  540.                                 'address': street + ", " + city + state,
  541.                             }, function (results, status) {
  542.                                 if (status == google.maps.GeocoderStatus.OK) {
  543.                                     new google.maps.Marker({
  544.                                         position: results[0].geometry.location,
  545.                                         map: map
  546.                                     });
  547.                                     map.setCenter(results[0].geometry.location);
  548.                                 }
  549.                             });
  550.                         }
  551.                         else{
  552.                                 var map = new google.maps.Map(thisElm.get(0), {
  553.                                 mapTypeId: google.maps.MapTypeId.ROADMAP,
  554.                                 streetViewControl: false,
  555.                                 zoom: 6,
  556.                                 center: new google.maps.LatLng(48.652871, 19.233856)
  557.                                 });
  558.                                 geoCode(map, lokalitaUrad);
  559.                         }
  560.                     }
  561.                     else {
  562.                         var map = new google.maps.Map(thisElm.get(0), {
  563.                             mapTypeId: google.maps.MapTypeId.ROADMAP,
  564.                             streetViewControl: false,
  565.                             zoom: 11,
  566.                             center: new google.maps.LatLng(latInst.replace(",", "."), lonInst.replace(",", "."))
  567.                         });
  568.                         var marker = new google.maps.Marker({
  569.                             position: new google.maps.LatLng(latInst.replace(",", "."), lonInst.replace(",", ".")),
  570.                             map: map,
  571.                             title: institution
  572.                         });
  573.                     }
  574.    
  575.         });*/
  576.  
  577.     function geoCode(map, mapData) {
  578.         var geocoder = new google.maps.Geocoder();
  579.         geocoder.geocode(mapData, function (results, status) {
  580.             if (status == google.maps.GeocoderStatus.OK) {
  581.                 var positionMarkerLat = results[0].geometry.location.lat();
  582.                 var positionMarkerLng = results[0].geometry.location.lng();
  583.                 var marker = new google.maps.Marker({
  584.                     position: new google.maps.LatLng(positionMarkerLat, positionMarkerLng),
  585.                     map: map
  586.                 });
  587.  
  588.                 if (typeof (map) != "undefined") {
  589.                     map.setCenter(new google.maps.LatLng(positionMarkerLat, positionMarkerLng));
  590.                 } else {
  591.                     alert("Sa mi neda vycentrovat!");
  592.                 }
  593.  
  594.  
  595.  
  596.             }
  597.         });
  598.     }
  599.  
  600. });
  601.  
  602. $(document).ready(function () {
  603.  
  604.     $(window).resize(function () {
  605.         var mainTabHeight = $(".mainTab .pertinentDocList .listDocument").height();
  606.         if (deviceWidth > 480) {
  607.             $(".pertinentDocList").height(mainTabHeight);
  608.         }
  609.     });
  610.  
  611.     if ($(".documentLinkList").size() != 0) {
  612.         var mainTabHeight = $(".documentLinkList").outerHeight();
  613.         var pertinentDocList = $(".pertinentDocList").text().trim().length;
  614.         var listHeight = $(".mainTab .pertinentDocList .listDocument").height();
  615.         if (deviceWidth > 480) {
  616.             if (pertinentDocList > 0) {
  617.                 $(".pertinentDocList").height(listHeight);
  618.             }
  619.             else {
  620.                 $(".pertinentDocList").height(mainTabHeight);
  621.             }
  622.         }
  623.     }
  624.  
  625.     $('.blog .list.action tr').click(function () {
  626.         $(".blog .list.action tr.actionList").addClass("hiddenElm");
  627.         $(this).next(".actionList").removeClass("hiddenElm");
  628.     });
  629.  
  630.     categoryList();
  631.     removeTextFromDocumentList();
  632.  
  633. });
  634.  
  635. function categoryList() {
  636.     $(".articleCategoryList li").mouseenter(function () {
  637.         $(this).parent().css("overflow", "visible");
  638.         $(".articleCategoryList li:first-child").addClass("noArr");
  639.     })
  640.     .mouseleave(function () {
  641.         $(this).parent().css("overflow", "hidden");
  642.         $(".articleCategoryList li:first-child").removeClass("noArr");
  643.     });
  644.  
  645. }
  646.  
  647. function removeTextFromDocumentList() {
  648.     $(".document .listDocument dd span").each(function () {
  649.         if (!$(this).text().trim().length) {
  650.             $(this).parent().css("display", "none");
  651.         }
  652.     });
  653. }
  654.  
  655.  
  656. $(document).ready(function () {
  657.     $('#institution .itemDetail .openHour').click(function () {
  658.         $('#g' + $(this).attr("id") + " .openHours").removeClass("novsb")
  659.         $('#g' + $(this).attr("id") + " .openHour").hide()
  660.     })
  661.  
  662.     $('#institution .itemDetail .openHours').addClass("novsb")
  663.     $('#institution .itemDetail .openHour').removeClass("novsb")
  664.  
  665.     $('#petition .list.action tr').click(function () {
  666.         $("#petition .list.action tr.actionList").addClass("hiddenElm")
  667.         $(this).next(".actionList").removeClass("hiddenElm")
  668.     })
  669. })
  670.  
  671.  
  672.  
  673. $(function () {
  674.     $(".contentNotice dl:nth-child(4)").css("padding", "0px");
  675.     $(".contentNotice dl:nth-child(7)").css("padding", "0px");
  676.  
  677.     $('.institutionDetailWrapp').css("visibility", "hidden");
  678.     setTimeout(function () {
  679.         $('.institutionDetailWrapp').hide();
  680.         $('.institutionDetailWrapp').css("visibility", "visible");
  681.     }, 500);
  682.  
  683.     $('.institutionDetailBtn').click(function () {
  684.  
  685.  
  686.         var rodic = $(this).parents().eq(1),
  687.             detail = $('.institutionDetailWrapp'),// najdeme rodica, co je element u uroven vyssie, ktory obsahuje element, na ktory sme klikli
  688.             vyrok = $(this).parents().eq(1).find(detail);   // vyrok je element nasledujuci po tom, na ktory sme pravy klikli
  689.  
  690.         // v ramci rodica najdeme [ .find() ] vsetky elementy s vyrokmi a skryjeme ich
  691.         rodic.find(detail).slideUp();
  692.  
  693.         // vysunieme vyrok, ale len v pripade, ze este nie vysunuty, cize nie je viditelny [ .not(':visible') ]
  694.  
  695.         vyrok.not(':visible').slideDown();
  696.  
  697.         if (vyrok.is(':visible')) {
  698.  
  699.             google.maps.event.trigger(window, 'resize', {});
  700.  
  701.         }
  702.  
  703.         return false;
  704.  
  705.     });
  706.  
  707.  
  708.     /*tabs-uprava*/
  709.  
  710.     if ($('.mainTabsNaviLink li a').hasClass('sel')) {
  711.         $('.mainTabsNaviLink li').find('.sel').parent().addClass('selected');
  712.     };
  713.  
  714.  
  715.     /*Notice na tit. stranke, odstranenie paddingu na poslednom*/
  716.     $(".contentPnl .noticeBox:nth-child(4)").css("padding-right", "0px");
  717.     $('.contentPnl .noticeBox').last().css('padding-right', '0');
  718. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement