function getCookie(name) { var bites = document.cookie.split("; "); for (var i=0; i < bites.length; i++) { nextbite = bites[i].split("="); if (nextbite[0] == name) return unescape(nextbite[1]); } return null; } function hideit(i) { if (i==1) { document.cookie="hidediscount=1"; $(".tohide").hide(); $(".zbozi-dopcena").addClass("zbozi-cena"); $(".zbozi-dopcena").removeClass("zbozi-cenadoporucena"); } else { if (getCookie("hidediscount")=="1") { document.cookie="hidediscount=0"; $(".tohide").show(); $(".zbozi-cenadoporucena").removeClass("zbozi-cenadoporucena-only"); $(".zbozi-dopcena").removeClass("zbozi-cena"); $(".zbozi-dopcena").addClass("zbozi-cenadoporucena"); } else { document.cookie="hidediscount=1"; $(".tohide").hide(); $(".zbozi-dopcena").addClass("zbozi-cena"); $(".zbozi-dopcena").removeClass("zbozi-cenadoporucena"); } } } function initMenu() { //$('#menu ul').hide(); /* $('#menu li a').removeAttr('href'); $('#menu li a').dblclick( function() { $(this).next().slideToggle(); } );*/ } post_reakce = function(id) { $('#fp_parent').val(id); if(id!=0) { $('#fp_subjekt').val("re: "+$('#li-'+id).html()); } else { $('#fp_subjekt').val(""); } $('#diskuze_form').show(); $('#fp_jmeno').focus(); } send_post = function(kod) { var jmeno = $('#fp_jmeno').val(); var email = $('#fp_email').val(); var subjekt = $('#fp_subjekt').val(); var telo = $('#fp_telo').val(); var kod = $('#fp_kod').val(); var parent = $('#fp_parent').val(); $.ajax({ type: "POST", url: "/scripts/ajax/ajax.zboziKoment.php", cache: false, data: "f_jmeno="+jmeno+"&f_email="+email+"&f_subjekt="+subjekt+"&f_telo="+telo+"&f_kod="+kod+"&f_parent="+parent, dataType: "text", beforeSend: function(){ // alert("Loading"); }, success: function(return_data){ var json_data = JSON.parse(return_data); if (json_data.status==1) { $('#fp_jmeno').val(""); $('#fp_email').val(""); $('#fp_subjekt').val(""); $('#fp_telo').val(""); $('#fp_parent').val("0"); $('#commentinfo').html("
Váš dotaz byl odeslán prodejci.
"); $('#diskuze_form').hide(); } else { $('#commentinfo').html("
Při vkládání dotazu se vyskytla chyba.
"); } } }); } $('.diskuze_close').click(function(){ $('#diskuze_form').hide();}); reworkDezen = function(vyrobce,dezenOld) { var sirka = $('#sirka').val(); var profil = $('#profil').val(); var rafek = $('#rafek').val(); var kategorie = $('#kategorie').val(); $.ajax({ type: "POST", url: "work.srch.php", cache: false, data: "matxr=-1&kategorie=" + kategorie +"&vyrobce="+ vyrobce+"&sirka="+ sirka+"&profil="+ profil+"&rafek="+ rafek, dataType: "xml", beforeSend: function(){ }, success: function(xml){ if (vyrobce!="") { $('#dezen').find('option').remove(); $('#dezen').append($('').val('').html('vše')); var rafekval =""; $(xml).find('dezen').each(function(){ rafekval = $(this).text(); $('#dezen').append($('')); }); $("#dezen").removeAttr("disabled"); $("#dezen").removeAttr("title"); $("#dezen option[value='"+dezenOld+"']").attr("selected", "selected"); } } }); } rework = function(id) { //$('#ajax-loading-box').removeClass("nodisp"); sirka = '';profil = '';rafek = '';kategorie = '';vyrobce = ''; { var sirka = $('#sirka').val();} { var profil = $('#profil').val();} { var rafek = $('#rafek').val(); } { var kategorie = $('#kategorie').val();} { var vyrobce = $('#vyrobce').val();} //$("#form_srch select").attr("disabled","disabled"); if (id!='s' || id=='all') {$('#sirka').find('option').remove();} if (id!='p' || id=='all') {$('#profil').find('option').remove();} if (id!='r' || id=='all') {$('#rafek').find('option').remove();} if (id!='k' || id=='all') {$('#kategorie').find('option').remove();} if (id!='v' || id=='all') {$('#vyrobce').find('option').remove();} var sirkaOld = sirka; var profilOld = profil; var rafekOld = rafek; var kategorieOld = kategorie; var vyrobceOld = vyrobce; // if (id=='s') {sirka = '';} if (id=='s') {profil = '';rafek = '';kategorie = '';vyrobce = '';profilOld = profil;rafekOld = rafek;} // if (id=='p') {profil = '';} // if (id=='r') {rafek = '';} if (id=='k') {kategorie = '';} if (id=='v') {vyrobce = '';} if (id=='all') {sirka = '';profil = '';rafek = '';kategorie = '';vyrobce = '';} $.ajax({ type: "POST", url: "work.srch.php", cache: false, data: "matxr=-1&kategorie=" + kategorie +"&vyrobce="+ vyrobce+"&sirka="+ sirka+"&profil="+ profil+"&rafek="+ rafek, dataType: "xml", beforeSend: function(){ }, success: function(xml){ //if (id=='k' || id=='all') { $('#kategorie').find('option').remove(); $('#kategorie').append($('').val('').html('vše')); var kategorieval = ""; $(xml).find('kategorie').each(function(){ kategorieval = $(this).text(); $('#kategorie').append($('')); }); $("#kategorie option[value='"+kategorieOld+"']").attr("selected", "selected"); } //if (id=='v' || id=='all') { $('#vyrobce').find('option').remove(); $('#vyrobce').append($('').val('').html('vše')); var vyrobceval =""; $(xml).find('vyrobce').each(function(){ vyrobceval = $(this).text(); $('#vyrobce').append($('')); }); $("#vyrobce option[value='"+vyrobceOld+"']").attr("selected", "selected"); $("#dezen").attr("disabled","disabled"); $("#dezen").attr("title","Nejprve musíte vybrat výrobce"); //alert(vyrobceOld); if (vyrobceOld!="") { reworkDezen(vyrobceOld,$("#dezen").val()); } } //if (id!='s' || id=='all') { $('#sirka').find('option').remove(); $('#sirka').append($('').val('').html('vše')); var sirkaval =""; $(xml).find('sirka').each(function(){ sirkaval = $(this).text(); $('#sirka').append($('').val(sirkaval).html(sirkaval)); }); $("#sirka option[value='"+sirkaOld+"']").attr("selected", "selected"); } if (id!='p' || id=='all') { $('#profil').find('option').remove(); $('#profil').append($('').val('').html('vše')); var profilval =""; $(xml).find('profil').each(function(){ profilval = $(this).text(); $('#profil').append($('')); }); $("#profil option[value='"+profilOld+"']").attr("selected", "selected"); } if (id!='r' || id=='all') { $('#rafek').find('option').remove(); $('#rafek').append($('').val('').html('vše')); var rafekval =""; $(xml).find('rafek').each(function(){ rafekval = $(this).text(); $('#rafek').append($('')); }); $("#rafek option[value='"+rafekOld+"']").attr("selected", "selected"); } if (id=='d' || vyrobce!="") { $('#dezen').find('option').remove(); $('#dezen').append($('').val('').html('vše')); var rafekval =""; $(xml).find('dezen').each(function(){ rafekval = $(this).text(); $('#dezen').append($('')); }); $("#dezen").removeAttr("disabled"); $("#dezen").removeAttr("title"); $("#dezen option[value='"+rafekOld+"']").attr("selected", "selected"); } if (id=='all') { $("#rafek option[value='']").attr("selected", "selected"); $("#profil option[value='']").attr("selected", "selected"); $("#sirka option[value='']").attr("selected", "selected"); $("#vyrobce option[value='']").attr("selected", "selected"); $("#kategorie option[value='']").attr("selected", "selected"); $("#dezen").attr("disabled","disabled"); $("#dezen").attr("title","Nejprve musíte vybrat výrobce"); } } }); //$('#ajax-loading-box').addClass("nodisp"); $("#form_srch select").removeAttr("disabled"); } $(document).ready(function(){ /* $(".ajax-loading-box").bind("ajaxSend", function(){ $(this).show(); }).bind("ajaxComplete", function(){ $(this).hide(); }); */ $("#sirka").change(function() {rework('s');}); $("#profil").change(function() {rework('p');}); $("#rafek").change(function() {rework('r');}); $("#kategorie").change(function() {rework('k');}); $("#vyrobce").change(function() {rework('v');}); /* $("#sirka").focus(function() {rework('s');}); $("#profil").focus(function() {rework('p');}); $("#rafek").focus(function() {rework('r');}); $("#kategorie").focus(function() {rework('k');}); $("#vyrobce").focus(function() {rework('v');}); $("#vyrobce").change(function() {rework('d');}); */ initMenu(); // JavaScript Document $('#read_next').click( function(){ var pgnumber = $('#pg_number').val(); pgnumber = parseInt(pgnumber); var pgcount = $('#pg_count').val(); pgcount = parseInt(pgcount); if (pgnumber=="") pgnumber=0; pgnumber =parseInt(pgnumber); if (pgnumber+''!='NaN' && pgnumber>0) { pgnumber = pgnumber+1; $('#pg_number').val(pgnumber); $('.ajax-loading-box').show(); $.post("/scripts/ajax/ajax.nactiZbozi.php?uriHash=b4862a90802bfe5b74029ece4f3fabfc&page="+pgnumber, function(data){ //alert (data); if (data != "") { $("#items_container_body").append(data); //if (pgcount==pgnumber) $('#read_next').hide(); if (pgcount==pgnumber) {$('#read_next').hide();} else {$('#read_next').show();}; //$.scrollTo($("#topline").position().top, 'slow'); $('html, body').animate({scrollTop:$("#topline").position().top}, 'slow'); } }) .done(function() { $('.ajax-loading-box').hide(); }) ; } }) var aktualni_strana=1; var hash = window.location.hash; var pgnumber = hash.replace("#", ""); pgnumber = parseInt(pgnumber); if (pgnumber=="") pgnumber=0; pgnumber =parseInt(pgnumber); //if (pgnumber==0) pgnumber=1; $('.ajaxpaging').removeClass('paging_sel'); $('#go_to_page_'+pgnumber).addClass('paging_sel'); $('.ajaxpaging').removeClass('paging_sel'); $('#go_to_page_'+pgnumber ).addClass('paging_sel'); if (pgnumber+''!='NaN' && pgnumber>0 ) { $('#pg_number').val(pgnumber); $.post("/scripts/ajax/ajax.nactiZbozi.php?uriHash=b4862a90802bfe5b74029ece4f3fabfc&page="+pgnumber, function(data){ //alert (data); if (data != "") { $("#items_container_body").html(data); } }); } $(".zbozi_koupit_detail").fancybox({ 'hideOnContentClick': true, 'padding':0, 'margin':0, 'overlayColor':'#000', beforeShow: function(){ } }); $(".zbozi_koupit").fancybox({ 'hideOnContentClick': true, 'padding':0 }); $('._blank').click(function() { return !window.open(this.href); }); var srovnaniOpen=0; var basketOpen=0; var lbOpen=0; var basketChangeStatus=1; var pocet_ke_srovnani =0; $(".validate").validationEngine(); $("[data-fancybox]").fancybox({ }); $("._fancy").fancybox({'titleShow' : true,'transitionIn' : 'elastic','transitionOut' : 'elastic'}); /* $("._fancy").magnificPopup({ type:'image', gallery: { enabled:true } }); */ /* $("._fancy[rel='g1']").each(function() { // the containers for all your galleries $(this).magnificPopup({ delegate: 'a', // the selector for gallery item type: 'image', gallery: { enabled:true } }); }); */ /* $(".btn-loginbox").magnificPopup({ type:'inline', gallery:{ enabled:true } }); */ $(".btn-loginbox").click(function(){ if (lbOpen==0) { $("#loginbox").animate({marginTop: "+=150px",}, 'slow'); lbOpen=1; } else { $("#loginbox").animate({marginTop: "-=150px",}, 'slow'); lbOpen=0; } }); $("#biname").mouseover(function(){ $("#kosik_nahled").fadeIn('fast'); if (basketChangeStatus==1) {nacti_ax_basket();basketChangeStatus=0;} }); $("#biname").mouseout(function(){ $("#kosik_nahled").fadeOut('fast'); }); $('body').click(function(event){ if ( ! $(event.target).closest('#kosik_nahled').length ) { $("#kosik_nahled").fadeOut('fast'); } }); $(".ocb").click(function(){ $("#kosik_nahled").fadeOut('fast'); }); $("#btn_srovnani").click(function(){ if (srovnaniOpen==0) { nacti_ax_srovnavac(); $('#srovnavac_cointainer').css({height: 54}).animate({ height: '315' }, 'slow'); $('#btn_srovnani').html('Skrýt'); srovnaniOpen=1; } else { if (pocet_ke_srovnani>0) { $('#srovnavac_cointainer').css({height: 315}).animate({ height: '54' }, 'slow'); $('#btn_srovnani').html('Zobrazit'); } else { $('#srovnavac_cointainer').css({height: 315}).animate({ height: '0' }, 'slow'); } srovnaniOpen=0; } }); nacti_ax_basket = function() { $.ajax({ type: "POST", url: "/scripts/ajax/ajax.getBasket.php", cache: false, //data: "kod="+kod+"&pocet="+pocet, dataType: "text", beforeSend: function(){ // alert("Loading"); }, success: function(return_data){ var json_data = JSON.parse(return_data); var rows; $("#ax_basket > tbody").empty(); $('#ax_basket > tbody').append('NázevPočet ksCena/ks'); for (rows in json_data) { if (rows!='system') { var pocet = json_data[rows]['pocet']; var cena = format_number('cz',json_data[rows]['cena']); //var nazev = json_data[rows]['vyrobce']+" "+json_data[rows]['model']; var nazev = json_data[rows]['nazev']; $('#ax_basket > tbody').append(''+nazev+''+pocet+'ks'+cena+''); } } var celkem_s_dani=json_data['system']['price_with_vat']; var celkem_bez_dani=json_data['system']['price_no_vat']; var pocet_polozek=json_data['system']['count_items']; $('#ax_basket > tbody').append('Celkem'+pocet_polozek+'ks'+format_number('cz',celkem_s_dani)+''); } }); } srovnavac_remove = function(kod) { $.ajax({ type: "POST", url: "/scripts/ajax/ajax.removeSrovnavac.php", cache: false, data: "kod="+kod, dataType: "text", beforeSend: function(){ // alert("Loading"); }, success: function(return_data){ var json_data = JSON.parse(return_data); var rows; $("#sr_"+kod).remove(); if (json_data.status==1) { $("#srovnavac_pocet").html(json_data.count_items+" ks"); pocet_ke_srovnani=json_data.count_items; } } }); } nacti_ax_srovnavac = function() { $.ajax({ type: "POST", url: "/scripts/ajax/ajax.getSrovnavac.php", cache: false, dataType: "text", beforeSend: function(){ // alert("Loading"); }, success: function(return_data){ var json_data = JSON.parse(return_data); var rows; var itmp=1; $("#srovnavac_items_holder").empty(); for (rows in json_data) { if (rows!='system') { var foto = json_data[rows]['foto']; var cena = format_number('cz',json_data[rows]['cena']); if (json_data[rows]['prodej']==0 ) {cena = "na dotaz";} var kod = json_data[rows]['kod']; var link = json_data[rows]['link']; // var nazev = json_data[rows]['vyrobce']+" "+json_data[rows]['model']; var nazev = json_data[rows]['nazev']; foto_file = "/rimg/118x118/"+foto; if (foto=="") foto_file = "/styl/nophoto2.png"; var sclass='srovnavac_items'; if (itmp==pocet_ke_srovnani) {sclass='srovnavac_items_last'; } $('#srovnavac_items_holder').append('
'+nazev+''+cena+'
odebrat

'); itmp++; } } } }); } add_to_basket = function(kod) { input_id='num_'+kod; typ_ceny=''; info=''; var pocet = $("input[id='"+input_id+"']").val(); //alert (pocet); //konfigurace $.ajax({ type: "POST", url: "/scripts/ajax/ajax.addToBasket.php", cache: false, data: "kod="+kod+"&pocet="+pocet+"&cena="+typ_ceny+"&info="+info, dataType: "text", beforeSend: function(){ // alert("Loading"); }, success: function(return_data){ //alert (return_data;) var json_data = JSON.parse(return_data); if (json_data.status==1) { $("#basketinfo_ks").html(json_data.count_items); $("#basketinfo_cena").html(format_number('cz',json_data.price_with_vat)); $("#kosik_info_ks").html(json_data.count_items); $("#kosik_info_cena").html(format_number('cz',json_data.price_with_vat)); } set_action=0; } }); nacti_ax_basket(); basketChangeStatus=0; } add_to_srovnavac = function(kod) { // cloneImg = $('#himg_'+kod); //cloneImg.flyto('.srovnavac'); $.ajax({ type: "POST", url: "/scripts/ajax/ajax.addToSrovnavac.php", cache: false, data: "kod="+kod, dataType: "text", beforeSend: function(){ // alert("Loading"); }, success: function(return_data){ var json_data = JSON.parse(return_data); if (json_data.status==1) { $("#srovnavac_pocet").html(json_data.count_items+" ks"); pocet_ke_srovnani=json_data.count_items; if (srovnaniOpen==0 && pocet_ke_srovnani==1) {$('#srovnavac_cointainer').css({height: 0}).animate({ height: '54' }, 'slow');$('#btn_srovnani').html('Zobrazit');} } } }); nacti_ax_srovnavac(); } /* $("#fulltextsrch").autocomplete("/scripts/ajax/ajax.fulltext.php", { width: 320, max: 100, highlight: false, scroll: true, scrollHeight: 300, selectFirst:false, width: 337, left: -20, formatItem: function(data, i, n, value) { var json_data = JSON.parse(value); //return json_data[0]['rozmer'] + " "+ json_data[0]['vyrobce']+" "+json_data[0]['model']+"
"+json_data[0]['model']+""; return ""+json_data[0]['nazev']+"
"+json_data[0]['anotace']+""; }, formatResult: function(data, value) { var json_data = JSON.parse(value); //return json_data[0]['rozmer'] + " "+ json_data[0]['vyrobce']+" "+json_data[0]['model']; return json_data[0]['nazev']; } }); $('#fulltextsrch').focus(function(){if ($('#fulltextsrch').val()=='Hledej...') $('#fulltextsrch').val("");}); $('#fulltextsrch').blur(function(){if ($('#fulltextsrch').val()=='') $('#fulltextsrch').val("Hledej...");}); $('#zp_email').focus(function(){if ($('#zp_email').val()=='Váš@email') $('#zp_email').val("");}); $('#zp_email').blur(function(){if ($('#zp_email').val()=='') $('#zp_email').val("Váš@email");}); */ }); function number_format (number, decimals, dec_point, thousands_sep) { decimals=0; number = (number + '').replace(/[^0-9+\-Ee.]/g, ''); var n = !isFinite(+number) ? 0 : +number, prec = !isFinite(+decimals) ? 0 : Math.abs(decimals), sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep, dec = (typeof dec_point === 'undefined') ? '.' : dec_point, s = '', toFixedFix = function (n, prec) { var k = Math.pow(10, prec); return '' + Math.round(n * k) / k; }; // Fix for IE parseFloat(0.55).toFixed(0) = 0; s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.'); if (s[0].length > 3) { s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep); } if ((s[1] || '').length < prec) { s[1] = s[1] || ''; s[1] += new Array(prec - s[1].length + 1).join('0'); } return s.join(dec); } function format_number(country,number) { return number_format (number, 2,',', ' ')+' Kč'; } set_sort = function (type) { $('#f_sort_type').val(type); $('#f_sort_set').submit(); } posun_strankovani = function (pocet_stran,aktualni_strana,posun) { //$('html, body').animate({scrollTop:$("#topline").position().top}, 'slow'); //$('html, body').animate({scrollTop:$("#topline").position().top}, 'slow'); $('.paging').addClass('nodisp'); for(i=1; i <= pocet_stran; i++) { if((i-posun< aktualni_strana) && (i+posun>aktualni_strana)) {$('#go_to_page_'+i).removeClass('nodisp'); } if((aktualni_strana-posun<1) && (i<=(posun*2)-1)) {$('#go_to_page_'+i).removeClass('nodisp'); } if((i+(posun*2-1)>pocet_stran) && (aktualni_strana*1+posun*1)>pocet_stran) {$('#go_to_page_'+i).removeClass('nodisp'); } if (aktualni_strana>posun && pocet_stran>(posun*2-1)) {$('#paging_first').removeClass('nodisp');$('#paging_first_txt').removeClass('nodisp'); } else {$('#paging_first').addClass('nodisp');$('#paging_first_txt').addClass('nodisp'); } if (aktualni_strana<=pocet_stran-posun) {$('#paging_last').removeClass('nodisp'); $('#paging_last_txt').removeClass('nodisp'); } else {$('#paging_last').addClass('nodisp'); $('#paging_last_txt').addClass('nodisp'); } } return false; } $.fn.flyto = function(obj,callback) { var $cloneImg = $(this).clone(); basketOffset = $(obj).offset(); //alert (basketOffset); var basketY = basketOffset.top, basketX = basketOffset.left, imgY = $(this).offset().top, imgX = $(this).offset().left; var gotoX = basketX - imgX; gotoY = basketY - imgY, newImageWidth = $(this).width() / 3, newImageHeight = $(this).height() / 3; $cloneImg.addClass('fly_elem') .prependTo($(this).parent()) .animate({opacity: 0.4}, 100 ) .animate({opacity: 0.1, marginLeft: gotoX, marginTop: gotoY, width: newImageWidth, height: newImageHeight}, 800, function() { $(this).remove(); }); if(callback) setTimeout(callback, 800); return $(this); }; $(document).ready(function($) { $('#bookmark-this').click(function(e) { var bookmarkURL = window.location.href; var bookmarkTitle = document.title; if ('addToHomescreen' in window && window.addToHomescreen.isCompatible) { // Mobile browsers addToHomescreen({ autostart: false, startDelay: 0 }).show(true); } else if (window.sidebar && window.sidebar.addPanel) { // Firefox version < 23 window.sidebar.addPanel(bookmarkTitle, bookmarkURL, ''); } else if ((window.sidebar && /Firefox/i.test(navigator.userAgent)) || (window.opera && window.print)) { // Firefox version >= 23 and Opera Hotlist $(this).attr({ href: bookmarkURL, title: bookmarkTitle, rel: 'sidebar' }).off(e); return true; } else if (window.external && ('AddFavorite' in window.external)) { // IE Favorite window.external.AddFavorite(bookmarkURL, bookmarkTitle); } else { // Other browsers (mainly WebKit - Chrome/Safari) alert('Press ' + (/Mac/i.test(navigator.userAgent) ? 'Cmd' : 'Ctrl') + '+D to bookmark this page.'); } return false; }); });