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();});
$(document).ready(function(){
initMenu();
$(window).hashchange( function(){
var hash = window.location.hash;
var pgnumber = hash.replace("#", "");
pgnumber = parseInt(pgnumber);
if (pgnumber=="") pgnumber=1;
pgnumber =parseInt(pgnumber);
//if (pgnumber==0) pgnumber=1;
if (pgnumber+''!='NaN' && pgnumber>0) {
var pgcount = $('#pg_count').val();
pgcount = parseInt(pgcount);
$('#pg_number').val(pgnumber);
$('.ajax-loading-box').show();
$.post("/scripts/ajax/ajax.nactiZbozi.php?uriHash=17722e5a02576ecbe42faa5bebd84f07&page="+pgnumber,
function(data){
//alert (data);
if (data != "") {
$("#items_container_body").html(data);
//$.scrollTo($("#topline").position().top, 'fast');
$('html, body').animate({scrollTop:$("#topline").position().top}, 'slow');
if (pgcount==pgnumber) {$('#read_next').hide();} else {$('#read_next').show();};
}
})
.done(function() {
$('.ajax-loading-box').hide();
})
;
}
$('.ajaxpaging').removeClass('paging_sel');
$('#go_to_page_'+pgnumber).addClass('paging_sel');
})
// 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=1;
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=17722e5a02576ecbe42faa5bebd84f07&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=1;
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=17722e5a02576ecbe42faa5bebd84f07&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();
$("._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ázev | Počet ks | Cena/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(' ');
itmp++;
}
}
}
});
}
add_to_basket = function(kod,typ_ceny, info) {
input_id='num_'+kod;
// cloneImg = $('#himg_'+kod);
// cloneImg.flyto('#kosik_holder');
// var pocet = $(input_id).val();
var pocet = $("input[id='"+input_id+"']").val();
//alert (pocet);
//konfigurace
pocetK = $("#conf_num").val();
if (pocetK!="") {
pocetK = parseInt(pocetK);
for (i=0;iNa zboží Vám byla přiznána setová cena.');
//$("#emailno").fancybox().trigger('click');
}
}
});
nacti_ax_basket();
basketChangeStatus=0;
// $('#kosik_holder').addClass('kosik_naplneny');
// $('#kosik_holder').removeClass('kosik');
}
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;
});
});