﻿FAQ = function(caption, text, row, selectedRowStyle, normalRowStyle)
{
    this._caption = caption;
    this._text = text;
    this._row = row;
    this._selectedRowStyle = selectedRowStyle;
    this._normalRowStyle = normalRowStyle;
}

FAQ.prototype =
{
    get_visible : function()
    {
        return this._text.style.display != 'none';
    },

    show : function(value)
    {
        if (value === true)
        {
            this._caption.style.fontWeight = 'bold';
            this._text.style.display = '';
        }
        else
        {
            this._caption.style.fontWeight = 'normal';
            this._text.style.display = 'none';
        }
    },
    
    hOver : function()
    {
        this._caption.style.cursor = 'hand';
        this._caption.style.cursor = 'pointer';
        //if(!this.get_visible())
        {
            this._row.className = this._selectedRowStyle;
        }
    },
    
    hOut : function()
    {
        //if(!this.get_visible())
        {
            this._row.className = this._normalRowStyle;
        }
    },
    
    toggle : function()
    {
        this.show(!this.get_visible());
    }
}

function clickFAQ(captionID, txtID)
{
    var faq = new FAQ($get(captionID), $get(txtID), '', '', '');
    faq.toggle();
}

function hoverFAQ(captionID, txtID, rowID, selectedRowStyle)
{
    var faq = new FAQ($get(captionID), $get(txtID), $get(rowID), selectedRowStyle, '');
    faq.hOver();
}

function houtFAQ(captionID, txtID, rowID, normalRowStyle)
{
    var faq = new FAQ($get(captionID), $get(txtID), $get(rowID), '', normalRowStyle);
    faq.hOut();
}