<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="NewsBanner.ascx.vb" Inherits="WebFoundations.WFPortal.BaseModules.UI.NewsBanner" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<script type="text/javascript">
    (function (global, undefined) {
        var lastShownButton, rotator;

        function rotator_load(sender, args) {
            rotator = sender;
        }

        function showItemByIndex(index) {
            rotator.set_currentItemIndex(index);

            if (lastShownButton)
                lastShownButton.removeClass("btnHighlight");


            var currentButton = getButtonByIndex(index);
            currentButton.addClass("btnHighlight");
            lastShownButton = currentButton;
        }

        function OnClientItemShown(sender, args) {
            var currentIndex = args.get_item().get_index();

            if (lastShownButton)
                lastShownButton.removeClass("btnHighlight");

            var currentButton = getButtonByIndex(currentIndex);
            currentButton.addClass("btnHighlight");
            lastShownButton = currentButton;
        }

        function getButtonByIndex(index) {
            var elementIndex = index + 1;
            var currentButton = $telerik.$(".ButtonsContainer a:nth-child(" + elementIndex + ")");
            return currentButton;
        }

        global.rotator_load = rotator_load;
        global.OnClientItemShown = OnClientItemShown;
        global.showItemByIndex = showItemByIndex;
    })(window);
</script>
<telerik:RadRotator ID="newsrot" ItemWidth="100%" Width="100%" RotatorType="AutomaticAdvance" ScrollDirection="Up" runat="server" OnClientLoad="rotator_load" PauseOnMouseOver="true">
    <ItemTemplate>
        <asp:HyperLink ID="lnkbanner" runat="server" />
        <div class="cnBannerTitle">
        <asp:Label runat="server" ID="lblTitle" />
        <asp:Label runat="server" ID="lblSubtitle" />
        </div>
    </ItemTemplate>
</telerik:RadRotator>
<div class="links">
    <asp:Panel ID="ButtonsContainer" CssClass="ButtonsContainer" runat="server" />
    <%--<a href="#" id="leftBtn" title="Rotate Left" class="leftButton"></a>
    <a href="#" id="rightBtn" title="Rotate Right" class="rightButton"></a>--%>
</div>
