var header=jQuery('#header .header_mid_inner'), nav=jQuery('#navigation'), nav_left=nav.offset().left, mega=nav.find('> li.menu-item-mega'), header_width=header.width(), firstRun=true, rtl=jQuery('html').attr('dir'); jQuery(document).ready(function(){ cmsmastersMegaMenu(); }); jQuery(window).on('debouncedresize', function (){ setTimeout(function (){ cmsmastersMegaMenu(); }, 150); }); jQuery(window).on('debouncedscroll', function (){ cmsmastersMegaMenu(); }); function cmsmastersMegaMenu(){ var win_width=jQuery(window).width(), new_header_width=header.width(), header_pad_left=Number(header.css('padding-left').replace('px', '')), header_left=header.offset().left + header_pad_left, header_right=header_left + new_header_width, new_nav_left=nav.offset().left; if(firstRun || new_header_width!==header_width || new_nav_left!==nav_left ){ mega.each(function (){ var li=jQuery(this), full=li.hasClass('menu-item-mega-fullwidth'), drop_right=li.hasClass('menu-item-dropdown-right'), li_left=li.offset().left, mega=li.find('> div'); if(mega.length===1){ var mega_width=mega.outerWidth(), mega_left=mega.offset().left, mega_right=mega_left + mega_width; if(full){ mega.css({ width:new_header_width + 'px', right:'auto', left:'-' + (li_left - header_left) + 'px' }); }else{ if(mega_width >=new_header_width){ li.addClass('menu-item-mega-fullwidth menu-item-mega-dynamic-fullwidth').find('> div').css({ width:new_header_width + 'px', right:'auto', left:'-' + ((typeof(rtl)==='undefined') ? (li_left - header_left):(mega_right - header_right)) + 'px' }); }else{ if(drop_right){ if(typeof(rtl)==='undefined'){ if(mega_left < header_left){ mega.css({ right:'auto', left:'-' + (li_left - header_left) + 'px' }); }}else{ if(mega_right > header_right){ mega.css({ left:'-' + (mega_right - header_right) + 'px' }); }} }else{ if(typeof(rtl)==='undefined'){ if(mega_right > header_right){ mega.css({ left:'-' + (mega_right - header_right) + 'px' }); }else if(mega_left < header_left){ mega.css({ left:'-' + (li_left - header_left) + 'px' }); }}else{ if(mega_left < header_left){ mega.css({ right:'auto', left:'-' + (li_left - header_left) + 'px' }); }} }} } if(win_width < 1008){ mega.css({ width:'', right:'', left:'' }); mega.find('a').each(function (){ var a_style=jQuery(this).attr('style'), span_tag=jQuery(this).find('span'); jQuery(this).removeAttr('style').attr('data-style', a_style); span_tag.each(function (){ var span_style=jQuery(this).attr('style'); jQuery(this).removeAttr('style').attr('data-style', span_style); }); }); }else{ mega.find('a').each(function (){ var a_style=jQuery(this).attr('data-style'), span_tag=jQuery(this).find('span'); jQuery(this).removeAttr('data-style').attr('style', a_style); span_tag.each(function (){ var span_style=jQuery(this).attr('data-style'); jQuery(this).removeAttr('data-style').attr('style', span_style); }); }); }} }); nav_left=new_nav_left; } firstRun=false; } function cmsmastersMegaMenuDestroy(){ mega.each(function (){ var li=jQuery(this), mega=li.find('> div'); mega.css({ width:'', right:'', left:'' }); }); firstRun=true; }; (function($){ 'use strict'; if(typeof wpcf7==='undefined'||wpcf7===null){ return; } wpcf7=$.extend({ cached: 0, inputs: [] }, wpcf7); $(function(){ wpcf7.supportHtml5=(function(){ var features={}; var input=document.createElement('input'); features.placeholder='placeholder' in input; var inputTypes=[ 'email', 'url', 'tel', 'number', 'range', 'date' ]; $.each(inputTypes, function(index, value){ input.setAttribute('type', value); features[ value ]=input.type!=='text'; }); return features; })(); $('div.wpcf7 > form').each(function(){ var $form=$(this); wpcf7.initForm($form); if(wpcf7.cached){ wpcf7.refill($form); }}); }); wpcf7.getId=function(form){ return parseInt($('input[name="_wpcf7"]', form).val(), 10); }; wpcf7.initForm=function(form){ var $form=$(form); $form.submit(function(event){ if(! wpcf7.supportHtml5.placeholder){ $('[placeholder].placeheld', $form).each(function(i, n){ $(n).val('').removeClass('placeheld'); }); } if(typeof window.FormData==='function'){ wpcf7.submit($form); event.preventDefault(); }}); $('.wpcf7-submit', $form).after(''); wpcf7.toggleSubmit($form); $form.on('click', '.wpcf7-acceptance', function(){ wpcf7.toggleSubmit($form); }); $('.wpcf7-exclusive-checkbox', $form).on('click', 'input:checkbox', function(){ var name=$(this).attr('name'); $form.find('input:checkbox[name="' + name + '"]').not(this).prop('checked', false); }); $('.wpcf7-list-item.has-free-text', $form).each(function(){ var $freetext=$(':input.wpcf7-free-text', this); var $wrap=$(this).closest('.wpcf7-form-control'); if($(':checkbox, :radio', this).is(':checked')){ $freetext.prop('disabled', false); }else{ $freetext.prop('disabled', true); } $wrap.on('change', ':checkbox, :radio', function(){ var $cb=$('.has-free-text', $wrap).find(':checkbox, :radio'); if($cb.is(':checked')){ $freetext.prop('disabled', false).focus(); }else{ $freetext.prop('disabled', true); }}); }); if(! wpcf7.supportHtml5.placeholder){ $('[placeholder]', $form).each(function(){ $(this).val($(this).attr('placeholder')); $(this).addClass('placeheld'); $(this).focus(function(){ if($(this).hasClass('placeheld')){ $(this).val('').removeClass('placeheld'); }}); $(this).blur(function(){ if(''===$(this).val()){ $(this).val($(this).attr('placeholder')); $(this).addClass('placeheld'); }}); }); } if(wpcf7.jqueryUi&&! wpcf7.supportHtml5.date){ $form.find('input.wpcf7-date[type="date"]').each(function(){ $(this).datepicker({ dateFormat: 'yy-mm-dd', minDate: new Date($(this).attr('min')), maxDate: new Date($(this).attr('max')) }); }); } if(wpcf7.jqueryUi&&! wpcf7.supportHtml5.number){ $form.find('input.wpcf7-number[type="number"]').each(function(){ $(this).spinner({ min: $(this).attr('min'), max: $(this).attr('max'), step: $(this).attr('step') }); }); } wpcf7.resetCounter($form); $form.on('change', '.wpcf7-validates-as-url', function(){ var val=$.trim($(this).val()); if(val && ! val.match(/^[a-z][a-z0-9.+-]*:/i) && -1!==val.indexOf('.')){ val=val.replace(/^\/+/, ''); val='http://' + val; } $(this).val(val); }); }; wpcf7.submit=function(form){ if(typeof window.FormData!=='function'){ return; } var $form=$(form); $('.ajax-loader', $form).addClass('is-active'); wpcf7.clearResponse($form); var formData=new FormData($form.get(0)); var detail={ id: $form.closest('div.wpcf7').attr('id'), status: 'init', inputs: [], formData: formData }; $.each($form.serializeArray(), function(i, field){ if('_wpcf7'==field.name){ detail.contactFormId=field.value; }else if('_wpcf7_version'==field.name){ detail.pluginVersion=field.value; }else if('_wpcf7_locale'==field.name){ detail.contactFormLocale=field.value; }else if('_wpcf7_unit_tag'==field.name){ detail.unitTag=field.value; }else if('_wpcf7_container_post'==field.name){ detail.containerPostId=field.value; }else if(field.name.match(/^_wpcf7_\w+_free_text_/)){ var owner=field.name.replace(/^_wpcf7_\w+_free_text_/, ''); detail.inputs.push({ name: owner + '-free-text', value: field.value }); }else if(field.name.match(/^_/)){ }else{ detail.inputs.push(field); }}); wpcf7.triggerEvent($form.closest('div.wpcf7'), 'beforesubmit', detail); var ajaxSuccess=function(data, status, xhr, $form){ detail.id=$(data.into).attr('id'); detail.status=data.status; detail.apiResponse=data; var $message=$('.wpcf7-response-output', $form); switch(data.status){ case 'validation_failed': $.each(data.invalidFields, function(i, n){ $(n.into, $form).each(function(){ wpcf7.notValidTip(this, n.message); $('.wpcf7-form-control', this).addClass('wpcf7-not-valid'); $('[aria-invalid]', this).attr('aria-invalid', 'true'); }); }); $message.addClass('wpcf7-validation-errors'); $form.addClass('invalid'); wpcf7.triggerEvent(data.into, 'invalid', detail); break; case 'acceptance_missing': $message.addClass('wpcf7-acceptance-missing'); $form.addClass('unaccepted'); wpcf7.triggerEvent(data.into, 'unaccepted', detail); break; case 'spam': $message.addClass('wpcf7-spam-blocked'); $form.addClass('spam'); wpcf7.triggerEvent(data.into, 'spam', detail); break; case 'aborted': $message.addClass('wpcf7-aborted'); $form.addClass('aborted'); wpcf7.triggerEvent(data.into, 'aborted', detail); break; case 'mail_sent': $message.addClass('wpcf7-mail-sent-ok'); $form.addClass('sent'); wpcf7.triggerEvent(data.into, 'mailsent', detail); break; case 'mail_failed': $message.addClass('wpcf7-mail-sent-ng'); $form.addClass('failed'); wpcf7.triggerEvent(data.into, 'mailfailed', detail); break; default: var customStatusClass='custom-' + data.status.replace(/[^0-9a-z]+/i, '-'); $message.addClass('wpcf7-' + customStatusClass); $form.addClass(customStatusClass); } wpcf7.refill($form, data); wpcf7.triggerEvent(data.into, 'submit', detail); if('mail_sent'==data.status){ $form.each(function(){ this.reset(); }); wpcf7.toggleSubmit($form); wpcf7.resetCounter($form); } if(! wpcf7.supportHtml5.placeholder){ $form.find('[placeholder].placeheld').each(function(i, n){ $(n).val($(n).attr('placeholder')); }); } $message.html('').append(data.message).slideDown('fast'); $message.attr('role', 'alert'); $('.screen-reader-response', $form.closest('.wpcf7')).each(function(){ var $response=$(this); $response.html('').attr('role', '').append(data.message); if(data.invalidFields){ var $invalids=$('