$(document).ready(function(){ $('#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");}); $('._blank').click(function() { return !window.open(this.href); }); $(".validate").validationEngine(); $("._fancy").fancybox({'titleShow' : true,'transitionIn' : 'elastic','transitionOut' : 'elastic'}); //$("#jq1").scrollable({circular: true, mousewheel: false}).navigator().autoscroll({interval: 4000}); //$("#jq1").scrollable({circular: true, mousewheel: false}); $("#hp_car1").scrollable({ circular: true, mousewheel: true }).navigator().autoscroll({interval: 4000});; $(".main_slide").jCarouselLite({ btnNext: ".nivo-nextNav", btnPrev: ".nivo-prevNav", circular: true, visible: 1, auto: 4000, speed: 500, scroll: 1 }); $("#jq3").jCarouselLite({ btnNext: ".jq3right", btnPrev: ".jq3left", circular: true, visible: 1, auto: 3000, speed: 600, scroll: 1 }); $('#btnSubmit').click(function() { var hasError = false; var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; var emailaddressVal = $("#mail_email").val(); var zpravaVal = $("#mail_zprava").val(); var jmenoVal = $("#mail_jmeno").val(); if(jmenoVal == '') { alert("Napište své jméno."); $("#mail_jmeno").focus(); hasError = true; } if(hasError == true) { return false; } if(emailaddressVal == '') { alert("Prosím vložte platnou emailovou adresu."); $("#mail_email").focus(); hasError = true; } if(hasError == true) { return false; } else if(!emailReg.test(emailaddressVal)) { alert("Prosím vložte platnou emailovou adresu."); $("#mail_email").focus(); hasError = true; } if(zpravaVal == '') { alert("Nemůžete odeslat prázdnou zprávu."); $("#mail_zprava").focus(); hasError = true; } if(hasError == true) { return false; } if(hasError == false) { //send form var mail_email= $("#mail_email").val(); var mail_zprava= $("#mail_zprava").val(); var mail_jmeno= $("#mail_jmeno").val(); $.ajax({ type: "POST", url: "/scripts/ajax/ajax.mailto.php", cache: false, data: "email=" + mail_email +"&jmeno="+ mail_jmeno+"&zprava="+ mail_zprava, dataType: "xml", beforeSend: function(){ // alert("Loading"); }, success: function(xml){ $(xml).find('status').each(function(){ var status = $(this).text(); if (status ==1) {$("#mail_jmeno").val('');$("#mail_email").val('');$("#mail_zprava").val('');alert ("Vaše zpráva byla odeslána");} else {alert ("Při odesílání zprávy se vyskytla chyba");} }); } }); } }); $("#footslider").jCarouselLite({ btnNext: ".footslider_right", btnPrev: ".footslider_left", circular: true, visible: 5, auto: 4000, speed: 500, scroll: 1 }); })