jQuery.fn.tabs = function (selected) {
    var sel = selected || 1;

    return this.each(function () {
        var ol    = jQuery(this);
        var ipl    = 'a[href^=#]';

        // Go through all the in-page links in the ol
        // and hide all but the selected's contents
        ol.find(ipl).each(function (i) {
            var link = jQuery(this);

            if ((i + 1) === sel) {
                link.addClass('selected');
            }
            else {
                jQuery(link.attr('href')).hide();
            }
        });

        // When clicking the ol (or anything within)
        ol.click(function (e) {
            var clicked    = jQuery(e.target);
            var link    = false;

            if (clicked.is(ipl)) {
                link = clicked;
            }
            else {
                var parent = clicked.parents(ipl);

                if (parent.length) {
                    link = parent;
                }
            }

            if (link) {
                var selected = ol.find('a.selected');

                if (selected.length) {
                    jQuery(selected.removeClass('selected').attr('href')).hide();
                }

                jQuery(link.addClass('selected').attr('href')).show();

                return false;
            }
        });
    });
}

jQuery(document).ready(function() {
	jQuery("a.myfancybox").fancybox({ 'zoomSpeedIn': 500, 'zoomSpeedOut': 500, 'overlayShow':true,'overlayOpacity':0.3 });
	jQuery('#tabs').tabs();
});

    // These two lines make set a Date variable with the current date and time
    var currentDate = new Date();
    var currentHour = currentDate.getHours();
 
    // Here we're creating a new <link /> to insert in the <head></head>
    var newCSS = document.createElement('link');
    newCSS.type = 'text/css';
    newCSS.rel = 'stylesheet';
 
    // This is where you can determine when to use which stylesheet.
    // If the current hour is before 9am or 8pm (or later), use "night.css"
    if (currentHour < 7 || currentHour >= 18) {
        newCSS.href = '/wp-content/themes/ivemendes/css/module/night.css';
    }
    // This line actually does the deed, and attaches the selected stylesheet
    jQuery("head").append(newCSS);
 


