$(function() {
$('#footer-news').load('/news_footer');
$('a[href*="http"]').each(function() {
if($(this).hasClass('feature-link')) {
// stop double opens
if($(this).attr('href').match(/http(s)?:\/\/(.*\.)?chordant\.io/i)) {
$(this).attr("data-new-window","true");
$(this).attr("data-disable-disclaimer","true");
return true;
}
} else {
if($(this).hasClass('zoom-image')) {
return true;
}
if($(this).attr('data-no-new-window') == 'true') {
return true;
}
if($(this).attr('href').match(/http(s)?:\/\/(.*\.)?interdigital\.com/i)) {
return true;
}
if($(this).attr('href').match(/http(s)?:\/\/(.*\.)?chordant\.io/i)) {
$(this).attr("data-new-window","true");
$(this).attr("data-disable-disclaimer","true");
return true;
}
if($(this).attr('href').match(/workforcenow\.adp\.com/i)) {
return true;
}
if($(this).attr('href').match(/files\.shareholder\.com/i)) {
return true;
}
if($(this).attr('href').match(/www\.virtualshareholdermeeting\.com/i)) {
return true;
}
$(this).click(function(event) {
alert('LEGAL DISCLAIMER: This is a hyperlink to an unrelated third party website. It is provided for your convenience and for informational purposes only. InterDigital assumes no responsibility for any circumstances arising out of the use, misuse, interpretation or application of any information or other material provided on this third party website');
window.open($(this).attr('href'));
event.preventDefault();
})
}
})
if($('#secondary-nav').length > 0) {
var sticky = new Waypoint.Sticky({
element: $('#secondary-nav')[0],
offset: 66
});
}
/* Vault Video */
var isIE8 = $('.lt-ie9').length;
$('#embed_code').click(function(event) {
openMessi(); // Defined on the page with Messi on it.
event.preventDefault();
});
var played = false;
if($('#video-control').length > 0) {
if($('#video-control video').attr('data-form-filled') == 'yes') {
gated = "Gated";
} else {
gated = "Not Gated";
}
videojs("video-control").ready(function(){
this.on("play", function() {
if(played == false) {
//send event to Analytics
ga('send', 'event', 'Vault Video', 'Video Play Clicked', gated);
if(typeof(postCallToAction) == "function") {
postCallToAction(); //defined in call to action page
}
played = true;
}
})
});
};
$('#cta-download').click(function(event) {
console.log('IS THIS RUNNING AT ALL?');
if($(this).attr('data-form-filled') == 'yes') {
gated = "Gated";
} else {
gated = "Not Gated";
}
console.log($('.linkedin-tracking-container-div').length);
if ($('.linkedin-tracking-container-div').length > 0) {
console.log('RAN?');
var s = document.createElement("script");
s.type = "text/javascript";
s.src = "https://s3.amazonaws.com/files.interdigital.com/55bd0288af0b0930ba599bd0c4b7ca38/resources/js/linkedin-tracking.js";
// Use any selector
$("head").append(s);
}
//send event to Analytics
ga('send', 'event', 'Vault Asset', 'Download Click', gated);
if(typeof(postCallToAction) == "function") {
postCallToAction(); //defined in call to action page
}
});
$('#embed_code').click(function(event) {
if($(this).attr('data-form-filled') == 'yes') {
gated = "Gated";
} else {
gated = "Not Gated";
}
//send event to Analytics
ga('send', 'event', 'Vault Video', 'Embed Click', gated);
if(typeof(postCallToAction) == "function") {
postCallToAction(); //defined in call to action page
}
});
/* ID FORMS */
$('.id-form .submit').click(function(event) {
event.preventDefault();
$(this).closest('form').find('.error-message').hide();
$(this).closest('form').find('.error-message ul li').remove();
is_valid = true;
$.each($(this).closest('form').find('input[data-required="true"]'), function(index) {
if(this.type == 'email') {
if(!validateEmail($(this).val())) {
is_valid = false;
$(this).parent().addClass('has-error');
$('.error-message ul').append('
' + $(this).attr('data-field-name') + ' is invalid.');
$('.error-message').show();
} else {
$(this).parent().removeClass('has-error');
}
} else {
if($(this).val() == '') {
is_valid = false;
$(this).parent().addClass('has-error');
$('.error-message ul').append('' + $(this).attr('data-field-name') + ' is invalid.');
$('.error-message').show();
} else {
$(this).parent().removeClass('has-error');
}
}
});
if(!is_valid) {
return event.preventDefault();
}
$('.id-form').attr('action', $('#pardot_form_handler').val() + '?success_location=' + $('#redirect_url').val());
//send to a different form handler when testing
if($('#company').val() == "Test Company") {
$('.id-form').attr('action', 'http://ww2.interdigital.com/l/45252/2014-07-17/7dmr?success_location=' + $('#redirect_url').val());
}
$('.id-form').submit();
});
var submitted = false;
$('.id-form').submit(function(event) {
if(submitted) {
analytics_name = 'Form'
if($(this).find('#analytics_form').length > 0 && $(this).find('#analytics_form').val().trim() !== '') {
analytics_name = $(this).find('#analytics_form').val();
}
//send event to Analytics
ga('send', 'event', analytics_name, 'Submit');
return true;
}
submitted = true;
$('#cta_first_name').val($('#first_name').val());
$('#cta_last_name').val($('#last_name').val());
$('#cta_email').val($('#email').val());
$('#cta_company').val($('#company').val());
$('#cta_title').val($('#title').val());
$('#cta_phone').val($('#phone').val());
$.ajax({
url: '/calls_to_action/',
type: 'POST',
data: $('.id-form').serialize(),
dataType:"json"
}).done(function() {
$('.id-form').submit();
});
event.preventDefault();
});
/* Vault CTA */
$('#cta_form .submit').click(function(event) {
$('.error-message').hide();
$('.error-message ul li').remove();
is_valid = true
$.each([['First Name', 'first_name'], ['Last Name', 'last_name'], ['Company', 'company']], function(index, value) {
if($.trim($('#' + value[1]).val()) == '') {
is_valid = false;
$('#'+value[1]).parent().addClass('has-error');
$('.error-message ul').append('' + value[0] + ' is invalid.');
$('.error-message').show();
} else {
$('#'+value[1]).parent().removeClass('has-error');
}
});
if(!validateEmail($('#email').val())) {
is_valid = false;
$('#email').parent().addClass('has-error');
$('.error-message ul').append('Email is invalid.');
$('.error-message').show();
}
if(!is_valid) {
return event.preventDefault();
}
//send to a different form handler when testing
if($('#company').val() == "Test Company") {
$('#cta_form').attr('action', 'http://ww2.interdigital.com/l/45252/2014-07-17/7dmr?success_location=' + $('#redirect_url').val());
}
$('#cta_form').submit();
event.preventDefault();
});
var submitted = false;
$('#cta_form').submit(function(event) {
if(submitted) {
//send event to Analytics
ga('send', 'event', 'Vault Registration', 'Submit');
return true;
}
submitted = true;
$('#cta_first_name').val($('#first_name').val());
$('#cta_last_name').val($('#last_name').val());
$('#cta_email').val($('#email').val());
$('#cta_company').val($('#company').val());
$('#cta_title').val($('#title').val());
$('#cta_phone').val($('#phone').val());
$.ajax({
url: '/calls_to_action/',
type: 'POST',
data: $('#cta_form').serialize(),
dataType:"json"
}).done(function() {
$('#cta_form').submit();
});
event.preventDefault();
});
/* resize videos for small screens */
// Find all iframes
var $allVideos = $(".mainbody iframe")
// Figure out and save aspect ratio for each video
$allVideos.each(function() {
//wrap them in the wrapper that has the max width
$(this).wrap('')
$(this).data('aspectRatio', this.height / this.width)
// and remove the hard coded width/height
.removeAttr('height')
.removeAttr('width');
});
// When the window is resized
$(window).resize(function() {
// Resize all videos according to their own aspect ratio
$allVideos.each(function() {
var $el = $(this);
newWidth = $(this).closest('.iframe-wrapper').width();
$el.width(newWidth).height(newWidth * $el.data('aspectRatio'));
});
// Kick off one resize to fix all videos on page load
}).resize();
// $('.social ul li a').click(function(event) {
// title = encodeURIComponent($('head title').text());
// url = encodeURIComponent(document.location.href);
// if($(this).attr('data-service') == 'email') {
// send_to = 'mailto:?subject=' + title + '&body=' + url;
// } else if($(this).attr('data-service') == 'linkedin') {
// send_to = 'http://count-server.sharethis.com/v2.0/share?url=' + url;
// } else {
// send_to = 'http://count-server.sharethis.com/v2.0/share?url=' + url + '&title=' + title;
// }
// // window.open(send_to);
// // event.preventDefault();
// });
// if($('.social ul li a').length > 0) {
// url = encodeURIComponent(document.location.href);
// $('.social ul li a').each(function(idx) {
// $.ajax({
// url: 'http://rest.sharethis.com/v1/count/urlinfo?url=' + url + '&provider=' + $(this).attr('data-service'),
// context: $(this),
// dataType: 'json'
// }).done(function(data) {
// if(data[$(this).attr('data-service')] && data[$(this).attr('data-service')].outbound > 0) {
// $(this).find('.count').html(data[$(this).attr('data-service')].outbound);
// $(this).find('.count').css('padding-left', '6px');
// }
// });
// });
// }
if($('#cbp-fwslider').length > 0) {
// support for CSS Transitions & transforms
transsupport = Modernizr.csstransitions && Modernizr.csstransforms;
transsupport3d = Modernizr.csstransforms3d;
// transition end event name and transform name
// transition end event name
var
transformNames = {
'WebkitTransform' : '-webkit-transform',
'MozTransform' : '-moz-transform',
'OTransform' : '-o-transform',
'msTransform' : '-ms-transform',
'transform' : 'transform'
};
if( transsupport ) {
var transformName = transformNames[ Modernizr.prefixed( 'transform' ) ];
}
$('#cbp-fwslider').cbpFWSlider({speed: 1000});
var list = $('#cbp-fwslider ul.background-slider');
var list_items = list.children('li');
var item_count = list_items.length;
list.css( 'width', 100 * item_count + '%' );
if( transsupport ) {
list.css( 'transition', transformName + ' 1500ms ease' );
}
list_items.css( 'width', 100 / item_count + '%' );
$( '#cbp-fwslider' ).on('cbpFWSlider:start_slide', function(event, old_idx, new_idx, total) {
$('.cbp-fwslider div.content').animate({ opacity: 0.3 }, 250);
var translateVal = -1 * new_idx * 100 / total;
if( transsupport ) {
list.css( 'transform', transsupport3d ? 'translate3d(' + translateVal + '%,0,0)' : 'translate(' + translateVal + '%)' );
}
else {
list.css( 'margin-left', -1 * new_idx * 100 + '%' );
}
})
$( '#cbp-fwslider' ).on('cbpFWSlider:end_slide', function(event, old_idx, new_idx, total) {
$('.cbp-fwslider div.content').animate({ opacity: 1 }, 500);
});
}
$(".features .col").hover(
function() {
$(this).find('.vault-feature-overlay').show();
$(this).find('.content h3').addClass('hover');
}, function() {
$(this).find('.vault-feature-overlay').hide();
$(this).find('.content h3').removeClass('hover');
}
);
$('.feature-link').click(function() {
url = $(this).attr('href');
disable_disclaimer = $(this).attr('data-disable-disclaimer') == 'true';
new_window = $(this).attr('data-new-window') == 'true';
if(disable_disclaimer) {
if(new_window) {
window.open(url);
} else {
document.location.href = url
}
return false;
}
if (url.match(/^http/) || url.match(/^https/) ) {
if(url.match(/http(s)?:\/\/(.*\.)?interdigital\.com/i)) {
if(new_window) {
window.open(url);
} else {
document.location.href = url
}
} else if(url.match(/http(s)?:\/\/(.*\.)?chordant\.io/i)) {
if(new_window) {
window.open(url);
} else {
document.location.href = url
}
} else {
alert('LEGAL DISCLAIMER: This is a hyperlink to an unrelated third party website. It is provided for your convenience and for informational purposes only. InterDigital assumes no responsibility for any circumstances arising out of the use, misuse, interpretation or application of any information or other material provided on this third party website');
window.open(url);
return false;
}
} else {
document.location.href = url;
}
});
if($('.mobile-banner').length > 0) {
banner_count = $('.mobile-banner .container').length;
random_num = Math.floor((Math.random()*banner_count))
$('#banner-container'+random_num.toString()).show();
}
if($(window).width() >= 1023 && $('.subnav-solutions').length > 0) {
$(document).scroll(function(event) {
if($(window).width() < 1023) { return true; }
var min = 282;
var max = 360;
if($(this).scrollTop() > min && $(this).scrollTop() <= max) {
shrink = (max - $(this).scrollTop())/(max - min);
} else if($(this).scrollTop() > max) {
shrink = 0
} else if($(this).scrollTop() <= min) {
shrink = 1
}
resizeSolutionsCircles(shrink);
});
}
$('#jumpstart_contact_us_form .submit').bind('click', function(event) {
$('.error-message').hide();
$('.error-message ul li').remove();
is_valid = true
$.each([['First Name', 'first_name'], ['Last Name', 'last_name'], ['Company', 'company']], function(index, value) {
if($.trim($('#' + value[1]).val()) == '') {
is_valid = false;
$('#'+value[1]).parent().addClass('has-error');
$('.error-message ul').append('' + value[0] + ' is invalid.');
$('.error-message').show();
} else {
$('#'+value[1]).parent().removeClass('has-error');
}
});
if(!validateEmail($('#email').val())) {
is_valid = false;
$('#email').parent().addClass('has-error');
$('.error-message ul').append('Email is invalid.');
$('.error-message').show();
}
if(!is_valid) {
return event.preventDefault();
}
//send to a different form handler when testing
if($('#company').val() == "Test Company") {
$('#jumpstart_contact_us_form').attr('action', 'http://ww2.interdigital.com/l/45252/2014-07-17/7dmr?success_location=' + $('#redirect_url').val());
}
$('#jumpstart_contact_us_form').submit();
event.preventDefault();
});
$('#jumpstart_contact_us_form').submit(function(event) {
if(submitted) {
//send event to Analytics
ga('send', 'event', 'JumpStart Contact Us', 'Submit', $('#entity_title').val());
return true;
}
submitted = true;
$('#cta_first_name').val($('#first_name').val());
$('#cta_last_name').val($('#last_name').val());
$('#cta_email').val($('#email').val());
$('#cta_company').val($('#company').val());
$('#cta_title').val($('#title').val());
$('#cta_phone').val($('#phone').val());
$.ajax({
url: '/calls_to_action/',
type: 'POST',
data: $(this).serialize(),
dataType:"json",
context: this
}).done(function() {
$(this).submit();
});
event.preventDefault();
});
$('#bundle_get_started_form .submit').bind('click', function(event) {
$('.error-message').hide();
$('.error-message ul li').remove();
is_valid = true
if(!validateEmail($('#email').val())) {
is_valid = false;
$('#email').parent().addClass('has-error');
$('.error-message ul').append('Email is invalid.');
$('.error-message').show();
}
if(!is_valid) {
return event.preventDefault();
}
link = $('#bundle_redirect_url').val();
link = link.replace("{{email}}", $('#email').val());
if($('#pardot_handler').length > 0 && $('#pardot_handler').val().length > 0) {
$('#bundle_get_started_form').attr('action', $('#pardot_handler').val() + '?success_location=' + encodeURIComponent(link));
$('#bundle_get_started_form').submit();
} else {
ga('send', 'event', 'Bundle Get Started', 'Submit');
document.location.href = link;
}
event.preventDefault();
});
$('#bundle_get_started_form').submit(function(event) {
if(submitted) {
//send event to Analytics
ga('send', 'event', 'Bundle Get Started', 'Submit', $('#entity_title').val());
return true;
}
submitted = true;
$('#cta_email').val($('#email').val());
$.ajax({
url: '/calls_to_action/',
type: 'POST',
data: $(this).serialize(),
dataType:"json",
context: this
}).done(function() {
$(this).submit();
});
event.preventDefault();
});
/* Personal Demo Form */
$('#demo_form .submit').click(function(event) {
$('.error-message').hide();
$('.error-message ul li').remove();
is_valid = true
$.each($(this).closest('form').find('input[data-required="true"]'), function(index) {
if(this.type == 'email') {
if(!validateEmail($(this).val())) {
is_valid = false;
$(this).parent().addClass('has-error');
$('.error-message ul').append('' + $(this).attr('data-field-name') + ' is invalid.');
$('.error-message').show();
} else {
$(this).parent().removeClass('has-error');
}
} else {
if($(this).val() == '') {
is_valid = false;
$(this).parent().addClass('has-error');
$('.error-message ul').append('' + $(this).attr('data-field-name') + ' is invalid.');
$('.error-message').show();
} else {
$(this).parent().removeClass('has-error');
}
}
});
if(!is_valid) {
return event.preventDefault();
}
//send to a different form handler when testing
if($('#company').val() == "Test Company") {
$('#demo_form').attr('action', 'http://ww2.interdigital.com/l/45252/2014-07-17/7dmr?success_location=' + $('#redirect_url').val());
}
$('#demo_form').submit();
event.preventDefault();
});
$('#demo_form').submit(function(event) {
if(submitted) {
//send event to Analytics
ga('send', 'event', 'Contact Form', 'Submit');
return true;
}
submitted = true;
$('#cta_first_name').val($('#first_name').val());
$('#cta_last_name').val($('#last_name').val());
$('#cta_email').val($('#email').val());
$('#cta_company').val($('#company').val());
$('#cta_title').val($('#title').val());
$('#cta_phone').val($('#phone').val());
if($('#area_of_interest').length > 0) {
$('#cta_area_of_interest').val($('#area_of_interest').val());
}
$.ajax({
url: '/calls_to_action/',
type: 'POST',
data: $(this).serialize(),
dataType:"json",
context: this
}).done(function() {
$(this).submit();
});
event.preventDefault();
});
$('.solutions-section').waypoint({
handler: function(direction) {
if(direction == 'down') {
$('.subnav-solutions-v2 li').removeClass('active');
$('.subnav-solutions-v2 li a').removeClass('active');
$('#'+this.element.id+'-link').addClass('active');
$('#'+this.element.id+'-link a').addClass('active');
} else {
if($(this.element).prev().length > 0) {
$('.subnav-solutions-v2 li').removeClass('active');
$('.subnav-solutions-v2 li a').removeClass('active');
$('#'+$(this.element).prev()[0].id+'-link').addClass('active');
$('#'+$(this.element).prev()[0].id+'-link a').addClass('active');
}
}
},
offset: 300
});
$('.video-resources-section').waypoint({
handler: function(direction) {
if(direction == 'down') {
$('.subnav-solutions-v2 li').removeClass('active');
$('.subnav-solutions-v2 li a').removeClass('active');
$('#'+this.element.id+'-link').addClass('active');
$('#'+this.element.id+'-link a').addClass('active');
} else {
if($(this.element).prev().length > 0) {
$('.subnav-solutions-v2 li').removeClass('active');
$('.subnav-solutions-v2 li a').removeClass('active');
$('#'+$(this.element).prev()[0].id+'-link').addClass('active');
$('#'+$(this.element).prev()[0].id+'-link a').addClass('active');
}
}
},
offset: 300
});
$('.data-sets-section').waypoint({
handler: function(direction) {
if(direction == 'down') {
$('.subnav-solutions-v2 li').removeClass('active');
$('.subnav-solutions-v2 li a').removeClass('active');
$('#'+this.element.id+'-link').addClass('active');
$('#'+this.element.id+'-link a').addClass('active');
} else {
if($(this.element).prev().length > 0) {
$('.subnav-solutions-v2 li').removeClass('active');
$('.subnav-solutions-v2 li a').removeClass('active');
$('#'+$(this.element).prev()[0].id+'-link').addClass('active');
$('#'+$(this.element).prev()[0].id+'-link a').addClass('active');
}
}
},
offset: 300
});
$('.subnav-solutions-v2 li a, #scroll-button').click(function(event) {
$('body,html').animate({
scrollTop: $('#'+$(this).attr('data-element')).offset().top - findSolutionsScrollOffset()
}, 1000);
event.preventDefault();
return false;
});
$('#scroll-button').click(function(event) {
$('body,html').animate({
scrollTop: $('#'+$(this).attr('data-element')).offset().top - 270
}, 300);
event.preventDefault();
return false;
});
if ($('#solutions-banner-container').length > 0 && $('#solutions-banner-container').hasClass('data-sets-banner-container')) {
var h = window.innerHeight;
var mh = parseInt(h / 1.54) * -1;
var sticky = new Waypoint.Sticky({
element: $('#solutions-banner-container')[0],
offset: mh
});
} else if ($('#solutions-banner-container').length > 0) {
var sticky = new Waypoint.Sticky({
element: $('#solutions-banner-container')[0],
offset: -100
});
}
if($('.zoom-image').length > 0) {
$('.zoom-image').magnificPopup({
type: 'image',
closeOnContentClick: true,
mainClass: 'mfp-img-mobile',
image: {
verticalFit: true
}
});
}
$(".solutions-partners:not('.sensors') .col").hover(function(event) {
if($(window).width() > 1023) {
$(this).find('.caption').fadeIn();
}
}, function(event) {
if($(window).width() > 1023) {
$(this).find('.caption').fadeOut();
}
});
//M2M Signup Form
$('.m2m-signup-form .submit').click(function(event) {
event.preventDefault();
$(this).closest('form').find('.error-message').hide();
$(this).closest('form').find('.error-message ul li').remove();
is_valid = true;
$.each($(this).closest('form').find('input[data-required="true"]'), function(index) {
if(this.type == 'email') {
if(!validateEmail($(this).val())) {
is_valid = false;
$(this).closest('.control-group').addClass('has-error');
$('.error-message ul').append('' + $(this).attr('data-field-name') + ' is invalid.');
$('.error-message').show();
} else {
$(this).closest('.control-group').removeClass('has-error');
}
} else if(this.type == 'checkbox') {
if(!$(this).prop('checked')) {
is_valid = false;
$(this).closest('.terms').addClass('has-error');
$('.error-message ul').append('' + $(this).attr('data-field-name') + ' must be checked.');
$('.error-message').show();
} else {
$(this).closest('.terms').removeClass('has-error');
}
} else {
if($(this).val() == '') {
is_valid = false;
$(this).closest('.control-group').addClass('has-error');
$('.error-message ul').append('' + $(this).attr('data-field-name') + ' is invalid.');
$('.error-message').show();
} else {
$(this).closest('.control-group').removeClass('has-error');
}
}
});
if($('#password').val() != $('#password_confirmation').val()) {
$('#password_confirmation').parent().addClass('has-error');
$('.error-message ul').append('Passwords do not match.');
$('.error-message').show();
is_valid = false;
}
if(!is_valid) {
return false;
}
$('.m2m-signup-form').attr('action', $('#pardot_form_handler').val() + '?success_location=' + $('#redirect_url').val());
//send to a different form handler when testing
if($('#company').val() == "Test Company") {
$('.m2m-signup-form').attr('action', 'http://ww2.interdigital.com/l/45252/2014-07-17/7dmr?success_location=' + $('#redirect_url').val());
}
$(this).html('');
$.ajax({
url: "https://app.interdigital.com/m2mconfig/users",
type: 'POST',
contentType:"application/json; charset=utf-8",
dataType: 'json',
data: JSON.stringify({
"user": {
"name": $('#first_name').val() + ' ' + $('#last_name').val(),
"company": $('#company').val(),
"title": $('#title').val(),
"phone": $('#phone').val(),
"email": $('#email').val(),
"zip_code": $('#zip_code').val(),
"country": $('#country').val(),
"password": $('#password').val(),
"password_confirmation": $('#password_confirmation').val()
}
}),
success: function(data) {
$('.m2m-signup-form').submit();
},
error: function(jqXHR, status, error) {
errors = $.parseJSON(jqXHR.responseText).errors;
$.each(errors, function(index) {
if(this == "Your request for an account is under review.") {
document.location.href = "/chordant-signup?submit_pending=true";
return;
} else {
$('.error-message ul').append('' + this + '');
$('.error-message').show();
}
});
$('.m2m-signup-form .submit').html('Sign up');
}
});
});
var submitted = false;
$('.m2m-signup-form').submit(function(event) {
if(submitted) {
analytics_name = 'Form'
if($(this).find('#analytics_form').length > 0 && $(this).find('#analytics_form').val().trim() !== '') {
analytics_name = $(this).find('#analytics_form').val();
}
//send event to Analytics
// ga('send', 'event', analytics_name, 'Submit');
return true;
}
submitted = true;
$('#cta_first_name').val($('#first_name').val());
$('#cta_last_name').val($('#last_name').val());
$('#cta_email').val($('#email').val());
$('#cta_company').val($('#company').val());
$('#cta_title').val($('#title').val());
$('#cta_phone').val($('#phone').val());
$('#cta_zip_code').val($('#zip_code').val());
$('#cta_country').val($('#country').val());
$.ajax({
url: '/calls_to_action/',
type: 'POST',
data: $('.m2m-signup-form').serialize(),
dataType:"json"
}).done(function() {
$('.m2m-signup-form').submit();
});
event.preventDefault();
});
});
function validateEmail(email) {
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(email);
}
var orig_style_data;
function resizeSolutionsCircles(shrink) {
if(orig_style_data == undefined) {
orig_style_data = {
'circle_height' : $('.subnav-solutions .circle').height(),
'circle_width' : $('.subnav-solutions .circle').width(),
'circle_margin_bottom' : parseInt($('.subnav-solutions .circle').css('margin-bottom').replace("px", "")),
'bar_height' : $('.subnav-solutions').height(),
'li_height' : $('.subnav-solutions li').height(),
'container_top_padding' : parseInt($('.subnav-solutions .container').css('padding-top').replace("px", ""))
};
}
$('.subnav-solutions .circle').width(orig_style_data.circle_width*shrink);
$('.subnav-solutions .circle').css('margin-bottom', orig_style_data.circle_margin_bottom*shrink + 'px');
if(orig_style_data.container_top_padding*shrink > 8) {
$('.subnav-solutions .container').css('padding-top', orig_style_data.container_top_padding*shrink + 'px');
} else {
$('.subnav-solutions .container').css('padding-top', '8px');
}
if(shrink <= 0.7) {
header_shrink = shrink + 0.3;
} else {
header_shrink = 1;
}
if (header_shrink == 1) {
$('.subnav-solutions .arrow').show();
$('.subnav-solutions').height(orig_style_data.bar_height);
$('.subnav-solutions li').height(orig_style_data.li_height);
$('.subnav-solutions li .title').css('position', 'static').css('top', 'auto').css('transform', 'none').css('margin-top', '0');
} else if(orig_style_data.bar_height*header_shrink > 51) {
$('.subnav-solutions .arrow').hide();
$('.subnav-solutions').height(orig_style_data.bar_height*header_shrink);
$('.subnav-solutions li').height((orig_style_data.bar_height*header_shrink)*.7);
$('.subnav-solutions li .title').css('position', 'static').css('top', 'auto').css('transform', 'none').css('margin-top', '0');
} else {
$('.subnav-solutions').height(51);
$('.subnav-solutions .arrow').hide();
$('.subnav-solutions li').height(51*.7);
$('.subnav-solutions li .title').css('position', 'relative').css('top', '50%').css('transform', 'translateY(-50%)').css('margin-top', '14px');
}
}
function updateQueryStringParameter(uri, key, value) {
var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
var separator = uri.indexOf('?') !== -1 ? "&" : "?";
if (uri.match(re)) {
return uri.replace(re, '$1' + key + "=" + value + '$2');
}
else {
return uri + separator + key + "=" + value;
}
}
function findSolutionsScrollOffset() {
if ($('div.mainbody').hasClass('data-sets-section')) {
return 230;
} else if ($('div.mainbody').hasClass('sensors-overview')) {
return 230;
}
return 270;
}