﻿
SSF.Faq = function() {

    /* Private */

    /* Properties */

    var cmp = {};




    /* Methods */

    var init = function() {

        /* Constructor */

        // Rollovers for questions
        TVI.event('#faq .faqQuestion', 'mouseover', function() {
            $(this).addClass('hover');
        });
        TVI.event('#faq .faqQuestion', 'mouseout', function() {
            $(this).removeClass('hover');
        });

        // Open and close answers
        TVI.event('#faq .faqQuestion .question', 'click', function() {

            // Get parent element
            var question = $(this).parents('.faqQuestion');
            var toggleButton = question.find('.toggleButton');

            if (question.hasClass('open')) {
                question.removeClass('open');
                question.find('.answer').slideUp('fast');
                toggleButton.removeClass('buttonMinus');
                toggleButton.addClass('buttonPlus');
            }
            else {
                question.addClass('open');
                question.find('.answer').slideDown('fast');
                toggleButton.removeClass('buttonPlus');
                toggleButton.addClass('buttonMinus');
            }

        });


    };


    /* Public */

    TVI.apply(cmp, {

        /* Properties */

        test: 'test',

        /* Methods */

        test: function() {

            /* Test function  */

        }

    });


    TVI.ready(init);


    return cmp;


} ();