jQuery(function() { imageSize(); $(window).resize(function() { imageSize(); }); function imageSize() { var osize=$("body").attr('size'); var size='desktop'; if ( $(window).outerWidth() < (763) ) { size='mobile'; } else if ( $(window).outerWidth() < (1045) ) { size='tablet'; } else if ( $(window).outerWidth() <= (1435) ) { size='medium'; } if ( size != osize ) { $(".img-load").each(function() { if ( $(this).find(".img-"+size).length > 0 ) { $(this).parent().find("img.iload").attr('src',$(this).find(".img-"+size).attr('data-string')); } else { $(this).parent().find("img.iload").attr('src',$(this).find(".img-desktop").attr('data-string')); } }); //if ( ( osize == 'mobile' || osize == 'tablet') && ( size != 'mobile' && size != 'tablet' ) ) { //$("body").css("padding-top","82px"); // $("header").css("top","0px"); //} $("body").attr('size',size); } $("body").attr('w',$(window).outerWidth()); } checkMenu(); animate(); $(window).scroll(function() { checkMenu(); animate(); }); doResize(); $(window).resize(function() { doResize(); }); function checkMenu() { if ( $("html").scrollTop() > parseInt($("body").css('padding-top').replace('px','')) ) { $("body").addClass('mfixed'); } else { $("body").removeClass('mfixed'); } if ( $("section.elevatorMenu").length > 0 ) { var hh = 0; if ( $("header").length > 0 ) { hh = $("header").height(); } if ( $("section.elevatorMenu").offset().top < ($("html").scrollTop() + hh ) ) { $("body").addClass('emfixed'); } else { $("body").removeClass('emfixed'); } } } function animate() { $(".animatedNumbers").each(function() { if ( !$(this).hasClass('animated') ) { var w = $(this).position().top+($(window).height()/2); var ww = ($(window).scrollTop()+$(window).height()); if ( w <= ww ) { $(this).addClass('animated'); $(this).find(".nlist").each(function() { $(this).css('top',($(this).parent().attr('data-string')*-100)+'%'); }); } } }); } function doResize() { $(".mainImage .vrap iframe").each(function() { var videoAspect = 0.5625;//parseFloat($(this).innerHeight() / $(this).innerWidth()); var windowAspect = parseFloat($(this).parent().height() / $(this).parent().width()); //$("h1").html($(this).innerHeight()+" ---- "+$(this).innerWidth()+" ---- "+videoAspect+" ---- "+windowAspect); if (windowAspect > videoAspect) { $(this).height($(this).parent().height()+'px'); $(this).width(($(this).parent().height()/videoAspect)+'px'); } else { $(this).width($(this).parent().width()+'px'); $(this).height(($(this).parent().width()*videoAspect)+'px'); } $(this).css('opacity','1'); }); } $("header .langs-rap a.curr").click(function() { if ( $(this).parent().hasClass('opened') ) { $(this).parent().removeClass('opened'); return false; } }); $("header .langs-rap").click(function() { if ( !$(this).hasClass('opened') ) { $(this).addClass('opened'); return false; } }); $("header .search-rap form").submit(function() { if ( $(this).find("input.stext").val() == '' ) { $(this).addClass('ierror'); return false; } }); $("header .search-rap .open-search").click(function() { if ( $(this).parent().find("form:visible").length > 0 ) { $(this).parent().find("form").fadeOut(); } else { $(this).parent().find("form").fadeIn(); } }); $("header .search-rap .close").click(function() { $(this).parent().parent().fadeOut(); return false; }); $("header .hamburger").click(function() { if ( $("body").hasClass("hopened") ) { $("body").removeClass('hopened'); } else { $("body").addClass('hopened'); } }); $(".gallery-slides .nav").click(function() { if ( $(this).parent().find(".gslides-window").hasClass('sliding') ) { return; } $(this).parent().find(".gslides-window").addClass('sliding'); var next = true; if ( !$(this).hasClass('next') ) { next=false; } var left = parseInt($(this).parent().find(".gslides-long").css('left')); var width = (parseInt($(this).parent().find(".gslides-long .litem").first().css('margin-left').replace('px',''))*2) + parseInt($(this).parent().find(".gslides-long .litem").first().width()); if ( next ) { left -= width; var llast = parseInt($(this).parent().find(".gslides-long .litem").last().position().left)+width; if ( llast <= ( $(this).parent().find(".gslides-window").width() - left) ) { var ii = parseInt($(this).parent().find(".gslides-long .litem").last().attr('data-string'))+1; if ( $(this).parent().find('.gslides-long .litem[data-string="'+ii+'"]').length == 0 ) { ii=0; } $(this).parent().find('.gslides-long .litem[data-string="'+ii+'"]').first().clone().insertAfter($(this).parent().find('.gslides-long .litem').last()); } } else { $(this).parent().find('.gslides-long').attr('ttt',left); if ( left == 0 ) { var ii = parseInt($(this).parent().find(".gslides-long .litem").first().attr('data-string'))-1; if ( ii == -1 ) { ii=parseInt($(this).parent().find(".gslides-window").attr('data-string'))-1; } left -= width; $(this).parent().find('.gslides-long').css('left',left+'px'); $(this).parent().find('.gslides-long .litem[data-string="'+ii+'"]').last().clone().insertBefore($(this).parent().find('.gslides-long .litem').first()); sync=true; } left += width; } $(this).parent().find(".gslides-long").animate({left:left},function() { var lp = (parseFloat($(this).css('left').replace('px',''))/$(this).width())*100*100; $(this).css('left',lp+'%'); $(this).parent().find(".gslides-window").removeClass('sliding'); }); }); $(".open-video").each(function() { $(this).parent().find(".video-rap iframe").attr('src',$(this).parent().find(".video-rap iframe").attr('src')+'&autoplay=0&controls=0&rel=0&showinfo=0&iv_load_policy=3&modestbranding=1&disablekb=1&playsinline=0&cc_load_policy=0&cc_lang_pref=auto&enablejsapi=1&widgetid=1'); }); $(".open-video").click(function() { $(this).parent().find(".video-rap iframe")[0].contentWindow.postMessage('{"event":"command","func":"' + 'playVideo' + '","args":""}', '*'); $(this).addClass('hidden').parent().find(".video-rap").removeClass('hidden'); }); $(".goto").click(function() { if ( $(this).attr('data-string') ) { var hh = 0; if ( $("header").length > 0 ) { hh = $("header").height(); } var mtop = hh+25; if ( $(".elevatorMenu").length > 0 ) { mtop += $(".elevatorMenu").height(); } $("body,html").animate({scrollTop:($("#"+$(this).attr('data-string')).position().top-mtop)+'px'}); } }); $(".accord-rap .accord-open").click(function() { if ( $(this).hasClass('aclose') ) { $(this).parent().removeClass('opened'); } else { $(this).parent().addClass('opened'); } }); $(".open-sub").click(function() { if ( $(this).parent().hasClass('sopened') ) { $(this).parent().removeClass('sopened'); } else { $(this).parent().addClass('sopened'); } }); $(".wpcf7 .icheck input").change(function() { if ( $(this).is(':checked') ) { $(this).parent().parent().parent().parent().addClass('checked'); } else { $(this).parent().parent().parent().parent().removeClass('checked'); } }); $(".wpcf7 .icheck input").each(function() { if ( $(this).is(':checked') ) { $(this).parent().parent().parent().parent().addClass('checked'); } }); $(".wpcf7 .irap input,.wpcf7 .irap textarea,.checkbox-rap input").each(function() { if ( $(this).val() != '' ) { $(this).parent().parent().addClass('focus'); } }); $(".wpcf7 .irap input,.wpcf7 .irap textarea,.checkbox-rap input").focusin(function() { $(this).parent().parent().addClass('focus'); }); $(".wpcf7 .irap input,.wpcf7 .irap textarea,.checkbox-rap input").focusout(function() { if ( $(this).val() != '' ) { $(this).parent().parent().addClass('full'); } else { $(this).parent().parent().removeClass('full'); } $(this).parent().parent().removeClass('focus'); }); if ( $(".npopup").length > 0 ) { var npopTimeout = setTimeout(showPop, (parseFloat($(".npopup").attr('data-string'))*1000)); function showPop() { $(".npopup").fadeIn(); if ( $(".npopup").attr('mode') == 'once' ) { $.cookie("goolaKHpopHide", '1', { path: '/' }); } } $(".npopup .close").click(function() { $(".npopup").fadeOut(); $.cookie("goolaKHpopHide", '1', { path: '/' }); //Cookies.set('goolaKHpopHide', '1'); }); document.addEventListener( 'wpcf7mailsent', function( event ) { if ( $(".npopup").attr('fid') == event.detail.contactFormId ) { $.cookie("goolaKHpopHide", '1', { path: '/' }); } }, false ); } });