function carouselInit()
{
    var carousel = new YAHOO.widget.Carousel
    (
        'newsContainer',
        {
            animation: {speed: 0}
        }
    );

    carousel.set('numVisible', 1);
    carousel.render();
    carousel.show();

    YAHOO.util.Event.addListener(
        'homeNewsPrevious',
        'click',
        function ()
        {
            carousel.scrollBackward();
            carousel.blur();

            document.getElementById('homeNewsNext').style.backgroundPosition = 'top right';

            if (hasClassName(document.getElementsByClassName('yui-carousel-first-button'), 'yui-carousel-first-button-disabled'))
            {
                document.getElementById('homeNewsPrevious').style.backgroundPosition = 'bottom left';
            }
            else
            {
                document.getElementById('homeNewsPrevious').style.backgroundPosition = 'top left';
            }
        }
    );

    YAHOO.util.Event.addListener(
        'homeNewsNext',
        'click',
        function ()
        {
            carousel.scrollForward();
            carousel.blur();

            document.getElementById('homeNewsPrevious').style.backgroundPosition = 'top left';

            if (hasClassName(document.getElementsByClassName('yui-carousel-next-button'), 'yui-carousel-button-disabled'))
            {
                document.getElementById('homeNewsNext').style.backgroundPosition = 'bottom right';
            }
            else
            {
                document.getElementById('homeNewsNext').style.backgroundPosition = 'top right';
            }
        }
    );
}

function hasClassName(objElementArray, strClass)
{
    for (itemId in objElementArray)
    {
        if (objElementArray[itemId].className)
        {
            var arrList = objElementArray[itemId].className.split(' ');

            var strClassUpper = strClass.toUpperCase();

            for (var i = 0; i < arrList.length; i++)
            {
                if (arrList[i].toUpperCase() == strClassUpper)
                {
                    return true;
                }
            }
        }
    }

    return false;
}

function formContactInit()
{
    YAHOO.util.Event.addListener(
        'demandType',
        'change',
        function ()
        {
            if (document.formContact.elements['demandType'].options[document.formContact.elements['demandType'].selectedIndex].value == 'lesson')
            {
                document.getElementById('formContactLessonDetails').style.display = 'block';
            }
            else
            {
                document.getElementById('formContactLessonDetails').style.display = 'none';
            }
        }
    );
}