
// makes sure the whole site is loaded
jQuery(window).load(function () {
// will first fade out the loading animation
    jQuery(".loaded").fadeOut();
    // will fade out the whole DIV that covers the website.
    jQuery(".loader").delay(1000).fadeOut("slow");
});



jQuery(document).ready(function ($) {
    "use strict";
    //do jQuery stuff when DOM is ready


// Global Color

    $('head style').append('h1,h2,h3,h4,h5,h6, .navigation ul li a, blockquote,.btnMain,.btnColor2,.btnColor3,.btnLte {font-family:"' + Heading_Font + '"; } html, body, div, p, table, tr, td, th, tbody, tfoot, ul, li, ol, dl, dd, dt, fieldset, cite, input, select, textarea, button, a, section, article, aside, header, footer, nav {font-family:"' + Site_Font + '"; }  body {background-color:#' + page_background_color + ';} .navbar-header, .btn, .schedule-box h6.section-head span, header.colored, .panel-heading a, .navigation nav ul li, .dateBox span, .hoverImg, .single-post-heading, .tags a:hover, .tagcloud a:hover, .add-comment, .comment-reply-link:hover, .admin-comment, .format-link .post-content > a, .format-link .post-content > p > a, .widget_search .search-form input[type="submit"], .widget_search input[type="submit"] {background-color:#' + main_color + '; }  a, h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover, h5 a:hover, h6 a:hover, #home li a:hover, .styled div, h3 span, .speaker .col-md-2 i, #directionsPanel .adp-summary, #schedule .nav-tabs li.active h5, .recent-post-entry h5 a:hover, .widget_calendar table caption, .widget_calendar table tr td a  {color:#' + main_color + '} #schedule .nav-tabs li.active i, #schedule .nav-tabs li a:hover h5, .schedule-box li h6 strong, .required {color:#' + main_color + ';}    div.section, #home {border-top:5px solid #' + main_color + ';  }  ::selection {background-color:#' + main_color + '; color:#fff;} ::-moz-selection {background-color:#' + main_color + '; color:#fff;} input[type=text]:focus, input[type=email]:focus, input[type=tel]:focus, textarea:focus, input[type=number]:focus,  {border:1px solid #' + main_color + '!important; -webkit-box-shadow:0 0 5px 0 #' + main_color + '; box-shadow:0 0 5px 0 #' + main_color + '!important; box-shadow:0 0 5px 0 #' + main_color + '; box-shadow:0 0 5px 0 #' + main_color + '!important;  } .border-color {border-color:#' + main_color + '!important; } ');


// Gallery Captions
    $(' #eg-thumbs > li ').each(function () {
        $(this).hoverdir();
    });

// Image Lightbox
    $("a[data-rel^='prettyPhoto']").prettyPhoto({overlay_gallery: true});
    $('.gallery a').append('<span class="link"><i class="fa fa-search-plus"></i></span>');

// equal heights columns
    $('.container').each(function () {
        var highestBox = 0;
        $('.column', this).each(function () {
            if ($(this).height() > highestBox)
                highestBox = $(this).height();
        });
        $('.column', this).height(highestBox);
    });

// Top Arrow
    $(window).scroll(function () {
        if ($(window).scrollTop() > 1000) {
            $('a.top').fadeIn('slow');
        } else {
            $('a.top').fadeOut('slow');
        }
    });

// Collapse menu for small devices
    var winWidth = $('body').width();
    if (winWidth <= 767) {

        // Add attribs to menu
        $('#Navigation li a').attr('data-toggle', 'collapse');
        $('#Navigation li a').attr('data-target', '#Navigation');

    } else {
    }

// Register toggle
    $('#register').hide();
    $('.register-trigger').click(function (event) {
        event.preventDefault();
        $('#register').slideToggle('fast');
    });

// Tooltip
    $('a.tips').tooltip();

// responsive Video Target your .container, .wrapper, .post, etc.
    $(".container").fitVids();

// Tabs Active
    $('#schedule .nav-tabs li').append('<span class="arrow"></span>');
    $('#schedule .nav-tabs li span.arrow').hide();

// Counter
    var countDiv = $('.countdown');
    var endDate = "June 7, 2022 15:00:00";
    if (countDiv.length > 0) {
        endDate = countDiv.attr('data-time');
    }
    $('.countdown.styled').countdown({
        date: endDate,
        render: function (data) {
            var years = this.leadingZeros(data.years, 2);
            if (years != '00') {
                $(this.el).html("<div><span>" + this.leadingZeros(data.years, 2) + " </span><strong>years</strong></div><div><span>" + this.leadingZeros(data.days, 3) + " </span><strong>days</strong></div><div><span>" + this.leadingZeros(data.hours, 2) + "  </span><strong>hrs</strong></div><div><span>" + this.leadingZeros(data.min, 2) + "</span><strong>min</strong></div><div><span>" + this.leadingZeros(data.sec, 2) + " </span><strong>sec</strong></div>");
            } else {
                $(this.el).html("<div><span>" + this.leadingZeros(data.days, 3) + " </span><strong>days</strong></div><div><span>" + this.leadingZeros(data.hours, 2) + "  </span><strong>hrs</strong></div><div><span>" + this.leadingZeros(data.min, 2) + "</span><strong>min</strong></div><div><span>" + this.leadingZeros(data.sec, 2) + " </span><strong>sec</strong></div>");
            }
        }
    });

// Accordion Symbols
//    $('.panel').on('shown.bs.collapse', function () {
//        $(this).find('.in').prev().addClass('active');
//    });
//    $('.panel').on('hidden.bs.collapse', function () {
//        $(this).find('.panel-heading').removeClass('active');
//    });

    $('.xs-faq .panel-heading a').addClass('collapsed');
    
//page Scroll
    $('nav a[href^=#], a.top[href^=#]').click(function (event) {
        event.preventDefault();
        $('html,body').animate({
            scrollTop: $(this.hash).offset().top - 80},
        1000);
    });

// Year Update
    var curYear = new Date().getFullYear();
    $('.year').html(curYear);


//Speaker OverlayColor
    var speacker_div = $('.speaker i');
    if (speacker_div.length > 0) {
        var getcolor = speacker_div.css("color");
        var matchColors = /rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)/;
        var match = matchColors.exec(getcolor);
        var transColor = "rgba(" + match[1] + ', ' + match[2] + ', ' + match[3] + ", 0.9)";
        $('figcaption').css("background-color", transColor);
    }



});