// Global Template JavaScript
// set functions
function homeHeroHeight() {
var windowHeight = $(window).height();
var windowHeightCalc = Math.floor(windowHeight-70);
$('#home #wrapBanner').css('height', windowHeightCalc+'px');
}
function quickSearch() {
$(".QuickSearchTextbox").attr('placeholder',"Search here");
$('.QuickSearchTextbox').parent('td').addClass('QuickSearchTextboxTD');
$('.QuickSearchButton').parent('td').addClass('QuickSearchButtonTD');
$('.QuickSearchButton').val("GO");
}
function bannerImageBackground() {
$('#wrapBanner').each(function(){
var backgroundImageSRC = $(this).find('.backgroundImage img').attr('src');
$(this).css('background-image','url(' + backgroundImageSRC + ')');
});
}
function makeSticky() {
var stickyNav = function(){
var windowWidth = $(window).width();
if (windowWidth > 1060) {
var scrollTop = $(window).scrollTop();
if (scrollTop > 100) {
$('#wrapHeader').addClass('sticky');
} else {
$('#wrapHeader').removeClass('sticky');
}
}
};
stickyNav();
$(window).scroll(function() {
stickyNav();
});
window.onresize = function() {
stickyNav();
};
}
function Inchabodbg() {
var InchabodbgHTML = '
';
$('#wrapContentBlocks').find('.background').empty().append(InchabodbgHTML);
}
function searchDDL() {
var searchDDLWrapper = '';
$('.mainMenu .search').append(searchDDLWrapper);
var searchFormHTML = $('.searchContainer .QuickSearchFormTable');
$('.mainMenu .search ul li').append(searchFormHTML);
$('#wrapMenu .mainMenu .search > a').on('click',function(){
$(this).parent().find('> ul').toggle();
$(this).parent().toggleClass('active');
$('.QuickSearchFormTable .QuickSearchTextbox').focus();
});
}
// Replace HTML tables with DIVs - Profile callout
function calloutTables() {
$('table.calloutTable').each(function(){
$(this).replaceWith( $(this).html()
.replace(//gi, "")
.replace(/<\/td>/gi, "")
.replace(/<\/tbody/gi, "<\/div")
);
});
}
function eventTables() {
$('table.eventTable').each(function(){
$(this).replaceWith( $(this).html()
.replace(//gi, "")
.replace(/<\/td>/gi, "")
.replace(/<\/tbody/gi, "<\/div")
);
});
}
function featureTables() {
$('table.featureTable').each(function(){
$(this).replaceWith( $(this).html()
.replace(//gi, "")
.replace(/<\/td>/gi, "")
.replace(/<\/tbody/gi, "<\/div")
);
});
var featuredImageLabel = '';
$(featuredImageLabel).prependTo('.eventFeature .image');
}
function homeFeatureTables() {
$('table.homeFeature').each(function(){
$(this).replaceWith( $(this).html()
.replace(//gi, "")
.replace(/<\/td>/gi, "")
.replace(/<\/tbody/gi, "<\/div")
);
});
}
function eventDetails() {
$('.eventDetails .eventDate').prepend('');
$('.eventDetails .eventTime').prepend('');
$('.eventDetails .eventLocation').prepend('');
}
function footerIcons() {
$('.footerSocial em[class*="fa"]').empty();
}
$(document).ready(function(){
if ($('.QuickSearchFormTable').length > 0) {
quickSearch();
}
if ($('#wrapHeader').length > 0) {
makeSticky();
}
if ($('.mainMenu .search').length > 0) {
searchDDL();
}
if ($('table.calloutTable').length > 0) {
calloutTables();
}
if ($('table.eventTable').length > 0) {
eventTables();
}
if ($('table.featureTable').length > 0) {
featureTables();
}
if ($('table.homeFeature').length > 0) {
homeFeatureTables();
}
if ($('.eventDetails').length > 0) {
eventDetails();
}
if ($('.footerSocial').length > 0) {
footerIcons();
}
// two column specific
if ($('#twoCol').length > 0) {
bannerImageBackground();
}
// three column spercific
if ($('#threeCol').length > 0) {
bannerImageBackground();
}
// home page specific
if ($('#home').length > 0) {
if ($('#wrapContentBlocks').length > 0) {
Inchabodbg();
}
homeHeroHeight();
$(window).resize(function(){
homeHeroHeight();
});
}
});