//****************************************************************************
// Copyright (c) 2005, Coveo Solutions Inc.
//****************************************************************************

function CES_SaveQueryOrFilter() {

//****************************************************************************
/// Called when the user clicks the Save Query link.
//****************************************************************************
this.BTNSaveQuery_Click = function(p_Event)
{
    this.m_Query = true;
    this.DIVButtons.style.display = 'none';
    this.DIVControls.style.display = 'block';
    this.TXTName.focus();
    CNL_CancelEvent(p_Event);

    this.AdjustTextBoxWidth();

    return false;
}

//****************************************************************************
/// Called when the user clicks the Save Filter link.
//****************************************************************************
this.BTNSaveFilter_Click = function(p_Event)
{
    this.m_Query = false;
    this.DIVButtons.style.display = 'none';
    this.DIVControls.style.display = 'block';
    this.TXTName.focus();
    CNL_CancelEvent(p_Event);

    this.AdjustTextBoxWidth();

    return false;
}

//****************************************************************************
/// Called when the Save button is clicked.
//****************************************************************************
this.BTNSave_Click = function(p_Event)
{
    if (this.TXTName.value != '') {
        if (this.m_Query) {
            this.SaveQuery();
        } else {
            this.SaveFilter();
        }
    }
    CNL_CancelEvent(p_Event);
    
    return false;
}

//****************************************************************************
/// Called when the Cancel button is clicked.
//****************************************************************************
this.BTNCancel_Click = function(p_Event)
{
    this.DIVButtons.style.display = 'block';
    this.DIVControls.style.display = 'none';
    CNL_CancelEvent(p_Event);

    return false;
}

this.AdjustTextBoxWidth = function()
{
    if (CNL_IsIE()) {
        CNL_FitToParentWidth(this.TXTName);
    }
}

} // constructor

