Type.registerNamespace('Coveo.CES.Common');

////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Common.SearchInterfaceQueryString

Coveo.CES.Common.SearchInterfaceQueryString = function Coveo_CES_Common_SearchInterfaceQueryString() {
    /// <summary>
    /// Provides constants for the various query string parameters used by CES.
    /// </summary>
    /// <field name="queryParameter" type="String" static="true">
    /// The query string parameter used for passing the query.
    /// </field>
    /// <field name="conversationSubjectParameter" type="String" static="true">
    /// The query string parameter used for passing the conversation Subject.
    /// </field>
    /// <field name="targetFrameParameter" type="String" static="true">
    /// The query string parameter used for the target frame.
    /// </field>
    /// <field name="oldOutlookAddInVersion" type="String" static="true">
    /// The query string parameter used for the old Outlook Add-In Version.
    /// </field>
    /// <field name="collectionNamesParameter" type="String" static="true">
    /// The query string parameter used for selecting collections (by names).
    /// </field>
    /// <field name="collectionIdsParameter" type="String" static="true">
    /// The query string parameter used for selecting collections (by ids).
    /// </field>
    /// <field name="initialScopeParameter" type="String" static="true">
    /// The query string parameter used for specifying the initial search scope.
    /// </field>
    /// <field name="timeZoneOffsetParameter" type="String" static="true">
    /// The query string parameter used for passing the time zone offset.
    /// </field>
    /// <field name="lcidParameter" type="String" static="true">
    /// The query string parameter used for passing the lcid to use.
    /// </field>
    /// <field name="stateParameter" type="String" static="true">
    /// The query string parameter used for passing the state.
    /// </field>
    /// <field name="sessionGuidParameter" type="String" static="true">
    /// The query string parameter used for passing the Analytics Action Guid.
    /// </field>
    /// <field name="interfaceNameParameter" type="String" static="true">
    /// The query string parameter used for passing the interface name.
    /// </field>
    /// <field name="iconSizeParameter" type="String" static="true">
    /// The query string parameter used for passing the icon size.
    /// </field>
    /// <field name="superUserTokenParameter" type="String" static="true">
    /// The query string parameter used for passing the super user token.
    /// </field>
    /// <field name="quirksModeParameter" type="String" static="true">
    /// The query string parameter used to tell when quirks mode is being used.
    /// </field>
    /// <field name="hubNameParameter" type="String" static="true">
    /// The query string parameter used for passing the hub name.
    /// </field>
    /// <field name="documentIdParameter" type="String" static="true">
    /// The query string parameter used to pass the id of a document.
    /// </field>
    /// <field name="mirrorIdParameter" type="String" static="true">
    /// The query string parameter used to pass the id of an aggregated mirror.
    /// </field>
    /// <field name="wildcardsParameter" type="String" static="true">
    /// The query string parameter used to pass whether wildcards are enabled.
    /// </field>
    /// <field name="improveReadabilityParameter" type="String" static="true">
    /// The query string parameter used to pass whether readability should be improved.
    /// </field>
    /// <field name="customContentRelayParameter" type="String" static="true">
    /// The query string parameter to use to relay custom content requests.
    /// </field>
    /// <field name="xmlSearchParameter" type="String" static="true">
    /// The query string parameter to use to retrieve results in xml format.
    /// </field>
    /// <field name="exportToExcelParameter" type="String" static="true">
    /// The query string parameter to use to export the query results to excel.
    /// </field>
    /// <field name="openSearchParameter" type="String" static="true">
    /// The query string parameter to use retrieve the OpenSearch description document.
    /// </field>
    /// <field name="desktopSearchParameter" type="String" static="true">
    /// The query string parameter to signal that the page is loaded under Coveo Desktop Search.
    /// </field>
    /// <field name="wakeUpParameter" type="String" static="true">
    /// The query string parameter used to wake up the search interface.
    /// </field>
    /// <field name="showDebugInfoParameter" type="String" static="true">
    /// The query string parameter to use to display debugging information.
    /// </field>
    /// <field name="emailAddressParameter" type="String" static="true">
    /// The query string parameter to specify the email address to use in the emailsearch interface.
    /// </field>
    /// <field name="searchBarParameter" type="String" static="true">
    /// The query string parameter to signal that the page is loaded under the Coveo Search Bar.
    /// </field>
    /// <field name="searchBarInfoParameter" type="String" static="true">
    /// The query string parameter to use to retrieve the Coveo Search Bar information.
    /// </field>
    /// <field name="searchBarVersionParameter" type="String" static="true">
    /// The query string parameter used to pass the version of the search bar.
    /// </field>
    /// <field name="outlookAddInParameter" type="String" static="true">
    /// The query string parameter to signal that the page is loaded under the Coveo Outlook Add-In.
    /// </field>
    /// <field name="outlookSenderEmailParameter" type="String" static="true">
    /// The query string parameter to specify the sender of the currently selected email.
    /// </field>
    /// <field name="outlookSubjectHash" type="String" static="true">
    /// The query string parameter to specify the hash of the currently selected email's subject.
    /// </field>
    /// <field name="outlookSentOn" type="String" static="true">
    /// The query string parameter to specify the sent date of the currently selected email.
    /// </field>
}


Type.registerNamespace('Coveo.CES.Web.Search.SharePoint');

////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.SharePoint.SharePointItemAttributes

Coveo.CES.Web.Search.SharePoint.SharePointItemAttributes = function Coveo_CES_Web_Search_SharePoint_SharePointItemAttributes() {
    /// <summary>
    /// Provides constantes for SharePoint item attributes.
    /// </summary>
    /// <field name="lisT_VERSION_ENABLED" type="String" static="true">
    /// Constant for <b>SPList.EnableVersioning</b> property.
    /// </field>
    /// <field name="lisT_IS_FORCE_CHECKOUT" type="String" static="true">
    /// Constant for <b>SPList.ForceCheckout</b> property.
    /// </field>
    /// <field name="lisT_ENABLE_MINOR_VERSIONS" type="String" static="true">
    /// Constant for <b>SPList.EnableMinorVersions</b> property.
    /// </field>
    /// <field name="lisT_CONTENT_TYPES_ENABLED" type="String" static="true">
    /// Constant for <b>SPList.ContentTypesEnabled</b> property.
    /// </field>
    /// <field name="lisT_BASE_TYPE" type="String" static="true">
    /// Constant for <b>SPList.BaseType</b> property.
    /// </field>
    /// <field name="lisT_BASE_TEMPLATE" type="String" static="true">
    /// Constant for <b>SPList.BaseTemplate</b> property.
    /// </field>
    /// <field name="lisT_WRITE_SECURITY" type="String" static="true">
    /// Constant for <b>SPList.WriteSecurity</b> property.
    /// </field>
    /// <field name="lisT_USER_ID" type="String" static="true">
    /// Constant for the current web session user id.
    /// </field>
    /// <field name="d_REF" type="String" static="true">
    /// Constant for the item <b>DRef</b> attribute.
    /// </field>
}


Type.registerNamespace('Coveo.CES.Web.Search.Scripts.Controls');

////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.FacetScript

