function pausecomp(millis){ var date = new Date(); var curDate = null; do { curDate = new Date(); } while(curDate-date < millis); } $(document).ready(function(){ //$('#header').css('background', '#FFFFFF url(http://www.detskynakup.cz/data/kategorie-banner/kath_uvodka.jpg) no-repeat scroll center center'); $('.vp_anketa .vp_text .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){ $('.vp_anketa .vp_text').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() { $('a.first-level', this).css('background','#fbae17'); $('a.second-level', this).css('background','none'); //pausecomp(500); $('ul', this).show(); }, 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 }); $(".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: "", 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ě:
';*/ $(".error").html(errors); }); $("#kosik-predchozi2").click(function(){ // prejdeme na krok 1 $("#kosik-platba").hide("slow"); $("#kosik-udaje").hide("slow"); $("#kosik-zbozi").show("slow"); $(".krok").removeClass("inactkrok"); $(".krok").addClass("inactkrok"); $("#krok1").removeClass("inactkrok"); $("#krok1").addClass("actkrok"); }); $("#kosik-predchozi3").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-vse").click(function(){ var errors = ''; // zobrazime vsechno $("#kosik-zbozi").show("slow"); $("#kosik-udaje").show("slow"); $("#kosik-platba").show("slow"); $(".krok").removeClass("inactkrok"); $(".krok").addClass("actkrok"); if ($("input[@name='platba']").is(":checked") && $("input[@name='doprava']").is(":checked")){ //alert('All checked'); } else{ errors += '
  • způsob platby i dopravy
  • '; } if ($("input[@name='obj_firma']").val() == ''){ errors += '
  • Vaše jméno
  • '; } if ($("input[@name='obj_ulice']").val() == ''){ errors += '
  • Vaši ulici
  • '; } if ($("input[@name='obj_mesto']").val() == ''){ errors += '
  • Vaše město
  • '; } if ($("input[@name='obj_psc']").val() == ''){ errors += '
  • Vaše PSČ
  • '; } if ($("input[@name='obj_mail']").val() == ''){ errors += '
  • Vaši e-mailovou adresu
  • '; } if ($("input[@name='obj_telefon']").val() == ''){ errors += '
  • Váš telefon
  • '; } if (errors != ''){ errors = 'Nevyplnili jste údaje:
    '; //alert(errors); } $(".error").html(errors); }); $("input[@src='new_layout/odeslat-objednavku.gif']").click(function(event){ var errors = ''; if ($("input[@name='obj_firma']").val() == ''){ errors += '
  • Vaše jméno
  • '; } if ($("input[@name='obj_ulice']").val() == ''){ errors += '
  • Vaši ulici
  • '; } if ($("input[@name='obj_mesto']").val() == ''){ errors += '
  • Vaše město
  • '; } if ($("input[@name='obj_psc']").val() == ''){ errors += '
  • Vaše PSČ
  • '; } if ($("input[@name='obj_mail']").val() == ''){ errors += '
  • Vaši e-mailovou adresu
  • '; } if ($("input[@name='obj_telefon']").val() == ''){ errors += '
  • Váš telefon
  • '; } $(".error").html(errors); if (errors != '') event.preventDefault(); }); });