/**
 * fix department scrollable height
 * fuck chrome not ie this time
 */
function fix() {
    jQuery("document").ready(function() {
    
        
        setTimeout(function() {
            var tallest = 0;
            jQuery("#departments ul li").each(function() {
                if (jQuery(this).height() > tallest) {
                    tallest = jQuery(this).height();
                }            
            });
            jQuery("#departments .items-out").height(tallest);
            jQuery("#departments ul").children().css({'min-height': tallest});
        }, 100);
    });
}

jQuery("document").ready(function() {
    /**
     * init scrollable plugin for departments section
     */
    if (jQuery("#departments .items-out .items .item").size() > 5) {
        jQuery("#departments .items-out").scrollable({
            'onSeek':function() {
                if (this.getIndex() >= this.getSize() - 5) {
                    jQuery("#departments .nav .next").addClass("toBegin");
                }
            }
        });
    }
    var scrollable = jQuery("#departments .items-out").data("scrollable");
    jQuery("#departments .nav a").click(function() {
        if (jQuery(this).hasClass("toBegin")) {
            scrollable.seekTo(0);
            jQuery(this).removeClass("toBegin");
        }
        return false;
    });
    
    /**
     * init tabs
     */
    jQuery(".tabs-out ul.tabs").tabs(".tabs-out .panes > div ");
});



jQuery(function(){
    jQuery('#featured .entry').columnize({
        lastNeverTallest: true
    });
});
