$(document).ready(function(){
// uvodni strana
$("#uvod_slider").nivoSlider({
pauseTime:5000,
effect:'fade'
});
$("#uvodPromoZbozi").tabs( {event: 'mouseover' } );
// uvod novinky
$("#uvod-novinky-slider").easySlider({
prevText: 'Předchozí',
nextText: 'Další',
auto: true,
continuous: true,
pause: 3000,
numeric: true
});
// uvod heureka
$("#uvod-heureka-slider").easySlider({
prevId: 'heureka-prev',
nextId: 'neureka-next',
controlsShow: false,
controlsBefore: '',
controlsAfter: '',
firstId: 'heureka-firstBtn',
firstShow: false,
lastId: 'heureka-lastBtn',
lastShow: false,
speed: 800,
auto: true,
pause: 5000,
continuous: true,
numeric: false,
numericId: 'heureka-controls'
});
// eshop - pridani do kosiku
$(".eshopItemAddForm").submit(function(){
$(".resultPlacer").remove();
var kosikUrl = '/nakupni-kosik.html';
var placerId = $(this).attr('id');
var modalInfoPosition = $(this).children(".eshopCartSpecialPlacer");
var prodId = $(this).children("input[name=prodid]").val();
var pocetProd = $(this).children("input[name=pocet]").val();
var nazev = $(this).children("input[name=prodnazev]").val();
//alert ( modalInfoPosition);
$.ajax({
url: '/eshop/itemadd/',
type: 'POST',
data: 'prodid='+prodId+'&pocet='+pocetProd,
beforeSend: function(){
$(modalInfoPosition).append('
Čekejte prosím...
');
},
success: function(htmlData){
var contentUrl = '/eshop/cartcontent/';
$(".eshop-cart-ajax-loader").hide();
$(modalInfoPosition).html('Přidání zboží do košíku
Přidali jste do košíku '+pocetProd+' ks položky '+nazev+'
zavřít ');
$("#cartContentPlacer").load(contentUrl);
$(".close").click(function(){
$(this).parent(".resultPlacer").remove();
return false;
});
},
error:function() {
alert("error");
}
});
return false;
});
// obrazky produktu - fancybox
$("a[rel=prod_images]").fancybox({
'transitionIn' : 'none',
'transitionOut' : 'none',
'titlePosition' : 'none',
'cyclic' : true,
titleShow : false
});
// nakupni kosik
$("#novaDodaci").hide();
$("#vybranaDodaci").hide();
$("#dodaci").change(function(){
var vybrana = $(this).val();
var obsah = $("#dodaci option:selected").text();
if( vybrana == 'new'){
$("#novaDodaci").show();
$("#vybranaDodaci").html('');
$("#vybranaDodaci").hide();
}
else if( vybrana > 0 ){
$("#vybranaDodaci").show();
$("#vybranaDodaci").html(obsah);
$("#novaDodaci").hide();
}
else{
$("#novaDodaci").hide();
$("#vybranaDodaci").html('');
$("#vybranaDodaci").hide();
}
});
$("#invoiceForm").hide();
$("#showInvoice").click(function(){
$("#invoiceForm").toggle();
return false ;
});
$("#eshopOderForm").validate({
rules: {
quickName: {
required: true,
minlength: 5
},
quickUlice: {
required: true,
minlength: 3
},
quickPsc: {
required: true,
minlength: 5
},
quickMesto: {
required: true,
minlength: 2
},
quickEmail: {
required: true,
email: true
},
quickTel: {
required: true,
minlength: 9
}
},
messages: {
quickName: "Zadejte jméno a p\u0159íjmení",
quickUlice: "Zadejte ulici a \u010díslo popisné",
quickPsc: "Zadejte po\u0161tovní směrovací číslo",
quickMesto: "Zadejte m\u011bsto",
quickEmail: "Zadejte prosím platnou emailovou adresu",
quickTel: "Zadejte prosím Va\u0161e telefonní číslo"
}
});
$("#eshopOderForm").submit(function(){
var kontrola = $(this).valid();
if( kontrola == false ){
alert("Vyplňte prosím všechny povinné údaje.");
return false;
}
});
function setDeliveryFee(){
var feeDph = 20 ;
var defaultSum = '';
var defaultSumDph = '';
var deliverType = $(".setDelivery:checked").val();
var paymentType = $(".setPayment:checked").val();
if( deliverType == 'geis' && defaultSum <= 1500 ){
if( paymentType == 'paysec' || paymentType == 'transfer' ){
var fee = 90;
}
else{
var fee = 125;
}
}
else {
var fee = 0 ;
}
// alert(fee);
$("#orderDeliveryFee").html(fee + " K\u010d" ) ;
$("#orderDeliveryFee2").html(fee * ( feeDph/100+1) + " K\u010d" );
$("#orderTotalSum").html( defaultSum + fee + " K\u010d");
$("#orderTotalSumDph").html( defaultSumDph + fee*( feeDph/100+1) + " K\u010d" );
$("#orderDopravaCena").val(fee) ;
$("#orderDopravaCenaDph").val( fee * ( feeDph/100+1) ) ;
$("#orderBottomInfoFee").html(fee * ( feeDph/100+1) + " K\u010d" );
};
$(function(){
setDeliveryFee('geis');
});
$(".setDelivery").change(function(){
setDeliveryFee();
})
$(".setPayment").change(function(){
setDeliveryFee();
})
$(".scroll").click(function(){
var aktId = $(this).attr('href');
if( aktId == '#top'){
offset = 0;
}
else{
var offset = $(aktId).offset().top - 20;
}
$('html, body').animate({
scrollTop: offset
},'slow');
return false ;
});
});
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-4874023-12']); // testovací účet je UA-4874023-28
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();