function pausecomp(millis){
var date = new Date();
var curDate = null;
do { curDate = new Date(); }
while(curDate-date < millis);
}
$(document).ready(function(){
var preimg23 = new Image();
preimg23.src = 'http://www.flajzar.cz/data/uvod/23_tn.jpg';
var preimg39 = new Image();
preimg39.src = 'http://www.flajzar.cz/data/uvod/39_tn.jpg';
var preimg43 = new Image();
preimg43.src = 'http://www.flajzar.cz/data/uvod/43_tn.jpg';
var preimg50 = new Image();
preimg50.src = 'http://www.flajzar.cz/data/uvod/50_tn.jpg';
// $('#header').css('background', '#FFFFFF url(http://www.flajzar.cz/data/kategorie-banner/kath_uvodka.jpg) no-repeat scroll center center');
$('#right_anketa .all .vp_obal a').click(function(){
var odpovedid = $(this).attr('id');
odpovedid = odpovedid.substr(8);
var otazkaid = $(this).parent().attr('id');
otazkaid = otazkaid.substr(7);
$.get("anketa.ajax.php", { otazka: otazkaid, odpoved: odpovedid }, function(data){
$('#right_anketa .all').html(data);
});
});
$('.vp_text a').hover(function(){
var idecko = $(this).attr('id');
var el = $(this).parent().parent().parent().children('.vp_img');
//alert('asd');
el.children('img.primary').fadeOut('slow');
el.children('img#i' + idecko).fadeIn('slow');
}, function(){
var idecko = $(this).attr('id');
var el = $(this).parent().parent().parent().children('.vp_img');
el.children('img.primary').stop(true, true).fadeIn('slow');
el.children('img#i' + idecko).stop(true, true).fadeOut('slow');
});
// horni drop menu
/*
$('.vp_menu ul li').hover(
function() {
//pausecomp(300);
$('ul', this).show();
$('a.first-level', this).css('background','#fbae17');
$('a.second-level', this).css('background','none');
},
function() {
//pausecomp(1000);
$('ul', this).hide();
$('a.first-level', this).css('background','none');
}
);
*/
/*
$('.vp_menu ul li a.first-level').mousemove(function(){
$(this).parent().children('ul').show();
$(this).css('background','#fbae17');
$(this).parent().children().children().children('a').css('background','none');
});
$('.vp_menu ul li a.first-level').mouseout(function(){
//var This = $(this);
//var postTimer1 = setTimeout(function(){ This.parent().children('ul').hide(); }, 1000);
//$(this).parent().children('ul').hide();
$(this).css('background','none');
});
$('.vp_menu ul li ul.second-level').mousemove(function(){
$(this).show();
$(this).parent().children('a').css('background','#fbae17');
$(this).children().children('a').css('background','none');
});
$('.vp_menu ul li ul.second-level').mouseout(function(){
//var This = $(this);
//var postTimer1 = setTimeout(function(){ This.hide(); }, 1000);
//$(this).hide();
//$(this).parent().children('a').css('background','none');
});*/
$(".hledat_inp").click(function(){
$(this).val("");
});
/*$("a[@rel='fotogalerie']").fancybox({
'zoomOpacity' : true,
'overlayShow' : false,
'zoomSpeedIn' : 500,
'zoomSpeedOut' : 500,
'padding' : 100
});*/
$(".dod_adresa").hide();
$(".adresa_diff").click(function(){
$(".dod_adresa").hide("slow");
});
$(".adresa_diff2").click(function(){
$(".dod_adresa").show("slow");
});
$("select[@name='velikost']").change(function(){
var coJeVybrano = $("select[@name='velikost'] option:selected").val();
$('#cena').hide("slow");
$.post("update_velikost.php", { idprodukt: "2833", idvlastnost: coJeVybrano }, function(data){
$('.cena').text(data);
$('#cena').show("slow");
});
});
$("#kosik-platba").hide();
$("#kosik-udaje").hide();
$(".krok").removeClass("actkrok");
$("#krok1").addClass("actkrok");
$(".krok").addClass("inactkrok");
$("#krok1").removeClass("inactkrok");
$(".krok").click(function(){
var go = false;
switch ($(this).attr("id")){
case "krok1":
$("#kosik-platba").hide("slow");
$("#kosik-udaje").hide("slow");
$("#kosik-zbozi").show("slow");
go = true;
break;
case "krok2":
$("#kosik-zbozi").hide("slow");
$("#kosik-udaje").hide("slow");
$("#kosik-platba").show("slow");
go = true;
break;
case "krok3":
/*$("input[@name='platba']").is(":checked") && $("input[@name='doprava']").is(":checked")*/
if (false){
$("#kosik-zbozi").hide("slow");
$("#kosik-platba").hide("slow");
$("#kosik-udaje").show("slow");
go = true;
}
else
alert('Musíte nejprve vybrat platbu a dopravu!');
break;
}
if (go){
$(".krok").removeClass("inactkrok");
$(".krok").addClass("inactkrok");
$(".krok").removeClass("actkrok");
$(this).removeClass("inactkrok");
$(this).addClass("actkrok");
}
});
$(".doprava").click(function(){
//alert('asd');
//alert($(this).attr("value"));
$.get("kosik-doprava2.php", { id: $(this).attr("value") }, function(vystup){
//alert(vystup);
//$("#doprava-zdarma").html(vystup);
});
$("#doprava-cena").load("kosik-doprava-cena.php");
$("#kosik-cena-celkem").load("kosik-cena-celkem.php");
});
$("#kosik-dalsi1").click(function(){
// prejdeme na krok 2
$("#kosik-zbozi").hide("slow");
$("#kosik-udaje").hide("slow");
$("#kosik-platba").show("slow");
$(".krok").removeClass("inactkrok");
$(".krok").addClass("inactkrok");
$("#krok2").removeClass("inactkrok");
$("#krok2").addClass("actkrok");
});
$("#kosik-dalsi2").click(function(){
var errors = '';
if (false/*$("input[@name='platba']").is(":checked") && $("input[@name='doprava']").is(":checked")*/){
// prejdeme na krok 3
$("#kosik-zbozi").hide("slow");
$("#kosik-platba").hide("slow");
$("#kosik-udaje").show("slow");
$(".krok").removeClass("inactkrok");
$(".krok").addClass("inactkrok");
$("#krok3").removeClass("inactkrok");
$("#krok3").addClass("actkrok");
}
else
alert('Musíte nejprve vybrat platbu a dopravu!');
/*else
errors += 'Nevyplnili jste správně: