$(document).ready(function() { /* * * defaultni text * */ $("#jsEmail").get(0).value = 'Your email'; function empty_field(q, empty_text){ return ! ( $(q).get(0).value.trim() != '' && $(q).get(0).value != empty_text ); } $("#jsEmail").on('focus',function(){ // nemaz pokud je vyplneny if(empty_field("#jsEmail",'Your email')){ $("#jsEmail").get(0).value = ''; } }); $("#jsEmail").on('blur',function(){ // nevkladej pokud je vyplneny if(! empty_field("#jsEmail",'Your email')) {//$(this).get(0).value.trim() != '' && $(this).get(0).value != 'Your email' ) { return; } $("#jsEmail").get(0).value = 'Your email'; }); $("#jsMessage").get(0).value = 'Message'; $("#jsMessage").on('focus',function(){ // nemaz pokud je vyplneny if(empty_field("#jsMessage",'Message')){ $("#jsMessage").get(0).value = ''; } }); $("#jsMessage").on('blur',function(){ // nevkladej pokud je vyplneny if(! empty_field("#jsMessage",'Message')) {//$(this).get(0).value.trim() != '' && $(this).get(0).value != 'Message' ) { return; } $("#jsMessage").get(0).value = 'Message'; }); /* * * odeslani formulare * */ $("#contact-form .jsSend").click(function(){ var email=$("#contact-form #jsEmail").get(0).value; var message=$("#contact-form #jsMessage").get(0).value; function fxBorderBlink($jq){ $($jq).animate({'border-color':'#f00'}).animate({'border-color':'rgb(193, 193, 193);'}).animate({'border-color':'#f00'}).animate({'border-color':'rgb(193, 193, 193);'}); } // dle RFC, slozite // var $emailch = "!#$%&'*+-/=?^_`{|}~a-zA-Z0-9." function validEmail($t){ return ( $t || "").match(new RegExp('[^@]{2,}@[^.][^@]{1,}\\.[^@]{2,}')); } // function test($ret, $exp) { // console.log( (( $ret? 'jo': 'ne' ) == $exp ) ? 'pass' : 'fail' ); // } // test(validEmail('Pepa Novák'), 'ne'); // test(validEmail('Pepa@'), 'ne'); // test(validEmail('@Pepa'), 'ne'); // test(validEmail('Forgot@country'), 'ne'); // test(validEmail('pp@xx.x'), 'ne'); // test(validEmail('name@seznam.cz'), 'jo'); // test(validEmail('name@.seznam.cz'), 'ne'); // chybny email zablikej if(!validEmail(email)){ fxBorderBlink($("#jsEmail").parent()); // ok email posli } else { $.post('https://www.fishtrader.cz/inc/ajax/contact-form.php', { email: email , message: message , rln_policy_check: $('.policy_check').is(':checked') , rln_market_chack: $('.market_chack').is(':checked') , rln_track_check: $('.track_check').is(':checked') , rln_lang: $('.weblang').val() } ,function (d){ // oznam ze je v poradku a smaz zpravu if('1'==d){ alert('Message sent.'); $("#jsMessage").val(""); } else { // chyba alert('Error sending message. Please use Your email client to contact us.'); } } ); } }); //console.log(window.location.hash); /* * * * */ $('a.mail').antispam({ 'emailname' : 'info','emaildomain' : 'nakhodka','emailltd' : 'cz' }); /* * * fancybox * */ $("a[href$='.jpg'],a[href$='.jpeg'],a[href$='.png'],a[href$='.gif'],a[href$='.JPG'],a[href$='.JPEG'],a[href$='.PNG'],a[href$='.GIF']").not('#superbgimage_block a').fancybox({ 'overlayOpacity' : 0.8, 'overlayColor' : '#000' }); /*$("a.infoblock, a.ref_link").fancybox({ 'overlayOpacity' : 0.8, 'overlayColor' : '#000' });*/ $("a.maping").fancybox({type:'iframe', width:'75%', height:'75%'}); $(".jsFancybox").fancybox({ // type:'iframe' // hideOnOverlayClick : true // , hideOnContentClick :true // , enableEscapeButton :true // , showCloseButton :true // ,'modal' : true width:'80%' , height:'75%' }); /*$('ul.sf-menu').superfish({ delay: 1000, animation: {opacity:'show',height:'show'}, autoArrows: true });*/ /*$('#langs').hover(function(){ $('#langs a').not('.activ').each(function(){ $(this).show('slow'); }); }, function(){ $('#langs a').not('.activ').each(function(){ $(this).hide('slow'); }); }); $('#textcontenthide').click(function(){ $('#textcontenttogglearrow').toggleClass('show'); $('#text_wrap,#infoblock').fadeToggle(); }); $('#menu #item2,#menu_sub_products').hover(function(){ clearTimeout( window.prod_sub_menu ); $('#menu_sub_products').show(); }, function(){ window.prod_sub_menu = setTimeout( function(){ $('#menu_sub_products').hide(500); },1000 ); } ); */ });