//****************************************************************************
// Copyright (c) 2005, Coveo Solutions Inc.
//****************************************************************************

function CES_HighlightedQuery() {

//****************************************************************************
// Handler for the onmousedown event on an highlighted term.
// p_Term - The index of the term to highlight.
//****************************************************************************
this.Term_OnMouseDown = function(p_Event, p_Term)
{
    this.HighlightNextOccurence(p_Term);
    return false;
}

//****************************************************************************
// Handler for the onmousewheel event on an highlighted term.
// p_Term - The index of the term to highlight.
//****************************************************************************
this.Term_OnMouseWheel = function(p_Event, p_Term)
{
    if (p_Event.wheelDelta < 0) {
        this.HighlightNextOccurence(p_Term);
    } else {
        this.HighlightPreviousOccurence(p_Term);
    }
    CNL_CancelEvent(p_Event);

    return false;
}

//****************************************************************************
// Highlights the next occurence of a term.
// p_Term - The index of the term to highlight.
//****************************************************************************
this.HighlightNextOccurence = function(p_Term)
{
    var frame = document.getElementsByName(this.FRAME_NAME)[0];
    if (frame != null) {
        frame.HighlightNextOccurence(p_Term);
    }
}

//****************************************************************************
// Highlights the previous occurence of a term.
// p_Term - The index of the term to highlight.
//****************************************************************************
this.HighlightPreviousOccurence = function(p_Term)
{
    var frame = document.getElementsByName(this.FRAME_NAME)[0];
    if (frame != null) {
        frame.HighlightPreviousOccurence(p_Term);
    }
}

} // Constructor

