I'm trying to fix a Javascript error on my WordPress website, but as I'm not a JS guru, I can't work it out. I'm told there is an error in the code below on line 77: offset is undefined.

Are there any JS coders that could help me out?

=========

/* ==========================================================================
Initiator Scripts
========================================================================== */

$(function() {
// Initiate standard slider
if ($('.flexslider').length > 0) {
$('.flexslider').flexslider({
animation: "slide",
controlNav: false,
directionNav: true,
prevText: "<",
nextText: ">",
controlsContainer: ".flex-container"
});
}

// Initiate Lifestyle page slider
if ($('.location-slider').length > 0) {
$('.location-slider').flexslider({
animation: "slide",
controlNav: true,
directionNav: true,
prevText: "<",
nextText: ">",
controlsContainer: ".location-slider-container"
});

// Append location description below link
$('#location-slider .slide-1 a').css('background', 'url(../wp-content/themes/roots/assets/img/btn_slide1.jpg) top left');
$('#location-slider .slide-2 a').css('background', 'url(../wp-content/themes/roots/assets/img/btn_slide2.jpg) top left');
$('#location-slider .slide-3 a').css('background', 'url(../wp-content/themes/roots/assets/img/btn_slide3.jpg) top left');
$('#location-slider .slide-4 a').css('background', 'url(../wp-content/themes/roots/assets/img/btn_slide4.jpg) top left');
$('#location-slider .slide-5 a').css('background', 'url(../wp-content/themes/roots/assets/img/btn_slide5.jpg) top left');

// Append location description below link
$('#location-slider .slide-1').append('<span>Robina Town Centre</span>');
$('#location-slider .slide-2').append('<span>Skilled Park Stadium</span>');
$('#location-slider .slide-3').append('<span>Commercial Precinct</span>');
$('#location-slider .slide-4').append('<span>Medical Precinct</span>');
$('#location-slider .slide-5').append('<span>Transport Hub</span>');
}

// Initiate Fancybox popup
if ($('.fancybox').length > 0) {
$('.fancybox').fancybox();
}
});



/* ==========================================================================
Custom Scripts
========================================================================== */

// Mobile dropdown menu functionality
$(function() {
$('.mobile-menu').on('click', function(){
$('.nav-main ul').slideToggle();
});
});


// Anchor links smooth scrolling
$(function($) {
$(".scroll").click(function(event){
event.preventDefault();
$('html,body').animate({scrollTop:$(this.hash).offset().top}, 500);
});
});


// Fixed sub-menu
var GblTop;

function GetVertOffset (srchStr) {
GblTop = $(srchStr).offset().top - parseFloat($(srchStr).css('marginTop').replace(/auto/, 0));
}

$(function () {

GetVertOffset ('.floating-sub-menu'); // -- Sets GblTop

$(window).scroll (function() {
// what is the y position of the scroll?
var y = $(window).scrollTop();

// whether that's below the start of article?
if (y >= GblTop) {
// if so, add the fixed class
$('.floating-sub-menu').addClass('fixed-nav');
} else {
// otherwise, remove it
$('.floating-sub-menu').removeClass('fixed-nav');
}
});
});