﻿$(function () {

    /*Event margins*/
    var eventItems = $(".eventitem");
    var eventItemCount = eventItems.size();
    var totalHeight = eventItems.parent().height();
    if (eventItemCount < 6) {
        $("#eventimg").css("display", "block");
        totalHeight -= (116 + 16); //116 = image height, 16 = bottom padding
    }

    var averageHeight = 0;
    var totalEventHeight = 0;
    eventItems.each(function () {
        totalEventHeight += $(this).height();
    });
    averageHeight = totalEventHeight / eventItemCount;
    var marginHeight = ((totalHeight / eventItemCount) - averageHeight);
    eventItems.css("margin-bottom", marginHeight);


    /*Industry news*/
    //    var wrapperHeight = $(".scrollwrapper").height();
    //    var wrapperHeight = 360;
    //    var newsHeight = 0;
    //    var actualNewsHeight = 0;
    //    var count = 0;
    //    $(".scrollingcontent1").children().each(function () {
    //        if ((newsHeight + $(this).height()) < wrapperHeight) {
    //            newsHeight += $(this).height();
    //            count++;
    //        }
    //        $(this).addClass("hideFeedItem");
    //    });

    //    $(".scrollingcontent1").children().each(function () {
    //        if ($.browser.webkit) {
    //            if (count != 0) {
    //                $(this).removeClass("hideFeedItem");
    //                $(this).addClass("displayFeedItem");
    //                count--;
    //            }
    //        } else {
    //            if (count != 1) {
    //                $(this).removeClass("hideFeedItem");
    //                $(this).addClass("displayFeedItem");
    //                count--;
    //            }
    //        }
    //    });

});