Coveo.CES.Web.Search.Scripts.Controls.FacetScript = function Coveo_CES_Web_Search_Scripts_Controls_FacetScript() {
    /// <summary>
    /// Client side code for the Facet control.
    /// </summary>
    /// <field name="m_Main" type="Object" domElement="true">
    /// </field>
    /// <field name="m_Header" type="Object" domElement="true">
    /// </field>
    /// <field name="m_Popup" type="Object" domElement="true">
    /// </field>
    /// <field name="m_Showing" type="Boolean">
    /// </field>
    /// <field name="_m_HeaderClickDomEventHandler$1" type="DOMEventHandler">
    /// </field>
    /// <field name="_m_OnClickElsewhereEvent$1" type="Coveo.CNL.Web.Scripts.OnClickElsewhereEvent">
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.FacetScript.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.FacetScript.prototype = {
    m_Main: null,
    m_Header: null,
    m_Popup: null,
    m_Showing: false,
    _m_HeaderClickDomEventHandler$1: null,
    _m_OnClickElsewhereEvent$1: null,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$initialize() {
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_Main);
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_Header);
        this._m_HeaderClickDomEventHandler$1 = Function.createDelegate(this, this._header_Click$1);
        this.m_Header.attachEvent('onclick', this._m_HeaderClickDomEventHandler$1);
        if (this.m_Popup != null) {
            this._m_OnClickElsewhereEvent$1 = new Coveo.CNL.Web.Scripts.OnClickElsewhereEvent([ this.m_Main ], Function.createDelegate(this, this._main_ClickElsewhere$1), true);
        }
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$tearDown() {
        if (this._m_HeaderClickDomEventHandler$1 != null) {
            this.m_Header.detachEvent('onclick', this._m_HeaderClickDomEventHandler$1);
            this._m_HeaderClickDomEventHandler$1 = null;
        }
        if (this._m_OnClickElsewhereEvent$1 != null) {
            this._m_OnClickElsewhereEvent$1.dispose();
            this._m_OnClickElsewhereEvent$1 = null;
        }
    },
    
    fillItems: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$fillItems(p_Callback) {
        /// <param name="p_Callback" type="Coveo.CNL.Web.Scripts.Ajax.PostBackCallback">
        /// </param>
    },
    
    hideItems: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$hideItems(p_Callback) {
        /// <param name="p_Callback" type="Coveo.CNL.Web.Scripts.Ajax.PostBackCallback">
        /// </param>
    },
    
    _fillItemsCallback$1: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_fillItemsCallback$1(p_Return) {
        /// <summary>
        /// Callback for when the server has filled the items.
        /// </summary>
        /// <param name="p_Return" type="Object">
        /// </param>
        this.m_Showing = true;
        if (this.m_Popup != null) {
            this.m_Popup.style.display = 'block';
            Coveo.CNL.Web.Scripts.DOMUtilities.positionElement(this.m_Popup, this.m_Main, Coveo.CNL.Web.Scripts.PositionEnum.belowLeft);
            this.m_Popup.style.visibility = 'visible';
        }
    },
    
    _hideItemsCallback$1: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_hideItemsCallback$1(p_Return) {
        /// <summary>
        /// Callback for when the server has hidden the items.
        /// </summary>
        /// <param name="p_Return" type="Object">
        /// </param>
        this.m_Showing = false;
    },
    
    _header_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_header_Click$1() {
        if (!this.m_Showing) {
            if (this.m_Popup != null) {
                this.m_Popup.style.visibility = 'hidden';
            }
            this.fillItems(Function.createDelegate(this, this._fillItemsCallback$1));
        }
        else if (this.m_Popup == null) {
            this.hideItems(Function.createDelegate(this, this._hideItemsCallback$1));
        }
    },
    
    _main_ClickElsewhere$1: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_main_ClickElsewhere$1() {
        Coveo.CNL.Web.Scripts.CNLAssert.check(this.m_Popup != null);
        if (this.m_Showing) {
            this.m_Showing = false;
            this.m_Popup.style.display = 'none';
        }
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.ContextualDropDownScript

Coveo.CES.Web.Search.Scripts.Controls.ContextualDropDownScript = function Coveo_CES_Web_Search_Scripts_Controls_ContextualDropDownScript() {
    /// <summary>
    /// Client side code for the ContextualDropDown control.
    /// </summary>
    /// <field name="m_HotSpot" type="Object" domElement="true">
    /// </field>
    /// <field name="m_DropDown" type="Object" domElement="true">
    /// </field>
    /// <field name="m_IFrame" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_OnClickElsewhere$1" type="Coveo.CNL.Web.Scripts.OnClickElsewhereEvent">
    /// </field>
    /// <field name="_m_Showing$1" type="Boolean">
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.ContextualDropDownScript.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.ContextualDropDownScript.prototype = {
    m_HotSpot: null,
    m_DropDown: null,
    m_IFrame: null,
    _m_OnClickElsewhere$1: null,
    _m_Showing$1: false,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_ContextualDropDownScript$initialize() {
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_HotSpot);
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_DropDown);
        if (Coveo.CNL.Web.Scripts.BrowserHelper.get_isIE6()) {
            Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_IFrame);
        }
        this.m_HotSpot.attachEvent('onclick', Function.createDelegate(this, this._hotSpot_Click$1));
        this.m_DropDown.attachEvent('onclick', Function.createDelegate(this, this._dropDown_Click$1));
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_ContextualDropDownScript$tearDown() {
        this.m_HotSpot = null;
        this.m_DropDown = null;
        if (this._m_OnClickElsewhere$1 != null) {
            this._m_OnClickElsewhere$1.dispose();
            this._m_OnClickElsewhere$1 = null;
        }
    },
    
    _hotSpot_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_ContextualDropDownScript$_hotSpot_Click$1() {
        if (!this._m_Showing$1) {
            this.m_DropDown.style.position = 'absolute';
            this.m_DropDown.style.zIndex = 999;
            this.m_DropDown.style.display = 'block';
            Coveo.CNL.Web.Scripts.DOMUtilities.positionElement(this.m_DropDown, this.m_HotSpot, Coveo.CNL.Web.Scripts.PositionEnum.belowLeft);
            if (Coveo.CNL.Web.Scripts.BrowserHelper.get_isIE6()) {
                this.m_IFrame.style.display = 'block';
                Coveo.CNL.Web.Scripts.DOMUtilities.setElementSize(this.m_IFrame, Coveo.CNL.Web.Scripts.DOMUtilities.getElementSize(this.m_DropDown));
                Coveo.CNL.Web.Scripts.DOMUtilities.positionElement(this.m_IFrame, this.m_HotSpot, Coveo.CNL.Web.Scripts.PositionEnum.belowLeft);
            }
            this._m_Showing$1 = true;
            Coveo.CNL.Web.Scripts.CNLAssert.isNull(this._m_OnClickElsewhere$1);
            this._m_OnClickElsewhere$1 = new Coveo.CNL.Web.Scripts.OnClickElsewhereEvent([ this.m_HotSpot, this.m_DropDown ], Function.createDelegate(this, this._document_ClickElsewhere$1), true);
        }
        else {
            this._hideDropdown$1();
        }
    },
    
    _dropDown_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_ContextualDropDownScript$_dropDown_Click$1() {
        this._hideDropdown$1();
    },
    
    _document_ClickElsewhere$1: function Coveo_CES_Web_Search_Scripts_Controls_ContextualDropDownScript$_document_ClickElsewhere$1() {
        this._hideDropdown$1();
    },
    
    _hideDropdown$1: function Coveo_CES_Web_Search_Scripts_Controls_ContextualDropDownScript$_hideDropdown$1() {
        /// <summary>
        /// Hides the dropdown.
        /// </summary>
        if (this._m_Showing$1) {
            Coveo.CNL.Web.Scripts.CNLAssert.notNull(this._m_OnClickElsewhere$1);
            this.m_DropDown.style.display = 'none';
            if (Coveo.CNL.Web.Scripts.BrowserHelper.get_isIE6()) {
                this.m_IFrame.style.display = 'none';
            }
            this._m_OnClickElsewhere$1.dispose();
            this._m_OnClickElsewhere$1 = null;
            this._m_Showing$1 = false;
        }
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.SearchControlScript

Coveo.CES.Web.Search.Scripts.Controls.SearchControlScript = function Coveo_CES_Web_Search_Scripts_Controls_SearchControlScript() {
    /// <summary>
    /// Client side code for the SearchControl control.
    /// </summary>
    /// <field name="_s_Instances$1" type="Object" static="true">
    /// </field>
    /// <field name="m_Id" type="String">
    /// </field>
    /// <field name="m_Prefetch" type="Coveo.CNL.Web.Scripts.Ajax.PartialPostBack">
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.SearchControlScript.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.SearchControlScript.getInstance = function Coveo_CES_Web_Search_Scripts_Controls_SearchControlScript$getInstance(p_Id) {
    /// <summary>
    /// Retrieves an instance of the <see cref="T:Coveo.CES.Web.Search.Scripts.Controls.SearchControlScript" /> associated
    /// with a specific SearchControl object on the server side.
    /// </summary>
    /// <param name="p_Id" type="String">
    /// The UniqueID of the SearchControl.
    /// </param>
    /// <returns type="Coveo.CES.Web.Search.Scripts.Controls.SearchControlScript"></returns>
    Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(p_Id);
    var found = Coveo.CES.Web.Search.Scripts.Controls.SearchControlScript._s_Instances$1[p_Id];
    Coveo.CNL.Web.Scripts.CNLAssert.notNull(found);
    return found;
}
Coveo.CES.Web.Search.Scripts.Controls.SearchControlScript.tryOpeningOutlookUri = function Coveo_CES_Web_Search_Scripts_Controls_SearchControlScript$tryOpeningOutlookUri(p_Uri, p_OnSuccess, p_OnFailure) {
    /// <summary>
    /// Tries opening an Outlook uri, and executes a piece of Javascript code
    /// if it is detected that the proper protocol handler is not installed.
    /// </summary>
    /// <param name="p_Uri" type="String">
    /// The outlook uri to open.
    /// </param>
    /// <param name="p_OnSuccess" type="String">
    /// The JavaScript code to execute on success.
    /// </param>
    /// <param name="p_OnFailure" type="String">
    /// The JavaScript code to execute on failure.
    /// </param>
    Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(p_Uri);
    Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(p_OnSuccess);
    Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(p_OnFailure);
    var html = new Sys.StringBuilder();
    html.appendLine('<html>');
    html.appendLine('<body onload=\"OpenItem()\">');
    html.appendLine('<script language=\"javascript\">');
    html.appendLine('initialized = false;');
    html.appendLine('function OpenItem() {');
    html.appendLine('  initialized = true;');
    html.appendLine('  var uri = \'' + p_Uri + '\';');
    html.appendLine('  var iframe = document.getElementById(\'f\');');
    html.appendLine('  iframe.src = uri;');
    html.appendLine('}');
    html.appendLine('function ItWorked() {');
    html.appendLine('  window.close();');
    html.appendLine('}');
    html.appendLine('</script>');
    html.appendLine('<iframe id=\"f\" onload=\"if (initialized) { ItWorked(); }\"></iframe>');
    html.appendLine('</body>');
    html.appendLine('</html>');
    var wnd = window.open('about:blank', '_blank', 'width=150,height=150,left=0,top=0,toolbar=no,status=no,menubar=no,location=no');
    var doc = wnd.document.open('text/html');
    doc.write(html.toString());
    doc.close();
    Coveo.CES.Web.Search.Scripts.Controls.SearchControlScript._checkWindowStatus$1(wnd, p_OnSuccess, p_OnFailure, 20);
}
Coveo.CES.Web.Search.Scripts.Controls.SearchControlScript._checkWindowStatus$1 = function Coveo_CES_Web_Search_Scripts_Controls_SearchControlScript$_checkWindowStatus$1(p_Window, p_OnSuccess, p_OnFailure, p_CountDown) {
    /// <summary>
    /// Checks the status of the window that is opening the outlook uri, and
    /// take the appropriate action if a result can be determined. Otherwise,
    /// arm a time to check the status again later.
    /// </summary>
    /// <param name="p_Window" type="WindowInstance">
    /// The window that is opening the Outlook uri.
    /// </param>
    /// <param name="p_OnSuccess" type="String">
    /// The JavaScript code to execute on success.
    /// </param>
    /// <param name="p_OnFailure" type="String">
    /// The JavaScript code to execute on failure.
    /// </param>
    /// <param name="p_CountDown" type="Number" integer="true">
    /// Number of remaining attempts.
    /// </param>
    Coveo.CNL.Web.Scripts.CNLAssert.notNull(p_Window);
    Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(p_OnSuccess);
    Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(p_OnFailure);
    if (p_CountDown === 0) {
        p_Window.close();
    }
    if (Coveo.CES.Web.Search.Scripts.Controls.SearchControlScript._isWindowClosed$1(p_Window)) {
        eval(p_OnSuccess);
    }
    else {
        try {
            var dummy = p_Window.location.href;
            window.setTimeout(Function.createDelegate(null, function() {
                Coveo.CES.Web.Search.Scripts.Controls.SearchControlScript._checkWindowStatus$1(p_Window, p_OnSuccess, p_OnFailure, p_CountDown - 1);
            }), 100);
        }
        catch ($e1) {
            if (Coveo.CES.Web.Search.Scripts.Controls.SearchControlScript._isWindowClosed$1(p_Window)) {
                eval(p_OnSuccess);
            }
            else {
                p_Window.close();
                eval(p_OnFailure);
            }
        }
    }
}
Coveo.CES.Web.Search.Scripts.Controls.SearchControlScript._isWindowClosed$1 = function Coveo_CES_Web_Search_Scripts_Controls_SearchControlScript$_isWindowClosed$1(p_Window) {
    /// <summary>
    /// Checks if a window is closed in a IE6 friendly way.
    /// </summary>
    /// <param name="p_Window" type="WindowInstance">
    /// The window to check.
    /// </param>
    /// <returns type="Boolean"></returns>
    Coveo.CNL.Web.Scripts.CNLAssert.notNull(p_Window);
    var closed;
    try {
        closed = p_Window.closed;
    }
    catch ($e1) {
        closed = true;
    }
    return closed;
}
Coveo.CES.Web.Search.Scripts.Controls.SearchControlScript.prototype = {
    m_Id: null,
    m_Prefetch: null,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_SearchControlScript$initialize() {
        Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(this.m_Id);
        Coveo.CES.Web.Search.Scripts.Controls.SearchControlScript._s_Instances$1[this.m_Id] = this;
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_SearchControlScript$tearDown() {
        delete Coveo.CES.Web.Search.Scripts.Controls.SearchControlScript._s_Instances$1[this.m_Id];
    },
    
    startPrefetch: function Coveo_CES_Web_Search_Scripts_Controls_SearchControlScript$startPrefetch(p_Target, p_Argument) {
        /// <summary>
        /// Starts a prefetching postback.
        /// </summary>
        /// <param name="p_Target" type="String">
        /// The postback target.
        /// </param>
        /// <param name="p_Argument" type="String">
        /// The postback argument.
        /// </param>
        Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(p_Target);
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(p_Argument);
        this.invalidatePendingPrefetch();
        this.m_Prefetch = Coveo.CNL.Web.Scripts.Ajax.AjaxManagerScript.get_current().DPB(p_Target, p_Argument, true);
    },
    
    invalidatePendingPrefetch: function Coveo_CES_Web_Search_Scripts_Controls_SearchControlScript$invalidatePendingPrefetch() {
        /// <summary>
        /// Invalidates any currently pending prefetch operation.
        /// </summary>
        this.m_Prefetch = null;
    },
    
    usePrefetchResultsIfPossible: function Coveo_CES_Web_Search_Scripts_Controls_SearchControlScript$usePrefetchResultsIfPossible() {
        /// <summary>
        /// Uses the results of the current prefetch operation, if any.
        /// </summary>
        /// <returns type="Boolean"></returns>
        var used;
        if (this.m_Prefetch != null) {
            this.m_Prefetch.applyPreemptivePostback();
            used = true;
        }
        else {
            used = false;
        }
        return used;
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.CloseModalBoxLinkScript

Coveo.CES.Web.Search.Scripts.Controls.CloseModalBoxLinkScript = function Coveo_CES_Web_Search_Scripts_Controls_CloseModalBoxLinkScript() {
    /// <summary>
    /// Client side code for the CloseModalBoxLink control.
    /// </summary>
    /// <field name="_m_OnKeyPressHandler$1" type="DOMEventHandler">
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.CloseModalBoxLinkScript.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.CloseModalBoxLinkScript.prototype = {
    _m_OnKeyPressHandler$1: null,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_CloseModalBoxLinkScript$initialize() {
        this._m_OnKeyPressHandler$1 = Function.createDelegate(this, this._body_KeyPress$1);
        document.attachEvent('onkeydown', this._m_OnKeyPressHandler$1);
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_CloseModalBoxLinkScript$tearDown() {
        document.detachEvent('onkeydown', this._m_OnKeyPressHandler$1);
    },
    
    closeModalBox: function Coveo_CES_Web_Search_Scripts_Controls_CloseModalBoxLinkScript$closeModalBox() {
        /// <summary>
        /// Closes the modal box.
        /// </summary>
    },
    
    _body_KeyPress$1: function Coveo_CES_Web_Search_Scripts_Controls_CloseModalBoxLinkScript$_body_KeyPress$1() {
        if (window.event.keyCode === 27) {
            window.event.cancelBubble = true;
            window.event.returnValue = false;
            this.closeModalBox();
        }
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.SharePointSearchBoxScript

Coveo.CES.Web.Search.Scripts.Controls.SharePointSearchBoxScript = function Coveo_CES_Web_Search_Scripts_Controls_SharePointSearchBoxScript() {
    /// <summary>
    /// Client side code for the SharePoint SearchBox control.
    /// </summary>
    Coveo.CES.Web.Search.Scripts.Controls.SharePointSearchBoxScript.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.SharePointSearchBoxScript.prototype = {
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_SharePointSearchBoxScript$initialize() {
        var OurSearch = '{0}_layouts/CES/Search2007.aspx?q=\"{1}\"';
        var s_MossPerson = new RegExp('(.+)Person\\.aspx.*');
        var s_MossPeopleResults = new RegExp('https?://.+/PeopleResults\\.aspx\\?.*k=(\\w+:)?\"(.+)\"');
        var person = s_MossPerson.exec(window.location.href);
        if (person != null && person.length > 0) {
            var elements = document.documentElement.getElementsByTagName('a');
            for (var i = 0; i < elements.length; i++) {
                var hrefAttribute = elements[i].attributes.getNamedItem('href');
                var match = s_MossPeopleResults.exec(hrefAttribute.value);
                if (match != null && match.length > 0) {
                    hrefAttribute.value = String.format(OurSearch, person[1], match[2]);
                }
            }
        }
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.SearchBoxScript

Coveo.CES.Web.Search.Scripts.Controls.SearchBoxScript = function Coveo_CES_Web_Search_Scripts_Controls_SearchBoxScript() {
    /// <summary>
    /// Client side code for the SearchBox control.
    /// </summary>
    /// <field name="m_Target" type="String">
    /// </field>
    /// <field name="m_SearchAsYouType" type="Boolean">
    /// </field>
    /// <field name="m_TextBox" type="Object" domElement="true">
    /// </field>
    /// <field name="m_SearchButton" type="Object" domElement="true">
    /// </field>
    /// <field name="m_LinkButton" type="Object" domElement="true">
    /// </field>
    /// <field name="m_ScopeDropDownList" type="Object" domElement="true">
    /// </field>
    /// <field name="m_ShowDelay" type="Number" integer="true">
    /// </field>
    /// <field name="m_HideDelay" type="Number" integer="true">
    /// </field>
    /// <field name="m_Position" type="Coveo.CNL.Web.Scripts.PositionEnum">
    /// </field>
    /// <field name="m_Popup" type="Object" domElement="true">
    /// </field>
    /// <field name="m_IFrame" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_OnFocusHandler$1" type="DOMEventHandler">
    /// </field>
    /// <field name="_m_OnBlurHandler$1" type="DOMEventHandler">
    /// </field>
    /// <field name="_m_OnKeyPressHandler$1" type="DOMEventHandler">
    /// </field>
    /// <field name="_m_SearchButtonClickEventHandler$1" type="DOMEventHandler">
    /// </field>
    /// <field name="_m_LinkButtonClickEventHandler$1" type="DOMEventHandler">
    /// </field>
    /// <field name="_m_PopupOnMouseOver$1" type="DOMEventHandler">
    /// </field>
    /// <field name="_m_PopupOnMouseOut$1" type="DOMEventHandler">
    /// </field>
    /// <field name="_m_UpdateTimeout$1" type="Coveo.CNL.Web.Scripts.Timeout">
    /// </field>
    /// <field name="_m_HideTimeout$1" type="Coveo.CNL.Web.Scripts.Timeout">
    /// </field>
    /// <field name="_m_HasFocus$1" type="Boolean">
    /// </field>
    /// <field name="_m_OverResults$1" type="Boolean">
    /// </field>
    /// <field name="_m_WakeUpSent$1" type="Boolean">
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.SearchBoxScript.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.SearchBoxScript.prototype = {
    m_Target: null,
    m_SearchAsYouType: false,
    m_TextBox: null,
    m_SearchButton: null,
    m_LinkButton: null,
    m_ScopeDropDownList: null,
    m_ShowDelay: 0,
    m_HideDelay: 0,
    m_Position: 0,
    m_Popup: null,
    m_IFrame: null,
    _m_OnFocusHandler$1: null,
    _m_OnBlurHandler$1: null,
    _m_OnKeyPressHandler$1: null,
    _m_SearchButtonClickEventHandler$1: null,
    _m_LinkButtonClickEventHandler$1: null,
    _m_PopupOnMouseOver$1: null,
    _m_PopupOnMouseOut$1: null,
    _m_UpdateTimeout$1: null,
    _m_HideTimeout$1: null,
    _m_HasFocus$1: false,
    _m_OverResults$1: false,
    _m_WakeUpSent$1: false,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_SearchBoxScript$initialize() {
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_TextBox);
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_SearchButton);
        this._m_OnKeyPressHandler$1 = Function.createDelegate(this, this._textBox_KeyPress$1);
        this.m_TextBox.attachEvent('onkeydown', this._m_OnKeyPressHandler$1);
        this._m_SearchButtonClickEventHandler$1 = Function.createDelegate(this, this._searchButton_Click$1);
        this.m_SearchButton.attachEvent('onclick', this._m_SearchButtonClickEventHandler$1);
        if (this.m_LinkButton != null) {
            this._m_LinkButtonClickEventHandler$1 = Function.createDelegate(this, this._linkButton_Click$1);
            this.m_LinkButton.attachEvent('onclick', this._m_LinkButtonClickEventHandler$1);
        }
        if (this.m_SearchAsYouType) {
            if (Coveo.CNL.Web.Scripts.BrowserHelper.get_isIE6()) {
                Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_IFrame);
            }
            Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_Popup);
            this._m_OnFocusHandler$1 = Function.createDelegate(this, this._textBox_Focus$1);
            this.m_TextBox.attachEvent('onfocus', this._m_OnFocusHandler$1);
            this._m_OnBlurHandler$1 = Function.createDelegate(this, this._textBox_Blur$1);
            this.m_TextBox.attachEvent('onblur', this._m_OnBlurHandler$1);
            this._m_PopupOnMouseOver$1 = Function.createDelegate(this, this._popup_OnMouseOver$1);
            this.m_Popup.attachEvent('onmouseover', this._m_PopupOnMouseOver$1);
            this._m_PopupOnMouseOut$1 = Function.createDelegate(this, this._popup_OnMouseOut$1);
            this.m_Popup.attachEvent('onmouseout', this._m_PopupOnMouseOut$1);
        }
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_SearchBoxScript$tearDown() {
        if (this._m_OnFocusHandler$1 != null) {
            this.m_TextBox.detachEvent('onfocus', this._m_OnFocusHandler$1);
        }
        if (this._m_OnBlurHandler$1 != null) {
            this.m_TextBox.detachEvent('onblur', this._m_OnBlurHandler$1);
        }
        if (this._m_OnKeyPressHandler$1 != null) {
            this.m_TextBox.detachEvent('onkeydown', this._m_OnKeyPressHandler$1);
        }
        if (this._m_SearchButtonClickEventHandler$1 != null) {
            this.m_SearchButton.detachEvent('onclick', this._m_SearchButtonClickEventHandler$1);
        }
        if (this._m_LinkButtonClickEventHandler$1 != null) {
            this.m_LinkButton.detachEvent('onclick', this._m_LinkButtonClickEventHandler$1);
        }
    },
    
    serverUpdateResults: function Coveo_CES_Web_Search_Scripts_Controls_SearchBoxScript$serverUpdateResults(p_Query, p_Scope, p_Callback) {
        /// <param name="p_Query" type="String">
        /// </param>
        /// <param name="p_Scope" type="String">
        /// </param>
        /// <param name="p_Callback" type="Coveo.CNL.Web.Scripts.Ajax.PostBackCallback">
        /// </param>
    },
    
    _scheduleUpdateResults$1: function Coveo_CES_Web_Search_Scripts_Controls_SearchBoxScript$_scheduleUpdateResults$1() {
        /// <summary>
        /// Schedules an update of the results.
        /// </summary>
        this._cancelUpdateResults$1();
        this._m_UpdateTimeout$1 = new Coveo.CNL.Web.Scripts.Timeout(Function.createDelegate(this, this._updateResults$1), this.m_ShowDelay);
    },
    
    _cancelUpdateResults$1: function Coveo_CES_Web_Search_Scripts_Controls_SearchBoxScript$_cancelUpdateResults$1() {
        /// <summary>
        /// Cancels a scheduled update of the results.
        /// </summary>
        if (this._m_UpdateTimeout$1 != null) {
            this._m_UpdateTimeout$1.cancel();
            this._m_UpdateTimeout$1 = null;
        }
    },
    
    _updateResults$1: function Coveo_CES_Web_Search_Scripts_Controls_SearchBoxScript$_updateResults$1() {
        /// <summary>
        /// Launches the server calls to update the results.
        /// </summary>
        this._m_UpdateTimeout$1 = null;
        if (this.m_TextBox.value !== '') {
            if (this.m_ScopeDropDownList != null) {
                this.serverUpdateResults(this.m_TextBox.value, this.m_ScopeDropDownList.value, Function.createDelegate(this, this._updateResultsCallback$1));
            }
            else {
                this.serverUpdateResults(this.m_TextBox.value, '', Function.createDelegate(this, this._updateResultsCallback$1));
            }
        }
        else {
            this._hidePopup$1();
        }
    },
    
    _updateResultsCallback$1: function Coveo_CES_Web_Search_Scripts_Controls_SearchBoxScript$_updateResultsCallback$1(p_Return) {
        /// <summary>
        /// Callback for when the server has updated the results.
        /// </summary>
        /// <param name="p_Return" type="Object">
        /// </param>
        this._showPopup$1();
    },
    
    _showPopup$1: function Coveo_CES_Web_Search_Scripts_Controls_SearchBoxScript$_showPopup$1() {
        /// <summary>
        /// Shows the popup containing quick results.
        /// </summary>
        this.m_Popup.style.display = 'block';
        Coveo.CNL.Web.Scripts.DOMUtilities.positionElement(this.m_Popup, this.m_TextBox, this.m_Position);
        if (Coveo.CNL.Web.Scripts.BrowserHelper.get_isIE6()) {
            this.m_IFrame.style.display = 'block';
            Coveo.CNL.Web.Scripts.DOMUtilities.setElementSize(this.m_IFrame, Coveo.CNL.Web.Scripts.DOMUtilities.getElementSize(this.m_Popup));
            Coveo.CNL.Web.Scripts.DOMUtilities.positionElement(this.m_IFrame, this.m_TextBox, this.m_Position);
        }
    },
    
    _scheduleHidePopup$1: function Coveo_CES_Web_Search_Scripts_Controls_SearchBoxScript$_scheduleHidePopup$1() {
        /// <summary>
        /// Schedules hiding the popup (when the user stops using the search box).
        /// </summary>
        this._cancelHidePopup$1();
        this._m_HideTimeout$1 = new Coveo.CNL.Web.Scripts.Timeout(Function.createDelegate(this, this._hidePopup$1), this.m_HideDelay);
    },
    
    _cancelHidePopup$1: function Coveo_CES_Web_Search_Scripts_Controls_SearchBoxScript$_cancelHidePopup$1() {
        /// <summary>
        /// Cancels a scheduled hiding of the popup.
        /// </summary>
        if (this._m_HideTimeout$1 != null) {
            this._m_HideTimeout$1.cancel();
            this._m_HideTimeout$1 = null;
        }
    },
    
    _hidePopup$1: function Coveo_CES_Web_Search_Scripts_Controls_SearchBoxScript$_hidePopup$1() {
        /// <summary>
        /// Hides the popup containing quick results.
        /// </summary>
        this._cancelHidePopup$1();
        this.m_Popup.style.display = 'none';
        if (Coveo.CNL.Web.Scripts.BrowserHelper.get_isIE6()) {
            this.m_IFrame.style.display = 'none';
        }
    },
    
    _submitSearch$1: function Coveo_CES_Web_Search_Scripts_Controls_SearchBoxScript$_submitSearch$1() {
        /// <summary>
        /// Submits the current search query.
        /// </summary>
        var uri = this.m_Target;
        uri += '&' + Coveo.CES.Common.SearchInterfaceQueryString.queryParameter + '=' + encodeURIComponent(this.m_TextBox.value);
        if (this.m_ScopeDropDownList != null && this.m_ScopeDropDownList.value !== '') {
            uri += '&' + Coveo.CES.Common.SearchInterfaceQueryString.initialScopeParameter + '=' + encodeURIComponent(this.m_ScopeDropDownList.value);
        }
        uri += '&' + Coveo.CES.Common.SearchInterfaceQueryString.timeZoneOffsetParameter + '=' + eval('-new Date().getTimezoneOffset()');
        window.navigate(uri);
    },
    
    _textBox_Focus$1: function Coveo_CES_Web_Search_Scripts_Controls_SearchBoxScript$_textBox_Focus$1() {
        this._cancelHidePopup$1();
        this._m_HasFocus$1 = true;
        if (this.m_TextBox.value !== '') {
            this._scheduleUpdateResults$1();
        }
        if (!this._m_WakeUpSent$1) {
            var uri = this.m_Target;
            uri += '&' + Coveo.CES.Common.SearchInterfaceQueryString.wakeUpParameter + '=1';
            var request = new XMLHttpRequest();
            request.open('GET', uri, true);
            request.send('');
            this._m_WakeUpSent$1 = true;
        }
    },
    
    _textBox_Blur$1: function Coveo_CES_Web_Search_Scripts_Controls_SearchBoxScript$_textBox_Blur$1() {
        if (!this._m_OverResults$1) {
            this._scheduleHidePopup$1();
        }
        this._cancelUpdateResults$1();
        this._m_HasFocus$1 = false;
    },
    
    _textBox_KeyPress$1: function Coveo_CES_Web_Search_Scripts_Controls_SearchBoxScript$_textBox_KeyPress$1() {
        if (window.event.keyCode === 13) {
            this._submitSearch$1();
            window.event.returnValue = false;
        }
        else if (this.m_SearchAsYouType) {
            this._scheduleUpdateResults$1();
        }
    },
    
    _searchButton_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_SearchBoxScript$_searchButton_Click$1() {
        this._submitSearch$1();
    },
    
    _linkButton_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_SearchBoxScript$_linkButton_Click$1() {
        window.navigate(this.m_Target);
    },
    
    _popup_OnMouseOver$1: function Coveo_CES_Web_Search_Scripts_Controls_SearchBoxScript$_popup_OnMouseOver$1() {
        this._m_OverResults$1 = true;
        this._cancelHidePopup$1();
    },
    
    _popup_OnMouseOut$1: function Coveo_CES_Web_Search_Scripts_Controls_SearchBoxScript$_popup_OnMouseOut$1() {
        if (!this._m_HasFocus$1) {
            this._scheduleHidePopup$1();
        }
        this._m_OverResults$1 = false;
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.PrefetchTermScript

Coveo.CES.Web.Search.Scripts.Controls.PrefetchTermScript = function Coveo_CES_Web_Search_Scripts_Controls_PrefetchTermScript() {
    /// <summary>
    /// Client side code for a control who prefetchs query terms.
    /// </summary>
    /// <field name="_prefetcH_DELAY$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_s_PrefetchedTerms$1" type="Array" static="true">
    /// </field>
    /// <field name="m_Id" type="String">
    /// </field>
    /// <field name="m_TextBox" type="Object" domElement="true">
    /// </field>
    /// <field name="m_PrefetchTimeout" type="Coveo.CNL.Web.Scripts.Timeout">
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.PrefetchTermScript.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.PrefetchTermScript.prototype = {
    m_Id: null,
    m_TextBox: null,
    m_PrefetchTimeout: null,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_PrefetchTermScript$initialize() {
        Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(this.m_Id);
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_TextBox);
        this.m_TextBox.attachEvent('onkeyup', Function.createDelegate(this, this._textBox_KeyUp$1));
        this.m_TextBox.attachEvent('onblur', Function.createDelegate(this, this._textBox_LostFocus$1));
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_PrefetchTermScript$tearDown() {
        this.m_TextBox = null;
    },
    
    prefetchTerms: function Coveo_CES_Web_Search_Scripts_Controls_PrefetchTermScript$prefetchTerms(p_Terms, p_Callback) {
        /// <param name="p_Terms" type="String">
        /// </param>
        /// <param name="p_Callback" type="Coveo.CNL.Web.Scripts.Ajax.PostBackCallback">
        /// </param>
    },
    
    _textBox_KeyUp$1: function Coveo_CES_Web_Search_Scripts_Controls_PrefetchTermScript$_textBox_KeyUp$1() {
        this._cancelPendingPrefetch$1();
        if (window.event.keyCode === 32) {
            this._startPrefetch$1();
        }
        else if (window.event.keyCode !== 13) {
            this._schedulePrefetch$1();
        }
    },
    
    _textBox_LostFocus$1: function Coveo_CES_Web_Search_Scripts_Controls_PrefetchTermScript$_textBox_LostFocus$1() {
        this._cancelPendingPrefetch$1();
    },
    
    _schedulePrefetch$1: function Coveo_CES_Web_Search_Scripts_Controls_PrefetchTermScript$_schedulePrefetch$1() {
        /// <summary>
        /// Schedules a prefetch.
        /// </summary>
        Coveo.CNL.Web.Scripts.CNLAssert.isNull(this.m_PrefetchTimeout);
        this.m_PrefetchTimeout = new Coveo.CNL.Web.Scripts.Timeout(Function.createDelegate(this, this._startPrefetch$1), Coveo.CES.Web.Search.Scripts.Controls.PrefetchTermScript._prefetcH_DELAY$1);
    },
    
    _cancelPendingPrefetch$1: function Coveo_CES_Web_Search_Scripts_Controls_PrefetchTermScript$_cancelPendingPrefetch$1() {
        /// <summary>
        /// Cancels any pending prefetch.
        /// </summary>
        if (this.m_PrefetchTimeout != null) {
            this.m_PrefetchTimeout.cancel();
            this.m_PrefetchTimeout = null;
        }
    },
    
    _startPrefetch$1: function Coveo_CES_Web_Search_Scripts_Controls_PrefetchTermScript$_startPrefetch$1() {
        /// <summary>
        /// Launches a terms prefetch on the server.
        /// </summary>
        this.m_PrefetchTimeout = null;
        if (this.m_TextBox != null) {
            if (this.m_TextBox.value !== '') {
                var terms = this.m_TextBox.value.split(' ');
                var newTerms = '';
                for (var i = 0; i < terms.length; i++) {
                    if (terms[i] !== '') {
                        if (!Array.contains(Coveo.CES.Web.Search.Scripts.Controls.PrefetchTermScript._s_PrefetchedTerms$1, terms[i])) {
                            Array.add(Coveo.CES.Web.Search.Scripts.Controls.PrefetchTermScript._s_PrefetchedTerms$1, terms[i]);
                            if (newTerms.length !== 0) {
                                newTerms += ' ';
                            }
                            newTerms += terms[i];
                        }
                    }
                }
                if (newTerms.length !== 0) {
                    this.prefetchTerms(newTerms, Function.createDelegate(this, this._prefetchTermsCallback$1));
                }
            }
        }
    },
    
    _prefetchTermsCallback$1: function Coveo_CES_Web_Search_Scripts_Controls_PrefetchTermScript$_prefetchTermsCallback$1(p_Return) {
        /// <summary>
        /// Callback for when the server has prefetched the terms.
        /// </summary>
        /// <param name="p_Return" type="Object">
        /// The return of the call to the server.
        /// </param>
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.QueryScript

Coveo.CES.Web.Search.Scripts.Controls.QueryScript = function Coveo_CES_Web_Search_Scripts_Controls_QueryScript() {
    /// <summary>
    /// Client side code for the Query control.
    /// </summary>
    /// <field name="_prefetcH_DELAY$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="m_Id" type="String">
    /// </field>
    /// <field name="m_TextBox" type="Object" domElement="true">
    /// </field>
    /// <field name="m_SearchControlId" type="String">
    /// </field>
    /// <field name="m_SearchObject" type="Coveo.CES.Web.Search.Scripts.Controls.SearchControlScript">
    /// </field>
    /// <field name="m_PrefetchTimeout" type="Coveo.CNL.Web.Scripts.Timeout">
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.QueryScript.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.QueryScript.prototype = {
    m_Id: null,
    m_TextBox: null,
    m_SearchControlId: null,
    m_SearchObject: null,
    m_PrefetchTimeout: null,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_QueryScript$initialize() {
        Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(this.m_Id);
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_TextBox);
        this.m_TextBox.attachEvent('onkeydown', Function.createDelegate(this, this._textBox_KeyPress$1));
        Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(this.m_SearchControlId);
        this.m_SearchObject = Coveo.CES.Web.Search.Scripts.Controls.SearchControlScript.getInstance(this.m_SearchControlId);
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_QueryScript$tearDown() {
        this.m_TextBox = null;
        this.m_SearchObject = null;
    },
    
    _textBox_KeyPress$1: function Coveo_CES_Web_Search_Scripts_Controls_QueryScript$_textBox_KeyPress$1() {
        this._cancelPendingPrefetch$1();
        if (window.event.keyCode === 13) {
            if (this.m_SearchObject.usePrefetchResultsIfPossible()) {
                window.event.returnValue = false;
            }
        }
        else {
            this.m_SearchObject.invalidatePendingPrefetch();
            this._schedulePrefetch$1();
        }
    },
    
    _schedulePrefetch$1: function Coveo_CES_Web_Search_Scripts_Controls_QueryScript$_schedulePrefetch$1() {
        /// <summary>
        /// Schedules a prefetch.
        /// </summary>
        Coveo.CNL.Web.Scripts.CNLAssert.isNull(this.m_PrefetchTimeout);
        this.m_PrefetchTimeout = new Coveo.CNL.Web.Scripts.Timeout(Function.createDelegate(this, this._startPrefetch$1), Coveo.CES.Web.Search.Scripts.Controls.QueryScript._prefetcH_DELAY$1);
    },
    
    _cancelPendingPrefetch$1: function Coveo_CES_Web_Search_Scripts_Controls_QueryScript$_cancelPendingPrefetch$1() {
        /// <summary>
        /// Cancels any pending prefetch.
        /// </summary>
        if (this.m_PrefetchTimeout != null) {
            this.m_PrefetchTimeout.cancel();
            this.m_PrefetchTimeout = null;
        }
    },
    
    _startPrefetch$1: function Coveo_CES_Web_Search_Scripts_Controls_QueryScript$_startPrefetch$1() {
        /// <summary>
        /// Launches a prefetch on the server.
        /// </summary>
        this.m_PrefetchTimeout = null;
        if (this.m_TextBox.value !== '') {
            this.m_SearchObject.startPrefetch(this.m_Id, '');
        }
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript

Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript = function Coveo_CES_Web_Search_Scripts_Controls_ResultPresenceIndicatorScript() {
    /// <summary>
    /// Client side code for the ResultPresenceIndicator control.
    /// </summary>
    /// <field name="_s_NameCtrl$1" type="Object" static="true">
    /// </field>
    /// <field name="_s_TriedCreatingNameCtrl$1" type="Boolean" static="true">
    /// </field>
    /// <field name="_s_RunningControls$1" type="Array" static="true">
    /// </field>
    /// <field name="_m_UnknownImageUrl$1" type="String">
    /// </field>
    /// <field name="m_Image" type="Object" domElement="true">
    /// The image element in which to display presence information.
    /// </field>
    /// <field name="m_Email" type="String">
    /// The email address of the user for which to display presence.
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript._nameCtrl_OnStatusChange$1 = function Coveo_CES_Web_Search_Scripts_Controls_ResultPresenceIndicatorScript$_nameCtrl_OnStatusChange$1(p_Email, p_Status, p_Id) {
    /// <param name="p_Email" type="String">
    /// </param>
    /// <param name="p_Status" type="Number" integer="true">
    /// </param>
    /// <param name="p_Id" type="String">
    /// </param>
    Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(p_Email);
    Coveo.CNL.Web.Scripts.CNLAssert.notNull(Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript._s_NameCtrl$1);
    for (var i = 0; i < Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript._s_RunningControls$1.length; ++i) {
        var control = Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript._s_RunningControls$1[i];
        if (control.m_Email.toLowerCase() === p_Email.toLowerCase()) {
            control._updateStatus$1(p_Status);
        }
    }
}
Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript.prototype = {
    _m_UnknownImageUrl$1: null,
    m_Image: null,
    m_Email: null,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_ResultPresenceIndicatorScript$initialize() {
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_Image);
        Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(this.m_Email);
        this._m_UnknownImageUrl$1 = this.m_Image.src;
        if (Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript._s_NameCtrl$1 == null && !Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript._s_TriedCreatingNameCtrl$1) {
            try {
                Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript._s_TriedCreatingNameCtrl$1 = true;
                Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript._s_NameCtrl$1 = eval('new ActiveXObject(\'Name.NameCtrl.1\')');
                if (Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript._s_NameCtrl$1 != null && Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript._s_NameCtrl$1.PresenceEnabled) {
                    Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript._s_NameCtrl$1.OnStatusChange = Function.createDelegate(null, Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript._nameCtrl_OnStatusChange$1);
                }
                else {
                    Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript._s_NameCtrl$1 = null;
                }
            }
            catch ($e1) {
                Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript._s_NameCtrl$1 = null;
            }
        }
        if (Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript._s_NameCtrl$1 != null) {
            Array.add(Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript._s_RunningControls$1, this);
            this.m_Image.attachEvent('onmouseover', Function.createDelegate(this, this._image_OnMouseOver$1));
            this.m_Image.attachEvent('onmouseout', Function.createDelegate(this, this._image_OnMouseOut$1));
            var status = Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript._s_NameCtrl$1.GetStatus(this.m_Email, '');
            this._updateStatus$1(status);
        }
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_ResultPresenceIndicatorScript$tearDown() {
        if (Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript._s_NameCtrl$1 != null) {
            Coveo.CNL.Web.Scripts.CNLAssert.check(Array.contains(Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript._s_RunningControls$1, this));
            Array.remove(Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript._s_RunningControls$1, this);
            Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript._s_NameCtrl$1.HideOOUI();
        }
        this.m_Image = null;
    },
    
    _image_OnMouseOver$1: function Coveo_CES_Web_Search_Scripts_Controls_ResultPresenceIndicatorScript$_image_OnMouseOver$1() {
        Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript._s_NameCtrl$1.HideOOUI();
        var pos = Coveo.CNL.Web.Scripts.DOMUtilities.getElementPosition(this.m_Image);
        var visible = Coveo.CNL.Web.Scripts.DOMUtilities.getVisibleRectangle();
        Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript._s_NameCtrl$1.ShowOOUI(this.m_Email, 0, pos.left - visible.left, pos.top - visible.top);
    },
    
    _updateStatus$1: function Coveo_CES_Web_Search_Scripts_Controls_ResultPresenceIndicatorScript$_updateStatus$1(p_Status) {
        /// <summary>
        /// Updates the status image for the user.
        /// </summary>
        /// <param name="p_Status" type="Number" integer="true">
        /// The status of the user.
        /// </param>
        var src;
        switch (p_Status) {
            case 0:
                src = this._m_UnknownImageUrl$1.replace('_unknown', '_online');
                break;
            case 1:
                src = this._m_UnknownImageUrl$1.replace('_unknown', '_offline');
                break;
            case 2:
                src = this._m_UnknownImageUrl$1.replace('_unknown', '_away');
                break;
            case 3:
                src = this._m_UnknownImageUrl$1.replace('_unknown', '_busy');
                break;
            case 4:
                src = this._m_UnknownImageUrl$1.replace('_unknown', '_away');
                break;
            case 5:
                src = this._m_UnknownImageUrl$1.replace('_unknown', '_busy');
                break;
            case 6:
                src = this._m_UnknownImageUrl$1.replace('_unknown', '_away');
                break;
            default:
                src = this._m_UnknownImageUrl$1;
                break;
        }
        this.m_Image.src = src;
        this.m_Image.style.display = 'inline';
    },
    
    _image_OnMouseOut$1: function Coveo_CES_Web_Search_Scripts_Controls_ResultPresenceIndicatorScript$_image_OnMouseOut$1() {
        Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript._s_NameCtrl$1.HideOOUI();
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.HighlightedQueryScript

Coveo.CES.Web.Search.Scripts.Controls.HighlightedQueryScript = function Coveo_CES_Web_Search_Scripts_Controls_HighlightedQueryScript() {
    /// <summary>
    /// Client side code for the HighlightedQuery control.
    /// </summary>
    /// <field name="_m_MouseDownEventHandler$1" type="DOMEventHandler">
    /// </field>
    /// <field name="_m_MouseWheelEventHandler$1" type="DOMEventHandler">
    /// </field>
    /// <field name="m_Term" type="Object" domElement="true">
    /// The term control to attach the mouse events to.
    /// </field>
    /// <field name="m_Index" type="Number" integer="true">
    /// The index of the term.
    /// </field>
    /// <field name="m_FrameName" type="String">
    /// The name of the frame that contains the terms to iterate.
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.HighlightedQueryScript.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.HighlightedQueryScript.prototype = {
    _m_MouseDownEventHandler$1: null,
    _m_MouseWheelEventHandler$1: null,
    m_Term: null,
    m_Index: 0,
    m_FrameName: null,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_HighlightedQueryScript$initialize() {
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_Term);
        Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(this.m_FrameName);
        this._m_MouseDownEventHandler$1 = Function.createDelegate(this, this._term_MouseDown$1);
        this._m_MouseWheelEventHandler$1 = Function.createDelegate(this, this._term_MouseWheel$1);
        this.m_Term.attachEvent('onmousedown', this._m_MouseDownEventHandler$1);
        this.m_Term.attachEvent('xxDOMMouseScroll', this._m_MouseWheelEventHandler$1);
        this.m_Term.attachEvent('onmousewheel', this._m_MouseWheelEventHandler$1);
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_HighlightedQueryScript$tearDown() {
        if (this.m_Term != null) {
            if (this._m_MouseDownEventHandler$1 != null) {
                this.m_Term.detachEvent('onmousedown', this._m_MouseDownEventHandler$1);
            }
            if (this._m_MouseWheelEventHandler$1 != null) {
                this.m_Term.detachEvent('xxDOMMouseScroll', this._m_MouseWheelEventHandler$1);
                this.m_Term.detachEvent('onmousewheel', this._m_MouseWheelEventHandler$1);
            }
            this.m_Term = null;
        }
    },
    
    _term_MouseDown$1: function Coveo_CES_Web_Search_Scripts_Controls_HighlightedQueryScript$_term_MouseDown$1() {
        this._highlightNextOccurence$1();
        window.event.returnValue = false;
    },
    
    _term_MouseWheel$1: function Coveo_CES_Web_Search_Scripts_Controls_HighlightedQueryScript$_term_MouseWheel$1() {
        if (this._getMouseWheelDelta$1() < 0) {
            this._highlightNextOccurence$1();
        }
        else {
            this._highlightPreviousOccurence$1();
        }
        window.event.cancelBubble = true;
        window.event.returnValue = false;
    },
    
    _getMouseWheelDelta$1: function Coveo_CES_Web_Search_Scripts_Controls_HighlightedQueryScript$_getMouseWheelDelta$1() {
        /// <summary>
        /// Get the mouse wheel delta for the current event.
        /// </summary>
        /// <returns type="Number" integer="true"></returns>
        var wheelDelta = 0;
        if (Coveo.CNL.Web.Scripts.BrowserHelper.get_isFirefox()) {
            wheelDelta = (eval('event.detail')) * -1;
        }
        else {
            wheelDelta = eval('window.event.wheelDelta');
        }
        return wheelDelta;
    },
    
    _highlightNextOccurence$1: function Coveo_CES_Web_Search_Scripts_Controls_HighlightedQueryScript$_highlightNextOccurence$1() {
        /// <summary>
        /// Highlights the next occurrence of a term.
        /// </summary>
        var frame = document.getElementsByName(this.m_FrameName)[0];
        if (frame != null) {
            frame.HighlightNextOccurence(this.m_Index);
        }
    },
    
    _highlightPreviousOccurence$1: function Coveo_CES_Web_Search_Scripts_Controls_HighlightedQueryScript$_highlightPreviousOccurence$1() {
        /// <summary>
        /// Highlights the previous occurrence of a term.
        /// </summary>
        var frame = document.getElementsByName(this.m_FrameName)[0];
        if (frame != null) {
            frame.HighlightPreviousOccurence(this.m_Index);
        }
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.PlayerScript

Coveo.CES.Web.Search.Scripts.Controls.PlayerScript = function Coveo_CES_Web_Search_Scripts_Controls_PlayerScript() {
    /// <summary>
    /// Client side code for the Player class.
    /// </summary>
    Coveo.CES.Web.Search.Scripts.Controls.PlayerScript.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.PlayerScript.prototype = {
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_PlayerScript$initialize() {
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.ResultPlayerScript

Coveo.CES.Web.Search.Scripts.Controls.ResultPlayerScript = function Coveo_CES_Web_Search_Scripts_Controls_ResultPlayerScript() {
    /// <summary>
    /// Client side code for the ResultPlayer class.
    /// </summary>
    /// <field name="m_Uri" type="String">
    /// The uri of the stream to play.
    /// </field>
    /// <field name="m_UtteranceUri" type="String">
    /// The uri of the image to use for utterances.
    /// </field>
    /// <field name="m_UtteranceSelectedUri" type="String">
    /// The uri of the image to use for selected utterances.
    /// </field>
    /// <field name="m_Player" type="Object" domElement="true">
    /// The DOM element for the player.
    /// </field>
    /// <field name="m_TimeLine" type="Object" domElement="true">
    /// The DOM element for the timeline.
    /// </field>
    /// <field name="m_Play" type="Object" domElement="true">
    /// The DOM element for the play button.
    /// </field>
    /// <field name="m_Pause" type="Object" domElement="true">
    /// The DOM element for the pause button.
    /// </field>
    /// <field name="m_Slider" type="Object" domElement="true">
    /// The DOM element for the slider.
    /// </field>
    /// <field name="m_Filler" type="Object" domElement="true">
    /// The DOM element for the filler.
    /// </field>
    /// <field name="m_Status" type="Object" domElement="true">
    /// The DOM element for the status.
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.ResultPlayerScript.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.ResultPlayerScript.prototype = {
    m_Uri: null,
    m_UtteranceUri: null,
    m_UtteranceSelectedUri: null,
    m_Player: null,
    m_TimeLine: null,
    m_Play: null,
    m_Pause: null,
    m_Slider: null,
    m_Filler: null,
    m_Status: null,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_ResultPlayerScript$initialize() {
        var s = this.m_Uri;
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.ViewAsHtmlPanelScript

Coveo.CES.Web.Search.Scripts.Controls.ViewAsHtmlPanelScript = function Coveo_CES_Web_Search_Scripts_Controls_ViewAsHtmlPanelScript() {
    /// <summary>
    /// Client side code for the ViewAsHtmlPanel control.
    /// </summary>
    /// <field name="_m_BackupDocumentMargin$1" type="String">
    /// </field>
    /// <field name="_m_BackupDocumentPadding$1" type="String">
    /// </field>
    /// <field name="_m_BackupDocumentHeight$1" type="String">
    /// </field>
    /// <field name="_m_BackupDocumentOverflow$1" type="String">
    /// </field>
    /// <field name="_m_BackupBodyMargin$1" type="String">
    /// </field>
    /// <field name="_m_BackupBodyPadding$1" type="String">
    /// </field>
    /// <field name="_m_BackupBodyHeight$1" type="String">
    /// </field>
    /// <field name="_m_BackupBodyOverflow$1" type="String">
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.ViewAsHtmlPanelScript.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.ViewAsHtmlPanelScript.prototype = {
    _m_BackupDocumentMargin$1: null,
    _m_BackupDocumentPadding$1: null,
    _m_BackupDocumentHeight$1: null,
    _m_BackupDocumentOverflow$1: null,
    _m_BackupBodyMargin$1: null,
    _m_BackupBodyPadding$1: null,
    _m_BackupBodyHeight$1: null,
    _m_BackupBodyOverflow$1: null,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_ViewAsHtmlPanelScript$initialize() {
        this._m_BackupDocumentMargin$1 = document.documentElement.style.margin;
        document.documentElement.style.margin = '0px';
        this._m_BackupDocumentPadding$1 = document.documentElement.style.padding;
        document.documentElement.style.padding = '0px';
        this._m_BackupDocumentHeight$1 = document.documentElement.style.height;
        document.documentElement.style.height = '100%';
        this._m_BackupDocumentOverflow$1 = document.documentElement.style.overflow;
        document.documentElement.style.overflow = 'hidden';
        this._m_BackupBodyMargin$1 = document.body.style.margin;
        document.body.style.margin = '0px';
        this._m_BackupBodyPadding$1 = document.body.style.padding;
        document.body.style.padding = '0px';
        this._m_BackupBodyHeight$1 = document.body.style.height;
        document.body.style.height = '100%';
        this._m_BackupBodyOverflow$1 = document.body.style.overflow;
        document.body.style.overflow = 'hidden';
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_ViewAsHtmlPanelScript$tearDown() {
        document.documentElement.style.margin = this._m_BackupDocumentMargin$1;
        document.documentElement.style.padding = this._m_BackupDocumentPadding$1;
        document.documentElement.style.height = this._m_BackupDocumentHeight$1;
        document.documentElement.style.overflow = this._m_BackupDocumentOverflow$1;
        document.body.style.margin = this._m_BackupBodyMargin$1;
        document.body.style.padding = this._m_BackupBodyPadding$1;
        document.body.style.height = this._m_BackupBodyHeight$1;
        document.body.style.overflow = this._m_BackupBodyOverflow$1;
    }
}


Type.registerNamespace('Coveo.CES.Web.Search.Scripts.Controls.Results');

////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightPlayPauseButtonMode

Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightPlayPauseButtonMode = function() { 
    /// <summary>
    /// Possible states for a <see cref="T:Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightPlayPauseButton" />.
    /// </summary>
    /// <field name="play" type="Number" integer="true" static="true">
    /// Play
    /// </field>
    /// <field name="pause" type="Number" integer="true" static="true">
    /// Pause
    /// </field>
};
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightPlayPauseButtonMode.prototype = {
    play: 0, 
    pause: 1
}
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightPlayPauseButtonMode.registerEnum('Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightPlayPauseButtonMode', false);


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgressOrientation

Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgressOrientation = function() { 
    /// <summary>
    /// Possible values for a <see cref="T:Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgress" /> orientation.
    /// </summary>
    /// <field name="horizontal" type="Number" integer="true" static="true">
    /// Progress will be rendered from left to right
    /// </field>
    /// <field name="vertical" type="Number" integer="true" static="true">
    /// Progress will be rendered from top to bottom
    /// </field>
};
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgressOrientation.prototype = {
    horizontal: 0, 
    vertical: 1
}
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgressOrientation.registerEnum('Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgressOrientation', false);


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightButtonState

Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightButtonState = function() { 
    /// <summary>
    /// Defines the different possibles states of a
    /// <see cref="T:Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightSymbolButton" />.
    /// </summary>
    /// <field name="disabled" type="Number" integer="true" static="true">
    /// Disabled
    /// </field>
    /// <field name="enabled" type="Number" integer="true" static="true">
    /// Enabled
    /// </field>
    /// <field name="grayed" type="Number" integer="true" static="true">
    /// Grayed
    /// </field>
};
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightButtonState.prototype = {
    disabled: 0, 
    enabled: 1, 
    grayed: 2
}
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightButtonState.registerEnum('Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightButtonState', false);


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.Results.ZoomDirection

Coveo.CES.Web.Search.Scripts.Controls.Results.ZoomDirection = function() { 
    /// <summary>
    /// Zooming direction possible values.
    /// </summary>
    /// <field name="zoomIn" type="Number" integer="true" static="true">
    /// Zoom In
    /// </field>
    /// <field name="zoomOut" type="Number" integer="true" static="true">
    /// Zoom Out
    /// </field>
};
Coveo.CES.Web.Search.Scripts.Controls.Results.ZoomDirection.prototype = {
    zoomIn: 0, 
    zoomOut: 1
}
Coveo.CES.Web.Search.Scripts.Controls.Results.ZoomDirection.registerEnum('Coveo.CES.Web.Search.Scripts.Controls.Results.ZoomDirection', false);


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightAnimatedButton

Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightAnimatedButton = function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightAnimatedButton(p_TargetControl) {
    /// <summary>
    /// Base class for all buttons providing an animation on mouse events.
    /// </summary>
    /// <param name="p_TargetControl" type="UIElement">
    /// </param>
    /// <field name="_m_FocusInAnimation$2" type="Storyboard">
    /// </field>
    /// <field name="_m_FocusOutAnimation$2" type="Storyboard">
    /// </field>
    /// <field name="_m_PressAnimation$2" type="Storyboard">
    /// </field>
    /// <field name="_m_DepressAnimation$2" type="Storyboard">
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightAnimatedButton.initializeBase(this, [ p_TargetControl ]);
}
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightAnimatedButton.prototype = {
    _m_FocusInAnimation$2: null,
    _m_FocusOutAnimation$2: null,
    _m_PressAnimation$2: null,
    _m_DepressAnimation$2: null,
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightAnimatedButton$tearDown() {
        this._m_FocusInAnimation$2 = null;
        this._m_FocusOutAnimation$2 = null;
        this._m_PressAnimation$2 = null;
        this._m_DepressAnimation$2 = null;
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightAnimatedButton.callBaseMethod(this, 'tearDown');
    },
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightAnimatedButton$initialize() {
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightAnimatedButton.callBaseMethod(this, 'initialize');
        this._m_FocusInAnimation$2 = this.m_TargetControl.getHost().content.findName(this.m_TargetControl.name + '_FocusInAnimation');
        this._m_FocusOutAnimation$2 = this.m_TargetControl.getHost().content.findName(this.m_TargetControl.name + '_FocusOutAnimation');
        this._m_PressAnimation$2 = this.m_TargetControl.getHost().content.findName(this.m_TargetControl.name + '_PressAnimation');
        this._m_DepressAnimation$2 = this.m_TargetControl.getHost().content.findName(this.m_TargetControl.name + '_DepressAnimation');
    },
    
    onMouseEnter: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightAnimatedButton$onMouseEnter(p_Args) {
        /// <param name="p_Args" type="MouseEventArgs">
        /// </param>
        if (this._m_FocusInAnimation$2 != null) {
            this._m_FocusInAnimation$2.begin();
        }
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightAnimatedButton.callBaseMethod(this, 'onMouseEnter', [ p_Args ]);
    },
    
    onMouseLeave: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightAnimatedButton$onMouseLeave(p_Args) {
        /// <param name="p_Args" type="MouseEventArgs">
        /// </param>
        if (this._m_FocusOutAnimation$2 != null && !this.m_ButtonPressed) {
            this._m_FocusOutAnimation$2.begin();
        }
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightAnimatedButton.callBaseMethod(this, 'onMouseLeave', [ p_Args ]);
    },
    
    onMouseLeftButtonDown: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightAnimatedButton$onMouseLeftButtonDown(p_Args) {
        /// <param name="p_Args" type="MouseEventArgs">
        /// </param>
        if (this._m_PressAnimation$2 != null) {
            this._m_PressAnimation$2.begin();
        }
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightAnimatedButton.callBaseMethod(this, 'onMouseLeftButtonDown', [ p_Args ]);
    },
    
    onMouseLeftButtonUp: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightAnimatedButton$onMouseLeftButtonUp(p_Args) {
        /// <param name="p_Args" type="MouseEventArgs">
        /// </param>
        if (this._m_DepressAnimation$2 != null) {
            this._m_DepressAnimation$2.begin();
        }
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightAnimatedButton.callBaseMethod(this, 'onMouseLeftButtonUp', [ p_Args ]);
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightButton

Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightButton = function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightButton(p_TargetCanvas) {
    /// <summary>
    /// Base class for all buttons Silverlight controls.
    /// </summary>
    /// <param name="p_TargetCanvas" type="UIElement">
    /// </param>
    Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightButton.initializeBase(this, [ p_TargetCanvas ]);
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightCustomControl

Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightCustomControl = function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl(p_TargetControl) {
    /// <summary>
    /// Base class for all the Silverlight controls.
    /// </summary>
    /// <param name="p_TargetControl" type="UIElement">
    /// Associated Silverlight control
    /// </param>
    /// <field name="_draG_MOUSE_THRESHOLD" type="Number" static="true">
    /// </field>
    /// <field name="_m_DebugControl" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightDebug">
    /// </field>
    /// <field name="_m_LastMouseDownTime" type="Date">
    /// </field>
    /// <field name="_m_Dragging" type="Boolean">
    /// </field>
    /// <field name="_m_DraggingThresholdRefX" type="Number">
    /// </field>
    /// <field name="_m_DraggingThresholdRefY" type="Number">
    /// </field>
    /// <field name="_m_Top" type="Number">
    /// </field>
    /// <field name="_m_Left" type="Number">
    /// </field>
    /// <field name="_m_Height" type="Number">
    /// </field>
    /// <field name="_m_Width" type="Number">
    /// </field>
    /// <field name="_m_Opacity" type="Number">
    /// </field>
    /// <field name="_m_Visible" type="Boolean">
    /// </field>
    /// <field name="_m_Controls" type="Array">
    /// </field>
    /// <field name="_m_TargetMouseEnter" type="Object">
    /// </field>
    /// <field name="_m_TargetMouseLeave" type="Object">
    /// </field>
    /// <field name="_m_TargetMouseMove" type="Object">
    /// </field>
    /// <field name="_m_TargetMouseLeftButtonDown" type="Object">
    /// </field>
    /// <field name="_m_TargetMouseLeftButtonUp" type="Object">
    /// </field>
    /// <field name="_m_MouseWheel" type="DOMEventHandler">
    /// </field>
    /// <field name="m_MouseOver" type="Boolean">
    /// </field>
    /// <field name="m_MouseWheelDelta" type="Number" integer="true">
    /// </field>
    /// <field name="m_ButtonPressed" type="Boolean">
    /// </field>
    /// <field name="m_TargetControl" type="UIElement">
    /// </field>
    /// <field name="beginDrag" type="Coveo.CNL.Web.Scripts.MulticastEventHandler">
    /// Event fired when a dragging operation starts.
    /// </field>
    /// <field name="mouseEnter" type="Coveo.CNL.Web.Scripts.MulticastEventHandler">
    /// Event fired when the mouse enters the control.
    /// </field>
    /// <field name="mouseLeave" type="Coveo.CNL.Web.Scripts.MulticastEventHandler">
    /// Event fired when the mouse leaves the control.
    /// </field>
    /// <field name="mouseMove" type="Coveo.CNL.Web.Scripts.MulticastEventHandler">
    /// Event fired when the mouse moves over the control.
    /// </field>
    /// <field name="dragging" type="Coveo.CNL.Web.Scripts.MulticastEventHandler">
    /// Event fired while the control is dragged.
    /// </field>
    /// <field name="dragDrop" type="Coveo.CNL.Web.Scripts.MulticastEventHandler">
    /// Event fired when the drag operation ends.
    /// </field>
    /// <field name="click" type="Coveo.CNL.Web.Scripts.MulticastEventHandler">
    /// Event fired when the control is clicked. A click operation is defined by
    /// a MouseDown action followed by a MouseUp while the mouse is over the
    /// control an no dragging operation was done.
    /// </field>
    /// <field name="doubleClick" type="Coveo.CNL.Web.Scripts.MulticastEventHandler">
    /// Event fired when the control is clicked. A double click operation is
    /// defined by two consecutive MouseDown actions in a small period of time.
    /// </field>
    this.beginDrag = new Coveo.CNL.Web.Scripts.MulticastEventHandler();
    this.mouseEnter = new Coveo.CNL.Web.Scripts.MulticastEventHandler();
    this.mouseLeave = new Coveo.CNL.Web.Scripts.MulticastEventHandler();
    this.mouseMove = new Coveo.CNL.Web.Scripts.MulticastEventHandler();
    this.dragging = new Coveo.CNL.Web.Scripts.MulticastEventHandler();
    this.dragDrop = new Coveo.CNL.Web.Scripts.MulticastEventHandler();
    this.click = new Coveo.CNL.Web.Scripts.MulticastEventHandler();
    this.doubleClick = new Coveo.CNL.Web.Scripts.MulticastEventHandler();
    Coveo.CNL.Web.Scripts.CNLAssert.notNull(p_TargetControl);
    this._m_Controls = [];
    this.m_TargetControl = p_TargetControl;
    this.initialize();
}
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightCustomControl.prototype = {
    _m_DebugControl: null,
    _m_LastMouseDownTime: null,
    _m_Dragging: false,
    _m_DraggingThresholdRefX: 0,
    _m_DraggingThresholdRefY: 0,
    _m_Top: 0,
    _m_Left: 0,
    _m_Height: 0,
    _m_Width: 0,
    _m_Opacity: 0,
    _m_Visible: false,
    _m_Controls: null,
    _m_TargetMouseEnter: null,
    _m_TargetMouseLeave: null,
    _m_TargetMouseMove: null,
    _m_TargetMouseLeftButtonDown: null,
    _m_TargetMouseLeftButtonUp: null,
    _m_MouseWheel: null,
    m_MouseOver: false,
    m_MouseWheelDelta: 0,
    m_ButtonPressed: false,
    m_TargetControl: null,
    
    get_targetControl: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$get_targetControl() {
        /// <summary>
        /// Gets the Silverlight target control
        /// </summary>
        /// <value type="UIElement"></value>
        return this.m_TargetControl;
    },
    
    get_controls: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$get_controls() {
        /// <summary>
        /// Gets the list of the child controls.
        /// </summary>
        /// <value type="Array"></value>
        return this._m_Controls;
    },
    
    get_debugControl: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$get_debugControl() {
        /// <summary>
        /// Gets or sets the debug control attached to the component.
        /// </summary>
        /// <value type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightDebug"></value>
        return this._m_DebugControl;
    },
    set_debugControl: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$set_debugControl(value) {
        /// <summary>
        /// Gets or sets the debug control attached to the component.
        /// </summary>
        /// <value type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightDebug"></value>
        this._m_DebugControl = value;
        return value;
    },
    
    get_isDragging: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$get_isDragging() {
        /// <summary>
        /// Indicates that the control is currently dragged. This property is
        /// read/only.
        /// </summary>
        /// <value type="Boolean"></value>
        return this._m_Dragging;
    },
    
    get_top: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$get_top() {
        /// <summary>
        /// Gets or sets the control top value.
        /// </summary>
        /// <value type="Number"></value>
        this._m_Top = this.m_TargetControl.getValue('Canvas.Top');
        return this._m_Top;
    },
    set_top: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$set_top(value) {
        /// <summary>
        /// Gets or sets the control top value.
        /// </summary>
        /// <value type="Number"></value>
        this._m_Top = value;
        this.renderControl();
        return value;
    },
    
    get_left: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$get_left() {
        /// <summary>
        /// Gets or sets the control left value.
        /// </summary>
        /// <value type="Number"></value>
        this._m_Left = this.m_TargetControl.getValue('Canvas.Left');
        return this._m_Left;
    },
    set_left: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$set_left(value) {
        /// <summary>
        /// Gets or sets the control left value.
        /// </summary>
        /// <value type="Number"></value>
        this._m_Left = value;
        this.renderControl();
        return value;
    },
    
    get_height: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$get_height() {
        /// <summary>
        /// Gets or sets the control height value.
        /// </summary>
        /// <value type="Number"></value>
        this._m_Height = this.m_TargetControl.height;
        return this._m_Height;
    },
    set_height: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$set_height(value) {
        /// <summary>
        /// Gets or sets the control height value.
        /// </summary>
        /// <value type="Number"></value>
        this._m_Height = value;
        this.renderControl();
        return value;
    },
    
    get_width: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$get_width() {
        /// <summary>
        /// Gets or sets the control width value.
        /// </summary>
        /// <value type="Number"></value>
        this._m_Width = this.m_TargetControl.width;
        return this._m_Width;
    },
    set_width: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$set_width(value) {
        /// <summary>
        /// Gets or sets the control width value.
        /// </summary>
        /// <value type="Number"></value>
        this._m_Width = value;
        this.renderControl();
        return value;
    },
    
    get_opacity: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$get_opacity() {
        /// <summary>
        /// Gets or sets the control opacity value.
        /// </summary>
        /// <value type="Number"></value>
        this._m_Opacity = this.m_TargetControl.opacity;
        return this._m_Opacity;
    },
    set_opacity: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$set_opacity(value) {
        /// <summary>
        /// Gets or sets the control opacity value.
        /// </summary>
        /// <value type="Number"></value>
        this._m_Opacity = value;
        this.renderControl();
        return value;
    },
    
    get_visible: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$get_visible() {
        /// <summary>
        /// Gets or sets the visibility value.
        /// </summary>
        /// <value type="Boolean"></value>
        this._m_Visible = this.m_TargetControl.visibility === 'visible';
        return this._m_Visible;
    },
    set_visible: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$set_visible(value) {
        /// <summary>
        /// Gets or sets the visibility value.
        /// </summary>
        /// <value type="Boolean"></value>
        this._m_Visible = value;
        this.renderControl();
        return value;
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$tearDown() {
        /// <summary>
        /// Call this method to release associated objects.
        /// </summary>
        window.detachEvent('onmousewheel', this._m_MouseWheel);
        this.m_TargetControl.removeEventListener('mouseEnter', this._m_TargetMouseEnter);
        this.m_TargetControl.removeEventListener('mouseLeave', this._m_TargetMouseLeave);
        this.m_TargetControl.removeEventListener('mouseMove', this._m_TargetMouseMove);
        this.m_TargetControl.removeEventListener('mouseLeftButtonDown', this._m_TargetMouseLeftButtonDown);
        this.m_TargetControl.removeEventListener('mouseLeftButtonUp', this._m_TargetMouseLeftButtonUp);
        for (var i = 0; i < this._m_Controls.length; i++) {
            var control = this._m_Controls[i];
            control.tearDown();
        }
        this._m_DebugControl = null;
        this.m_TargetControl = null;
    },
    
    disableEvents: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$disableEvents() {
        /// <summary>
        /// Call this method to disable all custom events fired by the control.
        /// </summary>
        this.m_TargetControl.isHitTestVisible = false;
    },
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$initialize() {
        /// <summary>
        /// Retrieves attributes manipulated by the control class and also set
        /// different event handlers.
        /// </summary>
        this._m_Top = this.m_TargetControl.getValue('Canvas.Top');
        this._m_Left = this.m_TargetControl.getValue('Canvas.Left');
        this._m_Height = this.m_TargetControl.height;
        this._m_Width = this.m_TargetControl.width;
        this._m_Opacity = this.m_TargetControl.opacity;
        this._m_Visible = this.m_TargetControl.visibility === 'visible';
        this._m_TargetMouseEnter = this.m_TargetControl.addEventListener('mouseEnter', Function.createDelegate(this, this._targetMouseEnter));
        this._m_TargetMouseLeave = this.m_TargetControl.addEventListener('mouseLeave', Function.createDelegate(this, this._targetMouseLeave));
        this._m_TargetMouseMove = this.m_TargetControl.addEventListener('mouseMove', Function.createDelegate(this, this._targetMouseMove));
        this._m_TargetMouseLeftButtonDown = this.m_TargetControl.addEventListener('mouseLeftButtonDown', Function.createDelegate(this, this._targetMouseLeftButtonDown));
        this._m_TargetMouseLeftButtonUp = this.m_TargetControl.addEventListener('mouseLeftButtonUp', Function.createDelegate(this, this._targetMouseLeftButtonUp));
        this._m_MouseWheel = Function.createDelegate(this, this._window_MouseWheel);
        this.m_TargetControl.getHost().attachEvent('onmousewheel', this._m_MouseWheel);
    },
    
    renderControl: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$renderControl() {
        /// <summary>
        /// Renders the target control.
        /// </summary>
        this.m_TargetControl.setValue('Canvas.Top', this._m_Top);
        this.m_TargetControl.setValue('Canvas.Left', this._m_Left);
        this.m_TargetControl.height = this._m_Height;
        this.m_TargetControl.width = this._m_Width;
        this.m_TargetControl.opacity = this._m_Opacity;
        if (this._m_Visible) {
            this.m_TargetControl.visibility = 'visible';
        }
        else {
            this.m_TargetControl.visibility = 'collapsed';
        }
    },
    
    ensureBoudaries: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$ensureBoudaries() {
        /// <summary>
        /// Ensures that the internally kept properties are synchronized with the
        /// ones of the control. You may call this method if you think, for example,
        /// that the left property of the control might have change, even if you
        /// don't explicitly set the Left property (e.g. Control has moved in result
        /// of a binded Animation).
        /// </summary>
        this._m_Left = this.m_TargetControl.getValue('Canvas.Left');
        this._m_Top = this.m_TargetControl.getValue('Canvas.Top');
        this._m_Height = this.m_TargetControl.height;
        this._m_Width = this.m_TargetControl.width;
    },
    
    onClick: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$onClick(p_Args) {
        /// <summary>
        /// Performs action when the control is clicked and then fires the event.
        /// </summary>
        /// <param name="p_Args" type="MouseEventArgs">
        /// Mouse arguments.
        /// </param>
        if (this.click.isDefined()) {
            this.click.invoke(this, new EventArgs());
        }
    },
    
    onDoubleClick: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$onDoubleClick(p_Args) {
        /// <summary>
        /// Performs action when the control is double clicked and then fires the event.
        /// </summary>
        /// <param name="p_Args" type="MouseEventArgs">
        /// Mouse arguments.
        /// </param>
        if (this.doubleClick.isDefined()) {
            this.doubleClick.invoke(this, new Sys.EventArgs());
        }
    },
    
    onMouseEnter: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$onMouseEnter(p_Args) {
        /// <summary>
        /// Performs action when the mouse enters the control and then fires the
        /// event.
        /// </summary>
        /// <param name="p_Args" type="MouseEventArgs">
        /// Mouse arguments.
        /// </param>
        if (this.mouseEnter.isDefined()) {
            this.mouseEnter.invoke(this, p_Args);
        }
    },
    
    onMouseLeave: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$onMouseLeave(p_Args) {
        /// <summary>
        /// Performs action when the mouse leaves the control and then fires the
        /// event.
        /// </summary>
        /// <param name="p_Args" type="MouseEventArgs">
        /// Mouse arguments.
        /// </param>
        if (this.mouseLeave.isDefined()) {
            this.mouseLeave.invoke(this, p_Args);
        }
    },
    
    onMouseMove: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$onMouseMove(p_Args) {
        /// <summary>
        /// Performs action when the mouse moves over the control and then fires the
        /// event.
        /// </summary>
        /// <param name="p_Args" type="MouseEventArgs">
        /// Mouse arguments.
        /// </param>
        if (this.mouseMove.isDefined()) {
            this.mouseMove.invoke(this, p_Args);
        }
    },
    
    onMouseLeftButtonDown: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$onMouseLeftButtonDown(p_Args) {
        /// <summary>
        /// Performs action when the mouse left button is pressed and then fires the
        /// event.
        /// </summary>
        /// <param name="p_Args" type="MouseEventArgs">
        /// Mouse arguments.
        /// </param>
    },
    
    onMouseLeftButtonUp: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$onMouseLeftButtonUp(p_Args) {
        /// <summary>
        /// Performs action when the mouse left button is depressed and then fires the
        /// event.
        /// </summary>
        /// <param name="p_Args" type="MouseEventArgs">
        /// Mouse arguments.
        /// </param>
    },
    
    onBeginDrag: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$onBeginDrag(p_Args) {
        /// <summary>
        /// Performs action when a drag operation is started on a control and the
        /// fires the event.
        /// </summary>
        /// <param name="p_Args" type="MouseEventArgs">
        /// Mouse arguments.
        /// </param>
        if (this.beginDrag.isDefined()) {
            this.beginDrag.invoke(this, p_Args);
        }
    },
    
    onDragging: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$onDragging(p_Args) {
        /// <summary>
        /// Performs action when the control is dragged and then fires the event.
        /// </summary>
        /// <param name="p_Args" type="MouseEventArgs">
        /// Mouse arguments.
        /// </param>
        if (this.dragging.isDefined()) {
            this.dragging.invoke(this, p_Args);
        }
    },
    
    onDragDrop: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$onDragDrop(p_Args) {
        /// <summary>
        /// Performs action when the drag operation is completed and then fires the
        /// event.
        /// </summary>
        /// <param name="p_Args" type="MouseEventArgs">
        /// Mouse arguments.
        /// </param>
        if (this.dragDrop.isDefined()) {
            this.dragDrop.invoke(this, p_Args);
        }
    },
    
    onMouseWheel: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$onMouseWheel(p_WheelDelta) {
        /// <summary>
        /// Performs action when a mouse wheel operation is processed.
        /// </summary>
        /// <param name="p_WheelDelta" type="Number" integer="true">
        /// </param>
    },
    
    _targetMouseEnter: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$_targetMouseEnter(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="MouseEventArgs">
        /// </param>
        this.m_MouseOver = true;
        this.onMouseEnter(p_Args);
    },
    
    _targetMouseLeave: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$_targetMouseLeave(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="MouseEventArgs">
        /// </param>
        this.m_MouseOver = false;
        this.onMouseLeave(p_Args);
    },
    
    _targetMouseMove: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$_targetMouseMove(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="MouseEventArgs">
        /// </param>
        if (this.m_ButtonPressed) {
            var wasDragging = this._m_Dragging;
            this._m_Dragging = this._m_Dragging || (Math.abs(this._m_DraggingThresholdRefX - p_Args.getPosition(this.m_TargetControl).x) >= Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightCustomControl._draG_MOUSE_THRESHOLD) || (Math.abs(this._m_DraggingThresholdRefY - p_Args.getPosition(this.m_TargetControl).y) >= Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightCustomControl._draG_MOUSE_THRESHOLD);
            if (this._m_Dragging) {
                if (!wasDragging) {
                    this.onBeginDrag(p_Args);
                }
                this.onDragging(p_Args);
            }
        }
        this.onMouseMove(p_Args);
    },
    
    _targetMouseLeftButtonDown: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$_targetMouseLeftButtonDown(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="MouseEventArgs">
        /// </param>
        var currentTime = new Date();
        if (this._m_LastMouseDownTime != null && currentTime.getTime() - this._m_LastMouseDownTime.getTime() <= 300) {
            this.onDoubleClick(p_Args);
        }
        else {
            this._m_LastMouseDownTime = currentTime;
            this.m_TargetControl.captureMouse();
            this.m_ButtonPressed = true;
            this._m_DraggingThresholdRefX = p_Args.getPosition(this.m_TargetControl).x;
            this._m_DraggingThresholdRefY = p_Args.getPosition(this.m_TargetControl).y;
            this.onMouseLeftButtonDown(p_Args);
        }
    },
    
    _targetMouseLeftButtonUp: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$_targetMouseLeftButtonUp(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="MouseEventArgs">
        /// </param>
        this.m_TargetControl.releaseMouseCapture();
        this.m_ButtonPressed = false;
        if (this._m_Dragging) {
            this._m_Dragging = false;
            this.onMouseLeftButtonUp(p_Args);
            this.onDragDrop(p_Args);
        }
        else if (this.m_MouseOver) {
            this.onMouseLeftButtonUp(p_Args);
            this.onClick(p_Args);
        }
    },
    
    _window_MouseWheel: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightCustomControl$_window_MouseWheel() {
        if (this.m_MouseOver) {
            eval('this.m_MouseWheelDelta = window.event.wheelDelta;');
            this.onMouseWheel(this.m_MouseWheelDelta);
        }
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightDebug

Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightDebug = function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightDebug(p_TargetControl) {
    /// <summary>
    /// This control is used to display debug information on a Silverlight module.
    /// </summary>
    /// <param name="p_TargetControl" type="UIElement">
    /// </param>
    /// <field name="_m_Array$1" type="Array">
    /// </field>
    /// <field name="_m_DebugText$1" type="TextBlock">
    /// </field>
    this._m_Array$1 = [];
    Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightDebug.initializeBase(this, [ p_TargetControl ]);
}
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightDebug.prototype = {
    _m_DebugText$1: null,
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightDebug$tearDown() {
        Array.clear(this._m_Array$1);
        this._m_Array$1 = null;
        this._m_DebugText$1 = null;
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightDebug.callBaseMethod(this, 'tearDown');
    },
    
    turnOn: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightDebug$turnOn() {
        /// <summary>
        /// Turns on the debug control.
        /// </summary>
        this.m_TargetControl.opacity = 0.75;
    },
    
    turnOff: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightDebug$turnOff() {
        /// <summary>
        /// Turns off the debug control.
        /// </summary>
        this.m_TargetControl.opacity = 0;
    },
    
    log: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightDebug$log(p_DebugLog) {
        /// <summary>
        /// Adds a new log entry to be displayed by the debug control.
        /// </summary>
        /// <param name="p_DebugLog" type="String">
        /// The log to display.
        /// </param>
        Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(p_DebugLog);
        Array.add(this._m_Array$1, p_DebugLog);
        var start = 0;
        var end = this._m_Array$1.length;
        if (end > 20) {
            start = this._m_Array$1.length - 20;
        }
        var sb = new Sys.StringBuilder();
        for (var i = start; i <= end - 1; i++) {
            sb.appendLine(this._m_Array$1[i].toString());
        }
        this._m_DebugText$1.text = sb.toString();
    },
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightDebug$initialize() {
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightDebug.callBaseMethod(this, 'initialize');
        Array.add(this._m_Array$1, 'Debug On...');
        this._m_DebugText$1 = this.m_TargetControl.findName('DebugText');
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this._m_DebugText$1);
        this.m_TargetControl.opacity = 0.75;
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightExcerptTooltip

Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightExcerptTooltip = function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightExcerptTooltip(p_Target) {
    /// <summary>
    /// Class used to render a time value.
    /// </summary>
    /// <param name="p_Target" type="Canvas">
    /// </param>
    /// <field name="_m_Rectangle$1" type="Rectangle">
    /// </field>
    /// <field name="_m_Text$1" type="String">
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightExcerptTooltip.initializeBase(this, [ p_Target ]);
}
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightExcerptTooltip.prototype = {
    _m_Rectangle$1: null,
    _m_Text$1: null,
    
    get_width: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightExcerptTooltip$get_width() {
        /// <value type="Number"></value>
        return Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightExcerptTooltip.callBaseMethod(this, 'get_width');
    },
    set_width: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightExcerptTooltip$set_width(value) {
        /// <value type="Number"></value>
        this._m_Rectangle$1.width = value;
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightExcerptTooltip.callBaseMethod(this, 'set_width', [ value ]);
        return value;
    },
    
    get_height: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightExcerptTooltip$get_height() {
        /// <value type="Number"></value>
        return Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightExcerptTooltip.callBaseMethod(this, 'get_height');
    },
    set_height: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightExcerptTooltip$set_height(value) {
        /// <value type="Number"></value>
        this._m_Rectangle$1.height = value;
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightExcerptTooltip.callBaseMethod(this, 'set_height', [ value ]);
        return value;
    },
    
    get_text: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightExcerptTooltip$get_text() {
        /// <summary>
        /// Gets or sets the text value rendered by the control.
        /// </summary>
        /// <value type="String"></value>
        return this._m_Text$1;
    },
    set_text: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightExcerptTooltip$set_text(value) {
        /// <summary>
        /// Gets or sets the text value rendered by the control.
        /// </summary>
        /// <value type="String"></value>
        this._m_Text$1 = value;
        this.renderControl();
        return value;
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightExcerptTooltip$tearDown() {
        this._m_Rectangle$1 = null;
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightExcerptTooltip.callBaseMethod(this, 'tearDown');
    },
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightExcerptTooltip$initialize() {
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightExcerptTooltip.callBaseMethod(this, 'initialize');
        this._m_Rectangle$1 = this.m_TargetControl.findName('ExcerptRect');
    },
    
    renderControl: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightExcerptTooltip$renderControl() {
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightExcerptTooltip.callBaseMethod(this, 'renderControl');
        (this.m_TargetControl).children.clear();
        (this.m_TargetControl).children.add(this._m_Rectangle$1);
        var xaml = '<TextBlock TextWrapping=\"Wrap\" FontFamily=\"Verdana\" FontSize=\"11\" Foreground=\"White\" Canvas.Left=\"3\" Canvas.Top=\"3\" Width=\"' + (this.m_TargetControl.width - 6) + '\" Height=\"' + (this.m_TargetControl.height - 6) + '\">' + this._m_Text$1 + '</TextBlock>';
        var textBlock = this.m_TargetControl.getHost().content.createFromXaml(xaml);
        (this.m_TargetControl).children.add(textBlock);
        var clipXaml = '<RectangleGeometry Rect=\"0, 0, ' + this.m_TargetControl.width + ', ' + this.m_TargetControl.height + '\" />';
        var clipRect = this.m_TargetControl.getHost().content.createFromXaml(clipXaml);
        (this.m_TargetControl).clip = clipRect;
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightPlayerControl

Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightPlayerControl = function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl() {
    /// <summary>
    /// This is the main class used to manage the Silverlight media player.
    /// </summary>
    /// <field name="_m_Concepts$1" type="Array">
    /// </field>
    /// <field name="_m_Utterances$1" type="Array">
    /// </field>
    /// <field name="_m_UtterancesDirty$1" type="Boolean">
    /// </field>
    /// <field name="_m_LastSelectedUtterance$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextEntry">
    /// </field>
    /// <field name="_m_LastHighlightUtterance$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextEntry">
    /// </field>
    /// <field name="_m_HeadStartAsPercent$1" type="Number">
    /// </field>
    /// <field name="_m_Loaded$1" type="Boolean">
    /// </field>
    /// <field name="_m_LastSelectedConcept$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextEntry">
    /// </field>
    /// <field name="_m_DebugControl$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightDebug">
    /// </field>
    /// <field name="_m_UtterancesCanvas$1" type="Canvas">
    /// </field>
    /// <field name="_m_PlayerControls$1" type="Canvas">
    /// </field>
    /// <field name="_m_MediaPlayer$1" type="MediaElement">
    /// </field>
    /// <field name="_m_PlayerControlsFadeInAnimation$1" type="Storyboard">
    /// </field>
    /// <field name="_m_PlayerControlsFadeOutInAnimation$1" type="Storyboard">
    /// </field>
    /// <field name="_m_ProgressTimer$1" type="Storyboard">
    /// </field>
    /// <field name="_m_MarkerLeftTimer$1" type="Storyboard">
    /// </field>
    /// <field name="_m_AudioVisualAnimationFadeIn$1" type="Storyboard">
    /// </field>
    /// <field name="_m_AudioVisualAnimationFadeOut$1" type="Storyboard">
    /// </field>
    /// <field name="_m_FullScreenHook$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightCustomControl">
    /// </field>
    /// <field name="_m_TotalTimeText$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextTime">
    /// </field>
    /// <field name="_m_CurrentTimeText$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextTime">
    /// </field>
    /// <field name="_m_PlayPauseButton$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightPlayPauseButton">
    /// </field>
    /// <field name="_m_ProgressControl$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgress">
    /// </field>
    /// <field name="_m_DownloadControl$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgress">
    /// </field>
    /// <field name="_m_VolumeControl$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgress">
    /// </field>
    /// <field name="_m_MarkersZoomButton$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightSymbolButton">
    /// </field>
    /// <field name="_m_MarkerContainer$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTimeLineMarkerContainer">
    /// </field>
    /// <field name="_m_FullScreenButton$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightButton">
    /// </field>
    /// <field name="_m_StopButton$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightAnimatedButton">
    /// </field>
    /// <field name="_m_NextButton$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightAnimatedButton">
    /// </field>
    /// <field name="_m_PreviousButton$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightAnimatedButton">
    /// </field>
    /// <field name="_m_MuteButton$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightButton">
    /// </field>
    /// <field name="_m_VolumeDownButton$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightAnimatedButton">
    /// </field>
    /// <field name="_m_VolumeUpButton$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightAnimatedButton">
    /// </field>
    /// <field name="_m_ExcerptTooltip$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightExcerptTooltip">
    /// </field>
    /// <field name="_m_ConceptsControl$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextContainer">
    /// </field>
    /// <field name="_m_UtteranceContainer$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextContainer">
    /// </field>
    /// <field name="_m_ScrollArea$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightScrollArea">
    /// </field>
    /// <field name="_m_PlayerControls_MouseEnter$1" type="Object">
    /// </field>
    /// <field name="_m_PlayerControls_MouseLeave$1" type="Object">
    /// </field>
    /// <field name="_m_MediaPlayer_MediaOpened$1" type="Object">
    /// </field>
    /// <field name="_m_MediaPlayer_MarkerReached$1" type="Object">
    /// </field>
    /// <field name="_m_MediaPlayer_CurrentStateChanged$1" type="Object">
    /// </field>
    /// <field name="_m_MediaPlayer_BufferingProgressChanged$1" type="Object">
    /// </field>
    /// <field name="_m_MediaPlayer_DownloadProgressChanged$1" type="Object">
    /// </field>
    /// <field name="_m_MediaPlayer_MediaFailed$1" type="Object">
    /// </field>
    /// <field name="_m_MediaPlayer_MediaEnded$1" type="Object">
    /// </field>
    /// <field name="_m_ProgressTimer_Completed$1" type="Object">
    /// </field>
    /// <field name="_m_MarkerLeftTimer_Completed$1" type="Object">
    /// </field>
    /// <field name="_m_AudioVisualFadeIn_Completed$1" type="Object">
    /// </field>
    /// <field name="_m_AudioVisualFadeOut_Completed$1" type="Object">
    /// </field>
    /// <field name="_m_FullScreenButton_Click$1" type="EventHandler">
    /// </field>
    /// <field name="_m_MarkersZoom_Click$1" type="EventHandler">
    /// </field>
    /// <field name="_m_PlayPauseButton_Click$1" type="EventHandler">
    /// </field>
    /// <field name="_m_StopButton_Click$1" type="EventHandler">
    /// </field>
    /// <field name="_m_NextButton_Click$1" type="EventHandler">
    /// </field>
    /// <field name="_m_PreviousButton_Click$1" type="EventHandler">
    /// </field>
    /// <field name="_m_ProgressControl_ProgressChange$1" type="EventHandler">
    /// </field>
    /// <field name="_m_MarkerContainer_UtteranceHighlighted$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.UtteranceEventHandler">
    /// </field>
    /// <field name="_m_MarkerContainer_UtteranceClick$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.UtteranceEventHandler">
    /// </field>
    /// <field name="_m_MuteButton_Click$1" type="EventHandler">
    /// </field>
    /// <field name="_m_VolumeDownButton_Click$1" type="EventHandler">
    /// </field>
    /// <field name="_m_VolumeUpButton_Click$1" type="EventHandler">
    /// </field>
    /// <field name="_m_VolumeControl_ProgressChange$1" type="EventHandler">
    /// </field>
    /// <field name="m_Control" type="Object" domElement="true">
    /// </field>
    /// <field name="m_MediaUri" type="String">
    /// </field>
    /// <field name="m_MediaLength" type="Number">
    /// </field>
    /// <field name="m_PlayerXaml" type="String">
    /// </field>
    /// <field name="m_HeadStart" type="Number">
    /// </field>
    /// <field name="m_PlayerWidth" type="Number" integer="true">
    /// </field>
    /// <field name="m_PlayerHeight" type="Number" integer="true">
    /// </field>
    /// <field name="m_Debug" type="Boolean">
    /// </field>
    /// <field name="m_SelectedConcept" type="String">
    /// </field>
    /// <field name="m_PartialCallbackMethod" type="String">
    /// </field>
    /// <field name="m_AudioFileOnly" type="Boolean">
    /// </field>
    /// <field name="m_SearchControls" type="Object" domElement="true">
    /// </field>
    /// <field name="m_SearchTextBox" type="Object" domElement="true">
    /// </field>
    /// <field name="m_SearchButton" type="Object" domElement="true">
    /// </field>
    /// <field name="m_Host" type="Object" domElement="true">
    /// </field>
    /// <field name="m_UnableToPlayError" type="String">
    /// </field>
    this._m_Concepts$1 = [];
    this._m_Utterances$1 = [];
    Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightPlayerControl.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightPlayerControl.prototype = {
    _m_UtterancesDirty$1: false,
    _m_LastSelectedUtterance$1: null,
    _m_LastHighlightUtterance$1: null,
    _m_HeadStartAsPercent$1: 0,
    _m_Loaded$1: false,
    _m_LastSelectedConcept$1: null,
    _m_DebugControl$1: null,
    _m_UtterancesCanvas$1: null,
    _m_PlayerControls$1: null,
    _m_MediaPlayer$1: null,
    _m_PlayerControlsFadeInAnimation$1: null,
    _m_PlayerControlsFadeOutInAnimation$1: null,
    _m_ProgressTimer$1: null,
    _m_MarkerLeftTimer$1: null,
    _m_AudioVisualAnimationFadeIn$1: null,
    _m_AudioVisualAnimationFadeOut$1: null,
    _m_FullScreenHook$1: null,
    _m_TotalTimeText$1: null,
    _m_CurrentTimeText$1: null,
    _m_PlayPauseButton$1: null,
    _m_ProgressControl$1: null,
    _m_DownloadControl$1: null,
    _m_VolumeControl$1: null,
    _m_MarkersZoomButton$1: null,
    _m_MarkerContainer$1: null,
    _m_FullScreenButton$1: null,
    _m_StopButton$1: null,
    _m_NextButton$1: null,
    _m_PreviousButton$1: null,
    _m_MuteButton$1: null,
    _m_VolumeDownButton$1: null,
    _m_VolumeUpButton$1: null,
    _m_ExcerptTooltip$1: null,
    _m_ConceptsControl$1: null,
    _m_UtteranceContainer$1: null,
    _m_ScrollArea$1: null,
    _m_PlayerControls_MouseEnter$1: null,
    _m_PlayerControls_MouseLeave$1: null,
    _m_MediaPlayer_MediaOpened$1: null,
    _m_MediaPlayer_MarkerReached$1: null,
    _m_MediaPlayer_CurrentStateChanged$1: null,
    _m_MediaPlayer_BufferingProgressChanged$1: null,
    _m_MediaPlayer_DownloadProgressChanged$1: null,
    _m_MediaPlayer_MediaFailed$1: null,
    _m_MediaPlayer_MediaEnded$1: null,
    _m_ProgressTimer_Completed$1: null,
    _m_MarkerLeftTimer_Completed$1: null,
    _m_AudioVisualFadeIn_Completed$1: null,
    _m_AudioVisualFadeOut_Completed$1: null,
    _m_FullScreenButton_Click$1: null,
    _m_MarkersZoom_Click$1: null,
    _m_PlayPauseButton_Click$1: null,
    _m_StopButton_Click$1: null,
    _m_NextButton_Click$1: null,
    _m_PreviousButton_Click$1: null,
    _m_ProgressControl_ProgressChange$1: null,
    _m_MarkerContainer_UtteranceHighlighted$1: null,
    _m_MarkerContainer_UtteranceClick$1: null,
    _m_MuteButton_Click$1: null,
    _m_VolumeDownButton_Click$1: null,
    _m_VolumeUpButton_Click$1: null,
    _m_VolumeControl_ProgressChange$1: null,
    m_Control: null,
    m_MediaUri: null,
    m_MediaLength: 0,
    m_PlayerXaml: null,
    m_HeadStart: 0,
    m_PlayerWidth: 0,
    m_PlayerHeight: 0,
    m_Debug: false,
    m_SelectedConcept: null,
    m_PartialCallbackMethod: null,
    m_AudioFileOnly: false,
    m_SearchControls: null,
    m_SearchTextBox: null,
    m_SearchButton: null,
    m_Host: null,
    m_UnableToPlayError: null,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$initialize() {
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_SearchControls);
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_Host);
        Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(this.m_PlayerXaml);
        if (!SilverlightPlugin.isInstalled()) {
            this.m_SearchControls.style.display = 'none';
        }
        var pluginParams = SilverlightPlugin.createParams(this.m_PlayerXaml, this.m_Host);
        pluginParams.id = this.m_Host.id + 'SilverlightPlugIn';
        pluginParams.style = 'width:' + this.m_PlayerWidth.toString() + 'px;height:' + this.m_PlayerHeight.toString() + 'px;';
        this.m_Control = SilverlightPlugin.createInstance(pluginParams, Function.createDelegate(this, this.onSilverlightLoad));
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$tearDown() {
        if (this.m_Control == null) {
            return;
        }
        this._m_PlayerControls$1.removeEventListener('mouseEnter', this._m_PlayerControls_MouseEnter$1);
        this._m_PlayerControls$1.removeEventListener('mouseLeave', this._m_PlayerControls_MouseLeave$1);
        this._m_MediaPlayer$1.stop();
        this._m_MediaPlayer$1.removeEventListener('mediaOpened', this._m_MediaPlayer_MediaOpened$1);
        this._m_MediaPlayer$1.removeEventListener('markerReached', this._m_MediaPlayer_MarkerReached$1);
        this._m_MediaPlayer$1.removeEventListener('currentStateChanged', this._m_MediaPlayer_CurrentStateChanged$1);
        this._m_MediaPlayer$1.removeEventListener('bufferingProgressChanged', this._m_MediaPlayer_BufferingProgressChanged$1);
        this._m_MediaPlayer$1.removeEventListener('downloadProgressChanged', this._m_MediaPlayer_DownloadProgressChanged$1);
        this._m_MediaPlayer$1.removeEventListener('mediaFailed', this._m_MediaPlayer_MediaFailed$1);
        this._m_MediaPlayer$1.removeEventListener('mediaEnded', this._m_MediaPlayer_MediaEnded$1);
        this._m_ProgressTimer$1.removeEventListener('completed', this._m_ProgressTimer_Completed$1);
        this._m_MarkerLeftTimer$1.removeEventListener('completed', this._m_MarkerLeftTimer_Completed$1);
        this._m_FullScreenButton$1.click.remove(this._m_FullScreenButton_Click$1);
        this._m_MarkersZoomButton$1.click.remove(this._m_MarkersZoom_Click$1);
        this._m_PlayPauseButton$1.click.remove(this._m_PlayPauseButton_Click$1);
        this._m_StopButton$1.click.remove(this._m_StopButton_Click$1);
        this._m_NextButton$1.click.remove(this._m_NextButton_Click$1);
        this._m_PreviousButton$1.click.remove(this._m_PreviousButton_Click$1);
        this._m_ProgressControl$1.progressChange.remove(this._m_ProgressControl_ProgressChange$1);
        this._m_MarkerContainer$1.utteranceHighlighted.remove(this._m_MarkerContainer_UtteranceHighlighted$1);
        this._m_MarkerContainer$1.utteranceClick.remove(this._m_MarkerContainer_UtteranceClick$1);
        this._m_MuteButton$1.click.remove(this._m_MuteButton_Click$1);
        this._m_VolumeDownButton$1.click.remove(this._m_VolumeDownButton_Click$1);
        this._m_VolumeUpButton$1.click.remove(this._m_VolumeUpButton_Click$1);
        this._m_VolumeControl$1.progressChange.remove(this._m_VolumeControl_ProgressChange$1);
        this.m_MediaUri = null;
        this.m_PlayerXaml = null;
        this.m_SearchControls = null;
        this.m_Host = null;
        this._m_UtterancesCanvas$1 = null;
        this._m_ProgressTimer$1.stop();
        this._m_MarkerLeftTimer$1.stop();
        this._m_MediaPlayer$1.source = null;
        this._m_MediaPlayer$1 = null;
        Array.clear(this._m_Utterances$1);
        this._m_Utterances$1 = null;
        this._m_LastSelectedUtterance$1 = null;
        this._m_LastHighlightUtterance$1 = null;
        this.m_Control.content.onFullScreenChange = null;
        this.m_Control.content.onResize = null;
        this.m_Control = null;
        this._m_DebugControl$1.tearDown();
        this._m_DebugControl$1 = null;
        this._m_PlayerControls$1 = null;
        this._m_PlayerControlsFadeInAnimation$1 = null;
        this._m_PlayerControlsFadeOutInAnimation$1 = null;
        this._m_ProgressTimer$1 = null;
        this._m_MarkerLeftTimer$1 = null;
        this._m_ExcerptTooltip$1.tearDown();
        this._m_ExcerptTooltip$1 = null;
        this._m_FullScreenHook$1.tearDown();
        this._m_FullScreenHook$1 = null;
        this._m_TotalTimeText$1.tearDown();
        this._m_TotalTimeText$1 = null;
        this._m_CurrentTimeText$1.tearDown();
        this._m_CurrentTimeText$1 = null;
        this._m_PlayPauseButton$1.tearDown();
        this._m_PlayPauseButton$1 = null;
        this._m_ProgressControl$1.tearDown();
        this._m_ProgressControl$1 = null;
        this._m_DownloadControl$1.tearDown();
        this._m_DownloadControl$1 = null;
        this._m_VolumeControl$1.tearDown();
        this._m_VolumeControl$1 = null;
        this._m_MarkersZoomButton$1.tearDown();
        this._m_MarkersZoomButton$1 = null;
        this._m_MarkerContainer$1.tearDown();
        this._m_MarkerContainer$1 = null;
        this._m_FullScreenButton$1.tearDown();
        this._m_FullScreenButton$1 = null;
        this._m_StopButton$1.tearDown();
        this._m_StopButton$1 = null;
        this._m_NextButton$1.tearDown();
        this._m_NextButton$1 = null;
        this._m_PreviousButton$1.tearDown();
        this._m_PreviousButton$1 = null;
        this._m_MuteButton$1.tearDown();
        this._m_MuteButton$1 = null;
        this._m_VolumeDownButton$1.tearDown();
        this._m_VolumeDownButton$1 = null;
        this._m_VolumeUpButton$1.tearDown();
        this._m_VolumeUpButton$1 = null;
        this._m_ConceptsControl$1.tearDown();
        this._m_ConceptsControl$1 = null;
        this._m_UtteranceContainer$1.tearDown();
        this._m_UtteranceContainer$1 = null;
        this._m_ScrollArea$1.tearDown();
        this._m_ScrollArea$1 = null;
        if (this.m_AudioFileOnly) {
            this._m_AudioVisualAnimationFadeIn$1.removeEventListener('completed', this._m_AudioVisualFadeIn_Completed$1);
            this._m_AudioVisualAnimationFadeOut$1.removeEventListener('completed', this._m_AudioVisualFadeOut_Completed$1);
        }
        this._m_AudioVisualAnimationFadeIn$1 = null;
        this._m_AudioVisualAnimationFadeOut$1 = null;
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightPlayerControl.callBaseMethod(this, 'tearDown');
    },
    
    addConcept: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$addConcept(p_Concept) {
        /// <summary>
        /// Adds a new concept to the collection.
        /// </summary>
        /// <param name="p_Concept" type="String">
        /// The concept text.
        /// </param>
        Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(p_Concept);
        Array.add(this._m_Concepts$1, p_Concept);
    },
    
    addUtterance: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$addUtterance(p_Start, p_Percent, p_Excerpt) {
        /// <summary>
        /// Adds a new utterance to the collection.
        /// </summary>
        /// <param name="p_Start" type="Number">
        /// The start position in seconds.
        /// </param>
        /// <param name="p_Percent" type="Number">
        /// The start position represented as a percentage.
        /// </param>
        /// <param name="p_Excerpt" type="String">
        /// The excerpt of the utterance.
        /// </param>
        Coveo.CNL.Web.Scripts.CNLAssert.check(p_Start >= 0);
        Coveo.CNL.Web.Scripts.CNLAssert.check(p_Percent >= 0 && p_Percent <= 1);
        Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(p_Excerpt);
        Array.add(this._m_Utterances$1, new Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtterance(p_Start, p_Percent, p_Excerpt));
    },
    
    onSilverlightLoad: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$onSilverlightLoad(p_Control, p_UserContext) {
        /// <param name="p_Control" type="Object" domElement="true">
        /// </param>
        /// <param name="p_UserContext" type="Object">
        /// </param>
        if (this._m_Loaded$1) {
            return;
        }
        this.m_Control = p_Control;
        this.m_Control.content.onFullScreenChange = Function.createDelegate(this, this.control_FullScreenChange);
        this.m_Control.content.onResize = Function.createDelegate(this, this.control_Resize);
        this._m_DebugControl$1 = new Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightDebug(this.m_Control.content.findName('Debug'));
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this._m_DebugControl$1);
        if (this.m_Debug) {
            this._m_DebugControl$1.turnOn();
        }
        else {
            this._m_DebugControl$1.turnOff();
        }
        this._m_UtterancesCanvas$1 = this.m_Control.content.findName('Utterances');
        this._m_UtteranceContainer$1 = new Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextContainer(this.m_Control.content.findName('UtteranceContainer'));
        this._m_UtteranceContainer$1.textEntryClick.add(Function.createDelegate(this, this._utteranceContainer_UtteranceClick$1));
        this._m_ConceptsControl$1 = new Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextContainer(this.m_Control.content.findName('Concepts'));
        this._m_ConceptsControl$1.textEntryClick.add(Function.createDelegate(this, this._conceptsControl_TextEntryClick$1));
        this._m_ScrollArea$1 = new Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightScrollArea(this.m_Control.content.findName('UtterancesScrollArea'));
        this._m_ScrollArea$1.set_scrollBarControlName('UtterancesScrollBar');
        this._m_ScrollArea$1.set_scrollUpButtonName('UtterancesUpButton');
        this._m_ScrollArea$1.set_scrollDownButtonName('UtterancesDownButton');
        this._m_ScrollArea$1.set_scrollHookThumbControlName('UtterancesThumb');
        this._m_ScrollArea$1.set_scrollHookControlName('UtterancesScrollHook');
        this._m_ScrollArea$1.set_scrollTarget(this._m_UtteranceContainer$1);
        this._m_PlayerControls$1 = this.m_Control.content.findName('PlayerControls');
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this._m_PlayerControls$1);
        this._m_PlayerControls_MouseEnter$1 = this._m_PlayerControls$1.addEventListener('mouseEnter', Function.createDelegate(this, this._playerControls_MouseEnter$1));
        this._m_PlayerControls_MouseLeave$1 = this._m_PlayerControls$1.addEventListener('mouseLeave', Function.createDelegate(this, this._playerControls_MouseLeave$1));
        this._m_PlayerControlsFadeInAnimation$1 = this.m_Control.content.findName('PlayerControlsFadeIn');
        this._m_PlayerControlsFadeOutInAnimation$1 = this.m_Control.content.findName('PlayerControlsFadeOut');
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this._m_PlayerControlsFadeInAnimation$1);
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this._m_PlayerControlsFadeOutInAnimation$1);
        this._m_FullScreenButton$1 = new Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightButton(this.m_Control.content.findName('FullScreenButton'));
        this._m_FullScreenButton_Click$1 = Function.createDelegate(this, this._fullScreenButton_Click$1);
        this._m_FullScreenButton$1.click.add(this._m_FullScreenButton_Click$1);
        this._m_MarkersZoomButton$1 = new Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightSymbolButton(this.m_Control.content.findName('MarkerZoomButton'));
        this._m_MarkersZoomButton$1.set_state(Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightButtonState.grayed);
        this._m_MarkersZoom_Click$1 = Function.createDelegate(this, this._markersZoom_Click$1);
        this._m_MarkersZoomButton$1.click.add(this._m_MarkersZoom_Click$1);
        this._m_FullScreenHook$1 = new Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightCustomControl(this.m_Control.content.findName('PlayerCanvas'));
        this._m_FullScreenHook$1.doubleClick.add(Function.createDelegate(this, this._fullScreenHook_DoubleClick$1));
        this._m_MediaPlayer$1 = this.m_Control.content.findName('MediaPlayer');
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this._m_MediaPlayer$1);
        this._m_MediaPlayer_MediaOpened$1 = this._m_MediaPlayer$1.addEventListener('mediaOpened', Function.createDelegate(this, this._mediaPlayer_MediaOpened$1));
        this._m_MediaPlayer_MarkerReached$1 = this._m_MediaPlayer$1.addEventListener('markerReached', Function.createDelegate(this, this._mediaPlayer_MarkerReached$1));
        this._m_MediaPlayer_CurrentStateChanged$1 = this._m_MediaPlayer$1.addEventListener('currentStateChanged', Function.createDelegate(this, this._mediaPlayer_CurrentStateChanged$1));
        this._m_MediaPlayer_BufferingProgressChanged$1 = this._m_MediaPlayer$1.addEventListener('bufferingProgressChanged', Function.createDelegate(this, this._mediaPlayer_BufferingProgressChanged$1));
        this._m_MediaPlayer_DownloadProgressChanged$1 = this._m_MediaPlayer$1.addEventListener('downloadProgressChanged', Function.createDelegate(this, this._mediaPlayer_DownloadProgressChanged$1));
        this._m_MediaPlayer_MediaFailed$1 = this._m_MediaPlayer$1.addEventListener('mediaFailed', Function.createDelegate(this, this._mediaPlayer_MediaFailed$1));
        this._m_MediaPlayer_MediaEnded$1 = this._m_MediaPlayer$1.addEventListener('mediaEnded', Function.createDelegate(this, this._mediaPlayer_MediaEnded$1));
        this._m_ProgressTimer$1 = this.m_Control.content.findName('ProgressTimer');
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this._m_ProgressTimer$1);
        this._m_ProgressTimer_Completed$1 = this._m_ProgressTimer$1.addEventListener('completed', Function.createDelegate(this, this._progressTimer_Completed$1));
        this._m_MarkerLeftTimer$1 = this.m_Control.content.findName('MarkerLeftTimer');
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this._m_MarkerLeftTimer$1);
        this._m_MarkerLeftTimer_Completed$1 = this._m_MarkerLeftTimer$1.addEventListener('completed', Function.createDelegate(this, this._markerLeftTimer_Completed$1));
        this._m_TotalTimeText$1 = new Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextTime(this.m_Control.content.findName('TotalTimeText'));
        this._m_CurrentTimeText$1 = new Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextTime(this.m_Control.content.findName('CurrentTimeText'));
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this._m_TotalTimeText$1);
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this._m_CurrentTimeText$1);
        this._m_PlayPauseButton$1 = new Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightPlayPauseButton(this.m_Control.content.findName('PlayPauseButton'));
        this._m_PlayPauseButton_Click$1 = Function.createDelegate(this, this._playPauseButton_Click$1);
        this._m_PlayPauseButton$1.click.add(this._m_PlayPauseButton_Click$1);
        this._m_StopButton$1 = new Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightAnimatedButton(this.m_Control.content.findName('StopButton'));
        this._m_StopButton_Click$1 = Function.createDelegate(this, this._stopButton_Click$1);
        this._m_StopButton$1.click.add(this._m_StopButton_Click$1);
        this._m_NextButton$1 = new Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightAnimatedButton(this.m_Control.content.findName('NextButton'));
        this._m_NextButton_Click$1 = Function.createDelegate(this, this._nextButton_Click$1);
        this._m_NextButton$1.click.add(this._m_NextButton_Click$1);
        this._m_PreviousButton$1 = new Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightAnimatedButton(this.m_Control.content.findName('PreviousButton'));
        this._m_PreviousButton_Click$1 = Function.createDelegate(this, this._previousButton_Click$1);
        this._m_PreviousButton$1.click.add(this._m_PreviousButton_Click$1);
        this._m_ProgressControl$1 = new Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgress(this.m_Control.content.findName('Timeline'));
        this._m_ProgressControl$1.set_highlightControlName('TimeSlider_Highlight');
        this._m_ProgressControl$1.set_thumbControlName('TimeThumb');
        this._m_ProgressControl$1.set_progress(0);
        this._m_ProgressControl_ProgressChange$1 = Function.createDelegate(this, this._progressControl_ProgressChange$1);
        this._m_ProgressControl$1.progressChange.add(this._m_ProgressControl_ProgressChange$1);
        this._m_DownloadControl$1 = new Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgress(this.m_Control.content.findName('DownloadProgressSlider'));
        this._m_DownloadControl$1.set_highlightControlName('DownloadProgressSlider_Highlight');
        this._m_DownloadControl$1.set_progress(0);
        this._m_MarkerContainer$1 = new Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTimeLineMarkerContainer(this.m_Control.content.findName('Timeline_MarkerContainer'));
        this._m_MarkerContainer$1.set_zoomOnMarkerConflict(false);
        this._m_MarkerContainer_UtteranceHighlighted$1 = Function.createDelegate(this, this._markerContainer_UtteranceHighlighted$1);
        this._m_MarkerContainer$1.utteranceHighlighted.add(this._m_MarkerContainer_UtteranceHighlighted$1);
        this._m_MarkerContainer_UtteranceClick$1 = Function.createDelegate(this, this._markerContainer_UtteranceClick$1);
        this._m_MarkerContainer$1.utteranceClick.add(this._m_MarkerContainer_UtteranceClick$1);
        this._m_MarkerContainer$1.set_debugControl(this._m_DebugControl$1);
        this._m_ExcerptTooltip$1 = new Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightExcerptTooltip(this.m_Control.content.findName('Excerpt'));
        this._m_MuteButton$1 = new Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightButton(this.m_Control.content.findName('MuteButton'));
        this._m_MuteButton_Click$1 = Function.createDelegate(this, this._muteButton_Click$1);
        this._m_MuteButton$1.click.add(this._m_MuteButton_Click$1);
        this._m_VolumeDownButton$1 = new Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightAnimatedButton(this.m_Control.content.findName('VolumeDownButton'));
        this._m_VolumeDownButton_Click$1 = Function.createDelegate(this, this._volumeDownButton_Click$1);
        this._m_VolumeDownButton$1.click.add(this._m_VolumeDownButton_Click$1);
        this._m_VolumeUpButton$1 = new Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightAnimatedButton(this.m_Control.content.findName('VolumeUpButton'));
        this._m_VolumeUpButton_Click$1 = Function.createDelegate(this, this._volumeUpButton_Click$1);
        this._m_VolumeUpButton$1.click.add(this._m_VolumeUpButton_Click$1);
        this._m_VolumeControl$1 = new Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgress(this.m_Control.content.findName('VolumeSliderHook'));
        this._m_VolumeControl$1.set_thumbControlName('VolumeThumb');
        this._m_VolumeControl_ProgressChange$1 = Function.createDelegate(this, this._volumeControl_ProgressChange$1);
        this._m_VolumeControl$1.progressChange.add(this._m_VolumeControl_ProgressChange$1);
        this._m_ConceptsControl$1.beginUpdate();
        try {
            for (var i = 0; i < this._m_Concepts$1.length; i++) {
                var concept = this._m_Concepts$1[i];
                var entry = this._m_ConceptsControl$1.addSeparatorTextEntry(concept, null, concept === this.m_SelectedConcept);
                if (concept === this.m_SelectedConcept) {
                    this._m_LastSelectedConcept$1 = entry;
                }
            }
        }
        finally {
            this._m_ConceptsControl$1.endUpdate();
        }
        if (this.m_AudioFileOnly) {
            this._m_AudioVisualAnimationFadeIn$1 = this.m_Control.content.findName('AudioVisualAnimationFadeIn');
            this._m_AudioVisualAnimationFadeOut$1 = this.m_Control.content.findName('AudioVisualAnimationFadeOut');
            Coveo.CNL.Web.Scripts.CNLAssert.notNull(this._m_AudioVisualAnimationFadeIn$1);
            Coveo.CNL.Web.Scripts.CNLAssert.notNull(this._m_AudioVisualAnimationFadeOut$1);
            this._m_AudioVisualFadeIn_Completed$1 = this._m_AudioVisualAnimationFadeIn$1.addEventListener('completed', Function.createDelegate(this, this._audioVisualFadeIn_Completed$1));
            this._m_AudioVisualFadeOut_Completed$1 = this._m_AudioVisualAnimationFadeOut$1.addEventListener('completed', Function.createDelegate(this, this._audioVisualFadeOut_Completed$1));
            (this.m_Control.content.findName('AudioVisual')).visibility = 'visible';
            this._m_PlayerControls$1.opacity = 1;
        }
        this._m_MediaPlayer$1.source = this.m_MediaUri;
        this._m_Loaded$1 = true;
        this._resize$1();
    },
    
    control_FullScreenChange: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$control_FullScreenChange(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="EventArgs">
        /// </param>
        this._resize$1();
    },
    
    control_Resize: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$control_Resize(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="EventArgs">
        /// </param>
        this._resize$1();
    },
    
    changeConcept: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$changeConcept(p_Concept, p_Callback) {
        /// <summary>
        /// Placeholder for the server call that fetches the concepts/utterances.
        /// </summary>
        /// <param name="p_Concept" type="String">
        /// </param>
        /// <param name="p_Callback" type="Coveo.CNL.Web.Scripts.Ajax.PostBackCallback">
        /// </param>
        Coveo.CNL.Web.Scripts.CNLAssert.fail();
    },
    
    _feedMarkersUtterances$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_feedMarkersUtterances$1() {
        /// <summary>
        /// Fills the markers on the timeline and the utterance text section with
        /// the content of the m_Utterances array.
        /// </summary>
        this._m_LastHighlightUtterance$1 = null;
        this._m_LastSelectedUtterance$1 = null;
        this._m_UtteranceContainer$1.clear();
        this._m_MarkerContainer$1.clear();
        this._m_MediaPlayer$1.markers.clear();
        this._m_UtteranceContainer$1.beginUpdate();
        try {
            for (var i = 0; i <= this._m_Utterances$1.length - 1; i++) {
                var utterance = this._m_Utterances$1[i];
                var datetime = new Date(0, 0, 0, 0, 0, utterance.get_start());
                var xaml = '<TimelineMarker Time=\'' + datetime.getHours().toString() + ':' + datetime.getMinutes().toString() + ':' + datetime.getSeconds().toString() + '\' Type=\'CESMarker\' Text=\'' + i + '\' />';
                var newMarker = this.m_Control.content.createFromXaml(xaml);
                this._m_MediaPlayer$1.markers.add(newMarker);
                this._m_MarkerContainer$1.addNewTimeLineMarker(utterance);
                utterance.set_data(this._m_UtteranceContainer$1.addUtteranceTextEntry(utterance.get_excerpt(), utterance, false));
            }
        }
        finally {
            this._m_UtteranceContainer$1.endUpdate();
        }
        this._m_ScrollArea$1.set_scrollTop(0);
    },
    
    _resize$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_resize$1() {
        /// <summary>
        /// Adjusts the controls correctly after a resize or a fullscreen operation.
        /// </summary>
        var m_FullScreenScale = this.m_Control.content.findName('FullScreenScale');
        var m_ControlsFullScreenScale = this.m_Control.content.findName('ControlsFullScreenScale');
        var controlScale = 1;
        this._m_UtterancesCanvas$1.width = Math.min(360, this.m_Control.content.actualWidth / 2);
        this._m_UtterancesCanvas$1.setValue('Canvas.Left', this.m_Control.content.actualWidth - this._m_UtterancesCanvas$1.width);
        this._m_UtterancesCanvas$1.height = this.m_Control.content.actualHeight;
        var uttRect = this.m_Control.content.findName('UtterancesRect');
        uttRect.height = this.m_Control.content.actualHeight;
        uttRect.width = this._m_UtterancesCanvas$1.width;
        var conceptArea = this.m_Control.content.findName('ConceptsArea');
        conceptArea.width = this._m_UtterancesCanvas$1.width;
        var conceptRect = this.m_Control.content.findName('ConceptsAreaRect');
        conceptRect.width = conceptArea.width - (conceptRect.getValue('Canvas.Left') * 2);
        var xaml = '<RectangleGeometry Rect=\"' + conceptRect.getValue('Canvas.Left') + ', ' + conceptRect.getValue('Canvas.Top') + ', ' + conceptRect.width + ', ' + conceptRect.height + '\" RadiusX=\"' + conceptRect.radiusX + '\" RadiusY=\"' + conceptRect.radiusY + '\" />';
        var clip = this.m_Control.content.createFromXaml(xaml);
        conceptArea.clip = clip;
        this._m_ConceptsControl$1.set_width(this._m_UtterancesCanvas$1.width - (this._m_ConceptsControl$1.get_left() * 2));
        var rectTop = conceptRect.getValue('Canvas.Top');
        if (this._m_ConceptsControl$1.get_height() < conceptRect.height + 4) {
            this._m_ConceptsControl$1.set_top(rectTop + (((conceptRect.height + 4) - this._m_ConceptsControl$1.get_height()) / 2));
        }
        else {
            this._m_ConceptsControl$1.set_top(rectTop + 2);
        }
        this._m_ScrollArea$1.set_height(this.m_Control.content.actualHeight - conceptArea.height - 10);
        this._m_ScrollArea$1.set_width(this._m_UtterancesCanvas$1.width);
        this._m_UtteranceContainer$1.set_width((this.m_Control.content.findName('UtterancesScrollBar')).getValue('Canvas.Left') - (this._m_UtteranceContainer$1.get_left() * 2));
        if (this._m_LastSelectedUtterance$1 != null) {
            this._m_ScrollArea$1.set_scrollTop(this._m_LastSelectedUtterance$1.get_top());
        }
        else {
            this._m_ScrollArea$1.set_scrollTop(0);
        }
        if (this.m_PlayerHeight !== 480 || this.m_PlayerWidth !== 1005 || this.m_Control.content.fullScreen) {
            (m_FullScreenScale).scaleX = (this.m_Control.content.actualWidth - this._m_UtterancesCanvas$1.width) / 640;
            (m_FullScreenScale).scaleY = this.m_Control.content.actualHeight / 480;
            if (this._m_PlayerControls$1.width <= (this._m_MediaPlayer$1.width * (m_FullScreenScale).scaleX)) {
                (m_ControlsFullScreenScale).scaleX = 1;
                (m_ControlsFullScreenScale).scaleY = 1;
            }
            else {
                controlScale = (this._m_MediaPlayer$1.width * (m_FullScreenScale).scaleX) / this._m_PlayerControls$1.width;
                (m_ControlsFullScreenScale).scaleX = controlScale;
                (m_ControlsFullScreenScale).scaleY = controlScale;
            }
        }
        else {
            (m_FullScreenScale).scaleX = 1;
            (m_FullScreenScale).scaleY = 1;
            (m_ControlsFullScreenScale).scaleX = 1;
            (m_ControlsFullScreenScale).scaleY = 1;
        }
        this._m_PlayerControls$1.setValue('Canvas.Left', ((this._m_MediaPlayer$1.width * (m_FullScreenScale).scaleX) - (this._m_PlayerControls$1.width * controlScale)) / 2);
        this._m_PlayerControls$1.setValue('Canvas.Top', this._m_MediaPlayer$1.getValue('Canvas.Top') + (this._m_MediaPlayer$1.height * (m_FullScreenScale).scaleY) - (this._m_PlayerControls$1.height * controlScale));
        this._m_ExcerptTooltip$1.set_left(this._m_MediaPlayer$1.getValue('Canvas.Left') + 5);
        this._m_ExcerptTooltip$1.set_width((this._m_MediaPlayer$1.width * (m_FullScreenScale).scaleX) - 10);
        this._m_ExcerptTooltip$1.set_top(this._m_PlayerControls$1.getValue('Canvas.Top') - 60);
    },
    
    _getMediaNaturalDuration$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_getMediaNaturalDuration$1() {
        /// <summary>
        /// Returns the value of the NaturalDuration property of the media player.
        /// This is done in a function to bypass the Script# TimeSpan class limitation.
        /// </summary>
        /// <returns type="Number"></returns>
        var result = 0;
        var naturalDuration = this._m_MediaPlayer$1.getValue('NaturalDuration');
        if (naturalDuration != null) {
            var durationHack = (naturalDuration).getValue('seconds');
            result = durationHack;
        }
        return result;
    },
    
    _getMediaPosition$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_getMediaPosition$1() {
        /// <summary>
        /// Returns the value of the Position property of the media player. This is
        /// done in a function to bypass the Script# TimeSpan class limitation.
        /// </summary>
        /// <returns type="Number"></returns>
        var position = this._m_MediaPlayer$1.getValue('Position');
        var positionHack = (position).getValue('seconds');
        return positionHack;
    },
    
    _changeMediaPlayerPosition$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_changeMediaPlayerPosition$1(p_newTime) {
        /// <summary>
        /// Use this function to set the value of the media player Position property.
        /// </summary>
        /// <param name="p_newTime" type="Number">
        /// New position in seconds.
        /// </param>
        if (p_newTime <= this._getMediaNaturalDuration$1()) {
            var newTimeHack = this._m_MediaPlayer$1.getValue('Position');
            (newTimeHack).setValue('seconds', p_newTime);
            this._m_MediaPlayer$1.setValue('Position', newTimeHack);
        }
    },
    
    _getCurrentUtteranceIndex$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_getCurrentUtteranceIndex$1(p_IncludeHeadStartTolerance) {
        /// <summary>
        /// Returns the <see cref="T:Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtterance" /> index according to the
        /// current position of the media player.
        /// </summary>
        /// <param name="p_IncludeHeadStartTolerance" type="Boolean">
        /// Set this value to True to include the head start value as part of the Utterance.
        /// </param>
        /// <returns type="Number" integer="true"></returns>
        var seconds = this._getMediaPosition$1();
        if (p_IncludeHeadStartTolerance) {
            seconds = Math.min(seconds + this.m_HeadStart, this.m_MediaLength);
        }
        var result = -1;
        for (var i = 0; i <= this._m_Utterances$1.length - 1; i++) {
            var utterance = this._m_Utterances$1[i];
            if (utterance.get_start() < seconds) {
                result = i;
            }
            else {
                break;
            }
        }
        return result;
    },
    
    _getCurrentUtterance$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_getCurrentUtterance$1() {
        /// <summary>
        /// Returns the <see cref="T:Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtterance" /> object according to the
        /// current position of the media player.
        /// </summary>
        /// <returns type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtterance"></returns>
        var result = null;
        var index = this._getCurrentUtteranceIndex$1(false);
        if (index > -1) {
            result = this._m_Utterances$1[index];
        }
        return result;
    },
    
    _handleMarkerReached$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_handleMarkerReached$1(p_Utterance) {
        /// <summary>
        /// Synchronize the utterances Div section with the media player position.
        /// </summary>
        /// <param name="p_Utterance" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtterance">
        /// The utterance to sync with. This value can be null.
        /// </param>
        if (this._m_LastSelectedUtterance$1 != null) {
            this._m_LastSelectedUtterance$1.set_selected(false);
            this._m_LastSelectedUtterance$1 = null;
        }
        if (p_Utterance != null) {
            var text = p_Utterance.get_data();
            text.set_selected(true);
            this._m_ScrollArea$1.scrollTo(text.get_top(), text.get_height());
            this._m_LastSelectedUtterance$1 = text;
        }
        else {
            this._m_ScrollArea$1.set_scrollTop(0);
        }
    },
    
    _handleUtteranceClick$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_handleUtteranceClick$1(p_Utterance) {
        /// <summary>
        /// This method is called whenever (and wherever) a utterance was clicked.
        /// </summary>
        /// <param name="p_Utterance" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtterance">
        /// The current utterance. This value can be null.
        /// </param>
        this._m_UtterancesDirty$1 = true;
        if (p_Utterance != null) {
            this._m_ProgressControl$1.set_progress(Math.max(0, p_Utterance.get_percent() - this._m_HeadStartAsPercent$1));
        }
        this._handleMarkerReached$1(p_Utterance);
    },
    
    _mediaPlayer_CurrentStateChanged$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_mediaPlayer_CurrentStateChanged$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="EventArgs">
        /// </param>
        if (this._m_MediaPlayer$1.currentState === 'playing') {
            this._m_ProgressTimer$1.begin();
            this._m_PlayPauseButton$1.set_mode(Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightPlayPauseButtonMode.pause);
            if (this.m_AudioFileOnly) {
                this._m_AudioVisualAnimationFadeIn$1.begin();
            }
        }
        else {
            this._m_ProgressTimer$1.stop();
            if (this.m_AudioFileOnly) {
                this._m_AudioVisualAnimationFadeIn$1.stop();
                this._m_AudioVisualAnimationFadeOut$1.stop();
            }
            this._m_PlayPauseButton$1.set_mode(Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightPlayPauseButtonMode.play);
            if (this._m_MediaPlayer$1.currentState === 'stopped') {
                this._m_ProgressControl$1.updateProgress(0);
                this._m_CurrentTimeText$1.set_seconds(0);
                this._handleMarkerReached$1(null);
            }
        }
    },
    
    _mediaPlayer_BufferingProgressChanged$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_mediaPlayer_BufferingProgressChanged$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="EventArgs">
        /// </param>
        if (!this._m_UtterancesDirty$1 && (this._m_Utterances$1.length > 0)) {
        }
    },
    
    _mediaPlayer_DownloadProgressChanged$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_mediaPlayer_DownloadProgressChanged$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="EventArgs">
        /// </param>
        this._m_DownloadControl$1.set_progress(this._m_MediaPlayer$1.downloadProgress);
        if (!this._m_UtterancesDirty$1 && (this._m_Utterances$1.length > 0) && (((this._m_Utterances$1[0]).get_percent() * 1.05) < this._m_MediaPlayer$1.downloadProgress)) {
        }
    },
    
    _mediaPlayer_MediaFailed$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_mediaPlayer_MediaFailed$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="EventArgs">
        /// </param>
        alert(this.m_UnableToPlayError);
    },
    
    _mediaPlayer_MediaOpened$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_mediaPlayer_MediaOpened$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="EventArgs">
        /// </param>
        var totalSeconds = this.m_MediaLength;
        this._m_TotalTimeText$1.set_seconds(totalSeconds);
        this._m_HeadStartAsPercent$1 = 0;
        if (totalSeconds > 0) {
            this._m_HeadStartAsPercent$1 = this.m_HeadStart / totalSeconds;
        }
        this._m_VolumeControl$1.set_progress(this._m_MediaPlayer$1.volume);
        this._feedMarkersUtterances$1();
        if (this.m_AudioFileOnly && (this._m_MediaPlayer$1.naturalVideoHeight > 0 || this._m_MediaPlayer$1.naturalVideoWidth > 0)) {
            (this.m_Control.content.findName('AudioVisual')).visibility = 'collapsed';
            Coveo.CNL.Web.Scripts.CNLAssert.failWithMessage('Video file was converted as an audio file.');
        }
        this._m_MediaPlayer$1.play();
    },
    
    _mediaPlayer_MediaEnded$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_mediaPlayer_MediaEnded$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="EventArgs">
        /// </param>
        this._m_MediaPlayer$1.stop();
    },
    
    _mediaPlayer_MarkerReached$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_mediaPlayer_MarkerReached$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="TimelineMarkerEventArgs">
        /// </param>
        var marker = p_Args.marker.text;
        this._handleMarkerReached$1(this._m_Utterances$1[marker]);
    },
    
    _audioVisualFadeIn_Completed$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_audioVisualFadeIn_Completed$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="EventArgs">
        /// </param>
        Coveo.CNL.Web.Scripts.CNLAssert.check(this.m_AudioFileOnly);
        if (this._m_MediaPlayer$1.currentState === 'playing') {
            this._m_AudioVisualAnimationFadeOut$1.begin();
        }
    },
    
    _audioVisualFadeOut_Completed$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_audioVisualFadeOut_Completed$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="EventArgs">
        /// </param>
        Coveo.CNL.Web.Scripts.CNLAssert.check(this.m_AudioFileOnly);
        if (this._m_MediaPlayer$1.currentState === 'playing') {
            this._m_AudioVisualAnimationFadeIn$1.begin();
        }
    },
    
    _progressTimer_Completed$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_progressTimer_Completed$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="EventArgs">
        /// </param>
        if (this._m_MediaPlayer$1.currentState === 'playing') {
            var seconds = this._getMediaPosition$1();
            this._m_ProgressControl$1.updateProgress(seconds / this.m_MediaLength);
            this._m_CurrentTimeText$1.set_seconds(seconds);
            this._m_ProgressTimer$1.begin();
        }
    },
    
    _fullScreenHook_DoubleClick$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_fullScreenHook_DoubleClick$1(sender, e) {
        /// <param name="sender" type="Object">
        /// </param>
        /// <param name="e" type="EventArgs">
        /// </param>
        this.m_Control.content.fullScreen = !this.m_Control.content.fullScreen;
    },
    
    _fullScreenButton_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_fullScreenButton_Click$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="EventArgs">
        /// </param>
        this.m_Control.content.fullScreen = !this.m_Control.content.fullScreen;
    },
    
    _markersZoom_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_markersZoom_Click$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="EventArgs">
        /// </param>
        this._m_MarkerContainer$1.set_zoomOnMarkerConflict(!this._m_MarkerContainer$1.get_zoomOnMarkerConflict());
        if (this._m_MarkerContainer$1.get_zoomOnMarkerConflict()) {
            this._m_MarkersZoomButton$1.set_state(Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightButtonState.enabled);
        }
        else {
            this._m_MarkersZoomButton$1.set_state(Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightButtonState.grayed);
        }
    },
    
    _volumeControl_ProgressChange$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_volumeControl_ProgressChange$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="EventArgs">
        /// </param>
        this._m_MediaPlayer$1.volume = (p_Sender).get_progress();
    },
    
    _volumeUpButton_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_volumeUpButton_Click$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="EventArgs">
        /// </param>
        var newVolume = this._m_MediaPlayer$1.volume + 0.05;
        this._m_VolumeControl$1.set_progress(Math.min(newVolume, 1));
    },
    
    _volumeDownButton_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_volumeDownButton_Click$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="EventArgs">
        /// </param>
        var newVolume = this._m_MediaPlayer$1.volume - 0.05;
        this._m_VolumeControl$1.set_progress(Math.max(newVolume, 0));
    },
    
    _muteButton_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_muteButton_Click$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="EventArgs">
        /// </param>
        if (this._m_MediaPlayer$1.isMuted) {
            this._m_MediaPlayer$1.isMuted = false;
            (this.m_Control.content.findName('MuteOffSymbol')).opacity = 1;
        }
        else {
            this._m_MediaPlayer$1.isMuted = true;
            (this.m_Control.content.findName('MuteOffSymbol')).opacity = 0;
        }
    },
    
    _progressControl_ProgressChange$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_progressControl_ProgressChange$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="EventArgs">
        /// </param>
        var newTime = (p_Sender).get_progress() * this.m_MediaLength;
        this._changeMediaPlayerPosition$1(newTime);
        this._handleMarkerReached$1(this._getCurrentUtterance$1());
    },
    
    _previousButton_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_previousButton_Click$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="EventArgs">
        /// </param>
        if (this._m_MediaPlayer$1.currentState === 'buffering') {
            return;
        }
        var currentIndex = this._getCurrentUtteranceIndex$1(true);
        if (currentIndex >= 1) {
            this._handleUtteranceClick$1(this._m_Utterances$1[currentIndex - 1]);
        }
    },
    
    _nextButton_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_nextButton_Click$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="EventArgs">
        /// </param>
        if (this._m_MediaPlayer$1.currentState === 'buffering') {
            return;
        }
        var currentIndex = this._getCurrentUtteranceIndex$1(true);
        if (currentIndex < this._m_Utterances$1.length - 1) {
            this._handleUtteranceClick$1(this._m_Utterances$1[currentIndex + 1]);
        }
    },
    
    _stopButton_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_stopButton_Click$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="EventArgs">
        /// </param>
        if ((this._m_MediaPlayer$1.currentState === 'playing') || (this._m_MediaPlayer$1.currentState === 'paused') || (this._m_MediaPlayer$1.currentState === 'buffering')) {
            this._m_MediaPlayer$1.stop();
        }
    },
    
    _playPauseButton_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_playPauseButton_Click$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="EventArgs">
        /// </param>
        if (this._m_MediaPlayer$1.currentState === 'playing') {
            this._m_MediaPlayer$1.pause();
        }
        else {
            this._m_MediaPlayer$1.play();
        }
    },
    
    _playerControls_MouseEnter$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_playerControls_MouseEnter$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="MouseEventArgs">
        /// </param>
        if (!this.m_AudioFileOnly) {
            this._m_PlayerControlsFadeInAnimation$1.begin();
        }
    },
    
    _playerControls_MouseLeave$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_playerControls_MouseLeave$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="MouseEventArgs">
        /// </param>
        if (!this.m_AudioFileOnly) {
            this._m_PlayerControlsFadeOutInAnimation$1.begin();
        }
    },
    
    _conceptsControl_TextEntryClick$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_conceptsControl_TextEntryClick$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="Coveo.CES.Web.Search.Scripts.Controls.Results.TextContainerEventArgs">
        /// </param>
        this.m_SearchTextBox.setAttribute('value', p_Args.textEntry.get_text());
        if (this._m_LastSelectedConcept$1 != null) {
            this._m_LastSelectedConcept$1.set_selected(false);
        }
        p_Args.textEntry.set_selected(true);
        this._m_LastSelectedConcept$1 = p_Args.textEntry;
        this.changeConcept(p_Args.textEntry.get_text(), Function.createDelegate(this, this._conceptChanged$1));
    },
    
    _conceptChanged$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_conceptChanged$1(p_ReturnValue) {
        /// <summary>
        /// Handles the return value of the ChangeConcept method.
        /// </summary>
        /// <param name="p_ReturnValue" type="Object">
        /// </param>
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(p_ReturnValue);
        Array.clear(this._m_Utterances$1);
        var xml = p_ReturnValue;
        var nodes = xml.selectSingleNode('Utterances').childNodes;
        for (var i = 0; i < nodes.length; i++) {
            var node = nodes[i];
            this.addUtterance(parseFloat((node.attributes.getNamedItem('Start')).value), parseFloat((node.attributes.getNamedItem('Percent')).value), (node.attributes.getNamedItem('Excerpt')).value);
        }
        this._feedMarkersUtterances$1();
    },
    
    _utteranceContainer_UtteranceClick$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_utteranceContainer_UtteranceClick$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="Coveo.CES.Web.Search.Scripts.Controls.Results.TextContainerEventArgs">
        /// </param>
        this._handleUtteranceClick$1(p_Args.textEntry.get_data());
    },
    
    _markerLeftTimer_Completed$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_markerLeftTimer_Completed$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="EventArgs">
        /// </param>
        if (this._m_LastSelectedUtterance$1 != null) {
            this._m_ScrollArea$1.scrollTo(this._m_LastSelectedUtterance$1.get_top(), this._m_LastSelectedUtterance$1.get_height());
        }
    },
    
    _markerContainer_UtteranceClick$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_markerContainer_UtteranceClick$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtterance">
        /// </param>
        this._handleUtteranceClick$1(p_Args);
    },
    
    _markerContainer_UtteranceHighlighted$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayerControl$_markerContainer_UtteranceHighlighted$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtterance">
        /// </param>
        this._m_MarkerLeftTimer$1.stop();
        if (p_Args != null) {
            var text = p_Args.get_data();
            this._m_ScrollArea$1.scrollTo(text.get_top(), text.get_height());
            text.highlight();
            this._m_LastHighlightUtterance$1 = text;
            this._m_ExcerptTooltip$1.set_text(p_Args.get_excerpt());
            this._m_ExcerptTooltip$1.set_visible(true);
        }
        else {
            if (this._m_LastSelectedUtterance$1 != null) {
                this._m_MarkerLeftTimer$1.begin();
            }
            if (this._m_LastHighlightUtterance$1 != null) {
                this._m_LastHighlightUtterance$1.undoHighlight();
                this._m_LastHighlightUtterance$1 = null;
            }
            this._m_ExcerptTooltip$1.set_visible(false);
        }
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightPlayPauseButton

Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightPlayPauseButton = function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayPauseButton(p_TargetControl) {
    /// <summary>
    /// Class used to manipulated a media play/pause button.
    /// </summary>
    /// <param name="p_TargetControl" type="UIElement">
    /// </param>
    /// <field name="_m_PlaySymbol$3" type="Path">
    /// </field>
    /// <field name="_m_PauseSymbol$3" type="Path">
    /// </field>
    /// <field name="_m_Mode$3" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightPlayPauseButtonMode">
    /// </field>
    this._m_Mode$3 = Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightPlayPauseButtonMode.play;
    Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightPlayPauseButton.initializeBase(this, [ p_TargetControl ]);
}
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightPlayPauseButton.prototype = {
    _m_PlaySymbol$3: null,
    _m_PauseSymbol$3: null,
    
    get_mode: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayPauseButton$get_mode() {
        /// <summary>
        /// Gets or sets the button mode.
        /// </summary>
        /// <value type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightPlayPauseButtonMode"></value>
        return this._m_Mode$3;
    },
    set_mode: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayPauseButton$set_mode(value) {
        /// <summary>
        /// Gets or sets the button mode.
        /// </summary>
        /// <value type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightPlayPauseButtonMode"></value>
        this._m_Mode$3 = value;
        this.renderControl();
        return value;
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayPauseButton$tearDown() {
        this._m_PlaySymbol$3 = null;
        this._m_PauseSymbol$3 = null;
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightPlayPauseButton.callBaseMethod(this, 'tearDown');
    },
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayPauseButton$initialize() {
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightPlayPauseButton.callBaseMethod(this, 'initialize');
        this._m_PlaySymbol$3 = this.m_TargetControl.findName('PlaySymbol');
        this._m_PauseSymbol$3 = this.m_TargetControl.findName('PauseSymbol');
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this._m_PlaySymbol$3);
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this._m_PauseSymbol$3);
    },
    
    renderControl: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightPlayPauseButton$renderControl() {
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightPlayPauseButton.callBaseMethod(this, 'renderControl');
        if (this._m_Mode$3 === Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightPlayPauseButtonMode.play) {
            this._m_PlaySymbol$3.opacity = 1;
            this._m_PauseSymbol$3.opacity = 0;
        }
        else if (this._m_Mode$3 === Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightPlayPauseButtonMode.pause) {
            this._m_PlaySymbol$3.opacity = 0;
            this._m_PauseSymbol$3.opacity = 1;
        }
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgress

Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgress = function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightProgress(p_TargetControl) {
    /// <summary>
    /// Base class for controls rendering progression values.
    /// </summary>
    /// <param name="p_TargetControl" type="UIElement">
    /// </param>
    /// <field name="_m_ThumbControlName$1" type="String">
    /// </field>
    /// <field name="_m_HighlightControlName$1" type="String">
    /// </field>
    /// <field name="_m_Orientation$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgressOrientation">
    /// </field>
    /// <field name="_m_ProgressWhileDraggingThumb$1" type="Boolean">
    /// </field>
    /// <field name="_m_Progress$1" type="Number">
    /// </field>
    /// <field name="_m_Thumb$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightButton">
    /// </field>
    /// <field name="_m_Highlight$1" type="Path">
    /// </field>
    /// <field name="_m_Thumb_Dragging$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.MouseEventHandler">
    /// </field>
    /// <field name="_m_Thumb_DragDrop$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.MouseEventHandler">
    /// </field>
    /// <field name="progressChange" type="Coveo.CNL.Web.Scripts.MulticastEventHandler">
    /// Event fired when the progression is changed.
    /// </field>
    this._m_Orientation$1 = Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgressOrientation.horizontal;
    this.progressChange = new Coveo.CNL.Web.Scripts.MulticastEventHandler();
    Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgress.initializeBase(this, [ p_TargetControl ]);
}
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgress.prototype = {
    _m_ThumbControlName$1: null,
    _m_HighlightControlName$1: null,
    _m_ProgressWhileDraggingThumb$1: false,
    _m_Progress$1: 0,
    _m_Thumb$1: null,
    _m_Highlight$1: null,
    _m_Thumb_Dragging$1: null,
    _m_Thumb_DragDrop$1: null,
    
    get_thumbControlName: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightProgress$get_thumbControlName() {
        /// <summary>
        /// Gets or sets the Xaml name of the control representing the thumb element.
        /// </summary>
        /// <value type="String"></value>
        return this._m_ThumbControlName$1;
    },
    set_thumbControlName: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightProgress$set_thumbControlName(value) {
        /// <summary>
        /// Gets or sets the Xaml name of the control representing the thumb element.
        /// </summary>
        /// <value type="String"></value>
        this._m_ThumbControlName$1 = value;
        this._m_Thumb$1 = new Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightAnimatedButton(this.m_TargetControl.findName(this._m_ThumbControlName$1));
        this._m_Thumb_Dragging$1 = Function.createDelegate(this, this._thumb_Dragging$1);
        this._m_Thumb$1.dragging.add(this._m_Thumb_Dragging$1);
        this._m_Thumb_DragDrop$1 = Function.createDelegate(this, this._thumb_DragDrop$1);
        this._m_Thumb$1.dragDrop.add(this._m_Thumb_DragDrop$1);
        return value;
    },
    
    get_highlightControlName: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightProgress$get_highlightControlName() {
        /// <summary>
        /// Gets or sets the Xaml name of the control representing the highlight element.
        /// </summary>
        /// <value type="String"></value>
        return this._m_HighlightControlName$1;
    },
    set_highlightControlName: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightProgress$set_highlightControlName(value) {
        /// <summary>
        /// Gets or sets the Xaml name of the control representing the highlight element.
        /// </summary>
        /// <value type="String"></value>
        this._m_HighlightControlName$1 = value;
        this._m_Highlight$1 = this.m_TargetControl.findName(this._m_HighlightControlName$1);
        return value;
    },
    
    get_orientation: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightProgress$get_orientation() {
        /// <summary>
        /// Gets or sets the orientation of the control.
        /// </summary>
        /// <value type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgressOrientation"></value>
        return this._m_Orientation$1;
    },
    set_orientation: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightProgress$set_orientation(value) {
        /// <summary>
        /// Gets or sets the orientation of the control.
        /// </summary>
        /// <value type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgressOrientation"></value>
        this._m_Orientation$1 = value;
        return value;
    },
    
    get_progressWhileDraggingThumb: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightProgress$get_progressWhileDraggingThumb() {
        /// <summary>
        /// Gets or sets the flag indicating that the control will update its <b>Progress</b> value
        /// on a drag operation.
        /// <remarks>If this value is <b>False</b>, the <b>Progress</b> value will be change only when a
        /// drag drop operation will terminate (mouse release). Otherwise, the progress value will be
        /// updated everytime the mouse moves within a drag operation.</remarks>
        /// </summary>
        /// <value type="Boolean"></value>
        return this._m_ProgressWhileDraggingThumb$1;
    },
    set_progressWhileDraggingThumb: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightProgress$set_progressWhileDraggingThumb(value) {
        /// <summary>
        /// Gets or sets the flag indicating that the control will update its <b>Progress</b> value
        /// on a drag operation.
        /// <remarks>If this value is <b>False</b>, the <b>Progress</b> value will be change only when a
        /// drag drop operation will terminate (mouse release). Otherwise, the progress value will be
        /// updated everytime the mouse moves within a drag operation.</remarks>
        /// </summary>
        /// <value type="Boolean"></value>
        this._m_ProgressWhileDraggingThumb$1 = value;
        return value;
    },
    
    get_progress: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightProgress$get_progress() {
        /// <summary>
        /// Gets or sets the current control progression. The progression is
        /// represented on a linear scale between 0 and 1. Setting the Progress
        /// property fires the <see cref="F:Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgress.ProgressChange" /> event.
        /// </summary>
        /// <value type="Number"></value>
        return this._m_Progress$1;
    },
    set_progress: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightProgress$set_progress(value) {
        /// <summary>
        /// Gets or sets the current control progression. The progression is
        /// represented on a linear scale between 0 and 1. Setting the Progress
        /// property fires the <see cref="F:Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgress.ProgressChange" /> event.
        /// </summary>
        /// <value type="Number"></value>
        this._setProgress$1(value, true);
        return value;
    },
    
    updateProgress: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightProgress$updateProgress(p_Progress) {
        /// <summary>
        /// Call UpdateProgress if you want to change the Progress value and don't
        /// want to receive a <see cref="F:Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgress.ProgressChange" /> event.
        /// </summary>
        /// <param name="p_Progress" type="Number">
        /// Progress value between 0 and 1.
        /// </param>
        Coveo.CNL.Web.Scripts.CNLAssert.check(p_Progress >= 0 && p_Progress <= 1);
        this._setProgress$1(p_Progress, false);
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightProgress$tearDown() {
        if (this._m_Thumb$1 != null) {
            this._m_Thumb$1.dragging.remove(this._m_Thumb_Dragging$1);
            this._m_Thumb$1.dragDrop.remove(this._m_Thumb_DragDrop$1);
        }
        this._m_Thumb$1 = null;
        this._m_Highlight$1 = null;
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgress.callBaseMethod(this, 'tearDown');
    },
    
    getProgressFromMousePos: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightProgress$getProgressFromMousePos(p_MousePos) {
        /// <summary>
        /// Returns the progression corresponding to mouse coords.
        /// </summary>
        /// <param name="p_MousePos" type="MouseEventArgs">
        /// Mouse event arguments.
        /// </param>
        /// <returns type="Number"></returns>
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(p_MousePos);
        if (this._m_Orientation$1 === Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgressOrientation.horizontal) {
            return Math.min(Math.max(0, p_MousePos.getPosition(this.m_TargetControl).x / this.m_TargetControl.width), 1);
        }
        else {
            return Math.min(Math.max(0, p_MousePos.getPosition(this.m_TargetControl).y / this.m_TargetControl.height), 1);
        }
    },
    
    renderControl: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightProgress$renderControl() {
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgress.callBaseMethod(this, 'renderControl');
        if (this._m_Thumb$1 != null) {
            if (this._m_Orientation$1 === Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgressOrientation.horizontal) {
                this._m_Thumb$1.set_left(Math.min(Math.max(0, (this.get_progress() * this.m_TargetControl.width) - (this._m_Thumb$1.get_width() / 2)), this.m_TargetControl.width - this._m_Thumb$1.get_width()));
            }
            else {
                this._m_Thumb$1.set_top(Math.min(Math.max(0, (this.get_progress() * this.m_TargetControl.height) - (this._m_Thumb$1.get_height() / 2)), this.m_TargetControl.height - this._m_Thumb$1.get_height()));
            }
        }
        if (this._m_Highlight$1 != null) {
            if (this._m_Orientation$1 === Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgressOrientation.horizontal) {
                this._m_Highlight$1.width = this.get_progress() * this.m_TargetControl.width;
            }
            else {
                this._m_Highlight$1.height = this.get_progress() * this.m_TargetControl.height;
            }
        }
    },
    
    onDragging: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightProgress$onDragging(p_Args) {
        /// <param name="p_Args" type="MouseEventArgs">
        /// </param>
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(p_Args);
        if (this._m_ProgressWhileDraggingThumb$1) {
            this.set_progress(this.getProgressFromMousePos(p_Args));
        }
        this.onProgressDragging(this.getProgressFromMousePos(p_Args));
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgress.callBaseMethod(this, 'onDragging', [ p_Args ]);
    },
    
    onProgressDragging: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightProgress$onProgressDragging(p_Progress) {
        /// <param name="p_Progress" type="Number">
        /// </param>
    },
    
    onClick: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightProgress$onClick(p_Args) {
        /// <param name="p_Args" type="MouseEventArgs">
        /// </param>
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(p_Args);
        this.set_progress(this.getProgressFromMousePos(p_Args));
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgress.callBaseMethod(this, 'onClick', [ p_Args ]);
    },
    
    onDragDrop: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightProgress$onDragDrop(p_Args) {
        /// <param name="p_Args" type="MouseEventArgs">
        /// </param>
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(p_Args);
        this.set_progress(this.getProgressFromMousePos(p_Args));
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgress.callBaseMethod(this, 'onDragDrop', [ p_Args ]);
    },
    
    _setProgress$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightProgress$_setProgress$1(p_Progress, p_TriggerChange) {
        /// <summary>
        /// Sets progression.
        /// </summary>
        /// <param name="p_Progress" type="Number">
        /// Progression value.
        /// </param>
        /// <param name="p_TriggerChange" type="Boolean">
        /// Flag indicating to trigger the <see cref="F:Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgress.ProgressChange" /> event.
        /// </param>
        Coveo.CNL.Web.Scripts.CNLAssert.check(p_Progress >= 0 && p_Progress <= 1);
        this._m_Progress$1 = p_Progress;
        if (!this.get_isDragging()) {
            this.renderControl();
        }
        if (p_TriggerChange && this.progressChange.isDefined()) {
            this.progressChange.invoke(this, new EventArgs());
        }
    },
    
    _thumb_DragDrop$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightProgress$_thumb_DragDrop$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="MouseEventArgs">
        /// </param>
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(p_Args);
        this.set_progress(this.getProgressFromMousePos(p_Args));
    },
    
    _thumb_Dragging$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightProgress$_thumb_Dragging$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="MouseEventArgs">
        /// </param>
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this._m_Thumb$1);
        if (this._m_Orientation$1 === Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgressOrientation.horizontal) {
            this._m_Thumb$1.set_left(Math.min(Math.max(0, (this.getProgressFromMousePos(p_Args) * this.m_TargetControl.width) - (this._m_Thumb$1.get_width() / 2)), this.m_TargetControl.width - this._m_Thumb$1.get_width()));
        }
        else {
            this._m_Thumb$1.set_top(Math.min(Math.max(0, (this.getProgressFromMousePos(p_Args) * this.m_TargetControl.height) - (this._m_Thumb$1.get_height() / 2)), this.m_TargetControl.height - this._m_Thumb$1.get_height()));
        }
        if (this._m_Highlight$1 != null) {
            if (this._m_Orientation$1 === Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgressOrientation.horizontal) {
                this._m_Highlight$1.width = this.getProgressFromMousePos(p_Args) * this.m_TargetControl.width;
            }
            else {
                this._m_Highlight$1.height = this.getProgressFromMousePos(p_Args) * this.m_TargetControl.height;
            }
        }
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightScrollArea

Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightScrollArea = function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightScrollArea(p_TargetCanvas) {
    /// <summary>
    /// This class is used to manipulate a scrolling area.
    /// </summary>
    /// <param name="p_TargetCanvas" type="UIElement">
    /// </param>
    /// <field name="_scrolL_MOVE_SIZE$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_m_ScrollBarControlName$1" type="String">
    /// </field>
    /// <field name="_m_ScrollUpButtonName$1" type="String">
    /// </field>
    /// <field name="_m_ScrollDownButtonName$1" type="String">
    /// </field>
    /// <field name="_m_ScrollHookControlName$1" type="String">
    /// </field>
    /// <field name="_m_ScrollHookThumbControlName$1" type="String">
    /// </field>
    /// <field name="_m_ScrollTop$1" type="Number">
    /// </field>
    /// <field name="_m_EnableAnimation$1" type="Boolean">
    /// </field>
    /// <field name="_m_ScrollStoryboard$1" type="Storyboard">
    /// </field>
    /// <field name="_m_ScrollAnimation$1" type="DoubleAnimation">
    /// </field>
    /// <field name="_m_ScrollDownButton$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightAnimatedButton">
    /// </field>
    /// <field name="_m_ScrollUpButton$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightAnimatedButton">
    /// </field>
    /// <field name="_m_HookControl$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgress">
    /// </field>
    /// <field name="_m_ScrollTarget$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightCustomControl">
    /// </field>
    /// <field name="_m_ScrollDownButton_Click$1" type="EventHandler">
    /// </field>
    /// <field name="_m_ScrollUpButton_Click$1" type="EventHandler">
    /// </field>
    /// <field name="_m_HookControl_ProgressChange$1" type="EventHandler">
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightScrollArea.initializeBase(this, [ p_TargetCanvas ]);
}
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightScrollArea.prototype = {
    _m_ScrollBarControlName$1: null,
    _m_ScrollUpButtonName$1: null,
    _m_ScrollDownButtonName$1: null,
    _m_ScrollHookControlName$1: null,
    _m_ScrollHookThumbControlName$1: null,
    _m_ScrollTop$1: 0,
    _m_EnableAnimation$1: true,
    _m_ScrollStoryboard$1: null,
    _m_ScrollAnimation$1: null,
    _m_ScrollDownButton$1: null,
    _m_ScrollUpButton$1: null,
    _m_HookControl$1: null,
    _m_ScrollTarget$1: null,
    _m_ScrollDownButton_Click$1: null,
    _m_ScrollUpButton_Click$1: null,
    _m_HookControl_ProgressChange$1: null,
    
    get_height: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightScrollArea$get_height() {
        /// <summary>
        /// Gets or sets the height value of the scroll area.
        /// </summary>
        /// <value type="Number"></value>
        return Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightScrollArea.callBaseMethod(this, 'get_height');
    },
    set_height: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightScrollArea$set_height(value) {
        /// <summary>
        /// Gets or sets the height value of the scroll area.
        /// </summary>
        /// <value type="Number"></value>
        (this.m_TargetControl.getHost().content.findName(this._m_ScrollBarControlName$1)).height = value;
        this._m_ScrollDownButton$1.set_top(value - this._m_ScrollDownButton$1.get_height());
        this._m_HookControl$1.set_height(value - (this._m_ScrollDownButton$1.get_height() * 2));
        var xaml = '<RectangleGeometry Rect=\"0, 0, ' + this.get_width() + ', ' + value + '\" />';
        var rect = this.m_TargetControl.getHost().content.createFromXaml(xaml);
        (this.m_TargetControl).clip = rect;
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightScrollArea.callBaseMethod(this, 'set_height', [ value ]);
        return value;
    },
    
    get_width: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightScrollArea$get_width() {
        /// <value type="Number"></value>
        return Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightScrollArea.callBaseMethod(this, 'get_width');
    },
    set_width: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightScrollArea$set_width(value) {
        /// <value type="Number"></value>
        (this.m_TargetControl.getHost().content.findName(this._m_ScrollBarControlName$1)).setValue('Canvas.Left', value - 20);
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightScrollArea.callBaseMethod(this, 'set_width', [ value ]);
        return value;
    },
    
    get_scrollBarControlName: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightScrollArea$get_scrollBarControlName() {
        /// <summary>
        /// Gets or sets the xaml name of the scrollbar control.
        /// </summary>
        /// <value type="String"></value>
        return this._m_ScrollBarControlName$1;
    },
    set_scrollBarControlName: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightScrollArea$set_scrollBarControlName(value) {
        /// <summary>
        /// Gets or sets the xaml name of the scrollbar control.
        /// </summary>
        /// <value type="String"></value>
        this._m_ScrollBarControlName$1 = value;
        return value;
    },
    
    get_scrollUpButtonName: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightScrollArea$get_scrollUpButtonName() {
        /// <summary>
        /// Gets or sets the xaml name of the scrollbar button up control.
        /// </summary>
        /// <value type="String"></value>
        return this._m_ScrollUpButtonName$1;
    },
    set_scrollUpButtonName: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightScrollArea$set_scrollUpButtonName(value) {
        /// <summary>
        /// Gets or sets the xaml name of the scrollbar button up control.
        /// </summary>
        /// <value type="String"></value>
        this._m_ScrollUpButtonName$1 = value;
        this._m_ScrollUpButton$1 = new Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightAnimatedButton(this.m_TargetControl.findName(this._m_ScrollUpButtonName$1));
        this._m_ScrollUpButton_Click$1 = Function.createDelegate(this, this._scrollUpButton_Click$1);
        this._m_ScrollUpButton$1.click.add(this._m_ScrollUpButton_Click$1);
        return value;
    },
    
    get_scrollDownButtonName: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightScrollArea$get_scrollDownButtonName() {
        /// <summary>
        /// Gets or sets the xaml name of the scrollbar button down control.
        /// </summary>
        /// <value type="String"></value>
        return this._m_ScrollDownButtonName$1;
    },
    set_scrollDownButtonName: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightScrollArea$set_scrollDownButtonName(value) {
        /// <summary>
        /// Gets or sets the xaml name of the scrollbar button down control.
        /// </summary>
        /// <value type="String"></value>
        this._m_ScrollDownButtonName$1 = value;
        this._m_ScrollDownButton$1 = new Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightAnimatedButton(this.m_TargetControl.findName(this._m_ScrollDownButtonName$1));
        this._m_ScrollDownButton_Click$1 = Function.createDelegate(this, this._scrollDownButton_Click$1);
        this._m_ScrollDownButton$1.click.add(this._m_ScrollDownButton_Click$1);
        return value;
    },
    
    get_scrollHookControlName: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightScrollArea$get_scrollHookControlName() {
        /// <summary>
        /// Gets or sets the xaml name of the control where the thumb slides.
        /// </summary>
        /// <value type="String"></value>
        return this._m_ScrollHookControlName$1;
    },
    set_scrollHookControlName: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightScrollArea$set_scrollHookControlName(value) {
        /// <summary>
        /// Gets or sets the xaml name of the control where the thumb slides.
        /// </summary>
        /// <value type="String"></value>
        this._m_ScrollHookControlName$1 = value;
        this._m_HookControl$1 = new Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgress(this.m_TargetControl.findName(this._m_ScrollHookControlName$1));
        this._m_HookControl$1.set_orientation(Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgressOrientation.vertical);
        this._m_HookControl$1.set_progressWhileDraggingThumb(true);
        this._m_HookControl$1.set_thumbControlName(this._m_ScrollHookThumbControlName$1);
        this._m_HookControl_ProgressChange$1 = Function.createDelegate(this, this._hookControl_ProgressChange$1);
        this._m_HookControl$1.progressChange.add(this._m_HookControl_ProgressChange$1);
        return value;
    },
    
    get_scrollHookThumbControlName: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightScrollArea$get_scrollHookThumbControlName() {
        /// <summary>
        /// Gets or sets the xaml name of the scrollbar thumb control.
        /// </summary>
        /// <value type="String"></value>
        return this._m_ScrollHookThumbControlName$1;
    },
    set_scrollHookThumbControlName: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightScrollArea$set_scrollHookThumbControlName(value) {
        /// <summary>
        /// Gets or sets the xaml name of the scrollbar thumb control.
        /// </summary>
        /// <value type="String"></value>
        this._m_ScrollHookThumbControlName$1 = value;
        return value;
    },
    
    get_scrollTarget: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightScrollArea$get_scrollTarget() {
        /// <summary>
        /// Gets or sets the control that will be scrolled.
        /// </summary>
        /// <value type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightCustomControl"></value>
        return this._m_ScrollTarget$1;
    },
    set_scrollTarget: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightScrollArea$set_scrollTarget(value) {
        /// <summary>
        /// Gets or sets the control that will be scrolled.
        /// </summary>
        /// <value type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightCustomControl"></value>
        var xaml = '<Storyboard xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" x:Name=\"ScrollStoryboard\"><DoubleAnimation x:Name=\"ScrollAnimation\" Storyboard.TargetName=\"' + value.get_targetControl().name + '\"  Storyboard.TargetProperty=\"(Canvas.Top)\" From=\"1.0\" To=\"0.0\" Duration=\"0:0:0.3\" /></Storyboard>';
        this._m_ScrollStoryboard$1 = this.m_TargetControl.getHost().content.createFromXaml(xaml);
        (this.m_TargetControl).resources.add(this._m_ScrollStoryboard$1);
        this._m_ScrollAnimation$1 = this.m_TargetControl.findName('ScrollAnimation');
        this._m_ScrollTarget$1 = value;
        return value;
    },
    
    get_scrollTop: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightScrollArea$get_scrollTop() {
        /// <summary>
        /// Gets or sets the current top value of the scroll target.
        /// <remarks>
        /// If the target control is already scrolled at the top or bottom, changing this property
        /// to a value that will put the target control out of bound will have no effect.
        /// </remarks>
        /// </summary>
        /// <value type="Number"></value>
        return this._m_ScrollTop$1;
    },
    set_scrollTop: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightScrollArea$set_scrollTop(value) {
        /// <summary>
        /// Gets or sets the current top value of the scroll target.
        /// <remarks>
        /// If the target control is already scrolled at the top or bottom, changing this property
        /// to a value that will put the target control out of bound will have no effect.
        /// </remarks>
        /// </summary>
        /// <value type="Number"></value>
        var newValue = 0;
        if (this._m_ScrollTarget$1.get_height() > this.get_height()) {
            newValue = Math.max(0, value);
            newValue = Math.min(this._m_ScrollTarget$1.get_height() - this.get_height(), newValue);
        }
        this._m_ScrollTop$1 = newValue;
        this._m_HookControl$1.updateProgress(this._m_ScrollTop$1 / (this._m_ScrollTarget$1.get_height() - this.get_height()));
        this.renderControl();
        return value;
    },
    
    scrollTo: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightScrollArea$scrollTo(p_TargetTop, p_MustSeeThreshold) {
        /// <summary>
        /// Scrolls the target value to the targeted top value.
        /// </summary>
        /// <param name="p_TargetTop" type="Number">
        /// The targeted top value.
        /// </param>
        /// <param name="p_MustSeeThreshold" type="Number">
        /// The height that must be include when calculating the top value.
        /// </param>
        var actualTargetTop = this._m_ScrollTarget$1.get_top() + p_TargetTop;
        if (actualTargetTop < 0) {
            this.set_scrollTop(p_TargetTop);
        }
        else if (actualTargetTop + p_MustSeeThreshold > this.get_height()) {
            this.set_scrollTop(this.get_scrollTop() + (actualTargetTop + p_MustSeeThreshold) - this.get_height());
        }
    },
    
    renderControl: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightScrollArea$renderControl() {
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightScrollArea.callBaseMethod(this, 'renderControl');
        if (this._m_ScrollTarget$1.get_height() <= this.get_height()) {
            this._m_HookControl$1.set_opacity(0);
        }
        else {
            this._m_HookControl$1.set_opacity(1);
        }
        if (this._m_EnableAnimation$1) {
            this._m_ScrollAnimation$1.from = this._m_ScrollTarget$1.get_top();
            this._m_ScrollAnimation$1.to = this._m_ScrollTop$1 * -1;
            this._m_ScrollStoryboard$1.begin();
        }
        else {
            this._m_ScrollTarget$1.set_top(this._m_ScrollTop$1 * -1);
        }
    },
    
    onMouseWheel: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightScrollArea$onMouseWheel(p_WheelDelta) {
        /// <param name="p_WheelDelta" type="Number" integer="true">
        /// </param>
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightScrollArea.callBaseMethod(this, 'onMouseWheel', [ p_WheelDelta ]);
        if (p_WheelDelta < 0) {
            this._scrollDown$1();
        }
        else {
            this._scrollUp$1();
        }
    },
    
    _scrollUp$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightScrollArea$_scrollUp$1() {
        /// <summary>
        /// Scrolls up the control.
        /// </summary>
        this.set_scrollTop(this.get_scrollTop() - Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightScrollArea._scrolL_MOVE_SIZE$1);
    },
    
    _scrollDown$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightScrollArea$_scrollDown$1() {
        /// <summary>
        /// Scrolls down the control.
        /// </summary>
        this.set_scrollTop(this.get_scrollTop() + Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightScrollArea._scrolL_MOVE_SIZE$1);
    },
    
    _scrollUpButton_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightScrollArea$_scrollUpButton_Click$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="EventArgs">
        /// </param>
        this._scrollUp$1();
    },
    
    _scrollDownButton_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightScrollArea$_scrollDownButton_Click$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="EventArgs">
        /// </param>
        this._scrollDown$1();
    },
    
    _hookControl_ProgressChange$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightScrollArea$_hookControl_ProgressChange$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="EventArgs">
        /// </param>
        this._m_EnableAnimation$1 = false;
        try {
            var progress = (p_Sender).get_progress();
            this.set_scrollTop((this._m_ScrollTarget$1.get_height() - this.get_height()) * progress);
        }
        finally {
            this._m_EnableAnimation$1 = true;
        }
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightSymbolButton

Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightSymbolButton = function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightSymbolButton(p_TargetCanvas) {
    /// <summary>
    /// Represents a button containing a symbol. The symbol is used to represent
    /// the different button states.
    /// </summary>
    /// <param name="p_TargetCanvas" type="UIElement">
    /// </param>
    /// <field name="_m_EnabledSymbol$2" type="Canvas">
    /// </field>
    /// <field name="_m_DisabledSymbol$2" type="Canvas">
    /// </field>
    /// <field name="_m_GrayedSymbol$2" type="Canvas">
    /// </field>
    /// <field name="_m_State$2" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightButtonState">
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightSymbolButton.initializeBase(this, [ p_TargetCanvas ]);
}
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightSymbolButton.prototype = {
    _m_EnabledSymbol$2: null,
    _m_DisabledSymbol$2: null,
    _m_GrayedSymbol$2: null,
    _m_State$2: 0,
    
    get_state: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightSymbolButton$get_state() {
        /// <summary>
        /// Gets or sets the button current state.
        /// </summary>
        /// <value type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightButtonState"></value>
        return this._m_State$2;
    },
    set_state: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightSymbolButton$set_state(value) {
        /// <summary>
        /// Gets or sets the button current state.
        /// </summary>
        /// <value type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightButtonState"></value>
        this._m_State$2 = value;
        this.renderControl();
        return value;
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightSymbolButton$tearDown() {
        this._m_EnabledSymbol$2 = null;
        this._m_DisabledSymbol$2 = null;
        this._m_GrayedSymbol$2 = null;
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightSymbolButton.callBaseMethod(this, 'tearDown');
    },
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightSymbolButton$initialize() {
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightSymbolButton.callBaseMethod(this, 'initialize');
        this._m_EnabledSymbol$2 = this.m_TargetControl.findName(this.m_TargetControl.name + '_Enabled');
        this._m_DisabledSymbol$2 = this.m_TargetControl.findName(this.m_TargetControl.name + '_Disabled');
        this._m_GrayedSymbol$2 = this.m_TargetControl.findName(this.m_TargetControl.name + '_Grayed');
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this._m_EnabledSymbol$2);
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this._m_DisabledSymbol$2);
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this._m_GrayedSymbol$2);
    },
    
    renderControl: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightSymbolButton$renderControl() {
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightSymbolButton.callBaseMethod(this, 'renderControl');
        this._m_EnabledSymbol$2.opacity = 0;
        this._m_DisabledSymbol$2.opacity = 0;
        this._m_GrayedSymbol$2.opacity = 0;
        if (this._m_State$2 === Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightButtonState.disabled) {
            this._m_DisabledSymbol$2.opacity = 1;
        }
        else if (this._m_State$2 === Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightButtonState.enabled) {
            this._m_EnabledSymbol$2.opacity = 1;
        }
        else if (this._m_State$2 === Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightButtonState.grayed) {
            this._m_GrayedSymbol$2.opacity = 1;
        }
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.Results.TextContainerEventArgs

Coveo.CES.Web.Search.Scripts.Controls.Results.TextContainerEventArgs = function Coveo_CES_Web_Search_Scripts_Controls_Results_TextContainerEventArgs() {
    /// <summary>
    /// Arguments class used for text entries related events.
    /// </summary>
    /// <field name="textEntry" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextEntry">
    /// Gets or sets the <see cref="T:Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextEntry" /> object targeted by the event.
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.Results.TextContainerEventArgs.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.Results.TextContainerEventArgs.prototype = {
    textEntry: null
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextContainer

Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextContainer = function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTextContainer(p_Target) {
    /// <summary>
    /// This class is used to render multiple text elements.
    /// </summary>
    /// <param name="p_Target" type="Canvas">
    /// </param>
    /// <field name="_m_TextEntries$1" type="Array">
    /// </field>
    /// <field name="_m_IsUpdating$1" type="Boolean">
    /// </field>
    /// <field name="textEntryClick" type="Coveo.CNL.Web.Scripts.MulticastEventHandler">
    /// Event fired when a text element is clicked.
    /// </field>
    this._m_TextEntries$1 = [];
    this.textEntryClick = new Coveo.CNL.Web.Scripts.MulticastEventHandler();
    Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextContainer.initializeBase(this, [ p_Target ]);
}
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextContainer.prototype = {
    _m_IsUpdating$1: false,
    
    get_width: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTextContainer$get_width() {
        /// <value type="Number"></value>
        return Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextContainer.callBaseMethod(this, 'get_width');
    },
    set_width: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTextContainer$set_width(value) {
        /// <value type="Number"></value>
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextContainer.callBaseMethod(this, 'set_width', [ value ]);
        for (var i = 0; i < this._m_TextEntries$1.length; i++) {
            var textEntry = this._m_TextEntries$1[i];
            if (Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtteranceTextEntry.isInstanceOfType(textEntry)) {
                textEntry.set_width(this.get_width());
            }
        }
        this._internalEndUpdate$1();
        return value;
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTextContainer$tearDown() {
        for (var i = 0; i < this._m_TextEntries$1.length; i++) {
            var textEntry = this._m_TextEntries$1[i];
            textEntry.tearDown();
        }
        Array.clear(this._m_TextEntries$1);
        this._m_TextEntries$1 = null;
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextContainer.callBaseMethod(this, 'tearDown');
    },
    
    beginUpdate: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTextContainer$beginUpdate() {
        /// <summary>
        /// Call this method when you start adding entries into a <see cref="T:Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextContainer" /> object.
        /// This method should be use with the <b>EndUpdate</b> method.
        /// </summary>
        Coveo.CNL.Web.Scripts.CNLAssert.check(!this._m_IsUpdating$1);
        this._m_IsUpdating$1 = true;
    },
    
    endUpdate: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTextContainer$endUpdate() {
        /// <summary>
        /// Call this method when you the adding entries operation is terminated.
        /// This method should be use with the <b>BeginUpdate</b> method.
        /// </summary>
        Coveo.CNL.Web.Scripts.CNLAssert.check(this._m_IsUpdating$1);
        this._m_IsUpdating$1 = false;
        this._internalEndUpdate$1();
    },
    
    clear: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTextContainer$clear() {
        /// <summary>
        /// Clears the list of entries.
        /// </summary>
        for (var i = 0; i < this._m_TextEntries$1.length; i++) {
            var textEntry = this._m_TextEntries$1[i];
            textEntry.tearDown();
        }
        Array.clear(this._m_TextEntries$1);
        this._internalEndUpdate$1();
    },
    
    addSeparatorTextEntry: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTextContainer$addSeparatorTextEntry(p_Text, p_Data, p_SelectedText) {
        /// <summary>
        /// Adds a <see cref="T:Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextEntry" /> element. When using this method,
        /// all added elements will be rendered on a single line separed by the "  .  "
        /// characters.
        /// </summary>
        /// <param name="p_Text" type="String">
        /// The text to display.
        /// </param>
        /// <param name="p_Data" type="Object">
        /// Any user object that can be attached to the text element.
        /// </param>
        /// <param name="p_SelectedText" type="Boolean">
        /// Set to <b>True</b> if you want the value to be rendered as selected.
        /// </param>
        /// <returns type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextEntry"></returns>
        Coveo.CNL.Web.Scripts.CNLAssert.check(this._m_IsUpdating$1);
        Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(p_Text);
        var containerXaml = '<Canvas xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"/>';
        if (this._m_TextEntries$1.length > 0) {
            var sepContainer = this.m_TargetControl.getHost().content.createFromXaml(containerXaml);
            sepContainer.width = this.m_TargetControl.width;
            var sepEntry = new Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextEntry(sepContainer);
            sepEntry.set_text('  .  ');
            sepEntry.disableEvents();
            Array.add(this._m_TextEntries$1, sepEntry);
        }
        var textContainer = this.m_TargetControl.getHost().content.createFromXaml(containerXaml);
        textContainer.width = this.m_TargetControl.width;
        var textEntry = new Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextEntry(textContainer);
        textEntry.set_data(p_Data);
        textEntry.set_selected(p_SelectedText);
        textEntry.set_text(p_Text);
        textEntry.click.add(Function.createDelegate(this, this._textEntry_Click$1));
        Array.add(this._m_TextEntries$1, textEntry);
        return textEntry;
    },
    
    addUtteranceTextEntry: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTextContainer$addUtteranceTextEntry(p_Text, p_Data, p_SelectedText) {
        /// <summary>
        /// Adds a <see cref="T:Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtteranceTextEntry" /> element. When using this method,
        /// each added element will be rendered on a single line.
        /// </summary>
        /// <param name="p_Text" type="String">
        /// The text to display.
        /// </param>
        /// <param name="p_Data" type="Object">
        /// Any user object that can be attached to the text element.
        /// </param>
        /// <param name="p_SelectedText" type="Boolean">
        /// Set to <b>True</b> if you want the value to be rendered as selected.
        /// </param>
        /// <returns type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtteranceTextEntry"></returns>
        Coveo.CNL.Web.Scripts.CNLAssert.check(this._m_IsUpdating$1);
        Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(p_Text);
        var containerXaml = '<Canvas xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"/>';
        var textContainer = this.m_TargetControl.getHost().content.createFromXaml(containerXaml);
        textContainer.width = this.m_TargetControl.width;
        var textEntry = new Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtteranceTextEntry(textContainer);
        textEntry.set_data(p_Data);
        textEntry.set_text(p_Text);
        textEntry.set_selected(p_SelectedText);
        textEntry.click.add(Function.createDelegate(this, this._textEntry_Click$1));
        Array.add(this._m_TextEntries$1, textEntry);
        return textEntry;
    },
    
    _internalEndUpdate$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTextContainer$_internalEndUpdate$1() {
        /// <summary>
        /// Reorganize the output with the last changes.
        /// </summary>
        (this.m_TargetControl).children.clear();
        var height = 0;
        var width = 0;
        var count = this._m_TextEntries$1.length;
        var top = 0;
        for (var i = 0; i <= count - 1; i++) {
            var textEntry = this._m_TextEntries$1[i];
            if (width + textEntry.get_width() > this.m_TargetControl.width) {
                width = 0;
                top = height;
                height += textEntry.get_height();
            }
            else {
                height = Math.max(height, textEntry.get_height());
            }
            textEntry.set_left(width);
            textEntry.set_top(top);
            width += textEntry.get_width();
            (this.m_TargetControl).children.add(textEntry.get_targetControl());
        }
        this.set_height(height);
    },
    
    _textEntry_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTextContainer$_textEntry_Click$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="EventArgs">
        /// </param>
        if (this.textEntryClick.isDefined()) {
            var args = new Coveo.CES.Web.Search.Scripts.Controls.Results.TextContainerEventArgs();
            args.textEntry = p_Sender;
            this.textEntryClick.invoke(this, args);
        }
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextEntry

Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextEntry = function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTextEntry(p_TargetControl) {
    /// <summary>
    /// This is the base class for any text entry created by a <see cref="T:Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextContainer" />.
    /// </summary>
    /// <param name="p_TargetControl" type="UIElement">
    /// </param>
    /// <field name="_selecteD_TEXT_COLOR$1" type="String" static="true">
    /// </field>
    /// <field name="_m_Selected$1" type="Boolean">
    /// </field>
    /// <field name="_m_Text$1" type="String">
    /// </field>
    /// <field name="_m_Data$1" type="Object">
    /// </field>
    /// <field name="_m_TextBlock$1" type="TextBlock">
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextEntry.initializeBase(this, [ p_TargetControl ]);
}
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextEntry.prototype = {
    _m_Selected$1: false,
    _m_Text$1: null,
    _m_Data$1: null,
    _m_TextBlock$1: null,
    
    get_selected: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTextEntry$get_selected() {
        /// <summary>
        /// Gets or sets the value indicating that the text should appear selected or not.
        /// </summary>
        /// <value type="Boolean"></value>
        return this._m_Selected$1;
    },
    set_selected: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTextEntry$set_selected(value) {
        /// <summary>
        /// Gets or sets the value indicating that the text should appear selected or not.
        /// </summary>
        /// <value type="Boolean"></value>
        this._m_Selected$1 = value;
        if (this._m_TextBlock$1 != null) {
            if (this._m_Selected$1) {
                (this._m_TextBlock$1.foreground).color = Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextEntry._selecteD_TEXT_COLOR$1;
                this._m_TextBlock$1.fontWeight = 'bold';
            }
            else {
                (this._m_TextBlock$1.foreground).color = 'Black';
                this._m_TextBlock$1.fontWeight = 'normal';
            }
        }
        this.renderControl();
        return value;
    },
    
    get_text: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTextEntry$get_text() {
        /// <summary>
        /// Gets or sets the text value.
        /// </summary>
        /// <value type="String"></value>
        return this._m_Text$1;
    },
    set_text: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTextEntry$set_text(value) {
        /// <summary>
        /// Gets or sets the text value.
        /// </summary>
        /// <value type="String"></value>
        this._m_Text$1 = value;
        this.buildTextControl();
        return value;
    },
    
    get_data: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTextEntry$get_data() {
        /// <summary>
        /// Gets or sets user data that can be attached to this object and retrieved afterwards.
        /// </summary>
        /// <value type="Object"></value>
        return this._m_Data$1;
    },
    set_data: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTextEntry$set_data(value) {
        /// <summary>
        /// Gets or sets user data that can be attached to this object and retrieved afterwards.
        /// </summary>
        /// <value type="Object"></value>
        this._m_Data$1 = value;
        return value;
    },
    
    highlight: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTextEntry$highlight() {
        /// <summary>
        /// Highlights the text.
        /// </summary>
        ((this.m_TargetControl).children.getItem(0)).textDecorations = 'underline';
    },
    
    undoHighlight: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTextEntry$undoHighlight() {
        /// <summary>
        /// Removes text highlighting.
        /// </summary>
        ((this.m_TargetControl).children.getItem(0)).textDecorations = 'none';
    },
    
    buildTextControl: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTextEntry$buildTextControl() {
        /// <summary>
        /// Creates the text control that will render the text.
        /// </summary>
        (this.m_TargetControl).children.clear();
        var color = 'Black';
        if (this._m_Selected$1) {
            color = Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextEntry._selecteD_TEXT_COLOR$1;
        }
        var xaml = '<TextBlock xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" TextWrapping=\"Wrap\" FontFamily=\"Verdana\" FontSize=\"11\" Foreground=\"' + color + '\" Cursor=\"Hand\" Text=\"' + this._m_Text$1 + '\"/>';
        this._m_TextBlock$1 = this.m_TargetControl.getHost().content.createFromXaml(xaml);
        if (this._m_Selected$1) {
            this._m_TextBlock$1.fontWeight = 'bold';
        }
        this._m_TextBlock$1.width = this.m_TargetControl.width;
        (this.m_TargetControl).children.add(this._m_TextBlock$1);
        this.m_TargetControl.height = this._m_TextBlock$1.actualHeight + 3;
        this.m_TargetControl.width = this._m_TextBlock$1.actualWidth;
    },
    
    onMouseMove: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTextEntry$onMouseMove(p_Args) {
        /// <param name="p_Args" type="MouseEventArgs">
        /// </param>
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextEntry.callBaseMethod(this, 'onMouseMove', [ p_Args ]);
        this.highlight();
    },
    
    onMouseLeave: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTextEntry$onMouseLeave(p_Args) {
        /// <param name="p_Args" type="MouseEventArgs">
        /// </param>
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextEntry.callBaseMethod(this, 'onMouseLeave', [ p_Args ]);
        this.undoHighlight();
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextTime

Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextTime = function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTextTime(p_Target) {
    /// <summary>
    /// Class used to render a time value.
    /// </summary>
    /// <param name="p_Target" type="TextBlock">
    /// </param>
    /// <field name="_m_Seconds$1" type="Number">
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextTime.initializeBase(this, [ p_Target ]);
}
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextTime.prototype = {
    _m_Seconds$1: 0,
    
    get_seconds: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTextTime$get_seconds() {
        /// <summary>
        /// Gets or sets the time (in seconds) to display.
        /// </summary>
        /// <value type="Number"></value>
        return this._m_Seconds$1;
    },
    set_seconds: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTextTime$set_seconds(value) {
        /// <summary>
        /// Gets or sets the time (in seconds) to display.
        /// </summary>
        /// <value type="Number"></value>
        this._m_Seconds$1 = value;
        this.renderControl();
        return value;
    },
    
    renderControl: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTextTime$renderControl() {
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextTime.callBaseMethod(this, 'renderControl');
        var datetime = new Date(0, 0, 0, 0, 0, this._m_Seconds$1);
        var hours = datetime.getHours();
        var minutes = datetime.getMinutes() + (hours * 60);
        (this.m_TargetControl).text = Coveo.CNL.Web.Scripts.Utilities.padLeft(minutes.toString(), 2, '0') + ':' + Coveo.CNL.Web.Scripts.Utilities.padLeft(datetime.getSeconds().toString(), 2, '0');
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTimeLineMarker

Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTimeLineMarker = function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTimeLineMarker(p_TargetControl) {
    /// <summary>
    /// Class used to render markers on the timeline of the media player.
    /// </summary>
    /// <param name="p_TargetControl" type="UIElement">
    /// </param>
    /// <field name="_mousE_ENTER_COLOR$1" type="String" static="true">
    /// </field>
    /// <field name="_mousE_LEAVE_COLOR$1" type="String" static="true">
    /// </field>
    /// <field name="_m_Utterance$1" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtterance">
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTimeLineMarker.initializeBase(this, [ p_TargetControl ]);
}
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTimeLineMarker.prototype = {
    _m_Utterance$1: null,
    
    get_utterance: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTimeLineMarker$get_utterance() {
        /// <summary>
        /// Gets or sets the <see cref="T:Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtterance" /> represented by the
        /// current marker.
        /// </summary>
        /// <value type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtterance"></value>
        return this._m_Utterance$1;
    },
    set_utterance: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTimeLineMarker$set_utterance(value) {
        /// <summary>
        /// Gets or sets the <see cref="T:Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtterance" /> represented by the
        /// current marker.
        /// </summary>
        /// <value type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtterance"></value>
        this._m_Utterance$1 = value;
        return value;
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTimeLineMarker$tearDown() {
        this._m_Utterance$1 = null;
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTimeLineMarker.callBaseMethod(this, 'tearDown');
    },
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTimeLineMarker$initialize() {
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTimeLineMarker.callBaseMethod(this, 'initialize');
    },
    
    onMouseMove: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTimeLineMarker$onMouseMove(p_Args) {
        /// <param name="p_Args" type="MouseEventArgs">
        /// </param>
        ((this.m_TargetControl).fill).color = Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTimeLineMarker._mousE_ENTER_COLOR$1;
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTimeLineMarker.callBaseMethod(this, 'onMouseMove', [ p_Args ]);
    },
    
    onMouseLeave: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTimeLineMarker$onMouseLeave(p_Args) {
        /// <param name="p_Args" type="MouseEventArgs">
        /// </param>
        ((this.m_TargetControl).fill).color = Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTimeLineMarker._mousE_LEAVE_COLOR$1;
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTimeLineMarker.callBaseMethod(this, 'onMouseLeave', [ p_Args ]);
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTimeLineMarkerContainer

Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTimeLineMarkerContainer = function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTimeLineMarkerContainer(p_TargetControl) {
    /// <summary>
    /// This control contains and displays media markers along a timeline.
    /// </summary>
    /// <param name="p_TargetControl" type="UIElement">
    /// </param>
    /// <field name="_markeR_WIDTH$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_markeR_HEIGHT$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_markeR_TOP$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_conflicT_SIDE_RANGE_LOOKUP$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_zooM_SCALE$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_m_ZoomOnMarkerConflict$1" type="Boolean">
    /// </field>
    /// <field name="_m_CanZoom$1" type="Boolean">
    /// </field>
    /// <field name="_m_DelayResetZoom$1" type="Boolean">
    /// </field>
    /// <field name="_m_Markers$1" type="Array">
    /// </field>
    /// <field name="_m_MarkerConflictContainer$1" type="Canvas">
    /// </field>
    /// <field name="_m_ConflictFocusInAnimation$1" type="Storyboard">
    /// </field>
    /// <field name="_m_ConflictScaleAnimation$1" type="ScaleTransform">
    /// </field>
    /// <field name="_m_ContainerAnimation$1" type="Storyboard">
    /// </field>
    /// <field name="_m_ContainerDoubleAnimation$1" type="Animation">
    /// </field>
    /// <field name="_m_ConflictFocusOutTimer$1" type="Storyboard">
    /// </field>
    /// <field name="_m_ScaleFactor$1" type="Number">
    /// </field>
    /// <field name="_m_BaseWidth$1" type="Number">
    /// </field>
    /// <field name="_m_BaseLeft$1" type="Number">
    /// </field>
    /// <field name="_m_LastCursorPos$1" type="Point">
    /// </field>
    /// <field name="_m_LastZoomStartPos$1" type="Point">
    /// </field>
    /// <field name="_m_MarkerConflictContainerMouseLeave$1" type="Object">
    /// </field>
    /// <field name="_m_ConflictFocusOut_Completed$1" type="Object">
    /// </field>
    /// <field name="_m_ContainerAnimation_Completed$1" type="Object">
    /// </field>
    /// <field name="utteranceHighlighted" type="Coveo.CNL.Web.Scripts.MulticastEventHandler">
    /// Event fired when an utterance is highlighted.
    /// </field>
    /// <field name="utteranceClick" type="Coveo.CNL.Web.Scripts.MulticastEventHandler">
    /// Event fired when an utterance is clicked.
    /// </field>
    this._m_Markers$1 = [];
    this.utteranceHighlighted = new Coveo.CNL.Web.Scripts.MulticastEventHandler();
    this.utteranceClick = new Coveo.CNL.Web.Scripts.MulticastEventHandler();
    Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTimeLineMarkerContainer.initializeBase(this, [ p_TargetControl ]);
}
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTimeLineMarkerContainer.prototype = {
    _m_ZoomOnMarkerConflict$1: false,
    _m_CanZoom$1: true,
    _m_DelayResetZoom$1: false,
    _m_MarkerConflictContainer$1: null,
    _m_ConflictFocusInAnimation$1: null,
    _m_ConflictScaleAnimation$1: null,
    _m_ContainerAnimation$1: null,
    _m_ContainerDoubleAnimation$1: null,
    _m_ConflictFocusOutTimer$1: null,
    _m_ScaleFactor$1: 1,
    _m_BaseWidth$1: 0,
    _m_BaseLeft$1: 0,
    _m_LastCursorPos$1: null,
    _m_LastZoomStartPos$1: null,
    _m_MarkerConflictContainerMouseLeave$1: null,
    _m_ConflictFocusOut_Completed$1: null,
    _m_ContainerAnimation_Completed$1: null,
    
    get_zoomOnMarkerConflict: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTimeLineMarkerContainer$get_zoomOnMarkerConflict() {
        /// <summary>
        /// Gets or sets the value indicating that the control will show a zoom box
        /// if there is a visual conflict between utterances.
        /// </summary>
        /// <value type="Boolean"></value>
        return this._m_ZoomOnMarkerConflict$1;
    },
    set_zoomOnMarkerConflict: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTimeLineMarkerContainer$set_zoomOnMarkerConflict(value) {
        /// <summary>
        /// Gets or sets the value indicating that the control will show a zoom box
        /// if there is a visual conflict between utterances.
        /// </summary>
        /// <value type="Boolean"></value>
        this._m_ZoomOnMarkerConflict$1 = value;
        return value;
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTimeLineMarkerContainer$tearDown() {
        for (var i = 0; i < this._m_Markers$1.length; i++) {
            var marker = this._m_Markers$1[i];
            marker.tearDown();
        }
        this._m_MarkerConflictContainer$1.removeEventListener('mouseLeave', this._m_MarkerConflictContainerMouseLeave$1);
        this._m_ConflictFocusOutTimer$1.removeEventListener('completed', this._m_ConflictFocusOut_Completed$1);
        this._m_ContainerAnimation$1.removeEventListener('completed', this._m_ContainerAnimation_Completed$1);
        Array.clear(this._m_Markers$1);
        this._m_Markers$1 = null;
        this._m_MarkerConflictContainer$1 = null;
        this._m_ConflictFocusInAnimation$1 = null;
        this._m_ConflictScaleAnimation$1 = null;
        this._m_ContainerAnimation$1 = null;
        this._m_ContainerDoubleAnimation$1 = null;
        this._m_ConflictFocusOutTimer$1 = null;
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTimeLineMarkerContainer.callBaseMethod(this, 'tearDown');
    },
    
    clear: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTimeLineMarkerContainer$clear() {
        /// <summary>
        /// Clears the list of markers.
        /// </summary>
        (this.m_TargetControl).children.clear();
        for (var i = (this.m_TargetControl).resources.count - 1; i >= 1; i--) {
            (this.m_TargetControl).resources.removeAt(i);
        }
        for (var i = 0; i < this._m_Markers$1.length; i++) {
            var marker = this._m_Markers$1[i];
            marker.tearDown();
        }
        Array.clear(this._m_Markers$1);
    },
    
    addNewTimeLineMarker: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTimeLineMarkerContainer$addNewTimeLineMarker(p_Utterance) {
        /// <summary>
        /// Adds a new time line marker to visually indicate the position of an
        /// utterance.
        /// </summary>
        /// <param name="p_Utterance" type="Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtterance">
        /// The utterance to mark.
        /// </param>
        var index = this._m_Markers$1.length.toString();
        var xaml = '<Rectangle xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" x:Name=\"Marker_' + index + '\" Height=\"13\" Width=\"9\" Stroke=\"White\" Opacity=\"1\" Cursor=\"Hand\">' + '<Rectangle.Fill>' + '<SolidColorBrush Color=\"#FF5D5A5A\" />' + '</Rectangle.Fill>' + '</Rectangle>';
        var newMarker = this.m_TargetControl.getHost().content.createFromXaml(xaml);
        var markerLeft = Math.min(Math.max(0, (p_Utterance.get_percent() * this.m_TargetControl.width) - (newMarker.width / 2)), this.m_TargetControl.width - newMarker.width);
        newMarker.setValue('Canvas.Left', markerLeft);
        (this.m_TargetControl).children.add(newMarker);
        var marker = new Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTimeLineMarker(newMarker);
        marker.set_utterance(p_Utterance);
        marker.mouseEnter.add(Function.createDelegate(this, this._marker_MouseEnter$1));
        marker.mouseLeave.add(Function.createDelegate(this, this._marker_MouseLeave$1));
        marker.click.add(Function.createDelegate(this, this._marker_Click$1));
        Array.add(this._m_Markers$1, marker);
        var zoomXaml = '<Storyboard xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" x:Name=\"MarkerAnimation_' + index + '\" >' + '<DoubleAnimation x:Name=\"_MarkerAnimationLeft_' + index + '\" Storyboard.TargetName=\"' + newMarker.name + '\" Storyboard.TargetProperty=\"(Canvas.Left)\" From=\"0.0\" To=\"0.0\" Duration=\"0:0:0.3\"  />' + '<DoubleAnimation x:Name=\"_MarkerAnimationWidth_' + index + '\" Storyboard.TargetName=\"' + newMarker.name + '\" Storyboard.TargetProperty=\"Width\" From=\"0.0\" To=\"0.0\" Duration=\"0:0:0.3\"  />' + '</Storyboard>';
        var markerAnimation = this.m_TargetControl.getHost().content.createFromXaml(zoomXaml);
        (this.m_TargetControl).resources.add(markerAnimation);
    },
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTimeLineMarkerContainer$initialize() {
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTimeLineMarkerContainer.callBaseMethod(this, 'initialize');
        this._m_BaseWidth$1 = this.get_width();
        this._m_BaseLeft$1 = this.get_left();
        this._m_MarkerConflictContainer$1 = this.m_TargetControl.getHost().content.findName('Timeline_MarkersConflictContainer');
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this._m_MarkerConflictContainer$1);
        this._m_MarkerConflictContainerMouseLeave$1 = this._m_MarkerConflictContainer$1.addEventListener('mouseLeave', Function.createDelegate(this, this._markerConflictContainerMouseLeave$1));
        this._m_ConflictFocusInAnimation$1 = this.m_TargetControl.getHost().content.findName('Timeline_MarkersConflictContainer_FocusIn');
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this._m_ConflictFocusInAnimation$1);
        this._m_ConflictFocusOutTimer$1 = this.m_TargetControl.getHost().content.findName('Timeline_MarkersConflictContainer_FocusOut');
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this._m_ConflictFocusOutTimer$1);
        this._m_ConflictFocusOut_Completed$1 = this._m_ConflictFocusOutTimer$1.addEventListener('completed', Function.createDelegate(this, this._conflictFocusOut_Completed$1));
        this._m_ConflictScaleAnimation$1 = this.m_TargetControl.getHost().content.findName('Timeline_MarkersConflictContainer_Scale');
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this._m_ConflictScaleAnimation$1);
        this._m_ContainerAnimation$1 = this.m_TargetControl.getHost().content.findName('Timeline_MarkerContainerAnimation');
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this._m_ContainerAnimation$1);
        this._m_ContainerAnimation_Completed$1 = this._m_ContainerAnimation$1.addEventListener('completed', Function.createDelegate(this, this._containerAnimation_Completed$1));
        this._m_ContainerDoubleAnimation$1 = this.m_TargetControl.getHost().content.findName('_Timeline_MarkerContainerAnimation');
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this._m_ContainerDoubleAnimation$1);
    },
    
    onMouseWheel: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTimeLineMarkerContainer$onMouseWheel(p_WheelDelta) {
        /// <param name="p_WheelDelta" type="Number" integer="true">
        /// </param>
        if (!this._m_ZoomOnMarkerConflict$1 && this._m_LastCursorPos$1 != null) {
            if (p_WheelDelta < 0) {
                if (this._m_LastZoomStartPos$1 != null) {
                    this._displayConflictRect$1(this._m_LastZoomStartPos$1, Coveo.CES.Web.Search.Scripts.Controls.Results.ZoomDirection.zoomOut);
                }
            }
            else {
                if (this._m_LastZoomStartPos$1 == null) {
                    this._m_LastZoomStartPos$1 = this._m_LastCursorPos$1;
                }
                this._displayConflictRect$1(this._m_LastZoomStartPos$1, Coveo.CES.Web.Search.Scripts.Controls.Results.ZoomDirection.zoomIn);
            }
        }
    },
    
    onMouseMove: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTimeLineMarkerContainer$onMouseMove(p_Args) {
        /// <param name="p_Args" type="MouseEventArgs">
        /// </param>
        this._m_LastCursorPos$1 = p_Args.getPosition(this.m_TargetControl);
    },
    
    onMouseLeave: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTimeLineMarkerContainer$onMouseLeave(p_Args) {
        /// <param name="p_Args" type="MouseEventArgs">
        /// </param>
        this._m_ScaleFactor$1 = 1;
        if (this._m_CanZoom$1) {
            this._renderFromScale$1(null);
        }
        else {
            this._m_DelayResetZoom$1 = true;
        }
    },
    
    _displayConflictRect$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTimeLineMarkerContainer$_displayConflictRect$1(p_Point, p_Direction) {
        /// <summary>
        /// Renders the markers on a different scale when a conflict is detected.
        /// </summary>
        /// <param name="p_Point" type="Point">
        /// The actual mouse position.
        /// </param>
        /// <param name="p_Direction" type="Coveo.CES.Web.Search.Scripts.Controls.Results.ZoomDirection">
        /// The <see cref="T:Coveo.CES.Web.Search.Scripts.Controls.Results.ZoomDirection" /> value.
        /// </param>
        if (!this._m_CanZoom$1) {
            return;
        }
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(p_Point);
        if (p_Direction === Coveo.CES.Web.Search.Scripts.Controls.Results.ZoomDirection.zoomIn) {
            this._m_ScaleFactor$1 = this._m_ScaleFactor$1 + 1;
            this._renderFromScale$1(p_Point);
        }
        else {
            this._m_ScaleFactor$1 = Math.max(1, this._m_ScaleFactor$1 - 1);
            if (this._m_ScaleFactor$1 === 1) {
                this._renderFromScale$1(null);
            }
            else {
                this._renderFromScale$1(p_Point);
            }
        }
    },
    
    _renderFromScale$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTimeLineMarkerContainer$_renderFromScale$1(p_Point) {
        /// <summary>
        /// Renders the markers according to the current scale.
        /// </summary>
        /// <param name="p_Point" type="Point">
        /// The actual mouse position. This value can be null.
        /// </param>
        Coveo.CNL.Web.Scripts.CNLAssert.check(this._m_CanZoom$1);
        this._m_DelayResetZoom$1 = false;
        var newLeft = this._m_BaseLeft$1;
        if (p_Point == null) {
            Coveo.CNL.Web.Scripts.CNLAssert.check(this._m_ScaleFactor$1 === 1);
            this.set_width(this._m_BaseWidth$1);
            this._m_LastZoomStartPos$1 = null;
        }
        else {
            Coveo.CNL.Web.Scripts.CNLAssert.check(p_Point != null);
            var currentLeft = this.get_left();
            var pointRatio = p_Point.x / this.get_width();
            this.set_width(this._m_BaseWidth$1 * this._m_ScaleFactor$1);
            var newPointPos = pointRatio * this.get_width();
            var threshhold = newPointPos - p_Point.x;
            newLeft = currentLeft - threshhold;
        }
        this._m_ContainerDoubleAnimation$1.from = this.get_left();
        this._m_ContainerDoubleAnimation$1.to = newLeft;
        if (this._m_LastZoomStartPos$1 != null) {
            this._m_LastZoomStartPos$1.x -= Math.round(newLeft - this.get_left());
        }
        this._m_CanZoom$1 = false;
        (this._m_ContainerAnimation$1).begin();
        var index = 0;
        for (var i = 0; i < this._m_Markers$1.length; i++) {
            var marker = this._m_Markers$1[i];
            var markerWidth = Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTimeLineMarkerContainer._markeR_WIDTH$1 * this._m_ScaleFactor$1;
            var doubleAnimationWidth = this.m_TargetControl.findName('_MarkerAnimationWidth_' + index);
            Coveo.CNL.Web.Scripts.CNLAssert.notNull(doubleAnimationWidth);
            (doubleAnimationWidth).from = marker.get_width();
            (doubleAnimationWidth).to = markerWidth;
            var markerLeft = Math.min(Math.max(0, (marker.get_utterance().get_percent() * this.get_width()) - (markerWidth / 2)), this.get_width() - markerWidth);
            var doubleAnimationLeft = this.m_TargetControl.findName('_MarkerAnimationLeft_' + index);
            Coveo.CNL.Web.Scripts.CNLAssert.notNull(doubleAnimationLeft);
            (doubleAnimationLeft).from = marker.get_left();
            (doubleAnimationLeft).to = markerLeft;
            var animation = this.m_TargetControl.findName('MarkerAnimation_' + index);
            Coveo.CNL.Web.Scripts.CNLAssert.notNull(animation);
            (animation).begin();
            index++;
        }
    },
    
    _marker_MouseEnter$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTimeLineMarkerContainer$_marker_MouseEnter$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="MouseEventArgs">
        /// </param>
        var conflict = false;
        if (this._m_ZoomOnMarkerConflict$1) {
            var currentMarkerLeft = (p_Sender).get_left();
            for (var i = 0; i < this._m_Markers$1.length; i++) {
                var marker = this._m_Markers$1[i];
                var markerLeft = marker.get_left();
                if (((currentMarkerLeft < markerLeft) && ((currentMarkerLeft + Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTimeLineMarkerContainer._markeR_WIDTH$1 / 2) > markerLeft)) || ((currentMarkerLeft > markerLeft) && ((markerLeft + Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTimeLineMarkerContainer._markeR_WIDTH$1 / 2) > currentMarkerLeft))) {
                    conflict = true;
                    break;
                }
            }
        }
        if (conflict) {
            this._displayConflictRect$1(p_Args.getPosition(this.m_TargetControl), Coveo.CES.Web.Search.Scripts.Controls.Results.ZoomDirection.zoomIn);
        }
        var currentMarker = p_Sender;
        if (this.utteranceHighlighted.isDefined()) {
            this.utteranceHighlighted.invoke(this, currentMarker.get_utterance());
        }
    },
    
    _marker_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTimeLineMarkerContainer$_marker_Click$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="EventArgs">
        /// </param>
        if (this.utteranceClick.isDefined()) {
            this.utteranceClick.invoke(this, (p_Sender).get_utterance());
        }
    },
    
    _marker_MouseLeave$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTimeLineMarkerContainer$_marker_MouseLeave$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="MouseEventArgs">
        /// </param>
        if (this.utteranceHighlighted.isDefined()) {
            this.utteranceHighlighted.invoke(this, null);
        }
    },
    
    _markerConflictContainerMouseLeave$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTimeLineMarkerContainer$_markerConflictContainerMouseLeave$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="MouseEventArgs">
        /// </param>
        (this._m_ConflictFocusOutTimer$1).begin();
    },
    
    _containerAnimation_Completed$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTimeLineMarkerContainer$_containerAnimation_Completed$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="EventArgs">
        /// </param>
        this.ensureBoudaries();
        this._m_CanZoom$1 = true;
        if (this._m_DelayResetZoom$1) {
            this._renderFromScale$1(null);
        }
    },
    
    _conflictFocusOut_Completed$1: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightTimeLineMarkerContainer$_conflictFocusOut_Completed$1(p_Sender, p_Args) {
        /// <param name="p_Sender" type="Object">
        /// </param>
        /// <param name="p_Args" type="EventArgs">
        /// </param>
        this._m_MarkerConflictContainer$1.setValue('Visibility', 'collapsed');
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtterance

Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtterance = function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightUtterance(p_Start, p_Percent, p_Excerpt) {
    /// <summary>
    /// This class contains all the information related to a media excerpt.
    /// </summary>
    /// <param name="p_Start" type="Number">
    /// Start time in seconds of the excerpt.
    /// </param>
    /// <param name="p_Percent" type="Number">
    /// Start time of the excerpt represented as a percentage
    /// </param>
    /// <param name="p_Excerpt" type="String">
    /// The content of the excerpt.
    /// </param>
    /// <field name="_m_Start$1" type="Number">
    /// </field>
    /// <field name="_m_Percent$1" type="Number">
    /// </field>
    /// <field name="_m_Excerpt$1" type="String">
    /// </field>
    /// <field name="_m_Data$1" type="Object">
    /// </field>
    /// <field name="m_OnUtteranceDivClick" type="DOMEventHandler">
    /// </field>
    /// <field name="m_OnUtteranceDivMouseOver" type="DOMEventHandler">
    /// </field>
    /// <field name="m_OnUtteranceDivMouseOut" type="DOMEventHandler">
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtterance.initializeBase(this);
    Coveo.CNL.Web.Scripts.CNLAssert.check(p_Start >= 0);
    Coveo.CNL.Web.Scripts.CNLAssert.check(p_Percent >= 0 && p_Percent <= 1);
    Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(p_Excerpt);
    this._m_Start$1 = p_Start;
    this._m_Percent$1 = p_Percent;
    this._m_Excerpt$1 = p_Excerpt;
}
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtterance.prototype = {
    _m_Start$1: 0,
    _m_Percent$1: 0,
    _m_Excerpt$1: null,
    _m_Data$1: null,
    m_OnUtteranceDivClick: null,
    m_OnUtteranceDivMouseOver: null,
    m_OnUtteranceDivMouseOut: null,
    
    get_start: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightUtterance$get_start() {
        /// <summary>
        /// Gets the start time of the excerpt in seconds.
        /// </summary>
        /// <value type="Number"></value>
        return this._m_Start$1;
    },
    
    get_percent: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightUtterance$get_percent() {
        /// <summary>
        /// Gets the start time of the excerpt.
        /// </summary>
        /// <value type="Number"></value>
        return this._m_Percent$1;
    },
    
    get_excerpt: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightUtterance$get_excerpt() {
        /// <summary>
        /// Gets the excerpt content.
        /// </summary>
        /// <value type="String"></value>
        return this._m_Excerpt$1;
    },
    
    get_data: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightUtterance$get_data() {
        /// <summary>
        /// Gets the user data object attached to the object.
        /// </summary>
        /// <value type="Object"></value>
        return this._m_Data$1;
    },
    set_data: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightUtterance$set_data(value) {
        /// <summary>
        /// Gets the user data object attached to the object.
        /// </summary>
        /// <value type="Object"></value>
        this._m_Data$1 = value;
        return value;
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtteranceTextEntry

Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtteranceTextEntry = function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightUtteranceTextEntry(p_TargetControl) {
    /// <summary>
    /// This class renders a <see cref="T:Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtterance" /> within a <see cref="T:Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextContainer" />.
    /// </summary>
    /// <param name="p_TargetControl" type="UIElement">
    /// </param>
    /// <field name="_mousE_ENTER_TEXT_COLOR$2" type="String" static="true">
    /// </field>
    /// <field name="_mousE_LEAVE_TEXT_COLOR$2" type="String" static="true">
    /// </field>
    /// <field name="_selecteD_COLOR$2" type="String" static="true">
    /// </field>
    /// <field name="_selecteD_TEXT_COLOR$2" type="String" static="true">
    /// </field>
    /// <field name="_m_TextBlock$2" type="TextBlock">
    /// </field>
    /// <field name="_m_TextContainer$2" type="Canvas">
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtteranceTextEntry.initializeBase(this, [ p_TargetControl ]);
}
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtteranceTextEntry.prototype = {
    _m_TextBlock$2: null,
    _m_TextContainer$2: null,
    
    get_width: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightUtteranceTextEntry$get_width() {
        /// <value type="Number"></value>
        return Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtteranceTextEntry.callBaseMethod(this, 'get_width');
    },
    set_width: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightUtteranceTextEntry$set_width(value) {
        /// <value type="Number"></value>
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtteranceTextEntry.callBaseMethod(this, 'set_width', [ value ]);
        this.set_text(this.get_text());
        return value;
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightUtteranceTextEntry$tearDown() {
        this._m_TextBlock$2 = null;
        this._m_TextContainer$2 = null;
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtteranceTextEntry.callBaseMethod(this, 'tearDown');
    },
    
    highlight: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightUtteranceTextEntry$highlight() {
        (this._m_TextBlock$2.foreground).color = Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtteranceTextEntry._mousE_ENTER_TEXT_COLOR$2;
    },
    
    undoHighlight: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightUtteranceTextEntry$undoHighlight() {
        this.renderControl();
    },
    
    buildTextControl: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightUtteranceTextEntry$buildTextControl() {
        (this.m_TargetControl).children.clear();
        var utt = this.get_data();
        var datetime = new Date(0, 0, 0, 0, 0, utt.get_start());
        var time = Coveo.CNL.Web.Scripts.Utilities.padLeft(datetime.getHours().toString(), 2, '0') + ':' + Coveo.CNL.Web.Scripts.Utilities.padLeft(datetime.getMinutes().toString(), 2, '0') + ':' + Coveo.CNL.Web.Scripts.Utilities.padLeft(datetime.getSeconds().toString(), 2, '0');
        var targetWidth = this.m_TargetControl.width - 2;
        var containerXaml = '<Canvas xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"/>';
        this._m_TextContainer$2 = this.m_TargetControl.getHost().content.createFromXaml(containerXaml);
        var xaml = '<TextBlock xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" TextWrapping=\"Wrap\" FontFamily=\"Verdana\" FontSize=\"11\" Foreground=\"' + Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtteranceTextEntry._mousE_LEAVE_TEXT_COLOR$2 + '\" Canvas.Left=\"3\" Width=\"' + (targetWidth - 3) + '\" Cursor=\"Hand\"><Run FontWeight=\"Bold\">' + time + '</Run> ' + utt.get_excerpt() + '</TextBlock>';
        this._m_TextBlock$2 = this.m_TargetControl.getHost().content.createFromXaml(xaml);
        this._m_TextContainer$2.children.add(this._m_TextBlock$2);
        this._m_TextContainer$2.height = this._m_TextBlock$2.actualHeight;
        this._m_TextContainer$2.width = this.m_TargetControl.width;
        (this.m_TargetControl).children.add(this._m_TextContainer$2);
        var lineXaml = '<Line Fill=\"#FFFFFFFF\" Stretch=\"Fill\" Stroke=\"#FFCCCCCC\" StrokeLineJoin=\"Round\" StrokeThickness=\"1.33333\"/>';
        var lineWidth = this.m_TargetControl.width;
        var line = this.m_TargetControl.getHost().content.createFromXaml(lineXaml);
        line.x1 = 0;
        line.x2 = line.x1 + lineWidth;
        line.y1 = this._m_TextContainer$2.height + 4;
        line.y2 = line.y1;
        (this.m_TargetControl).children.add(line);
        this.set_height(this._m_TextContainer$2.height + 4 + line.height + 4);
    },
    
    renderControl: function Coveo_CES_Web_Search_Scripts_Controls_Results_SilverlightUtteranceTextEntry$renderControl() {
        Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtteranceTextEntry.callBaseMethod(this, 'renderControl');
        if (this.get_selected()) {
            var xaml = '<SolidColorBrush Color=\"' + Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtteranceTextEntry._selecteD_COLOR$2 + '\" />';
            this._m_TextContainer$2.background = this.m_TargetControl.getHost().content.createFromXaml(xaml);
            (this._m_TextBlock$2.foreground).color = Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtteranceTextEntry._selecteD_TEXT_COLOR$2;
        }
        else {
            this._m_TextContainer$2.background = null;
            (this._m_TextBlock$2.foreground).color = Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtteranceTextEntry._mousE_LEAVE_TEXT_COLOR$2;
        }
    }
}


Type.registerNamespace('Coveo.CES.Web.Search.Scripts.Controls.SharePoint');

////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ResultContextualMenu

Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ResultContextualMenu = function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ResultContextualMenu() {
    /// <summary>
    /// This class represents the associated Javascript object for the control
    /// used to render the SharePoint contextual menus.
    /// </summary>
    /// <field name="_VERSION$1" type="String" static="true">
    /// </field>
    /// <field name="_sP_MENU_COLOR$1" type="String" static="true">
    /// </field>
    /// <field name="_m_OnMouseOver$1" type="DOMEventHandler">
    /// </field>
    /// <field name="_m_OnMouseOut$1" type="DOMEventHandler">
    /// </field>
    /// <field name="_m_OnDwellEvent$1" type="Coveo.CNL.Web.Scripts.OnDwellEvent">
    /// </field>
    /// <field name="_m_Request$1" type="XMLHttpRequest">
    /// </field>
    /// <field name="_m_IsBusy$1" type="Boolean">
    /// </field>
    /// <field name="_m_QueryDone$1" type="Boolean">
    /// </field>
    /// <field name="_m_MouseIsOver$1" type="Boolean">
    /// </field>
    /// <field name="_m_ContextIsInvalid$1" type="Boolean">
    /// </field>
    /// <field name="m_Target" type="Object" domElement="true">
    /// </field>
    /// <field name="m_SPTable" type="Object" domElement="true">
    /// </field>
    /// <field name="m_SPTableImage" type="Object" domElement="true">
    /// </field>
    /// <field name="m_SiteUri" type="String">
    /// </field>
    /// <field name="m_ListId" type="String">
    /// </field>
    /// <field name="m_ListItemId" type="String">
    /// </field>
    /// <field name="m_ShowDelay" type="Number" integer="true">
    /// </field>
    /// <field name="m_BorderColor" type="String">
    /// </field>
    /// <field name="m_FileName" type="String">
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ResultContextualMenu.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ResultContextualMenu.prototype = {
    _m_OnMouseOver$1: null,
    _m_OnMouseOut$1: null,
    _m_OnDwellEvent$1: null,
    _m_Request$1: null,
    _m_IsBusy$1: false,
    _m_QueryDone$1: false,
    _m_MouseIsOver$1: false,
    _m_ContextIsInvalid$1: false,
    m_Target: null,
    m_SPTable: null,
    m_SPTableImage: null,
    m_SiteUri: null,
    m_ListId: null,
    m_ListItemId: null,
    m_ShowDelay: 0,
    m_BorderColor: null,
    m_FileName: null,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ResultContextualMenu$initialize() {
        Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ResultContextualMenu.callBaseMethod(this, 'initialize');
        Coveo.CNL.Web.Scripts.CNLAssert.check(this.m_ShowDelay > 0);
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_SPTable);
        this._m_OnDwellEvent$1 = new Coveo.CNL.Web.Scripts.OnDwellEvent(this.m_SPTable, this.m_ShowDelay, Function.createDelegate(this, this._spTable_OnDwell$1));
        this._m_OnMouseOver$1 = Function.createDelegate(this, this._onMouseOver$1);
        this._m_OnMouseOut$1 = Function.createDelegate(this, this._onMouseOut$1);
        this.m_Target.attachEvent('onmouseover', this._m_OnMouseOver$1);
        this.m_Target.attachEvent('onmouseout', this._m_OnMouseOut$1);
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ResultContextualMenu$tearDown() {
        this._m_OnDwellEvent$1.dispose();
        this._m_OnDwellEvent$1 = null;
        this.m_Target.detachEvent('onmouseover', this._m_OnMouseOver$1);
        this.m_Target.detachEvent('onmouseout', this._m_OnMouseOut$1);
        this._m_Request$1 = null;
        Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ResultContextualMenu.callBaseMethod(this, 'tearDown');
    },
    
    _spTable_OnDwell$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ResultContextualMenu$_spTable_OnDwell$1() {
        if (!this._m_QueryDone$1) {
            this._doBeforeMouseOver$1();
        }
    },
    
    _onMouseOver$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ResultContextualMenu$_onMouseOver$1() {
        this._m_MouseIsOver$1 = true;
        if (this._m_QueryDone$1) {
            this._handleSPOnItem$1();
        }
    },
    
    _onMouseOut$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ResultContextualMenu$_onMouseOut$1() {
        this._m_MouseIsOver$1 = !this._isMouseReallyOut$1(window.event, this.m_Target);
        if (!this._m_MouseIsOver$1) {
            this._resetBorder$1();
        }
    },
    
    _resetBorder$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ResultContextualMenu$_resetBorder$1() {
        /// <summary>
        /// Resets the table border after the menu has been displayed. This method
        /// is called after the mouse has exited the control area. However, when the
        /// menu is displayed, a timeout mecanism is started to automatically hide
        /// the menu since the mouse is already outside the control boundaries.
        /// </summary>
        if (this.m_SPTableImage.style.visibility === 'hidden') {
            var resetTimeOut = document.body.getAttribute(this.m_Target.id + 'ResetBorderTimeOut');
            if (resetTimeOut != null) {
                window.clearTimeout(resetTimeOut);
            }
            document.body.removeAttribute(this.m_Target.id + 'ResetBorderTimeOut');
            Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(this.m_BorderColor);
            this.m_SPTable.style.borderLeftColor = this.m_BorderColor;
            this.m_SPTable.style.borderTopColor = this.m_BorderColor;
            this.m_SPTable.style.borderRightColor = this.m_BorderColor;
            this.m_SPTable.style.borderBottomColor = this.m_BorderColor;
        }
        else {
            document.body.setAttribute(this.m_Target.id + 'ResetBorderTimeOut', window.setTimeout(Function.createDelegate(this, this._resetBorder$1), 500));
        }
    },
    
    _isMouseReallyOut$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ResultContextualMenu$_isMouseReallyOut$1(p_Event, p_Target) {
        /// <summary>
        /// This function determines if the mouse is really outside the control
        /// boundaries. The <b>mouseout</b> event is triggered when the cursor
        /// pass from the current control to a child control and vice-versa.
        /// </summary>
        /// <param name="p_Event" type="Event">
        /// The triggered event.
        /// </param>
        /// <param name="p_Target" type="Object" domElement="true">
        /// The element from which the event was triggered.
        /// </param>
        /// <returns type="Boolean"></returns>
        var relatedTarget = p_Event.toElement;
        while (relatedTarget != null && relatedTarget !== p_Target) {
            relatedTarget = relatedTarget.parentNode;
        }
        return relatedTarget !== p_Target;
    },
    
    _doBeforeMouseOver$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ResultContextualMenu$_doBeforeMouseOver$1() {
        /// <summary>
        /// Prefetch contextual menu information from the installed service.
        /// </summary>
        if (this._m_IsBusy$1) {
            return;
        }
        this._m_IsBusy$1 = true;
        if (this._m_Request$1 == null) {
            this._m_Request$1 = new XMLHttpRequest();
            this._m_Request$1.onreadystatechange = Function.createDelegate(this, this._onRequestComplete$1);
        }
        this._m_Request$1.open('GET', String.format(this.m_SiteUri + '/_layouts/CES/AttributesSelector.aspx?ListItemId={0}&ListId={1}&Dummy={2}', this.m_ListItemId, this.m_ListId, new Date().toString()), true);
        this._m_Request$1.send(null);
    },
    
    _onRequestComplete$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ResultContextualMenu$_onRequestComplete$1() {
        /// <summary>
        /// Update the control with the contextual menu informations received from
        /// the installed service.
        /// </summary>
        if (this._m_Request$1.readyState === 4) {
            this._m_QueryDone$1 = true;
            var xml = this._m_Request$1.responseXML;
            var versionNode = xml.selectSingleNode('/ItemAttributes/Version');
            if ((versionNode == null) || (versionNode.attributes.getNamedItem('Value').text !== Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ResultContextualMenu._VERSION$1)) {
                this._m_ContextIsInvalid$1 = true;
                return;
            }
            var errorNode = xml.selectSingleNode('/ItemAttributes/Error');
            if (errorNode != null) {
                this._m_ContextIsInvalid$1 = true;
                return;
            }
            var nodes = xml.selectNodes('/ItemAttributes/ItemAttribute');
            for (var i = 0; i <= nodes.length - 1; i++) {
                var node = nodes[i];
                var fieldName = node.attributes.getNamedItem('FieldName').text;
                var value = node.attributes.getNamedItem('Value').text;
                if (fieldName === Coveo.CES.Web.Search.SharePoint.SharePointItemAttributes.lisT_VERSION_ENABLED) {
                    eval('var setEnabledVersion = new Function(\"' + this.m_SPTable.getAttribute('CTXName') + '.verEnabled = ' + value + ';\"); setEnabledVersion();');
                }
                else if (fieldName === Coveo.CES.Web.Search.SharePoint.SharePointItemAttributes.lisT_IS_FORCE_CHECKOUT) {
                    eval('var setIsForceCheckout = new Function(\"' + this.m_SPTable.getAttribute('CTXName') + '.isForceCheckout = ' + value + ';\"); setIsForceCheckout();');
                }
                else if (fieldName === Coveo.CES.Web.Search.SharePoint.SharePointItemAttributes.lisT_ENABLE_MINOR_VERSIONS) {
                    eval('var setEnableMinorVersions = new Function(\"' + this.m_SPTable.getAttribute('CTXName') + '.EnableMinorVersions = ' + value + ';\"); setEnableMinorVersions();');
                }
                else if (fieldName === Coveo.CES.Web.Search.SharePoint.SharePointItemAttributes.lisT_CONTENT_TYPES_ENABLED) {
                    eval('var setContentTypesEnabled = new Function(\"' + this.m_SPTable.getAttribute('CTXName') + '.ContentTypesEnabled = ' + value + ';\"); setContentTypesEnabled();');
                }
                else if (fieldName === Coveo.CES.Web.Search.SharePoint.SharePointItemAttributes.lisT_BASE_TYPE) {
                    eval('var setListBaseType = new Function(\"' + this.m_SPTable.getAttribute('CTXName') + '.listBaseType = ' + value + ';\"); setListBaseType();');
                }
                else if (fieldName === Coveo.CES.Web.Search.SharePoint.SharePointItemAttributes.lisT_BASE_TEMPLATE) {
                    eval('var setListBaseTemplate = new Function(\"' + this.m_SPTable.getAttribute('CTXName') + '.listTemplate = ' + value + ';\"); setListBaseTemplate();');
                }
                else if (fieldName === Coveo.CES.Web.Search.SharePoint.SharePointItemAttributes.lisT_WRITE_SECURITY) {
                    eval('var setWriteSecurity = new Function(\"' + this.m_SPTable.getAttribute('CTXName') + '.WriteSecurity = ' + value + ';\"); setWriteSecurity();');
                }
                else if (fieldName === Coveo.CES.Web.Search.SharePoint.SharePointItemAttributes.lisT_USER_ID) {
                    eval('var setUserID = new Function(\"' + this.m_SPTable.getAttribute('CTXName') + '.CurrentUserID = ' + value + ';\"); setUserID();');
                }
                else if (fieldName === Coveo.CES.Web.Search.SharePoint.SharePointItemAttributes.d_REF) {
                    var url = value;
                    if (!url.startsWith('/')) {
                        url = '/' + url;
                    }
                    if (!url.endsWith('/')) {
                        url += '/';
                    }
                    url += this.m_FileName;
                    this.m_SPTable.setAttribute('Url', url);
                    this.m_SPTable.setAttribute(fieldName, value);
                }
                else {
                    this.m_SPTable.setAttribute(fieldName, value);
                }
            }
            this._m_IsBusy$1 = false;
            if (this._m_MouseIsOver$1) {
                this._handleSPOnItem$1();
            }
        }
    },
    
    _handleSPOnItem$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ResultContextualMenu$_handleSPOnItem$1() {
        /// <summary>
        /// Call the SharePoint Javascript method that renders the contextual menu.
        /// </summary>
        if (!this._m_ContextIsInvalid$1) {
            this.m_SPTable.style.borderLeftColor = Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ResultContextualMenu._sP_MENU_COLOR$1;
            this.m_SPTable.style.borderTopColor = Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ResultContextualMenu._sP_MENU_COLOR$1;
            this.m_SPTable.style.borderRightColor = Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ResultContextualMenu._sP_MENU_COLOR$1;
            this.m_SPTable.style.borderBottomColor = Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ResultContextualMenu._sP_MENU_COLOR$1;
            OnItem(this.m_SPTable);
        }
    }
}


Type.registerNamespace('Coveo.CES.Web.Search.Scripts');

////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.SharePointItemUtilities

Coveo.CES.Web.Search.Scripts.SharePointItemUtilities = function Coveo_CES_Web_Search_Scripts_SharePointItemUtilities() {
    /// <summary>
    /// Client side code for the SearchControl control.
    /// </summary>
}
Coveo.CES.Web.Search.Scripts.SharePointItemUtilities.viewDocument = function Coveo_CES_Web_Search_Scripts_SharePointItemUtilities$viewDocument(p_Uri, p_Window) {
    /// <summary>
    /// Opens a SharePoint document for viewing.
    /// </summary>
    /// <param name="p_Uri" type="String">
    /// The uri of the document to open.
    /// </param>
    /// <param name="p_Window" type="WindowInstance">
    /// The window that opens the document.
    /// </param>
    var res = false;
    var obj = Coveo.CES.Web.Search.Scripts.SharePointItemUtilities._getOpenDocuments();
    if (obj != null) {
        try {
            res = obj.viewDocument2(p_Window, p_Uri);
        }
        catch ($e1) {
            try {
                res = obj.viewDocument(p_Uri);
            }
            catch ($e2) {
                res = false;
            }
        }
    }
    if (obj == null || !res) {
        p_Window.navigate(p_Uri);
    }
}
Coveo.CES.Web.Search.Scripts.SharePointItemUtilities.editDocument = function Coveo_CES_Web_Search_Scripts_SharePointItemUtilities$editDocument(p_Uri, p_Window) {
    /// <summary>
    /// Opens a SharePoint document for editing.
    /// </summary>
    /// <param name="p_Uri" type="String">
    /// The uri of the document to open.
    /// </param>
    /// <param name="p_Window" type="WindowInstance">
    /// The window that opens the document.
    /// </param>
    var obj = Coveo.CES.Web.Search.Scripts.SharePointItemUtilities._getOpenDocuments();
    if (obj != null) {
        try {
            obj.editDocument2(p_Window, p_Uri);
        }
        catch ($e1) {
            obj.editDocument(p_Uri);
        }
    }
    else {
        Coveo.CES.Web.Search.Scripts.SharePointItemUtilities.viewDocument(p_Uri, p_Window);
    }
}
Coveo.CES.Web.Search.Scripts.SharePointItemUtilities._getOpenDocuments = function Coveo_CES_Web_Search_Scripts_SharePointItemUtilities$_getOpenDocuments() {
    /// <summary>
    /// Attempts to create an SharePoint.OpenDocuments object.
    /// </summary>
    /// <returns type="SharePointOpenDocuments"></returns>
    var obj;
    try {
        obj = new ActiveXObject('SharePoint.OpenDocuments.2');
    }
    catch ($e1) {
        try {
            obj = new ActiveXObject('SharePoint.OpenDocuments.1');
        }
        catch ($e2) {
            try {
                obj = new ActiveXObject('SharePoint.OpenDocuments');
            }
            catch ($e3) {
                obj = null;
            }
        }
    }
    return obj;
}


Coveo.CES.Common.SearchInterfaceQueryString.registerClass('Coveo.CES.Common.SearchInterfaceQueryString');
Coveo.CES.Web.Search.SharePoint.SharePointItemAttributes.registerClass('Coveo.CES.Web.Search.SharePoint.SharePointItemAttributes');
Coveo.CES.Web.Search.Scripts.Controls.FacetScript.registerClass('Coveo.CES.Web.Search.Scripts.Controls.FacetScript', Coveo.CNL.Web.Scripts.Ajax.AjaxObjectScript);
Coveo.CES.Web.Search.Scripts.Controls.ContextualDropDownScript.registerClass('Coveo.CES.Web.Search.Scripts.Controls.ContextualDropDownScript', Coveo.CNL.Web.Scripts.Ajax.AjaxObjectScript);
Coveo.CES.Web.Search.Scripts.Controls.SearchControlScript.registerClass('Coveo.CES.Web.Search.Scripts.Controls.SearchControlScript', Coveo.CNL.Web.Scripts.Ajax.AjaxObjectScript);
Coveo.CES.Web.Search.Scripts.Controls.CloseModalBoxLinkScript.registerClass('Coveo.CES.Web.Search.Scripts.Controls.CloseModalBoxLinkScript', Coveo.CNL.Web.Scripts.Ajax.AjaxObjectScript);
Coveo.CES.Web.Search.Scripts.Controls.SharePointSearchBoxScript.registerClass('Coveo.CES.Web.Search.Scripts.Controls.SharePointSearchBoxScript', Coveo.CNL.Web.Scripts.Ajax.AjaxObjectScript);
Coveo.CES.Web.Search.Scripts.Controls.SearchBoxScript.registerClass('Coveo.CES.Web.Search.Scripts.Controls.SearchBoxScript', Coveo.CNL.Web.Scripts.Ajax.AjaxObjectScript);
Coveo.CES.Web.Search.Scripts.Controls.PrefetchTermScript.registerClass('Coveo.CES.Web.Search.Scripts.Controls.PrefetchTermScript', Coveo.CNL.Web.Scripts.Ajax.AjaxObjectScript);
Coveo.CES.Web.Search.Scripts.Controls.QueryScript.registerClass('Coveo.CES.Web.Search.Scripts.Controls.QueryScript', Coveo.CNL.Web.Scripts.Ajax.AjaxObjectScript);
Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript.registerClass('Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript', Coveo.CNL.Web.Scripts.Ajax.AjaxObjectScript);
Coveo.CES.Web.Search.Scripts.Controls.HighlightedQueryScript.registerClass('Coveo.CES.Web.Search.Scripts.Controls.HighlightedQueryScript', Coveo.CNL.Web.Scripts.Ajax.AjaxObjectScript);
Coveo.CES.Web.Search.Scripts.Controls.PlayerScript.registerClass('Coveo.CES.Web.Search.Scripts.Controls.PlayerScript', Coveo.CNL.Web.Scripts.Ajax.AjaxObjectScript);
Coveo.CES.Web.Search.Scripts.Controls.ResultPlayerScript.registerClass('Coveo.CES.Web.Search.Scripts.Controls.ResultPlayerScript', Coveo.CNL.Web.Scripts.Ajax.AjaxObjectScript);
Coveo.CES.Web.Search.Scripts.Controls.ViewAsHtmlPanelScript.registerClass('Coveo.CES.Web.Search.Scripts.Controls.ViewAsHtmlPanelScript', Coveo.CNL.Web.Scripts.Ajax.AjaxObjectScript);
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightCustomControl.registerClass('Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightCustomControl');
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightButton.registerClass('Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightButton', Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightCustomControl);
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightAnimatedButton.registerClass('Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightAnimatedButton', Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightButton);
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightDebug.registerClass('Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightDebug', Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightCustomControl);
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightExcerptTooltip.registerClass('Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightExcerptTooltip', Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightCustomControl);
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightPlayerControl.registerClass('Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightPlayerControl', Coveo.CNL.Web.Scripts.Ajax.AjaxObjectScript);
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightPlayPauseButton.registerClass('Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightPlayPauseButton', Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightAnimatedButton);
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgress.registerClass('Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightProgress', Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightCustomControl);
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightScrollArea.registerClass('Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightScrollArea', Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightCustomControl);
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightSymbolButton.registerClass('Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightSymbolButton', Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightButton);
Coveo.CES.Web.Search.Scripts.Controls.Results.TextContainerEventArgs.registerClass('Coveo.CES.Web.Search.Scripts.Controls.Results.TextContainerEventArgs', Sys.EventArgs);
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextContainer.registerClass('Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextContainer', Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightCustomControl);
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextEntry.registerClass('Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextEntry', Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightCustomControl);
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextTime.registerClass('Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextTime', Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightCustomControl);
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTimeLineMarker.registerClass('Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTimeLineMarker', Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightCustomControl);
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTimeLineMarkerContainer.registerClass('Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTimeLineMarkerContainer', Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightCustomControl);
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtterance.registerClass('Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtterance', Sys.EventArgs);
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtteranceTextEntry.registerClass('Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtteranceTextEntry', Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextEntry);
Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ResultContextualMenu.registerClass('Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ResultContextualMenu', Coveo.CNL.Web.Scripts.Ajax.AjaxObjectScript);
Coveo.CES.Web.Search.Scripts.SharePointItemUtilities.registerClass('Coveo.CES.Web.Search.Scripts.SharePointItemUtilities');
Coveo.CES.Common.SearchInterfaceQueryString.queryParameter = 'q';
Coveo.CES.Common.SearchInterfaceQueryString.conversationSubjectParameter = 'convsj';
Coveo.CES.Common.SearchInterfaceQueryString.targetFrameParameter = 'f';
Coveo.CES.Common.SearchInterfaceQueryString.oldOutlookAddInVersion = 'oaiv';
Coveo.CES.Common.SearchInterfaceQueryString.collectionNamesParameter = 'c';
Coveo.CES.Common.SearchInterfaceQueryString.collectionIdsParameter = 'ci';
Coveo.CES.Common.SearchInterfaceQueryString.initialScopeParameter = 'sc';
Coveo.CES.Common.SearchInterfaceQueryString.timeZoneOffsetParameter = 't';
Coveo.CES.Common.SearchInterfaceQueryString.lcidParameter = 'lcid';
Coveo.CES.Common.SearchInterfaceQueryString.stateParameter = 's';
Coveo.CES.Common.SearchInterfaceQueryString.sessionGuidParameter = 'sg';
Coveo.CES.Common.SearchInterfaceQueryString.interfaceNameParameter = 'sk';
Coveo.CES.Common.SearchInterfaceQueryString.iconSizeParameter = 'is';
Coveo.CES.Common.SearchInterfaceQueryString.superUserTokenParameter = 'sut';
Coveo.CES.Common.SearchInterfaceQueryString.quirksModeParameter = 'qm';
Coveo.CES.Common.SearchInterfaceQueryString.hubNameParameter = 'sh';
Coveo.CES.Common.SearchInterfaceQueryString.documentIdParameter = 'docid';
Coveo.CES.Common.SearchInterfaceQueryString.mirrorIdParameter = 'mir';
Coveo.CES.Common.SearchInterfaceQueryString.wildcardsParameter = 'wld';
Coveo.CES.Common.SearchInterfaceQueryString.improveReadabilityParameter = 'rdb';
Coveo.CES.Common.SearchInterfaceQueryString.customContentRelayParameter = 'ccr';
Coveo.CES.Common.SearchInterfaceQueryString.xmlSearchParameter = 'xml';
Coveo.CES.Common.SearchInterfaceQueryString.exportToExcelParameter = 'xls';
Coveo.CES.Common.SearchInterfaceQueryString.openSearchParameter = 'opensearch';
Coveo.CES.Common.SearchInterfaceQueryString.desktopSearchParameter = 'desktopsearch';
Coveo.CES.Common.SearchInterfaceQueryString.wakeUpParameter = 'wakeup';
Coveo.CES.Common.SearchInterfaceQueryString.showDebugInfoParameter = 'debug';
Coveo.CES.Common.SearchInterfaceQueryString.emailAddressParameter = 'ea';
Coveo.CES.Common.SearchInterfaceQueryString.searchBarParameter = 'searchbar';
Coveo.CES.Common.SearchInterfaceQueryString.searchBarInfoParameter = 'searchbarinfo';
Coveo.CES.Common.SearchInterfaceQueryString.searchBarVersionParameter = 'searchbarversion';
Coveo.CES.Common.SearchInterfaceQueryString.outlookAddInParameter = 'outlookaddin';
Coveo.CES.Common.SearchInterfaceQueryString.outlookSenderEmailParameter = 'senderemail';
Coveo.CES.Common.SearchInterfaceQueryString.outlookSubjectHash = 'subjecthash';
Coveo.CES.Common.SearchInterfaceQueryString.outlookSentOn = 'senton';
Coveo.CES.Web.Search.SharePoint.SharePointItemAttributes.lisT_VERSION_ENABLED = 'VersionEnabled';
Coveo.CES.Web.Search.SharePoint.SharePointItemAttributes.lisT_IS_FORCE_CHECKOUT = 'IsForceCheckout';
Coveo.CES.Web.Search.SharePoint.SharePointItemAttributes.lisT_ENABLE_MINOR_VERSIONS = 'EnableMinorVersions';
Coveo.CES.Web.Search.SharePoint.SharePointItemAttributes.lisT_CONTENT_TYPES_ENABLED = 'ContentTypesEnabled';
Coveo.CES.Web.Search.SharePoint.SharePointItemAttributes.lisT_BASE_TYPE = 'ListBaseType';
Coveo.CES.Web.Search.SharePoint.SharePointItemAttributes.lisT_BASE_TEMPLATE = 'ListBaseTemplate';
Coveo.CES.Web.Search.SharePoint.SharePointItemAttributes.lisT_WRITE_SECURITY = 'WriteSecurity';
Coveo.CES.Web.Search.SharePoint.SharePointItemAttributes.lisT_USER_ID = 'UserID';
Coveo.CES.Web.Search.SharePoint.SharePointItemAttributes.d_REF = 'DRef';
Coveo.CES.Web.Search.Scripts.Controls.SearchControlScript._s_Instances$1 = {};
Coveo.CES.Web.Search.Scripts.Controls.PrefetchTermScript._prefetcH_DELAY$1 = 600;
Coveo.CES.Web.Search.Scripts.Controls.PrefetchTermScript._s_PrefetchedTerms$1 = [];
Coveo.CES.Web.Search.Scripts.Controls.QueryScript._prefetcH_DELAY$1 = 600;
Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript._s_NameCtrl$1 = null;
Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript._s_TriedCreatingNameCtrl$1 = false;
Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript._s_RunningControls$1 = [];
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightCustomControl._draG_MOUSE_THRESHOLD = 3;
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightScrollArea._scrolL_MOVE_SIZE$1 = 50;
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTextEntry._selecteD_TEXT_COLOR$1 = '#FFF1922A';
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTimeLineMarker._mousE_ENTER_COLOR$1 = 'Lime';
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTimeLineMarker._mousE_LEAVE_COLOR$1 = '#FF5D5A5A';
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTimeLineMarkerContainer._markeR_WIDTH$1 = 9;
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTimeLineMarkerContainer._markeR_HEIGHT$1 = 13;
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTimeLineMarkerContainer._markeR_TOP$1 = 0;
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTimeLineMarkerContainer._conflicT_SIDE_RANGE_LOOKUP$1 = 50;
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightTimeLineMarkerContainer._zooM_SCALE$1 = 6;
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtteranceTextEntry._mousE_ENTER_TEXT_COLOR$2 = 'Black';
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtteranceTextEntry._mousE_LEAVE_TEXT_COLOR$2 = 'White';
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtteranceTextEntry._selecteD_COLOR$2 = '#FFD3D3D3';
Coveo.CES.Web.Search.Scripts.Controls.Results.SilverlightUtteranceTextEntry._selecteD_TEXT_COLOR$2 = 'Black';
Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ResultContextualMenu._VERSION$1 = '5.0.200708161';
Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ResultContextualMenu._sP_MENU_COLOR$1 = '#b09460';

// ---- Do not remove this footer ----
// This script was generated using Script# v0.5.5.0 (http://projects.nikhilk.net/ScriptSharp)
// -----------------------------------
//****************************************************************************
// Copyright (c) 2005, Coveo Solutions Inc.
//****************************************************************************

function CES_CachedDocument() {

// PUBLIC INTERFACE

//****************************************************************************
// Opens the currently displayed document in a new window.
//****************************************************************************
this.OpenInNewWindow = function()
{
    window.open(this.m_Uri, this.m_Uri.indexOf('outlook:') == 0 ? '_self' : '_blank');
}

//****************************************************************************
// Opens the currently displayed view as html in a new window.
//****************************************************************************
this.OpenViewAsHtmlInNewWindow = function()
{
    window.open(this.src, '_blank');
}

//****************************************************************************
// Highlights the next occurence of a term.
// p_Term  - The index of the term to highlight.
//****************************************************************************
this.HighlightNextOccurence = function(p_Term)
{
    if (!this.m_DoNotHighlight) {
        this.RemoveLastHighlight();
        
        var last = this.m_Positions[p_Term];
        if (last == undefined) {
            last = 0;
        }

        var current = last + 1;
        if (this.GetTermPart(p_Term, current, 1) == null) {
            current = 1;
        }

        this.HighlightTerm(p_Term, current);
        this.m_Positions[p_Term] = current;
    }
}

//****************************************************************************
// Highlights the previous occurence of a term.
// p_Term  - The index of the term to highlight.
//****************************************************************************
this.HighlightPreviousOccurence = function(p_Term)
{
    if (!this.m_DoNotHighlight) {
        this.RemoveLastHighlight();
        
        var last = this.m_Positions[p_Term];
        if (last == undefined) {
            last = 1;
        }

        var current = last - 1;
        if (this.GetTermPart(p_Term, current, 1) == null) {
            // Skip to the last one
            current = 1;
            while (this.GetTermPart(p_Term, current, 1) != null) {
                ++current;
            }
            --current;
        }

        this.HighlightTerm(p_Term, current);
        this.m_Positions[p_Term] = current;
    }
}

// PRIVATE INTERFACE

//****************************************************************************
// Resets the members used to track the current highlight.
//****************************************************************************
this.ResetMembers = function()
{
    this.m_Positions = new Array();
    this.m_LastTerm = 0;
    this.m_LastOccurence = 0;
    this.m_DoNotHighlight = false;
}

//****************************************************************************
// Retrieves the document object inside the frame.
//****************************************************************************
this.GetDocument = function()
{
    return frames[this.name].document;
}

//****************************************************************************
// Retrieves a specific highlight part.
// p_Term      - The index of the term.
// p_Occurence - The index of the occurence of the term.
// p_Part      - The index of the part of the term.
//****************************************************************************
this.GetTermPart = function(p_Term, p_Occurence, p_Part)
{
    return this.GetDocument().getElementById('CoveoHighlight:' + p_Term + '.' + p_Occurence + '.' + p_Part);
}

//****************************************************************************
// Highlights a term and scrolls it into view.
// p_Term      - The index of the term to highlight.
// p_Occurence - The index of the term occurence to highlight.
//****************************************************************************
this.HighlightTerm = function(p_Term, p_Occurence)
{
    var part = 1;
    var elem = this.GetTermPart(p_Term, p_Occurence, part);
    if (elem != null) {
        elem.scrollIntoView();
        while (elem != null) {
            elem.m_BackupColor = elem.style.color;
            elem.m_BackupBackground = elem.style.backgroundColor;
            elem.style.color = 'white';
            elem.style.backgroundColor = 'green';
            elem = this.GetTermPart(p_Term, p_Occurence, ++part);
        }

        this.m_LastTerm = p_Term;
        this.m_LastOccurence = p_Occurence;

        // FireFox 1.5.0.2 has a bug with scrollIntoView
        document.documentElement.scrollTop = 0;
    }
}

//****************************************************************************
// Unhighlights the last highlighted term.
//****************************************************************************
this.RemoveLastHighlight = function()
{
    if (this.m_LastTerm != 0) {
        var part = 1;
        var elem = this.GetTermPart(this.m_LastTerm, this.m_LastOccurence, part);
        while (elem != null) {
            elem.style.color = elem.m_BackupColor;
            elem.style.backgroundColor = elem.m_BackupBackground;
            elem = this.GetTermPart(this.m_LastTerm, this.m_LastOccurence, ++part);
        }
    }
}

} // Constructor

//****************************************************************************
// Copyright (c) 2006, Coveo Solutions Inc.
//****************************************************************************

function CES_Player() {

var m_LastPositions = new Array();
var m_LastTerm = 0;
var m_LastOccurence = 0;
var m_LastCurrentWord = null;

//****************************************************************************
// Handler for the onclick event of the utterances link.
//****************************************************************************
this.UtterancesLink_OnClick = function()
{
    this.ShowUtterances();
}

//****************************************************************************
// Handler for the onclick event of the transcript link.
//****************************************************************************
this.TranscriptLink_OnClick = function()
{
    this.ShowTranscript();
}

//****************************************************************************
// Handler for the onclick event of the timeline.
//****************************************************************************
this.TimeLine_OnClick = function(p_Event)
{
    var tlpos = CNL_GetPosition(this.m_TimeLine);
    var tlsize = CNL_GetSize(this.m_TimeLine);
    var percent = (p_Event.x - tlpos.m_Left) / tlsize.m_Width;
    this.Jump(this.m_Length * percent);
}

//****************************************************************************
// Handler for the onclick event on the play button.
//****************************************************************************
this.Play_OnClick = function(p_Event)
{
    this.m_Player.controls.play();
    this.Synchronize(false);
}

//****************************************************************************
// Handler for the onclick event on the pause button.
//****************************************************************************
this.Pause_OnClick = function(p_Event)
{
    this.m_Player.controls.pause();
    this.Synchronize(false);
}

//****************************************************************************
// Shows the utterances tab.
//****************************************************************************
this.ShowUtterances = function()
{
    this.m_UtterancesLink.style.fontWeight = 'bold';
    this.m_UtterancesLink.style.backgroundColor = 'silver';
    this.m_TranscriptLink.style.fontWeight = 'normal';
    this.m_TranscriptLink.style.backgroundColor = 'whitesmoke';
    this.m_Utterances.style.display = 'block';
    this.m_Transcript.style.display = 'none';
}

//****************************************************************************
// Shows the transcript tab.
//****************************************************************************
this.ShowTranscript = function()
{
    this.m_UtterancesLink.style.fontWeight = 'normal';
    this.m_UtterancesLink.style.backgroundColor = 'whitesmoke';
    this.m_TranscriptLink.style.fontWeight = 'bold';
    this.m_TranscriptLink.style.backgroundColor = 'silver';
    this.m_Utterances.style.display = 'none';
    this.m_Transcript.style.display = 'block';
    this.Synchronize(false);
}

//****************************************************************************
// Highlights the next occurence of a term.
// p_Term  - The index of the term to highlight.
//****************************************************************************
this.HighlightNextOccurence = function(p_Term)
{
    this.ShowTranscript();
    this.RemoveLastHighlight();
    
    var last = m_LastPositions[p_Term];
    if (last == undefined) {
        last = 0;
    }

    var current = last + 1;
    if (this.GetTermPart(p_Term, current, 1) == null) {
        current = 1;
    }

    this.HighlightTerm(p_Term, current);
    m_LastPositions[p_Term] = current;
}

//****************************************************************************
// Highlights the previous occurence of a term.
// p_Term  - The index of the term to highlight.
//****************************************************************************
this.HighlightPreviousOccurence = function(p_Term)
{
    this.ShowTranscript();
    this.RemoveLastHighlight();
    
    var last = m_LastPositions[p_Term];
    if (last == undefined) {
        last = 1;
    }

    var current = last - 1;
    if (this.GetTermPart(p_Term, current, 1) == null) {
        // Skip to the last one
        current = 1;
        while (this.GetTermPart(p_Term, current, 1) != null) {
            ++current;
        }
        --current;
    }

    this.HighlightTerm(p_Term, current);
    m_LastPositions[p_Term] = current;
}

//****************************************************************************
// Creates the media player within the page.
// p_Uri   - The uri to load within the media player.
// p_Start - The position of the first utterance.
//****************************************************************************
this.CreateMediaPlayer = function(p_Uri, p_Start)
{
    // Create the media player (visible or not)
    var elem = document.createElement('object');
    if (this.m_Video) {
        elem.style.width = this.m_Player.style.width;
        elem.style.height = this.m_Player.style.height;
        this.m_Player.replaceNode(elem);
    } else {
        this.m_Player.appendChild(elem);
        elem.style.display = 'none';
    }

    // Setup the player. I configure it to use windowless video so that we can
    // put stuff over the player. This make certains rare codecs unable to play,
    // but this ain't a problem since we're converting the clips to a known format.
    this.m_Player = elem;
    elem.classid = 'CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6';
    elem.stretchToFit = true;
    elem.windowlessVideo = true;
    elem.uiMode = 'none';
    elem.URL = p_Uri;
    this.Jump(this.GetHeadStart(p_Start));

    // Arm the timer that constantly synchronizes the position of the player
    this.Synchronize(true);
}

//****************************************************************************
// Adds an utterance to the various displays.
// p_Start   - The start time of the utterance.
// p_Percent - The position expressed as a percentage.
// p_Html    - The html for displaying info about the utterance.
//****************************************************************************
this.AddUtterance = function(p_Start, p_Percent, p_Html)
{
    // Create the entry in the utterances
    var utelem = document.createElement('div');
    utelem.className = 'CesUnselectedMenuItem';
    utelem.style.cursor = 'pointer';
    utelem.innerHTML = p_Html;
    this.m_Utterances.appendChild(utelem);

    // Create the bar in the timeline
    var tlpos = CNL_GetPosition(this.m_TimeLine);
    var tlsize = CNL_GetSize(this.m_TimeLine);
    var tlelem = document.createElement('img');
    tlelem.src = this.m_UtteranceUri;
    tlelem.style.position = 'absolute';
    tlelem.style.cursor = 'pointer';
    tlelem.style.zIndex = '800';
    this.m_TimeLine.appendChild(tlelem);
    CNL_SetPosition(tlelem, tlpos.m_Left + tlsize.m_Width * p_Percent - 6, tlpos.m_Top + 3);

    // Create the tooltip for the timeline bar
    var ttelem = document.createElement('div');
    ttelem.style.position = 'absolute';
    ttelem.style.width = '500px';
    ttelem.style.border = '1px solid black';
    ttelem.style.backgroundColor = 'whitesmoke';
    ttelem.style.padding = '5px';
    ttelem.style.zIndex = '999';
    ttelem.innerHTML = p_Html;
    this.m_TimeLine.appendChild(ttelem);
    CNL_PositionObject(ttelem, tlelem, 'AboveLeft');
    ttelem.style.visibility = 'hidden';

    // Setup event handlers
    var myself = this;
    utelem.onmouseover = function() { 
        utelem.className = 'CesSelectedMenuItem'; 
        tlelem.src = myself.m_UtteranceSelectedUri;
    };
    utelem.onmouseout = function() { 
        utelem.className = 'CesUnselectedMenuItem'; 
        tlelem.src = myself.m_UtteranceUri;
    };
    utelem.onclick = function() {
        myself.Jump(myself.GetHeadStart(p_Start));
    }
    tlelem.onmouseover = function() { 
        utelem.style.backgroundColor = 'lightgrey';
        tlelem.src = myself.m_UtteranceSelectedUri;
        ttelem.style.visibility = 'visible';
    };
    tlelem.onmouseout = function() { 
        utelem.style.backgroundColor = '';
        tlelem.src = myself.m_UtteranceUri;
        ttelem.style.visibility = 'hidden';
    };
}

//****************************************************************************
// Jumps to a given position within the clip.
// p_Position - The position to which to jump.
//****************************************************************************
this.Jump = function(p_Position)
{
    this.m_Player.controls.currentPosition = p_Position;
    this.m_Player.controls.play();
    //this.Synchronize(false);
}

//****************************************************************************
// Synchronizes the currently highlighted word with the position of the player.
// p_Auto - Whether the call comes from the timer.
//****************************************************************************
this.Synchronize = function(p_Auto)
{
    // If we get called while the page is unloading, we should not attempt to
    // touch the media player as it mail trigger exceptions.
    if (!this.m_Player.controls) {
        return;
    }

    // Try to detect when the code for the player was replaced with newer one
    // (happens when using partial postbacks). If we detect this, stop the player.
    var found = false;
    var up = this.parentElement;
    while (up != null) {
        if (up.tagName == 'BODY') {
            found = true;
            break;
        }
        up = up.parentElement;
    }
    if (!found) {
        this.m_Player.controls.stop();
        this.m_Utterances = null;
        this.m_Transcript = null;
        this.m_Player = null;
        this.m_TimeLine = null;
        this.m_Play = null;
        this.m_Pause = null;
        this.m_Slider = null;
        this.m_Filler = null;
        this.m_Status = null;
        return;
    }

    // Update the status of the buttons
    switch (this.m_Player.playState) {
    case 3:
        this.m_Play.style.display = 'none';
        this.m_Pause.style.display = 'inline';
        this.m_Status.innerHTML = '';
        break;
    case 6:
        this.m_Play.style.display = 'none';
        this.m_Pause.style.display = 'inline';
        this.m_Status.innerHTML = this.m_Player.status;
        break;
    default:
        this.m_Play.style.display = 'inline';
        this.m_Pause.style.display = 'none';
        this.m_Status.innerHTML = '';
        break;
    }

    // Update the position of the slider
    var slsize = CNL_GetSize(this.m_Slider);
    var position = this.m_Player.controls.currentPosition;
    var spos = this.GetTimeLinePosition(position / this.m_Length);
    CNL_SetPosition(this.m_Slider, spos.m_Left - slsize.m_Width / 2, spos.m_Top - 8);

    // Update the filler
    var tlpos = CNL_GetPosition(this.m_TimeLine);
    var tlsize = CNL_GetSize(this.m_TimeLine);
    CNL_SetPosition(this.m_Filler, tlpos.m_Left - 2, tlpos.m_Top + 3);
    this.m_Filler.style.width = (spos.m_Left - tlpos.m_Left + 2) + 'px';

    var delay;
    if (this.m_Transcript) {
        // Unhighlight the last word
        if (m_LastCurrentWord != null) {
            m_LastCurrentWord.style.color = m_LastCurrentWord.m_BackupColor;
            m_LastCurrentWord.style.backgroundColor = m_LastCurrentWord.m_BackupBackground;
        }

        // Find the index of the current word (eg. the one before the one that is
        // starting at the nearest time after the current position).
        var beg = 0;
        var end = this.m_Positions.length;
        var index = 0;
        while (beg < end) {
            index = beg + Math.floor((end - beg) / 2);
            var value = this.m_Positions[index];
            if (value < position) {
                beg = index + 1;
            } else {
                end = index;
            }
        }
        index = Math.max(beg - 1, 0);

        // If a word was found highlight it
        m_LastCurrentWord = G(this.id + '_' + this.m_Positions[index]);
        if (m_LastCurrentWord != null) {
            m_LastCurrentWord.m_BackupColor = m_LastCurrentWord.style.color;
            m_LastCurrentWord.m_BackupBackground = m_LastCurrentWord.style.backgroundColor;
            m_LastCurrentWord.style.color = 'white';
            m_LastCurrentWord.style.backgroundColor = 'maroon';

            // When doing an explicit (eg. non-auto) synchronize, we want
            // to scroll the transcript so that the current word is displayed.
            if (!p_Auto) {
                m_LastCurrentWord.scrollIntoView();
            }
        }

        // Compute the delay till the next word
        if (this.m_Positions[index] > position) {
            delay = (this.m_Positions[index] - position) * 1000;
        } else if (index + 1 < this.m_Positions.length) { 
            delay = (this.m_Positions[index + 1] - position) * 1000;
        } else {
            delay = 1000;
        }
        if (delay > 500) {
            delay = 500;
        }
    } else { 
        delay = 500;
    }

    // Rearm the timer if needed
    if (p_Auto) {
        var myself = this;
        setTimeout(function() { myself.Synchronize(true); }, delay);
    }
}

//****************************************************************************
// Retrieves the position at which to jump for an utterance, including a head start.
// p_Start - The position at which the utterance starts.
// Returns the position with the headstart.
//****************************************************************************
this.GetHeadStart = function(p_Start)
{
    var pos = p_Start - this.m_HeadStart;
    if (pos < 0) {
        pos = 0;
    }

    return pos;
}

//****************************************************************************
// Retrieves the position of a point on the timeline.
// p_Percent - The percentage of the point on the timeline.
// Returns an object holding the position.
//****************************************************************************
this.GetTimeLinePosition = function(p_Percent)
{
    var tlpos = CNL_GetPosition(this.m_TimeLine);
    var tlsize = CNL_GetSize(this.m_TimeLine);
    tlpos.m_Left += tlsize.m_Width * p_Percent - 2;

    return tlpos;
}

//****************************************************************************
// Retrieves a specific highlight part.
// p_Term      - The index of the term.
// p_Occurence - The index of the occurence of the term.
// p_Part      - The index of the part of the term.
//****************************************************************************
this.GetTermPart = function(p_Term, p_Occurence, p_Part)
{
    return document.getElementById('CoveoHighlight:' + p_Term + '.' + p_Occurence + '.' + p_Part);
}

//****************************************************************************
// Highlights a term and scrolls it into view.
// p_Term      - The index of the term to highlight.
// p_Occurence - The index of the term occurence to highlight.
//****************************************************************************
this.HighlightTerm = function(p_Term, p_Occurence)
{
    var part = 1;
    var elem = this.GetTermPart(p_Term, p_Occurence, part);
    if (elem != null) {
        // Jump to the position of this word
        var time = parseFloat(elem.parentNode.id.substring(this.id.length + 1, elem.parentNode.id.length));
        this.Jump(time);
        elem.scrollIntoView();
        while (elem != null) {
            elem.m_BackupColor = elem.style.color;
            elem.m_BackupBackground = elem.style.backgroundColor;
            elem.style.color = 'white';
            elem.style.backgroundColor = 'green';
            elem = this.GetTermPart(p_Term, p_Occurence, ++part);
        }

        m_LastTerm = p_Term;
        m_LastOccurence = p_Occurence;

    }
}

//****************************************************************************
// Unhighlights the last highlighted term.
//****************************************************************************
this.RemoveLastHighlight = function()
{
    if (m_LastTerm != 0) {
        var part = 1;
        var elem = this.GetTermPart(m_LastTerm, m_LastOccurence, part);
        while (elem != null) {
            elem.style.color = elem.m_BackupColor;
            elem.style.backgroundColor = elem.m_BackupBackground;
            elem = this.GetTermPart(m_LastTerm, m_LastOccurence, ++part);
        }
    }
}

} // Constructor

