﻿// ----------------------------------------------------------------------
/// <summary>
/// Description:    Clientside script class for the EventInfoViewer.cs
/// 
/// Autor:			Hans Hawe
/// Date:			28.08.2009
/// 
/// (c) by team ModulAcht. All rights reserved
/// </summary>
// ----------------------------------------------------------------------
var EventInfoViewer =
{
    // ----------------------------------------------------------------------------
    /// initialize
    // ----------------------------------------------------------------------------
    initialize: function()
    {
    },

    // --------------------------------------------------------------------------------
    ///
    /// switches to a specific index within the eventview
    ///
    // --------------------------------------------------------------------------------
    switchEvent: function(index)
    {
        // get infoviewer element
        var infoViewer = $('infoviewer');
        if (infoViewer)
        {
            // get all children
            var children = infoViewer.childElements();
            var elementToAppear = null;
            if (children)
            {
                // set each children's display property to none, except the one to which to 
                // switch. let this one appear
                for (var i = 0; i < children.length; i++)
                {
                    var current = children[i];
                    current.style.display = 'none';
                    // remember the element to be shown
                    if (i == index)
                    {
                        elementToAppear = current;
                    }
                }
                // check for the element to be shown
                if (elementToAppear)
                {
                    // let element appear smoothly
                    elementToAppear.style.display = 'block';
                }
            }
        }
    }
};
