﻿jQuery(function () {
    jQuery('.newscycle').each(function () {
        var nodes = jQuery(this).children('div').hide();
        var selectedNode = nodes.first().show();

        nodes.bind('showNext', function () {
            selectedNode.hide();
            selectedNode = selectedNode.next();
            if (selectedNode.length === 0)
                selectedNode = nodes.first();
            selectedNode.show();

            setTimeout(function () {
                selectedNode.triggerHandler('showNext');
            }, 8000);
        });
        selectedNode.triggerHandler('showNext');
    });


    // make columns on homepage the same height as eachother, using the column with the larges height as a reference.
    var largestHeight = 0;
    jQuery('#homepage .content-container .column').each(function () {
        if (jQuery(this).height() > largestHeight)
            largestHeight = jQuery(this).height();
    });
    jQuery('#homepage .content-container .column').height(largestHeight);
});
