function close_popup() { $('#popup_head').hide().removeClass().addClass('popup'); // Pridavam class o jake okno jde, napr. popup-uvodni-upoutavka, pri zavreni okna je potreba tuto tridu odstranit. $('#popup_front').hide().removeClass().addClass('popup'); $('#popup_bg').hide().removeClass('open'); $('#popup_content').html(''); $('#popup_head_text').html(''); $('body').css('overflow', 'auto').removeClass('popup_open'); // Po zavreni popupu povolim scroll stranky (viz. duvod nie). $(document).trigger('close_popup'); } function show_popup(popup_class) { $('#popup_head').show().removeClass().addClass('popup').addClass(popup_class); $('#popup_front').show().removeClass().addClass('popup').addClass(popup_class); $('#popup_bg').show().addClass('open'); $('body').css('overflow', 'hidden').addClass('popup_open'); // Zakzu scroll stranky, na telefonech delal problem, kdyz bylo i popup skrolovaci. $(document).trigger('show_popup', [popup_class]); } var mouse_is_inside = false; $(document).ready(function() { /* Zavreni popup kliknutim mimo */ $(document).on('mouseenter', '.close_popup_click_outside', function() { mouse_is_inside = true; }).on('mouseleave', '.close_popup_click_outside', function() { mouse_is_inside = false; }); $("body").mouseup(function(){ if(!mouse_is_inside) { $(document).trigger('close_popup_click_outside'); $('.close_popup_click_outside').hide(); } }); }); if (window.jQuery){ jQuery( document ).ready(function() { jQuery(document.body).append('
'); // otevreni popupu + editace $(document).on("click", ".eu-cookies-nastaveni", function(event) { event.stopPropagation(); event.preventDefault(); $("#loader").show(); $.ajax({ method: "POST", url: "/ajax_se_cookies.php?popup=1", dataType: "html", success: function (data) { show_popup('eu-cookies-popup'); $("#popup_front.eu-cookies-popup #popup_content").html(data); $("#loader").hide(); } }); }); // odsouhlaseni vseho $(document).on("click", "#eu-cookies-souhlas-vse", function(event) { event.stopPropagation(); event.preventDefault(); $("#loader").show(); $.ajax({ method: "GET", data: $('#eu-cookies-form').serialize(), url: "/ajax_se_cookies.php?vse=1", dataType: "html", success: function () { close_popup('eu-cookies-popup'); $(".eu-cookies").hide(); $("#loader").hide(); } }); }); // odsouhlaseni vseho $(document).on("click", ".eu-cookies-ok", function(event) { event.stopPropagation(); event.preventDefault(); $("#loader").show(); $.ajax({ method: "GET", url: "/ajax_se_cookies.php?vse=1", dataType: "html", success: function () { close_popup('eu-cookies-popup'); $(".eu-cookies").hide(); $("#loader").hide(); } }); }); // odsouhlaseni vybranych - popup $(document).on("click", "#eu-cookies-souhlas-vybrane", function(event) { event.stopPropagation(); event.preventDefault(); $("#loader").show(); $.ajax({ method: "GET", data: $('#eu-cookies-form').serialize(), url: "/ajax_se_cookies.php?vybrane=1", dataType: "html", success: function () { close_popup('eu-cookies-popup'); $(".eu-cookies").hide(); $("#loader").hide(); } }); }); // odmitnuti $(document).on("click", ".eu-cookies-link", function(event) { event.stopPropagation(); event.preventDefault(); $("#loader").show(); $.ajax({ method: "GET", url: "/ajax_se_cookies.php?vybrane=1", dataType: "html", success: function () { $(".eu-cookies").hide(); $("#loader").hide(); } }); }); }); } function checkForm(form) { for (var i = 0; i < form.elements.length; ++i) if (!form.elements[i].value && (form.elements[i].type=='password' || form.elements[i].type=='text')) { alert("Je nutné vyplniť všetky údaje!"); form.elements[i].focus(); return false; } } function checkVyhledavaniForm() { if(trim12(document.getElementById('vyhledavani_text').value)=='') { alert ("Nezadali ste žiadny výraz pre vyhľadávanie."); document.getElementById('vyhledavani_text').focus(); return false; } } function checkEmail(id_pole) { re = /^[a-zA-Z0-9_]{1}[a-zA-Z0-9\-_]*(\.[a-zA-Z0-9\-_]+)*@[a-zA-Z0-9]{1}[a-zA-Z0-9\-_]*(\.[a-zA-Z0-9\-_]+)*\.[a-zA-Z]{2,4}$/; if (document.getElementById(id_pole).value.search(re)!=0) { alert ("Zadaná e-mailová adresa nemá správny formát!"); document.getElementById(id_pole).focus(); return false; } } function show_menu(id, id_li) { if(document.getElementById(id).style.display == "block") { var trida=document.getElementById(id_li).className; document.getElementById(id).style.display="none"; trida=trida.replace(/ li_open/, ""); trida=trida.replace(/ li_open/, ""); trida=trida.replace(/ li_aktivni_open/, ""); trida=trida.replace(/ li_aktivni/, ""); document.getElementById(id_li).className=trida; } else { document.getElementById(id).style.display="block"; document.getElementById(id_li).className+=" li_open"; } } function trim12 (str) { var str = str.replace(/^\s\s*/, ''), ws = /\s/, i = str.length; while (ws.test(str.charAt(--i))); return str.slice(0, i + 1); } function switch_img_det(image) { document.getElementById('det-img').src = 'pic_zbozi_det/_thb_' + image; document.getElementById('det-img-a').href = 'pic_zbozi/' + image; } function limitText(limitField, limitCount, limitNum) { if (limitField.value.length > limitNum) { limitField.value = limitField.value.substring(0, limitNum); } else { limitCount.innerHTML = limitNum - limitField.value.length; } } /** * Delay for a number of milliseconds */ function sleep(delay) { var start = new Date().getTime(); while (new Date().getTime() < start + delay); } function skupina_popisek() { var vyska=document.getElementById('skupina-popisek').offsetHeight; if(vyska>180) { var cely_text='... zobraziť celý text'; document.getElementById('skupina-popisek').style.height='180px'; document.getElementById('skupina-popisek').style.overflow='hidden'; document.getElementById('skupina-popisek').className='skupina-popisek-short'; document.getElementById('skupina-popisek').innerHTML=document.getElementById('skupina-popisek').innerHTML+''; document.getElementById('skupina-popisek-more').innerHTML=''+cely_text+''; } } function show_full_popisek(vyska) { var skryt_text='... skrýť text'; document.getElementById('skupina-popisek').style.height=vyska+'px'; document.getElementById('skupina-popisek').className=''; document.getElementById('skupina-popisek-more').innerHTML=''+skryt_text+''; } function show_short_popisek(vyska, vyska2) { var cely_text='... zobraziť celý text'; document.getElementById('skupina-popisek').style.height=vyska+'px'; document.getElementById('skupina-popisek').style.overflow='hidden'; document.getElementById('skupina-popisek').className='skupina-popisek-short'; document.getElementById('skupina-popisek').innerHTML=document.getElementById('skupina-popisek').innerHTML+''; document.getElementById('skupina-popisek-more').innerHTML=''+cely_text+''; } function check_filtr(id) { if(document.getElementById('filvyh'+id).checked==true) { document.getElementById('act_fil').value='filtr-on'; document.getElementById('fil_id').value=id; } else { document.getElementById('act_fil').value='filtr-off'; document.getElementById('fil_id').value=id; } } function obj_pridej_kupon() { document.getElementById("id_odeslani_obj").value='kosik-pridej-kupon'; document.getElementById("form").submit(); return false; } function obj_odeber_kupon() { document.getElementById("id_odeslani_obj").value='kosik-odeber-kupon'; document.getElementById("form").submit(); return false; } function getE(objectID) { return document.getElementById(objectID); } var activeBookmarkSheet = new Array(); function setActiveBookmark( nBookmarks, nSheet ) { getE( 'bookmarks-'+nBookmarks+'-fold-'+activeBookmarkSheet[nBookmarks] ).className = ""; getE( 'bookmarks-'+nBookmarks+'-content-'+activeBookmarkSheet[nBookmarks] ).style.display = "none"; activeBookmarkSheet[nBookmarks]=nSheet; getE( 'bookmarks-'+nBookmarks+'-fold-'+activeBookmarkSheet[nBookmarks] ).className = "dp-active"; getE( 'bookmarks-'+nBookmarks+'-content-'+activeBookmarkSheet[nBookmarks] ).style.display = ""; return false; } $(document).ready(function() { $('.hide_show_VOC').on('click', function () { hide_show_nakupni_cena($('.VOC'), $(this), 1); }); hide_show_nakupni_cena($('.VOC'), $('.hide_show_VOC'), 0); }); /** * @param element * @param click_element * @param set 0 = ctu hodnotu, 1 = nastavuju hodnotu */ hide_show_nakupni_cena = function(element, click_element, set) { if(!set) set = 0; $.ajax({ url: '/ajax_hide_show_nakupni_cena.php?set='+set, type: 'get', success: function(result) { if(result == 1) { // hide element.hide(); click_element.removeClass('show').addClass('hide'); } else { // show element.show(); click_element.removeClass('hide').addClass('show'); } } }); }; $(document).on('click', '.basket_form_up',function() { var currentVal = parseInt($(this).parents(".js_up_down").find('input.input_ks').val()); if (!isNaN(currentVal)) { $(this).parents(".js_up_down").find('input.input_ks').val(currentVal + 1); } else { $(this).parents(".js_up_down").find('input.input_ks').val(1); } }); $(document).on('click', '.basket_form_down',function() { var currentVal = parseInt($(this).parents(".js_up_down").find('input.input_ks').val()); if (!isNaN(currentVal) && currentVal > 1) { $(this).parents(".js_up_down").find('input.input_ks').val(currentVal - 1); } else { $(this).parents(".js_up_down").find('input.input_ks').val(1); } });