﻿getRotationAnim = function()
{
    var result = null;
    var extender = $find("NewsAnimation");
    if (extender != null)
    {
        var loadBehavior = extender.get_OnLoadBehavior();
        if (loadBehavior != null)
        {
            var animOuter = loadBehavior.get_animation();
            if (animOuter != null)
            {
                var animArray = animOuter.get_animations();
                if ((animArray != null) && (animArray.length > 1))
                {
                    result = animArray[1];
                }
            }
        }
    }
    return result;
}

pauseNewsRotation = function()
{
    var rotationAnim = getRotationAnim();
    if ((rotationAnim != null) && (typeof(rotationAnim.pause) != "undefined"))
    {
        rotationAnim.pause();
        rotationAnim._paused = true;
        rotationAnim._playing = false;
        var anchor = document.getElementById("news-pause");
        if (anchor != null)
        {
            anchor.style.display = "none";
            anchor = document.getElementById("news-resume");
            anchor.style.display = "block";
        }
    }
}

resumeNewsRotation = function()
{
    var rotationAnim = getRotationAnim();
    if ((rotationAnim != null) && (typeof(rotationAnim.play) != "undefined"))
    {
        rotationAnim.play();
        rotationAnim._paused = false;
        rotationAnim._playing = true;
        var anchor = document.getElementById("news-resume");
        if (anchor != null)
        {
            anchor.style.display = "none";
            anchor = document.getElementById("news-pause");
            anchor.style.display = "block";
        }
    }
}
