// ========== TOP FAQS
// This code reformats an index page tile if the tile's title contains "Top FAQs".

var page = window.location.pathname;
page = page.substring(page.lastIndexOf('/'));
// alert(page);
if(page == '/index.html' || page == '/') {
    // Add id to main tiles container
    $('a:contains("Top FAQs")').closest('.wh_tiles').attr('id','main_tiles');
    // Add a class and an id to the top faqs div
    $('a:contains("Top FAQs")').closest('.wh_tile').addClass('topfaqs_tile').attr('id','topfaqs_tile');

    // Add a class and an id to the wh_tile_shortdesc
    $('a:contains("Top FAQs")').closest('.wh_tile_text').children('div.wh_tile_shortdesc').attr('id','topfaqs_shortdesc');
    
    // Create a new div for the Top FAQs tiles
    $('<div class=" wh_tiles_topfaqs " id=" wh_tiles_topfaqs "></div>').insertAfter('#main_tiles');
    // Move the Top FAQs tile to the new div
    $('#topfaqs_tile').appendTo('.wh_tiles_topfaqs');
    // Remove wh_content_flex_container class from parent div
    $('a:contains("Top FAQs")').closest('.container').attr('id','main_container').css('display','flex');
    $('a:contains("Top FAQs")').closest('div#main_container').removeClass('wh_content_flex_container');
    // Format the Top FAQs tiles
    $('a:contains("Top FAQs")').closest('a').css({color: '#ffffff'});
    $('.wh_tile_text').children('wh_tile_shortdesc').css('color', '#ffffff !important'); 
}