var loading = '
';
$(document).ready(function() {
scrolling = false;
scroll = 0;
$(window).on('scroll', function (e) {
if (scroll > 0) {
if (isMobile()) {
checkScrollDirection();
scrollDestination = $('#header-container:first').position().top - scrollAmount;
if (scrollDestination < -$('#header-container:first').height()) scrollDestination = -$('#header-container:first').height();
if (scrollDestination > 0) scrollDestination = 0;
$('#header-container:first').css({top: scrollDestination+'px'});
}
$('.spinner-static', 'body').each(function(){
var checkVisible = checkVisibility($(this));
if (checkVisible) {
var spinnnerSpeed = $(this).data('speed');
rotation = spinnnerSpeed / 100 * $(window).scrollTop();
$(this).rotate(rotation);
}
});
$('.infinite-scroll-data', 'body').each(function(){
var that = $(this), source = $(this).data('source'), where = $(this).data('where'), limit = $(this).data('limit'), offset = $(this).data('offset'), extra_class = $(this).data('extra_class'), checkInfiniteScrollVisible = checkVisibility(that);
if (checkInfiniteScrollVisible && !scrolling) {
scrolling = true;
$.ajax({
'url': build_url(that.data('src')),
'type': 'POST',
'cache': false,
'data': {
'source' : source,
'where' : where,
'limit' : limit,
'offset' : offset,
'extra_class' : extra_class
},
'success': function(response) {
$(that.data('append-to')).append(response);
that.data('offset',limit+offset);
scrolling = false;
socialShare();
},
'beforeSend': function() {},
'complete': function() { try { Sirv.start(); fancyBox(); } catch(err) {} }
});
}
});
if ($('.news-side-scroll').length) {
var scrollBottom = $(window).scrollTop() + $(window).height() + 350;
if ( scrollBottom > $(document).height() ) {
$('.news-side-scroll').addClass('news-side-scroll-fixed');
} else {
$('.news-side-scroll').removeClass('news-side-scroll-fixed');
}
}
if ($('.whatsAppFormShow').length) {
var scrollBottom = $(window).scrollTop() + $(window).height() + 350;
if ( scrollBottom > $(document).height() ) {
$('.whatsAppFormShow').addClass('news-side-scroll-fixed');
} else {
$('.whatsAppFormShow').removeClass('news-side-scroll-fixed');
}
}
}
scroll = 1;
});
if (!isMobile() && $('.newsletter-reminder-container').length) {
var reminderReadTime = $('#reminderReadTime').val();
setTimeout(function() {
$('.newsletter-reminder-container').slideToggle();
}, reminderReadTime);
$(document).on('click','.newsletter-reminder-container-close', function(){
$('.newsletter-reminder-container').slideToggle();
setCookie('hideReminderNewsletterAlert-'+$('#reminderEventID').val(), true, 7);
});
}
/* CRM PEOPLE ROUND PLUS HOVER */
$(document).on('mouseenter','.crm-people-round-plus a',function() {
$(this).parent().find('.crm-people-round-plus-hover').fadeIn();
$(this).parent().find('.crm-people-round-plus-text').fadeIn();
}).on('mouseleave','.crm-people-round-plus a',function() {
$(this).parent().find('.crm-people-round-plus-hover').fadeOut();
$(this).parent().find('.crm-people-round-plus-text').fadeOut();
});
$(document).on('mouseenter','.crm-people-round-plus .crm-people-round-plus-plus a',function(){
$(this).parent().parent().find('.crm-people-round-plus-hover').fadeIn();
$(this).parent().parent().find('.crm-people-round-plus-text').fadeIn();
}).on('mouseleave','.crm-people-round-plus .crm-people-round-plus-plus a',function() {
$(this).parent().parent().find('.crm-people-round-plus-hover').fadeOut();
$(this).parent().parent().find('.crm-people-round-plus-text').fadeOut();
});
/* CRM PEOPLE ROUND PLUS HOVER */
/* NEWS FOR YOU HOVER */
$(document).on('mouseenter','.news-block-item',function() {
var that = $(this);
that.find('.news-block-hover').fadeIn(400, function() {
that.find('.news-block-text').animate({
bottom: '60'
}, 400);
that.find('.news-block-more').fadeIn(1000);
});
}).on('mouseleave','.news-block-item',function(){
var that = $(this);
that.find('.news-block-hover').fadeOut(400, function() {
that.find('.news-block-text').animate({
bottom: '30'
}, 400);
that.find('.news-block-more').fadeOut();
});
})
/* NEWS FOR YOU HOVER */
/* RELATED EVENTS HOVER */
$(document).on('mouseenter','.related-events-block-item',function() {
$(this).find('.related-events-block-hover').fadeIn(400);
}).on('mouseleave','.related-events-block-item',function(){
$(this).find('.related-events-block-hover').fadeOut(400);
});
/* RELATED EVENTS HOVER */
/* DESTAQUE HOVER */
$(document).on('mouseenter','.news-destaque-hover',function() {
$(this).find('.news-events-fadein-hover').fadeIn();
}).on('mouseleave','.news-destaque-hover',function(){
$(this).find('.news-events-fadein-hover').fadeOut();
});
/* DESTAQUE HOVER */
$(document).on('mouseenter','.site-events-button a',function() {
$(this).css('border-color', $(this).data('border')).css('background', $(this).data('texto')).css('color', $(this).data('fundo'));
}).on('mouseleave','.site-events-button a',function(){
$(this).css('border-color', $(this).data('border')).css('background', $(this).data('fundo')).css('color', $(this).data('texto'));
})
/* NEWSLETTER */
$(document).on('keypress', '#EventUpdateEmail', function(ev){
var keycode = (ev.keyCode ? ev.keyCode : ev.which);
if (keycode == '13') {
ev.preventDefault();
newsletter_function($(this).data('sufix'));
return;
}
});
$(document).on('keypress', '#HubNewsletterFirstName', function(ev){
var keycode = (ev.keyCode ? ev.keyCode : ev.which);
if (keycode == '13') {
ev.preventDefault();
newsletter_function($(this).data('sufix'));
return;
}
});
$(document).on('keypress', '#HubNewsletterEmail', function(ev){
var keycode = (ev.keyCode ? ev.keyCode : ev.which);
if (keycode == '13') {
ev.preventDefault();
newsletter_function($(this).data('sufix'));
return;
}
});
$(document).on('click','.hubnews-newsletter-email-button', function(){
newsletter_function($(this).data('sufix'));
return;
});
$(document).on('click','.event-top-image-newsletter-email-button', function(){
newsletter_function($(this).data('sufix'));
return;
});
/* WHATSAPP */
$("#whatsAppFormShow").click(function(event){
event.preventDefault();
$("#whatsAppForm").fadeIn(400, function() {
window.dispatchEvent(new Event('resize'));
});
$(".whatsAppFormShow img").fadeOut(400);
});
$("#whatsAppFormClose").click(function(event){
event.preventDefault();
$("#whatsAppForm").hide("fade");
$(".whatsAppFormShow img").fadeIn(200);
});
$("#whatsAppSendData").click(function(event){
// if (!whatsAppAlertText) whatsAppAlertText = $('.newsletter-spam-alert'+sufix).html();
var SalesForceFields = $('input[name="WhatsApp_SalesForceFields"]').val(),
postURL = $('input[name="WhatsApp_postURL"]').val(),
formID = $('input[name="WhatsApp_formID"]').val(),
targetID = $('input[name="WhatsApp_targetID"]').val();
$.ajax({
'url': 'admin_oper/hub_download_send',
'type': 'POST',
'cache': false,
'data': $('#whatsApp_form').serializeArray(),
'dataType': 'json',
'success': function(response) {
if (response.status == 'sucesso') {
if (isset(SalesForceFields)) sendSalesForce($('#whatsApp_form'), SalesForceFields, postURL, formID, targetID);
// var mensagemWhats = 'Hello, my name is "'+$("input[name='WhatsApp_FirstName']").val()+' '+$("input[name='WhatsApp_LastName']").val()+'", I work for "'+$("input[name='WhatsApp_Company']").val()+'", my phone number is "'+$("input[name='WhatsApp_Phone']").val()+'", my email is "'+$("input[name='WhatsApp_Email']").val()+'".', apiVar = 'web';
var mensagemWhats = 'Hi, this is "'+$("input[name='WhatsApp_FirstName']").val()+' '+$("input[name='WhatsApp_LastName']").val()+'" from "'+$("input[name='WhatsApp_Company']").val()+'". Please get back to me.', apiVar = 'web';
if (isMobile()) apiVar = 'api';
window.open('https://'+apiVar+'.whatsapp.com/send?phone='+$("input[name='whatsappPhoneNumber']").val()+'&text='+mensagemWhats, 'whatsappShareWindow', 'height=800, width=1000, top=' + ($(window).height() / 2 - 400 + 50) + ', left=' + ($(window).width() / 2 - 500) + ', toolbar=0, location=0, menubar=0, directories=0, scrollbars=0, scrolling=no');
$("input[name='WhatsApp_FirstName']").val('');
$("input[name='WhatsApp_LastName']").val('');
$("input[name='WhatsApp_Company']").val('');
$("input[name='WhatsApp_MobilePhone']").val('');
$("input[name='WhatsApp_Email']").val('');
$("#whatsAppForm").hide("fade");
$(".whatsAppFormShow img").fadeIn(200);
} else {
$('.send-text').html(response.msg);
$('input[name="'+response.field+'"]').focus();
}
/*
$("input.hubnews-newsletter-email"+sufix+"[name='"+emailField+"']").val('');
$('.hubnews-newsletter-email-button'+sufix).show();
$('.hubnews-newsletter-email-loading'+sufix).hide();
$('.newsletter-spam-alert'+sufix).css({'color' : 'green'})
$('.newsletter-spam-alert'+sufix).html('Successful registration');
if (newsletterMsgBox) clearTimeout(newsletterMsgBox);
newsletterMsgBox = setTimeout(function() {
$('.send-text').html(whatsAppAlertText);
$('.newsletter-spam-alert').css({'color' : '#000'})
newsletterMsgBox = false;
}, 5000);
*/
},
'beforeSend': function() {},
'complete': function() {}
});
});
$(".whatsAppDirectContact").click(function(event){
var mensagemWhats = apiVar = 'web'; if (isMobile()) apiVar = 'api';
window.open('https://'+apiVar+'.whatsapp.com/send?phone='+$(this).data('mobile')+'&text='+$(this).data('message'), 'whatsappShareWindow', 'height=800, width=1000, top=' + ($(window).height() / 2 - 400 + 50) + ', left=' + ($(window).width() / 2 - 500) + ', toolbar=0, location=0, menubar=0, directories=0, scrollbars=0, scrolling=no');
});
$(".cookies_alert_fechar").click(function(event){
$(".cookies_alert").hide();
setCookie('hideCookieAlert', true, 30);
});
$(".rodape_email_fechar").click(function(event){
$(".rodape_email").hide();
setCookie('hideRodapeEmail', true, 30);
});
$(".cookies_alert_form_button").click(function(event){
$(".cookies_alert").hide();
setCookie('hideCookieAlert', true, 30);
});
var formContactMsgBox = false;
$('.form_contato').submit(function(event){
event.preventDefault();
var that = $(this),
formContactMsgBoxTimeout = 8000,
prefixo = $(this).find('input[name="prefixo"]').val(),
SalesForceFields = $(this).find('input[name="'+prefixo+'SalesForceFields"]').val(),
postURL = $(this).find('input[name="'+prefixo+'postURL"]').val(),
formID = $(this).find('input[name="'+prefixo+'formID"]').val(),
targetID = $(this).find('input[name="'+prefixo+'targetID"]').val(),
download_url = $(this).find('input[name="download_url"]').val(),
download_filename = $(this).find('input[name="download_filename"]').val(),
download_target = $(this).find('input[name="download_target"]').val();
$.ajax({
'url': 'admin_oper/hub_download_send',
'type': 'POST',
'cache': false,
'data': that.serializeArray(),
'dataType': 'json',
'success': function(response) {
if (response.status == 'sucesso') {
var n = formContactMsgBoxTimeout / 1000;
if (isset(SalesForceFields)) sendSalesForce(that, SalesForceFields, postURL, formID, targetID);
if (download_target == 'download')
download_file(download_url, download_filename);
else if (download_target == '_blank')
window.open(download_url, 'form_download');
else if (download_target == '_self')
window.top.location.href = download_url;
that.trigger('reset');
that.find('.result').css({'color' : 'green'});
that.find('.result').html(response.msg+' ('+n+')');
if (formContactMsgBox) clearTimeout(formContactMsgBox);
function countDownMsgBox() {
n--;
that.find('.result').html(response.msg+' ('+n+')');
if (n > 0) formContactMsgBox = setTimeout(countDownMsgBox, 1000); else {
that.find('.result').html('');
formContactMsgBox = false;
parent.$.fancybox.close();
}
}
formContactMsgBox = setTimeout(countDownMsgBox, 1000);
} else {
that.find('.result').css({'color' : 'red'});
that.find('.result').html(response.msg);
that.find('input[name="'+response.field+'"]').focus();
if (formContactMsgBox) clearTimeout(formContactMsgBox);
formContactMsgBox = setTimeout(function() {
that.find('.result').html('');
formContactMsgBox = false;
}, formContactMsgBoxTimeout);
}
},
'beforeSend': function() {},
'complete': function() {}
});
return;
});
$(document).on('mouseenter','.events-menu-button',function() {
$(this).find('.event-bullet').addClass('event-bullet-hover');
}).on('mouseleave','.events-menu-button',function() {
$(this).find('.event-bullet').removeClass('event-bullet-hover');
});
$('.events-prev-menu-button').click(function(event){
event.preventDefault();
$('.events-next-menu-button').find('.event-bullet').removeClass('event-bullet-active');
$('.events-prev-menu-button').find('.event-bullet').addClass('event-bullet-active');
$('.events-next-block-container').fadeOut(400).promise().done(function() {
$('.events-prev-block-container').fadeIn(400, function() { window.dispatchEvent(new Event('resize')); });
});
});
$('.events-next-menu-button').click(function(event){
event.preventDefault();
$('.events-prev-menu-button').find('.event-bullet').removeClass('event-bullet-active');
$('.events-next-menu-button').find('.event-bullet').addClass('event-bullet-active');
$('.events-prev-block-container').fadeOut(400).promise().done(function() {
$('.events-next-block-container').fadeIn(400, function() { window.dispatchEvent(new Event('resize')); });
});
});
$('.open-submenu').click(function() {
event.preventDefault();
var that = $(this);
itemClass = ''; if (isset($(this).data('item-class'))) itemClass = $(this).data('item-class');
if ($('.mobile-submenu-'+itemClass).is(':visible')) {
$('.sub-menu-arrow svg').rotate(0);
$('.mobile-submenu-'+itemClass).slideUp(400).promise().done(function() {
});
} else {
$('.sub-menu-arrow svg').rotate(0);
that.find('span svg').rotate(90);
$('.mobile-submenu').slideUp(400, function() {});
$('.mobile-submenu-'+itemClass).slideDown(400, function() {
$('.mobile-nav').animate({scrollTop: $('.mobile-submenu-anchor-'+itemClass).offset().top},'slow');
});
}
});
menuStart();
toolTip();
adjustSelect2();
});
window.onload = function() {
if ($(window).scrollTop() > 0) {
window.dispatchEvent(new Event('resize'));
window.dispatchEvent(new Event('scroll'));
}
}
var SirvOptions = {
image: {
threshold: 400
}
};
function socialShare() {
$('.facebook-share').click(function(e) {
e.preventDefault();
window.open('https://www.facebook.com/sharer/sharer.php?u='+$(this).data('share-url')+'&source=GRIClub', 'facebookShareWindow', 'height=400, width=600, top=' + ($(window).height() / 2 - 200 + 50) + ', left=' + ($(window).width() / 2 - 300) + ', toolbar=0, location=0, menubar=0, directories=0, scrollbars=0');
return false;
});
$('.linkedin-share').click(function(e) {
e.preventDefault();
window.open('https://www.linkedin.com/shareArticle?mini=true&url='+$(this).data('share-url')+'&summary='+$(this).data('share-text')+'&source=GRIClub', 'linkedinShareWindow', 'height=600, width=1080, top=' + ($(window).height() / 2 - 300 + 50) + ', left=' + ($(window).width() / 2 - 540) + ', toolbar=0, location=0, menubar=0, directories=0, scrollbars=0, scrolling=no');
return false;
});
$('.twitter-share').click(function(e) {
e.preventDefault();
window.open('https://twitter.com/intent/tweet?url='+$(this).data('share-url')+'&text='+$(this).data('share-text')+'&hashtags='+$(this).data('share-hashtags')+'&source=GRIClub', 'twitterShareWindow', 'height=480, width=600, top=' + ($(window).height() / 2 - 240 + 50) + ', left=' + ($(window).width() / 2 - 300) + ', toolbar=0, location=0, menubar=0, directories=0, scrollbars=0, scrolling=no');
return false;
});
var apiVar = 'web'; if (isMobile()) apiVar = 'api';
$('.whatsapp-share').click(function(e) {
e.preventDefault();
window.open('https://'+apiVar+'.whatsapp.com/send?text='+$(this).data('share-url'), 'whatsappShareWindow', 'height=800, width=1000, top=' + ($(window).height() / 2 - 400 + 50) + ', left=' + ($(window).width() / 2 - 500) + ', toolbar=0, location=0, menubar=0, directories=0, scrollbars=0, scrolling=no');
return false;
});
}
$(document).on('resize orientationchange', function() {
if ($('.slick-initialized').length) $('.slick-initialized').slick('resize');
});
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires="+ d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
var newsletterMsgBox = false;
var spamAlertText = false;
function newsletter_function(sufix) {
$('.hubnews-newsletter-email-button'+sufix).hide();
$('.hubnews-newsletter-email-loading'+sufix).show();
var newsletterMsgBoxTimeout = 8000,
prefixo = $('#newsletter_form'+sufix).find('input[name="prefixo"]').val(),
SalesForceFields = $('#newsletter_form'+sufix).find('input[name="'+prefixo+'SalesForceFields"]').val(),
postURL = $('#newsletter_form'+sufix).find('input[name="'+prefixo+'postURL"]').val(),
formID = $('#newsletter_form'+sufix).find('input[name="'+prefixo+'formID"]').val(),
targetID = $('#newsletter_form'+sufix).find('input[name="'+prefixo+'targetID"]').val();
if (!spamAlertText) spamAlertText = $('.newsletter-spam-alert'+sufix).html();
spamAlertTextColor = $('.newsletter-spam-alert'+sufix).css('color');
if (!spamAlertTextColor) spamAlertTextColor = '#000000';
$.ajax({
'url': 'admin_oper/hub_download_send',
'type': 'POST',
'cache': false,
'data': $('#newsletter_form'+sufix).serializeArray(),
'dataType': 'json',
'success': function(response) {
if (response.status == 'sucesso') {
var n = newsletterMsgBoxTimeout / 1000;
if (isset(SalesForceFields)) sendSalesForce($('#newsletter_form'+sufix), SalesForceFields, postURL, formID, targetID);
$('#newsletter_form'+sufix).trigger('reset');
$('.hubnews-newsletter-email-button'+sufix).show();
$('.hubnews-newsletter-email-loading'+sufix).hide();
$('.newsletter-spam-alert'+sufix).css({'color' : 'green'});
$('.newsletter-spam-alert'+sufix).html(response.msg+' ('+n+')');
if (newsletterMsgBox) clearTimeout(newsletterMsgBox);
function countNewsletterMsgBox() {
n--;
$('.newsletter-spam-alert'+sufix).html(response.msg+' ('+n+')');
if (n > 0) newsletterMsgBox = setTimeout(countNewsletterMsgBox, 1000); else {
$('.newsletter-spam-alert'+sufix).css({'color' : spamAlertTextColor});
$('.newsletter-spam-alert'+sufix).html(spamAlertText);
newsletterMsgBox = false;
if (!isMobile() && $('.newsletter-reminder-container').length) {
$('.newsletter-reminder-container').slideToggle();
setCookie('hideReminderNewsletterAlert-'+$('#reminderEventID').val(), true, 7);
}
}
}
newsletterMsgBox = setTimeout(countNewsletterMsgBox, 1000);
} else {
$('.hubnews-newsletter-email-button'+sufix).show();
$('.hubnews-newsletter-email-loading'+sufix).hide();
$('.newsletter-spam-alert'+sufix).css({'color' : 'red'});
$('.newsletter-spam-alert'+sufix).html(response.msg);
if (newsletterMsgBox) clearTimeout(newsletterMsgBox);
newsletterMsgBox = setTimeout(function() {
$('.newsletter-spam-alert'+sufix).css({'color' : spamAlertTextColor});
$('.newsletter-spam-alert'+sufix).html(spamAlertText);
newsletterMsgBox = false;
}, newsletterMsgBoxTimeout);
$('#newsletter_form'+sufix).find('input[name="'+response.field+'"]').focus();
}
},
'beforeSend': function() {},
'complete': function() {}
});
}
function isMobile() {
var isMobile = false;
if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent)
|| /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0,4))) {
isMobile = true;
}
return isMobile;
}
function validateEmail($email) {
var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,6})?$/;
return ($email.length > 0 && emailReg.test($email))
}
var windowHeight = $(window).height();
$(window).on('resize orientationchange', function() {
windowHeight = $(window).height();
// if (!isMobile()) menuStart();
});
function checkVisibility(elm, evalType) {
evalType = evalType || 'visible';
var vpH = windowHeight, // Viewport Height
st = $(window).scrollTop(), // Scroll Top
y = elm.offset().top,
elementHeight = $(elm).height();
if (evalType === 'visible') return ((y < (vpH + st)) && (y > (st - elementHeight)));
if (evalType === 'above') return ((y < (vpH + st)));
if (evalType === 'below') return ((y > (st - elementHeight)));
}
var scrollAmount = scrollDirection = lastScreenTop = 0;
function checkScrollDirection() {
scroolTop = $(window).scrollTop();
if (scroolTop > lastScreenTop) { scrollDirection = 'down'; retono_moving = 1; }
else if (scroolTop == lastScreenTop) { retono_moving = 0; }
else { scrollDirection = 'up'; retono_moving = 1; }
scrollAmount = scroolTop - lastScreenTop;
lastScreenTop = scroolTop <= 0 ? 0 : scroolTop;
// if (!retono_moving) {
// return scrollDirection;
// }
}
jQuery.fn.rotate = function(degrees) {
$(this).css({'-webkit-transform' : 'rotate('+ degrees +'deg)', '-moz-transform' : 'rotate('+ degrees +'deg)', '-ms-transform' : 'rotate('+ degrees +'deg)', '-o-transform' : 'rotate('+ degrees +'deg)', 'transform' : 'rotate('+ degrees +'deg)'});
};
function toolTip() {
/*
$('[title]:not(.no-title)', 'body').each(function(){
$(this).tooltip({
'html':true,
container: 'body'
});
});
*/
}
function adjustSelect2() {
// BUG do select2 que adiciona um title indesejavel
$('.select2-selection__rendered').attr('title','');
$('.select2-selection__choice').attr('title','');
}
function build_url(link, sufix) {
if (sufix === false) return base_url+link;
else return base_url+link+url_sufix;
}
function isset(myVariable) {
if (typeof myVariable !== 'undefined' && myVariable) return true;
}
function updateURL(queryString) {
if (history.pushState) {
if (isset(queryString)) {
if (queryString.charAt(0) != "?") queryString = '?' + queryString;
var newurl = window.location.protocol + "//" + window.location.host + window.location.pathname + queryString;
} else {
var newurl = window.location.protocol + "//" + window.location.host + window.location.pathname;
}
window.history.pushState({path:newurl},'',newurl);
}
}
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, '\\$&');
var regex = new RegExp('[?&]' + name + '(=([^]*)|&|#|$)'),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, ' '));
}
function goToByScroll(classe, offset, removeMenu) {
if (!isset(offset)) offset = 0;
if (!isset(removeMenu)) removeMenu = 'yes';
offset = parseInt(offset, 10);
$('html,body').animate({scrollTop: $(classe).offset().top-offset},'slow');
if ((isMobile() && removeMenu == 'yes') || removeMenu == 'force') {
$('body').removeClass('mobile-nav-active');
showMenu = 1;
}
}
function sendSalesForce(objForm, SalesForceFields, postURL, formID, targetID) {
var data = {};
$(objForm).serializeArray().map(function(x){data[x.name] = x.value;});
postURL = 'https://pub.s7.exacttarget.com/'+postURL+'/smartcapture/post';
data = JSON.stringify(data, SalesForceFields.split(','));
var payload = {
formID: formID,
targetID: targetID,
targetType: 'dataExtension',
attributes: data,
withTriggeredSend: '',
isJourneyBuilderIntegrated: false
};
$.ajax({
url: postURL,
type: 'post',
dataType: 'json',
data: payload,
success: function(response) { return; },
complete: function(response) { return; },
error: function(XMLHttpRequest, textStatus, errorThrown) { return; }
});
return false;
}
function updateMenu(page) {
$('#menu .menu_line').show();
$('#menu_box .menu_active').removeClass('on').removeClass('menu_active');
$('#menu_box .'+page).addClass('on').addClass('menu_active');
offset = $('#menu_box .'+page+' a').offset().left,
menuOffset = $('#menu_box').offset().left;
TweenMax.to($('#menu .menu_line'), 0.5, {
css:{
width: $('#menu_box .'+page+' a').outerWidth()+'px',
left: (offset-menuOffset)+'px'
},
overwrite:'all',
ease:Back.easeOut
});
}
function menuStart() {
Menu._init();
}
var Menu = {
doScroll: 1,
$header: null,
$nav: null,
$navigation: null,
didScroll: !1,
shrinkOn: 60,
docElem: document.documentElement,
_init: function() {
Menu.$header = $('#header-container:first'), Menu.$nav = Menu.$header.find('nav:first'), Menu.$navigation = $('.nav'), $(window).on('scroll', function() {
Menu.didScroll || (Menu.didScroll = !0, setTimeout(Menu._onScroll, 250))
}), setTimeout(Menu._onResize, 210), $(window).on('resize orientationchange', function() {
Menu._onResize()
}), Menu._mobile()
},
_onScroll: function() {
if (Menu.doScroll) {
var t = Menu._getScrollY();
t >= Menu.shrinkOn ? (Menu.$header.addClass('menu-shrink'), Menu.$navigation.addClass('nav-shrink'),$('.apply-consideration-button.submenu-buttons-fixed').show()) : (Menu.$header.removeClass('menu-shrink'), Menu.$navigation.removeClass('nav-shrink'), $('.apply-consideration-button.submenu-buttons-fixed').hide()), Menu.didScroll = !1;
}
},
_getScrollY: function() {
return window.pageYOffset || Menu.docElem.scrollTop
},
_onResize: function() {
if (Menu.doScroll) {
$(window).trigger('scroll'), Menu.$nav.is(':visible') && (Menu.$nav.css({
position: 'absolute',
}), setTimeout(function() {
Menu.$navigation.css({
position: 'fixed',
zIndex: 999999,
opacity: 1
})
}, 1200))
}
},
_mobile: function() {
$('.mobile-nav-anchor:first, .mobile-nav-close:first').on('click touchstart', function(t) {
return t.preventDefault(), $('body').toggleClass('mobile-nav-active'), !1;
})
}
};
function download_file(file_url, file_name) {
var anchor = document.createElement('a');
anchor.href = file_url;
anchor.target = '_blank';
anchor.download = file_name;
anchor.click();
}
$(document).on('click','.postlink',function() {
var form = document.createElement('form');
form.method = 'post';
form.action = this.protocol+'//'+this.hostname+this.pathname;
$.each(this.search.slice(1).split(/[&;]/g), function() {
var ix = this.indexOf('=');
if (ix===-1) return;
var input = document.createElement('input');
input.type = 'hidden';
input.name = decodeURIComponent(this.slice(0, ix));
input.value = decodeURIComponent(this.slice(ix+1));
form.appendChild(input);
});
document.body.appendChild(form);
form.submit();
return false;
});
$.fn.scrollStopped = function(callback) {
var that = this, $this = $(that);
$this.scroll(function(ev) {
clearTimeout($this.data('scrollTimeout'));
$this.data('scrollTimeout', setTimeout(callback.bind(that), 150, ev));
});
};