﻿// Shows the add KB panel
function ShowKBPanel(oPanel,oButton)
{
    var pnlKBPanel = document.getElementById(oPanel);
    var btnKB = document.getElementById(oButton);
    var arrPosition = CumulativeOffset(btnKB);
    
    pnlKBPanel.style.visibility='visible';
    pnlKBPanel.style.top = arrPosition[1] + 21 + 'px';
    pnlKBPanel.style.right = '50px'

}	
// Hides the add KB panel	
function HideKBPanel(oPanel,oButton)
{
    var pnlKBPanel = document.getElementById(oPanel);
    pnlKBPanel.style.visibility='hidden';
}

//Add the message to the questions of the KB
function AddQuestion(oQuestion, nMessageID)
{
     var txtQuestionField = document.getElementById(oQuestion);
     var nIndexOf = txtQuestionField.value.indexOf(',' + nMessageID + ',');
     if (nIndexOf == '-1')
     {
        txtQuestionField.value += nMessageID + ',';
     }
}

//Adds the message to the ansswers of the KB
function AddAnswer(oAnswer, nMessageID)
{
     var txtAnswerField = document.getElementById(oAnswer);
     var nIndexOf = txtAnswerField.value.indexOf(',' + nMessageID + ',');
     if (nIndexOf == '-1')
     {
        txtAnswerField.value += nMessageID + ',';
     }
}
