'); }else if(WID == 714){ //jQuery('#credit-app-used-tab').html(' '); }else{ //jQuery('#credit-app-used-tab').html(' '); } } jQuery("#watch_video, #videoWatchId, #watch_video_main").click(function(){ var videoContent = 'Video Content'; if(videoContent != 'Video Content'){ var trimmedContent = videoContent.trim(); if(trimmedContent.indexOf('<') === 0){ videoContent = (jQuery)(videoContent); var current = videoContent.attr('src'); if ((current.indexOf("?rel=0") >= 0) || (current.indexOf("&rel=0") >= 0) || (current.indexOf("//media.flickfusion.net") >= 0)){ }else if(current.indexOf("?") >= 0){ videoContent.attr('src', current + '&rel=0'); }else{ videoContent.attr('src', current + '?rel=0'); } }else{ var VideoId = ''; if(VideoId != ''){ videoContent = ' '; } } } jQuery("#modal-video-iframe").html(videoContent); if(trimmedContent.indexOf('<') === 0){ var vIframeHeight = videoContent.attr('height'); jQuery("#modal-video-iframe").children().attr("style", "height: "+vIframeHeight+"px !important;"); } var screenDoc = jQuery(document).width(); if(screenDoc > 668){ if (jQuery('#modal-video-iframe iframe').attr('src').includes('momento360') !== true) { var videoWidth = parseInt(jQuery("#modal-video-iframe").children().attr("width")) + 17; jQuery(".modal-content").css("width", videoWidth); } else { jQuery(".modal-content").css("width", '100%'); } } else{ jQuery("#modal-video-iframe").children().attr("width", 100 +'%'); } }); var offset = 220; var duration = 500; jQuery(window).scroll(function() { if (jQuery(this).scrollTop() > offset) { jQuery('.back-to-top').fadeIn(duration); } else { jQuery('.back-to-top').fadeOut(duration); } }); jQuery('.back-to-top').click(function(event) { event.preventDefault(); jQuery('html, body').animate({scrollTop: 0}, duration); return false; }); /** * Function checks for vehicle ids in cookie and forms comparison section * @returns {undefined} */ function checkCookie(){ if(cookieString !== null && cookieString !== ""){ jQuery.ajax({ type : 'POST', url: '/ajax/get-vehicles-for-compare', dataType : 'json', async : true, success : function(reply) { if (reply.length > 0) { for ( var i = 0; i < reply.length; i++ ) { var vehicle = reply[i]; compareIdArray.push(parseInt(vehicle.vehicleId)); counter++; } } if ( compareIdArray.length > 1 ) { jQuery("#compare-button").show("slow"); } }, data: { vehicle_ids: cookieString , baseUrl: baseUrl } }); } } jQuery('#compareVehicles').click(function(){ console.log('compare vehicles'); if (compareIdArray.length < 2){ alert("Minimum number of vehicles for comparing is 2"); } else { var compareUrl = '/used/compare'; var compareArrayString = compareIdArray.join('|'); compareUrl += '/ids/'+compareArrayString; window.location = compareUrl; } }); jQuery( document ).on( "click", ".colapse-button-new-details", function() { var row_small = jQuery(this).find('small'); var link = jQuery(this).find('a'); if (row_small.html() == '[click to expand]') { row_small.html('[click to collapse]'); } else if (row_small.html() == '[click to collapse]') { row_small.html('[click to expand]'); } }); jQuery('.back-to-top').click(function() { var expanded = jQuery(".panel-collapse").hasClass("in"); if(expanded) { jQuery(".panel-collapse").removeClass("in"); jQuery(".panel-collapse").addClass("collapse"); var link = jQuery(".colapse-button-new-details").find('a'); var row_small = jQuery(".colapse-button-new-details").find('small'); row_small.html('[click to expand]'); } }); jQuery(document).on("click", ".collapse-button-bottom-right-options", function() { jQuery("#collapseVehicleDetails").removeClass("in"); jQuery("#collapseVehicleDetails").addClass("collapse"); var link = jQuery("#options-new-details").find('a'); var row_small = jQuery(".colapse-button-new-details").find('small'); row_small.html('[click to expand]'); jQuery('html, body').animate({scrollTop: jQuery("#options-vdp").offset().top}, 500); }); jQuery(document).on("click", ".colapse-button-bottom-right-tech-specs", function() { jQuery("#collapseVehicleTechSpecs").removeClass("in"); jQuery("#collapseVehicleTechSpecs").addClass("collapse"); var link = jQuery("#tech-specs-new-details").find('a'); var row_small = jQuery(".colapse-button-new-details").find('small'); row_small.html('[click to expand]'); jQuery('html, body').animate({scrollTop: jQuery("#tech-specs-vdp").offset().top}, 500); }); jQuery(document).on('click', '#dealertrack_button', function(){ var headerOffset = 0; if(jQuery('header').length > 0){ if(jQuery('header').css('position') === 'fixed'){ headerOffset = jQuery('header').height(); } } jQuery('html, body').animate({ scrollTop: jQuery("#accordion-dealertrack").offset().top - headerOffset }, 1000); });