﻿/*****************************************
 EFFECTS
*****************************************/
// Wait function (ms)
$.fn.wait = function(time, type) {
    time = time || 1000;
    type = type || "fx";
    return this.queue(type, function() {
        var self = this;
        setTimeout(function() {
            $(self).dequeue();
        }, time);
    });
};

// Hover Menu
$(document).ready(function() {
    $('.headlink').hover(
            function() {
                $(this).children('ul').animate({ opacity: 'show', top: '18' }, 'fast');
            },
                    function() {
                        $(this).children('ul').animate({ opacity: 'hide', top: '5' }, 'fast');
                    }
            )
});

/*****************************************
Logic
*****************************************/
$(document).ready(function() {
    //Blog comment show/hide or hide completely when empty
    $('.commentContainer:div empty').hide();

    //Check if div is empty
    if ($('.commentContainer').html()) {
        $(this).each('.blogContainer').remove;
        //alert('empty?');
        //$(this).children('.blogContainer').remove;
    };

    // Here, we will modify our CSS classes for business/organizations to minify the data down to be more usable
    $('.blogComments').click(
            function() {
                $(this).next('.comments').slideToggle('fast');
            })
    $('.slideHeader').mouseenter(
        function() {
            $(this).next('.slideBody').slideToggle('fast');
        })
    });

    $('.slideHeader').mouseleave(
        function() {
            $(this).next('.slideBody').slideToggle('fast');
        });

    $(function() {
        $(".dataHolder").jCarouselLite({
            btnNext: ".next",
            btnPrev: ".prev",
            visible: 1,
            vertical: true,
            circular: false
        });
    });