!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?a(require("jquery")):a(jquery)}(function(a){function b(b,e){function f(){return i.update(),i.move(i.slidecurrent),g(),i}function g(){i.options.buttons&&(n.click(function(){return i.move(--t),!1}),m.click(function(){return i.move(++t),!1})),a(window).resize(i.update),i.options.bullets&&b.on("click",".bullet",function(){return i.move(t=+a(this).attr("data-slide")),!1})}function h(){i.options.buttons&&!i.options.infinite&&(n.toggleclass("disable",i.slidecurrent<=0),m.toggleclass("disable",i.slidecurrent>=i.slidestotal-r)),i.options.bullets&&(o.removeclass("active"),a(o[i.slidecurrent]).addclass("active"))}this.options=a.extend({},d,e),this._defaults=d,this._name=c;var i=this,j=b.find(".viewport:first"),k=b.find(".overview:first"),l=0,m=b.find(".next:first"),n=b.find(".prev:first"),o=b.find(".bullet"),p=0,q={},r=0,s=0,t=0,u="x"===this.options.axis,v=u?"width":"height",w=u?"left":"top",x=null;return this.slidecurrent=0,this.slidestotal=0,this.update=function(){return k.find(".mirrored").remove(),l=k.children(),p=j[0]["offset"+v],s=l.first()["outer"+v](!0),i.slidestotal=l.length,i.slidecurrent=i.options.start||0,r=math.ceil(p/s),k.append(l.slice(0,r).clone().addclass("mirrored")),k.css(v.tolowercase(),s*(i.slidestotal+r)),i},this.start=function(){return i.options.interval&&(cleartimeout(x),x=settimeout(function(){i.move(++t)},i.options.intervaltime)),i},this.stop=function(){return cleartimeout(x),i},this.move=function(a){return t=a,i.slidecurrent=t%i.slidestotal,0>t&&(i.slidecurrent=t=i.slidestotal-1,k.css(w,-i.slidestotal*s)),t>i.slidestotal&&(i.slidecurrent=t=1,k.css(w,0)),q[w]=-t*s,k.animate(q,{queue:!1,duration:i.options.animation?i.options.animationtime:0,always:function(){b.trigger("move",[l[i.slidecurrent],i.slidecurrent])}}),h(),i.start(),i},f()}var c="tinycarousel",d={start:0,axis:"x",buttons:!0,bullets:!1,interval:!1,intervaltime:3e3,animation:!0,animationtime:1e3,infinite:!0};a.fn[c]=function(d){return this.each(function(){a.data(this,"plugin_"+c)||a.data(this,"plugin_"+c,new b(a(this),d))})}});
$.easing.jswing = $.easing.swing;
$.extend($.easing,
{
def: 'easeoutquad',
swing: function (x, t, b, c, d) {
//alert($.easing.default);
return $.easing[$.easing.def](x, t, b, c, d);
},
easeinquad: function (x, t, b, c, d) {
return c*(t/=d)*t + b;
},
easeoutquad: function (x, t, b, c, d) {
return -c *(t/=d)*(t-2) + b;
},
easeinoutquad: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t + b;
return -c/2 * ((--t)*(t-2) - 1) + b;
},
easeincubic: function (x, t, b, c, d) {
return c*(t/=d)*t*t + b;
},
easeoutcubic: function (x, t, b, c, d) {
return c*((t=t/d-1)*t*t + 1) + b;
},
easeinoutcubic: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t + b;
return c/2*((t-=2)*t*t + 2) + b;
},
easeinquart: function (x, t, b, c, d) {
return c*(t/=d)*t*t*t + b;
},
easeoutquart: function (x, t, b, c, d) {
return -c * ((t=t/d-1)*t*t*t - 1) + b;
},
easeinoutquart: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
return -c/2 * ((t-=2)*t*t*t - 2) + b;
},
easeinquint: function (x, t, b, c, d) {
return c*(t/=d)*t*t*t*t + b;
},
easeoutquint: function (x, t, b, c, d) {
return c*((t=t/d-1)*t*t*t*t + 1) + b;
},
easeinoutquint: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
return c/2*((t-=2)*t*t*t*t + 2) + b;
},
easeinsine: function (x, t, b, c, d) {
return -c * math.cos(t/d * (math.pi/2)) + c + b;
},
easeoutsine: function (x, t, b, c, d) {
return c * math.sin(t/d * (math.pi/2)) + b;
},
easeinoutsine: function (x, t, b, c, d) {
return -c/2 * (math.cos(math.pi*t/d) - 1) + b;
},
easeinexpo: function (x, t, b, c, d) {
return (t==0) ? b : c * math.pow(2, 10 * (t/d - 1)) + b;
},
easeoutexpo: function (x, t, b, c, d) {
return (t==d) ? b+c : c * (-math.pow(2, -10 * t/d) + 1) + b;
},
easeinoutexpo: function (x, t, b, c, d) {
if (t==0) return b;
if (t==d) return b+c;
if ((t/=d/2) < 1) return c/2 * math.pow(2, 10 * (t - 1)) + b;
return c/2 * (-math.pow(2, -10 * --t) + 2) + b;
},
easeincirc: function (x, t, b, c, d) {
return -c * (math.sqrt(1 - (t/=d)*t) - 1) + b;
},
easeoutcirc: function (x, t, b, c, d) {
return c * math.sqrt(1 - (t=t/d-1)*t) + b;
},
easeinoutcirc: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return -c/2 * (math.sqrt(1 - t*t) - 1) + b;
return c/2 * (math.sqrt(1 - (t-=2)*t) + 1) + b;
},
easeinelastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
if (a < math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*math.pi) * math.asin (c/a);
return -(a*math.pow(2,10*(t-=1)) * math.sin( (t*d-s)*(2*math.pi)/p )) + b;
},
easeoutelastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
if (a < math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*math.pi) * math.asin (c/a);
return a*math.pow(2,-10*t) * math.sin( (t*d-s)*(2*math.pi)/p ) + c + b;
},
easeinoutelastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
if (a < math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*math.pi) * math.asin (c/a);
if (t < 1) return -.5*(a*math.pow(2,10*(t-=1)) * math.sin( (t*d-s)*(2*math.pi)/p )) + b;
return a*math.pow(2,-10*(t-=1)) * math.sin( (t*d-s)*(2*math.pi)/p )*.5 + c + b;
},
easeinback: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
return c*(t/=d)*t*((s+1)*t - s) + b;
},
easeoutback: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
},
easeinoutback: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
},
easeinbounce: function (x, t, b, c, d) {
return c - $.easing.easeoutbounce (x, d-t, 0, c, d) + b;
},
easeoutbounce: function (x, t, b, c, d) {
if ((t/=d) < (1/2.75)) {
return c*(7.5625*t*t) + b;
} else if (t < (2/2.75)) {
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
} else if (t < (2.5/2.75)) {
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
} else {
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
}
},
easeinoutbounce: function (x, t, b, c, d) {
if (t < d/2) return $.easing.easeinbounce (x, t*2, 0, c, d) * .5 + b;
return $.easing.easeoutbounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
}
});
jquery(document).ready(function($) {
/*var mainmenu = $('#menu-nav-refresh-container');
if( mainmenu.find('.menu-el_insurance-carriers').hasclass('current-menu-item') || mainmenu.find('.menu-el_insurance-carriers').hasclass('current-menu-ancestor') ){
console.log('swapping!');
$('.menu-el_insurance-carriers').insertbefore($('.menu-el_insurance-carriers').prev('.menu-el_collision-repairers'));
}*/
$('#ninja_forms_form_22').submit(function(){
//create frame and forward fields
first_name = $(this).find('#ninja_forms_field_220').val();
last_name = $(this).find('#ninja_forms_field_221').val();
email = $(this).find('#ninja_forms_field_222').val();
company = $(this).find('#ninja_forms_field_223').val();
});
/*$('#ninja_forms_form_4').submit(function(){
//create frame and forward fields
first_name = $(this).find('#ninja_forms_field_56').val();
last_name = $(this).find('#ninja_forms_field_57').val();
email = $(this).find('#ninja_forms_field_58').val();
phone = $(this).find('#ninja_forms_field_61').val();
zip = $(this).find('#ninja_forms_field_60').val();
company = $(this).find('#ninja_forms_field_59').val();
});
first_name = $(this).find('#ninja_forms_field_162').val();
last_name = $(this).find('#ninja_forms_field_163').val();
email = $(this).find('#ninja_forms_field_165').val();
company = $(this).find('#ninja_forms_field_164').val();
});
first_name = $(this).find('#ninja_forms_field_116').val();
last_name = $(this).find('#ninja_forms_field_117').val();
email = $(this).find('#ninja_forms_field_118').val();
phone = $(this).find('#ninja_forms_field_121').val();
zip = $(this).find('#ninja_forms_field_120').val();
company = $(this).find('#ninja_forms_field_119').val();
*/
//detect...
$('.cw-content-wrapper,.cur-content-wrapper').hide();
$('#carwise-content .collapsible,#cur-content .collapsible').each(function(){
$(this).addclass('closed');
});
if( $('.template-carwise-landing-page,.template-carwise-landing-page_short,.template-uber-ride').length > 0 ){
var hash = window.location.hash;
var par = $( hash );
par.removeclass('closed').addclass('openc');
par.children('.cw-content-wrapper,.cur-content-wrapper').show();
}
$('#carwise-content .collapsible').click(function(){
if( $(this).hasclass('closed') ){
$('#carwise-content .openc').removeclass('openc').addclass('closed');
$('.cw-content-wrapper').slideup();
$(this).removeclass('closed').addclass('openc');
$(this).children('.cw-content-wrapper').slidedown();
window.location.hash = $(this).attr('id');
}
else{
}
});
$('#cur-content .collapsible').click(function(){
if( $(this).hasclass('closed') ){
$('#cur-content .openc').removeclass('openc').addclass('closed');
$('.cur-content-wrapper').slideup();
$(this).removeclass('closed').addclass('openc');
$(this).children('.cur-content-wrapper').slidedown();
window.location.hash = $(this).attr('id');
}
else{
$('#cur-content .openc').removeclass('openc').addclass('closed');
$('.cur-content-wrapper').slideup();
/*$(this).removeclass('closed').addclass('openc');
$(this).children('.cur-content-wrapper').slidedown();
window.location.hash = $(this).attr('id');*/
}
});
$('.template-carwise-landing-page .container a.widget,.template-carwise-landing-page_short .container a.widget').click(function(e){
var target = $(this).attr('href');
var par = $(target);
if( par.hasclass('closed') ){
$('#carwise-content .openc').removeclass('openc').addclass('closed');
$('.cw-content-wrapper').slideup(function(){
});
par.removeclass('closed').addclass('openc');
par.children('.cw-content-wrapper').show();
}
});
if( $('.curslide' ).length > 1 ){
$('#cur-slides-wrap').cycle({
fx: 'scrollhorz',
speed: 200,
timeout: 0,
prev: 'a#cur-prev',
next: 'a#cur-next',
});
}
if( $('.wveslide' ).length > 1 ){
$('#wve-slides-wrap').cycle({
fx: 'scrollhorz',
speed: 600,
timeout: 0,
prev: 'a#wve-prev',
next: 'a#wve-next',
});
}
if( $('.udps-screen' ).length > 1 ){
$('#udps-screens-wrap').cycle({
fx: 'scrollhorz',
speed: 200,
timeout: 0,
prev: 'a#udps-prev',
next: 'a#udps-next',
});
}
$('#webinar-nav').hover(
function(){
$(this).children('ul').show();
$(this).addclass('webinar-open');
},
function(){
$(this).children('ul').hide();
$(this).removeclass('webinar-open');
}
);
var ccctestsorter = $('#testimonial-sorter');
var ccctest = $('#ccc-testimonials');
var cccvids = $('#videolist');
var ctarget;
$('#tlp-mobile').change( function(){
ctarget = $(this).val();
ccctest.find('ul').animate({
top: "0"
}, 0, function() {
});
ccctest.find('li').not('.'+ctarget).slideup(200);
ccctest.find('.more').hide();
ccctest.find('.'+ctarget)
.each(function(index, element){
if( iseven(index) && !$(this).hasclass('talt'))
$(this).addclass('talt');
else if( isodd(index) && $(this).hasclass('talt'))
$(this).removeclass('talt');
$(this).slidedown(200);
if( index = 4 || index > 4 ){
ccctest.find('.more').show();
}
})
.promise()
.done( function() {
height = ccctest.find('ul').height();
if( height <= 745 )
ccctest.find('.more a').addclass('tlp-disabled');
else{
ccctest.find('.more a.tlp-disabled').removeclass('tlp-disabled');
ccctest.find('.more a#ttmore').addclass('tlp-disabled');
}
console.log(height);
});
cccvids.find('.vhide').removeclass('vhide');
cccvids.find('li').not('.'+ctarget).hide();
//cccvids.find('.'+ctarget).show();
found = cccvids.find('.'+ctarget);
if( found.length > 1 )
found.show();
else
found.hide();
$('#testvideos li.active').removeclass('active');
var targethref = cccvids.find('.'+ctarget+' a').eq(0).attr('href');
targethref = targethref.substr(1);
cccvids.find('.'+ctarget).eq(0).addclass('active');
$('#testvideo iframe').attr('src', cccvids.find('.'+ctarget+' a').eq(0).attr('data') );
});
ccctestsorter.find('a')
.click(function(e){
e.preventdefault();
ccctest.find('ul').animate({
top: "0"
}, 0, function() {
});
if( $(this).hasclass('catactive') )
return false;
else{
ccctestsorter.find('.catactive').removeclass('catactive');
$(this).addclass('catactive');
ctarget = $(this).attr('href');
ctarget = ctarget.substr(1);
ccctest.find('li').not('.'+ctarget).slideup(200);
ccctest.find('.more').hide();
ccctest.find('.'+ctarget)
.each(function(index, element){
if( iseven(index) && !$(this).hasclass('talt'))
$(this).addclass('talt');
else if( isodd(index) && $(this).hasclass('talt'))
$(this).removeclass('talt');
$(this).slidedown(200);
if( index = 4 || index > 4 ){
ccctest.find('.more').show();
}
})
.promise()
.done( function() {
height = ccctest.find('ul').height();
if( height <= 745 )
ccctest.find('.more a').addclass('tlp-disabled');
else{
ccctest.find('.more a.tlp-disabled').removeclass('tlp-disabled');
ccctest.find('.more a#ttmore').addclass('tlp-disabled');
}
console.log(height);
});
cccvids.find('.vhide').removeclass('vhide');
cccvids.find('li').not('.'+ctarget).hide();
//cccvids.find('.'+ctarget).show();
found = cccvids.find('.'+ctarget);
if( found.length > 1 )
found.show();
else
found.hide();
$('#testvideos li.active').removeclass('active');
var targethref = cccvids.find('.'+ctarget+' a').eq(0).attr('href');
targethref = targethref.substr(1);
cccvids.find('.'+ctarget).eq(0).addclass('active');
$('#testvideo iframe').attr('src', cccvids.find('.'+ctarget+' a').eq(0).attr('data') );
//.eq(0)
}
});
//});
/*
$( '.panel' )
.fadeout( 'slow')
.promise()
.done( function() {
$( '#' + target_panel ).fadein( 'slow', function() {});
});
*/
ccctest.find('.more a').click(function(e){
e.preventdefault();
ctarget = ccctestsorter.find('.catactive').attr('href').substr(1);
//alert( sel );
var counter = 0;
var items = ccctest.find('.'+ctarget);
var count = items.length;
/*items.each(function(index, element){
if( iseven(index) && !$(this).hasclass('talt'))
$(this).addclass('talt');
else if( isodd(index) && $(this).hasclass('talt'))
$(this).removeclass('talt');
if( counter < 4 ){
if( !$(this).is(':visible') ){
$(this).slidedown();
counter++;
}
//ccctest.find('.more').hide();
}
else{
//ccctest.find('.more').show();
return false;
}
});*/
pos = ccctest.find('ul').position();
postop = pos.top;
height = ccctest.find('ul').height();
maxneg = height - 745;
console.log( height );
console.log( postop );
/*
$( this ).css([
"width", "height", "color", "background-color"
]);
*/
if( $(this).parent().hasclass('more-top') && !$(this).hasclass('tlp-disabled') ){
if( postop <= -300 )
ccctest.find('ul').animate({
top: "+=300"
}, 800, function() {
// animation complete.
});
else
ccctest.find('ul').animate({
top: "0"
}, 800, function() {
// animation complete.
});
if( postop + 300 >= 0 )
$(this).addclass('tlp-disabled');
if ( $('#tbmore').hasclass('tlp-disabled') )
$('#tbmore').removeclass('tlp-disabled');
}
if( $(this).parent().hasclass('more-bottom') && !$(this).hasclass('tlp-disabled') ){
//console.log( 'postop: '+postop+' maxneg: '+maxneg );
if( postop * -1 + 300 <= maxneg )
ccctest.find('ul').animate({
top: "-=300"
}, 800, function() {
// animation complete.
});
else
ccctest.find('ul').animate({
top: maxneg * -1
}, 800, function() {
// animation complete.
});
if( postop * -1 + 300 >= maxneg )
$(this).addclass('tlp-disabled');
if ( $('#ttmore').hasclass('tlp-disabled') )
$('#ttmore').removeclass('tlp-disabled');
}
});
///
$('#rl-filter select').change(function(){
val = $(this).val();
selector = ( val == '' || val == 'all' )? '.rl-box:gt(3)' : '.rltype'+val+':gt(3)';
mselector = ( val == '' || val == 'all' )? '.rl-box' : '.rltype'+val;
selcat = '';
if( $('#rl-categories').find('.rl-active').length > 0 )
selcat = $('#rl-categories').find('.rl-active').attr('href').substr(1);
$('.rl-group').each(function(){
if( val == '' || val == 'all' ){
//$('.rl-box').css('display','inline-block').not('.rl-box:lt(4)').hide();
$(this).find('.rl-box').css('display','inline-block');
$(this).find('.rl-box:gt(3)').hide();
findbox = '.rl-box';
}
else{
$(this).find('.rl-box').css('display','inline-block').not('.rltype'+val+':lt(4)').hide();
findbox = '.rltype'+val;
}
$(this).find(findbox).each(function(index, element) {
if( $(this).hasclass('rl-last') ){
$(this).removeclass('rl-last');
//console.log( index );
}
//console.log( index );
if( ( index + 1 ) % 4 == 0 ){
$(this).addclass('rl-last');
//console.log( 'add '+index );
}
});
if( $(this).find('.rltype'+val).length > 0 || val == 'all' || val == '' ){
if( selcat == 'rl-all' || selcat == '' ){
$(this).slidedown();
}
else{
if( $(this).attr('id') == selcat )
$(this).slidedown();
}
}
else{
$(this).slideup();
}
if( $(this).find(mselector).length > 4 ){
$(this).find('.rl-more').show();
if( $(this).find('.rl-more').hasclass('rl-opened') ){
$(this).find('.rl-more').removeclass('rl-opened').addclass('rl-closed').text('expand to see more');
}
}
else{
$(this).find('.rl-more').hide();
}
});
//$('.rl-more').hide();
});
$('#rl-categories a').click(function(e){
e.preventdefault();
target = $(this).attr('href');
if( target == '#rl-all' ){
$('.rl-group').slidedown();
$('.rl-active').removeclass('rl-active');
$(this).addclass('rl-active');
}
else{
$('.rl-group').not(target).slideup();
$(target).slidedown();
$('.rl-active').removeclass('rl-active');
$(this).addclass('rl-active');
}
});
$('.rl-more').click(function(e){
e.preventdefault();
type = $('#rl-filter select').val();
selector = ( type == '' || type == 'all' )? '.rl-box:gt(3)' : '.rltype'+type+':gt(3)';
if( $(this).hasclass('rl-closed') ){
$( this ).parents('.rl-group').find(selector).each(function(){
$(this).slidedown().css('display','inline-block');
});
$(this).removeclass('rl-closed').addclass('rl-opened').text('close');
}
else{
$( this ).parents('.rl-group').find(selector).each(function(){
$(this).slideup();//slidedown().css('display','inline-block');
});
$(this).removeclass('rl-opened').addclass('rl-closed').text('expand to see more');
}
});
//add a more function to determine whether or not to show
$('#testvideos .overview').click(function( event ){
var target = $( event.target );
if( target.is('a') ){
if( target.parent('li').hasclass('active') ){
//do nothing... its already highlighted
}
else{
$('#testvideos li.active').removeclass('active');
var targethref = target.attr('href');
targethref = targethref.substr(1);
/*if( targetclass != '' ){
$('.'+targetclass).addclass('active');
}*/
target.parents('li').addclass('active');
$('#testvideo iframe').attr('src', target.attr('data') );
}
return false;
}
else if( target.is('h5') || target.is('h6') ){
if( target.parents('li').hasclass('active') ){
//do nothing... its already highlighted
}
else{
$('#testvideos li.active').removeclass('active');
var targethref = target.parent('a').attr('href');
targethref = targethref.substr(1);
target.parents('li').addclass('active');
$('#testvideo iframe').attr('src', target.parent('a').attr('data') );
}
return false;
}
else if( target.is('span') || target.is('img') ){
if( target.parents('li').hasclass('active') ){
//do nothing... its already highlighted
}
else{
$('#testvideos li.active').removeclass('active');
var targethref = target.parents('a').attr('href');
targethref = targethref.substr(1);
target.parents('li').addclass('active');
$('#testvideo iframe').attr('src', target.parents('a').attr('data') );
}
return false;
}
else{
//chill like a villain
}
});
/*
$( "ul" ).click(function( event ) {
var target = $( event.target );
if ( target.is( "li" ) ) {
target.css( "background-color", "red" );
}
});
*/
/*$('#vidprev,#vidnext').click(function(){
return false;
});*/
//$('#videoscroll').tinycarousel({infinite: false });
if( $('.hero_image_slide' ).length > 1 ){
$('#hero_images_slider').cycle({
fx: 'scrollhorz',
speed: 200,
prev: 'a#hero_prev',
next: 'a#hero_next',
});
}
/*$('#vidprev,#vidnext').click(function(){
var sd = 201;
var $this = $(this);
var $carousel = $(this).parent();
var $ul = $carousel.find('ul');
var distance = sd;
var time = 500;
var rate = distance/time;
distance = math.abs($ul.position().left);
continue_scroll = function(dist) {
time = 500;
if(arguments.length != 0){
distance = dist;
}
if($this.hasclass('vidprev')){
if(distance == 0) {
time = 500;
} else {
time = distance/rate;
}
$ul.stop().animate({
left: 0
}, time, 'linear', function(){
$ul.prepend($ul.children('li:last-child'));
$ul.css({left: -201});
//continue_scroll(210);
});
}
else if($this.hasclass('vidnext')){
if(distance != 0 && arguments.length == 0){
distance = sd - distance;
time = distance/rate;
}
$ul.stop().animate({
left: -201
}, time, 'linear', function(){
$ul.append($ul.children('li:first-child'));
$ul.css({left: 0});
//continue_scroll(0);
});
}
}
return false;
continue_scroll();
});*/
/*var testvid = $('#testvideos');
testvid.cycle({
fx: 'scrollhorz', //'shuffle',
prev: '#testleft a',
next: '#testright a',
timeout: 0,
rev: true,
speed: 500,
after: onafter
});*/
/*$('#test-videos .carousel').carousel({
carouselwidth:796,
carouselheight:410,
directionnav:true,
shadow:true,
buttonnav:'none',//'bullets',
nextbutton: 'lo',
prevbutton: 'la',
autoplay: false
});*/
//$( this ).find( "li:eq(1)" ).css( "fontstyle", "italic" );
//$('#testvideos').find('.item').click(function(){
//$('#testvideos .item').html('');
//$('#testvideos .item').not( ).html('');
//});
function onafter(curr, next, opts) {
var index = opts.currslide;
prev = (index == 0 )? opts.slidecount - 1 : index - 1;
next = (index == opts.slidecount - 1 )? 0 : index + 1;
pf = testvid.find( 'div:eq('+prev+') iframe' );
nf = testvid.find( 'div:eq('+next+') iframe' );
var purl = pf.attr('src');
var nurl = nf.attr('src');
pf.attr('src', '');
nf.attr('src', '');
pf.attr('src', purl);
nf.attr('src', nurl);
}
function vonafter(curr, next, opts) {
var index = opts.currslide;
prev = (index == 0 )? opts.slidecount - 1 : index - 1;
next = (index == opts.slidecount - 1 )? 0 : index + 1;
pf = $('#pslp-slider').find( 'div:eq('+prev+') iframe' );
nf = $('#pslp-slider').find( 'div:eq('+next+') iframe' );
var purl = pf.attr('src');
var nurl = nf.attr('src');
pf.attr('src', '');
nf.attr('src', '');
pf.attr('src', purl);
nf.attr('src', nurl);
}
$('#pslp-slider').cycle({
fx: 'scrollhorz', //'shuffle',
next: '#pslp-prev',
prev: '#pslp-next',
timeout: 0,
rev: true,
speed: 400,
after: vonafter
});
$('#pinn-buttons a,#udps-buttons a').click(function(e){
e.preventdefault();
target = $(this).attr('href');
$('html, body').animate({
scrolltop: $(target).offset().top
}, 1000);
});
if( $('body').hasclass('template-parts-vibrant-followup') ){
$('.container .row').click(function(){
var obj = $(this).find('.showhidecontent');
$('.expandedmaininner').not(obj.parents('.expandedmaininner')[0]).removeclass('expanded');
$('.expandmain').not(obj.next('.expandmain')[0]).slideup('slow');
obj.next('.expandmain').slidetoggle('slow');
obj.parents('.expandedmaininner').toggleclass('expanded');
//return false;
});
$(function() {
$('a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({
scrolltop: target.offset().top
}, 1000);
return false;
}
}
});
});
/*$('#pvib-testimonialsm').click(function(){
if( $(this).hasclass('pvib-vid-open') ){
$('#pvib-vid').slideup(function(){
$('#pvib-testimonialsm').removeclass('pvib-vid-open');
});
}
else{
$(this).addclass('pvib-vid-open');
$('#pvib-vid').slidedown();
}
});*/
}
});
function iseven(n) {
return isnumber(n) && (n % 2 == 0);
}
function isodd(n){
return isnumber(n) && (math.abs(n) % 2 == 1);
}
function isnumber(n){
return n == parsefloat(n);
}
function iselementinviewport(elem) {
var $elem = $(elem);
// get the scroll position of the page.
var scrollelem = ((navigator.useragent.tolowercase().indexof('webkit') != -1) ? 'body' : 'html');
var viewporttop = $(scrollelem).scrolltop();
var viewportbottom = viewporttop + $(window).height();
// get the position of the element on the page.
var elemtop = math.round( $elem.offset().top );
var elembottom = elemtop + $elem.height();
return ((elemtop < viewportbottom) && (elembottom > viewporttop));
}
function iselementinviewport2($elem) {
//var $elem = $(elem);
// get the scroll position of the page.
var scrollelem = ((navigator.useragent.tolowercase().indexof('webkit') != -1) ? 'body' : 'html');
var viewporttop = $(scrollelem).scrolltop();
var viewportbottom = viewporttop + $(window).height();
// get the position of the element on the page.
var elemtop = math.round( $elem.offset().top );
var elembottom = elemtop + $elem.height();
return ((elemtop < viewportbottom) && (elembottom > viewporttop));
}
function iselementinviewport3($elem) {
//var $elem = $(elem);
// get the scroll position of the page.
var scrollelem = ((navigator.useragent.tolowercase().indexof('webkit') != -1) ? 'body' : 'html');
var viewporttop = $(scrollelem).scrolltop();
var viewportbottom = viewporttop + $(window).height();
// get the position of the element on the page.
var elemtop = math.round( $elem.offset().top );
var elembottom = elemtop + $elem.height();
return ((elemtop - 300 < viewportbottom) && (elembottom + 300 > viewporttop));
}
// check if it's time to start the animation.
function checkanimation1() {
if( $('#pinnsecimg1').length == 0 )
return false;
var $elem1 = $('#pinnsecimg1 .pinnoverlay');
// if the animation has already been started
if ($elem1.hasclass('pinndone')) return;
if (iselementinviewport($elem1)) {
pinnanimate($elem1);
$elem1.addclass('pinndone');
}
}
function checkanimation2() {
if( $('#pinnsecimg2').length == 0 )
return false;
var $elem2 = $('#pinnsecimg2 .pinnoverlay');
// if the animation has already been started
if ($elem2.hasclass('pinndone')) return;
if (iselementinviewport($elem2)) {
pinnanimate($elem2);
$elem2.addclass('pinndone');
}
}
function checkanimation3() {
if( $('#pinnsecimg3').length == 0 )
return false;
var $elem3 = $('#pinnsecimg3 .pinnoverlay');
// if the animation has already been started
if ($elem3.hasclass('pinndone')) return;
if (iselementinviewport($elem3)) {
pinnanimate($elem3);
$elem3.addclass('pinndone');
}
}
function ucheckanimation1() {
if( $('#udpssecimg1').length == 0 )
return false;
var $elem1 = $('#udpssec1 .udps-img');
if( $('#udpssecfeatures1').hasclass('udps-donezo') )
return;
// if the animation has already been started
$elem1.each(function(index, element) {
if ($(this).hasclass('udpsdone')) return;
if (iselementinviewport2($('#udpssecfeatures1'))) {
udpsanimate($(this));
//$elem1.addclass('udpsdone');
if( !$('#udpssecfeatures1').hasclass('udps-donezo') )
$('#udpssecfeatures1').addclass('udps-donezo');
}
});
}
function ucheckanimation2() {
if( $('#udpssecimg2').length == 0 )
return false;
var $elem2 = $('#udpssec2 .udps-img');
if( $('#udpssecfeatures2').hasclass('udps-donezo') )
return;
// if the animation has already been started
$elem2.each(function(index, element) {
if ($(this).hasclass('udpsdone')) return;
if (iselementinviewport2($('#udpssecfeatures2'))) {
udpsanimate($(this));
//$elem2.addclass('udpsdone');
if( !$('#udpssecfeatures2').hasclass('udps-donezo') )
$('#udpssecfeatures2').addclass('udps-donezo');
}
});
}
function ucheckanimation3() {
if( $('#udps-screens-wrap').length == 0 )
return false;
//var $elem2 = $('#udpssec2 .udps-img');
if( $('#udps-screens-wrap').hasclass('udps-donezo') )
return;
// if the animation has already been started
if (iselementinviewport2($('#udps-screens-wrap'))) {
//udpsanimate($(this));
$('#udps-screens .udps-arrow').stop(true, true).delay(500).animate({opacity:1},1000,function(){$('#udps-screens .udps-arrow').css('transition','opacity .2s')});
//$elem2.addclass('udpsdone');
if( !$('#udps-screens-wrap').hasclass('udps-donezo') )
$('#udps-screens-wrap,.transnow').addclass('udps-donezo');
}
}
function pslpdcheckanimation1() {
if( $('#pslp-revenue').length == 0 )
return false;
if( $('#pslp-revenue').hasclass('pslp-donezo') )
return;
// if the animation has already been started
if (iselementinviewport2($('#pslp-revenue'))) {
//udpsanimate($(this));
$('#pslp-revenue').find('.pslp-arrow').stop(true, true).delay(500).animate({top:'0'},350,function(){/*$('#udps-screens .udps-arrow').css('transition','opacity .2s')*/});
if( !$('#pslp-revenue').hasclass('pslp-donezo') )
$('#pslp-revenue').addclass('pslp-donezo');
}
}
function pslpcheckanimation1() {
if( $('#pslp-logo').length == 0 )
return false;
if( $('#pslp-logo').hasclass('udps-donezo') )
return;
if (iselementinviewport2($('#pslp-logo'))) {
pslpanimate();
if( !$('#pslp-logo').hasclass('udps-donezo') )
$('#pslp-logo').addclass('udps-donezo');
}
}
function pslpcheckanimation2() {
if( $('#pslp-map-band').length == 0 )
return false;
if( $('#pslp-map-band').hasclass('pslp-donezo') )
return;
// if the animation has already been started
if (iselementinviewport3($('#pslp-map-band'))) {
//udpsanimate($(this));
$('#pslp-map-band').animate({top:'33%'},600,function(){/*$('#udps-screens .udps-arrow').css('transition','opacity .2s')*/});
//$elem2.addclass('udpsdone');
if( !$('#pslp-map-band').hasclass('pslp-donezo') )
$('#pslp-map-band').addclass('pslp-donezo');
}
}
function pslpcheckanimation3() {
if( $('#pslp-network-components').length == 0 )
return false;
if( $('#pslp-network-components').hasclass('pslp-donezo') )
return;
// if the animation has already been started
if (iselementinviewport2($('#pslp-network-components'))) {
//udpsanimate($(this));
$('#pslp-box-1').stop(true, true).delay(300).animate({top:'0'},600,function(){$('#pslp-box-2').animate({top:'0'},600);});
//$elem2.addclass('udpsdone');
if( !$('#pslp-network-components').hasclass('pslp-donezo') )
$('#pslp-network-components').addclass('pslp-donezo');
}
}
//#pslp-network-components
//#pslp-map-band
//udps-screens-wrap
function pinnanimate($elem){
$elem.animate({top: 0}, 500, function() {
// animation complete.
});
}
function pslpanimate(){
//special animation... arms!!!!!
//slides arm1 arm2 arm3 arm4 arm5
var acontainer = $('#pslp-arms');
acontainer.html('');
acontainer.find('.parm-center').stop(true, true).delay(400).animate({
top:80,left:116,width:119,height:119
},500,/*'easeinbounce',*/function(){
$('#pslp-arms').find('.parm2').show().animate({
left:89,
top:0
},250);//'easeoutback'
$('#pslp-arms').find('.parm1').stop(true, true).delay(300).show().animate({
left:0,
top:149,
width:119
},250);
$('#pslp-arms').find('.parm4').stop(true, true).delay(550).show().animate({
left:227,
top:163
},250);
$('#pslp-arms').find('.parm3').stop(true, true).delay(700).show().animate({
left:218,
top:5,
width:124
},250);
$('#pslp-arms').find('.parm5').stop(true, true).delay(950).show().animate({
left:151,
top:198
},250,function(){
});
});
}
function udpsanimate($elem){
console.log('called');
if( $elem.parent('li').hasclass('udps-animate') && $elem.siblings('div').attr('id') == 'udps-animation2' ){
//special animation... arms!!!!!
//slides arm1 arm2 arm3 arm4 arm5
var acontainer = $('#udps-animation2');
acontainer.html('');
//
//$elem.attr('id') == 'udps-animation2' ) sibling
acontainer.find('.arm-center').stop(true, true).delay(400).animate({
top:40,left:55,width:57,height:57
},500,/*'easeinbounce',*/function(){
$('#udps-animation2').find('.arm2').show().animate({
left:59,
top:0
},250);//'easeoutback'
$('#udps-animation2').find('.arm1').stop(true, true).delay(300).show().animate({
left:0
},250);
$('#udps-animation2').find('.arm4').stop(true, true).delay(550).show().animate({
left:100,
top:89
},250);
$('#udps-animation2').find('.arm3').stop(true, true).delay(700).show().animate({
left:108,
top:27
},250);
$('#udps-animation2').find('.arm5').stop(true, true).delay(950).show().animate({
left:42,
top:93
},250,function(){
//$('#udps-animation2').find('.arm-center').css({'border-radius':0,'background-color':'transparent'});
});
});
$elem.addclass('udpsdone');
}
else if( $elem.parent('li').hasclass('udps-animate') && $elem.siblings('div').attr('id') == 'udps-animation1' ){
//rings
var acontainer = $('#udps-animation1');
acontainer.html('');
acontainer.find('.ring1').stop(true, true).delay(400).animate({
left:48//left:21
},700/*,'easeoutback'*/);
acontainer.find('.ring2').stop(true, true).delay(400).animate({
right:49//right:22
},700/*,'easeoutback'*/);
$elem.addclass('udpsdone');
}
else{
$elem.stop(true, true).delay(300).animate({opacity: 1}, 1100, function(
) {
$elem.addclass('udpsdone');
// animation complete.
});
}
}
// capture scroll events
jquery(window).scroll(function($){
jquery(document).ready(function($) {
});
});
function pager_highlight(){
var positions = [];
$('#trends-feed').find('.trends-post').each(function(){
var postpos = $(this).css('top');
positions.push( postpos.substr(0, postpos.length - 2 ) );
});
var ppos = $('#trends-pager').css('top');
ppos = ppos.substr(0, ppos.length - 2 );
//console.log( ppos );
var index = positions.length - 1;
for( var i = 0; i < positions.length; i++ ){
if( parseint( positions[i] ) > parseint( ppos ) ){
index = i;
break;
}
}
//console.log( positions );
//console.log( 'index: '+i );
//console.log( 'pager position: '+ppos );
//console.log( 'index position: '+positions[i] );
//console.log( 'length: '+positions.length );
spostyear = $('#trends-feed').find('.trends-post:eq( '+index+' )' ).data('year');
$('#trends-pager li.active').removeclass('active');
$('#trends-pager').find('li[data-year="'+spostyear+'"]').addclass('active'); //[data-js="carousel"]
//find('li:data('+spostyear+')')
}
jquery(document).ready(function($) {
///navigation refresh
$('#menu-navigation-select select').on('change', function () {
var url = $(this).val(); // get selected value
if (url) { // require a url
window.location = url; // redirect
}
return false;
});
if( $('#spark-slides .spark-slide' ).length > 1 ){
console.log('slideshow baby!');
$('#spark-slides').cycle({
fx: 'scrollhorz',
speed: 200,
timeout: 0,
prev: '#spark-prev',
next: '#spark-next',
after: onafter,
pager: '#spark-pager'
});
}
function onafter(curr, next, opts) {
var index = opts.currslide;
$('#spark-prev')[index == 0 ? 'hide' : 'show']();
$('#spark-next')[index == opts.slidecount - 1 ? 'hide' : 'show']();
}
faqs = $('#dft-faqs');
if( faqs.length > 0 ){
$('.faq-section').click(function(){
if( $(this).hasclass('faq-closed') ){
$('.faq-open').find('ul').slideup();
$('.faq-open').removeclass('faq-open').addclass('faq-closed');
$(this).find('ul').hide();
$(this).removeclass('faq-closed').addclass('faq-open').find('ul').slidedown();
}
});
}
/*$('.menu-item-629 a').hover(function(){
$('#menu-navigation-refresh .menu-el_collision-repairers').slidedown();
},
function(){
$('#menu-navigation-refresh .menu-el_collision-repairers').slideup();
}
);
$('#menu-navigation-refresh .menu-el_collision-repairers').hover(function(){
$('#menu-navigation-refresh .menu-el_collision-repairers').show();
},
function(){
$('#menu-navigation-refresh .menu-el_collision-repairers').hide();
}
);*/
$('#menu-navigation-refresh > li').hoverintent(function(){
if( !$(this).parents('.menu-navigation-refresh-container').hasclass('nr-open') ){ /*&& !$(this).hasclass('menu-el_parts-suppliers') */
currleft = $(this).offset().left;
$(this).find('> .nr-menu-wrap > .sub-menu').css({
top: "0px",
left: currleft + "px",
});
$(this).find('.nr-menu-wrap').slidedown(100);
}
},
function(){
if( !$(this).parents('.menu-navigation-refresh-container').hasclass('nr-open') ){ /*&& !$(this).hasclass('menu-el_parts-suppliers') */
$(this).find('.nr-menu-wrap').slideup(100);
}
});
$('.navbar-toggle').click(function(){
$('.menu-navigation-refresh-container').slidetoggle();
$('.menu-navigation-refresh-container').toggleclass('nr-open');
});
$('#menu-navigation-refresh').click(function(e){
var target = $( e.target );
if( target.is('a') && $('.navbar-toggle:hidden').length == 0 ){
if( $(target).parent('li').hasclass('menu-item-has-children') && $(target).parent('li').find('> .nr-menu-wrap > .sub-menu:hidden').length > 0 ){ //.filter(':hidden')
e.preventdefault();
$(target).parent().find('.sub-menu:hidden').slidedown();
$(target).parent('li').addclass('nr-slid');
}
else{
console.log('outside');
}
}
});
/*
$('.prod-info').mouseenter(function () {
currtop = $(this).offset().top+20;
currleft = $(this).offset().left;
$('#prod-menu').css({
top: currtop + "px",
left: currleft + "px",
display: "block"
})
});
$('.prod-info').mouseleave(function () {
currtop = $(this).offset().top;
currleft = $(this).offset().left;
$('#prod-menu').css({
display: "none"
})
});
*/
//browser resize function
});