_coveoDefineJQuery = function() { var $ = _coveoJQuery;
Type.registerNamespace('Coveo.CES.Web.Search.SharePoint.SharePointScopes');

////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeFieldTypeEnum

Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeFieldTypeEnum = function() { 
    /// <summary>
    /// The various field types.
    /// </summary>
    /// <field name="integer" type="Number" integer="true" static="true">
    /// Integer field.
    /// </field>
    /// <field name="longInt" type="Number" integer="true" static="true">
    /// Long field.
    /// </field>
    /// <field name="doubleNum" type="Number" integer="true" static="true">
    /// Double field.
    /// </field>
    /// <field name="smallString" type="Number" integer="true" static="true">
    /// Small string.
    /// </field>
    /// <field name="date" type="Number" integer="true" static="true">
    /// Date field.
    /// </field>
    /// <field name="largeString" type="Number" integer="true" static="true">
    /// Large string.
    /// </field>
};
Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeFieldTypeEnum.prototype = {
    integer: 0, 
    longInt: 1, 
    doubleNum: 2, 
    smallString: 3, 
    date: 4, 
    largeString: 5
}
Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeFieldTypeEnum.registerEnum('Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeFieldTypeEnum', false);


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleTypeEnum

Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleTypeEnum = function() { 
    /// <summary>
    /// The various types of SharePoint scope rules to filter results.
    /// </summary>
    /// <field name="freeText" type="Number" integer="true" static="true">
    /// The rule is a text expression added to the query.
    /// </field>
    /// <field name="webAddress" type="Number" integer="true" static="true">
    /// The rule is a Web address (e.g. a SharePoint site).
    /// </field>
    /// <field name="field" type="Number" integer="true" static="true">
    /// The rule is a field condition (e.g. "@fieldname=fieldvalue").
    /// </field>
};
Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleTypeEnum.prototype = {
    freeText: 0, 
    webAddress: 1, 
    field: 2
}
Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleTypeEnum.registerEnum('Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleTypeEnum', false);


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleActionEnum

Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleActionEnum = function() { 
    /// <summary>
    /// The various types of SharePoint scope rule actions.
    /// </summary>
    /// <field name="require" type="Number" integer="true" static="true">
    /// The documents matching the condition will be returned.
    /// All the <see cref="F:Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleActionEnum.Require" /> conditions are joined together with the AND operator.
    /// </field>
    /// <field name="include" type="Number" integer="true" static="true">
    /// The documents matching the condition will be included.
    /// All the <see cref="F:Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleActionEnum.Include" /> conditions are joined together with the OR operator.
    /// </field>
    /// <field name="exclude" type="Number" integer="true" static="true">
    /// The documents matching the condition will be excluded.
    /// All the <see cref="F:Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleActionEnum.Exclude" /> conditions are prefixed with the NOT operator.
    /// </field>
};
Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleActionEnum.prototype = {
    require: 0, 
    include: 1, 
    exclude: 2
}
Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleActionEnum.registerEnum('Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleActionEnum', false);


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeData

Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeData = function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeData(p_RawData) {
    /// <summary>
    /// Holds information about a SharePoint scope.
    /// </summary>
    /// <param name="p_RawData" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeRawData">
    /// The underlying content of the object.
    /// </param>
    /// <field name="_m_Rules$1" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleCollectionData">
    /// </field>
    Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeData.initializeBase(this, [ p_RawData ]);
}
Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeData.prototype = {
    _m_Rules$1: null,
    
    get_id: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeData$get_id() {
        /// <summary>
        /// Gets or sets the ID.
        /// </summary>
        /// <value type="String"></value>
        return this.m_RawData.getStringValue('ID', '');
    },
    set_id: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeData$set_id(value) {
        /// <summary>
        /// Gets or sets the ID.
        /// </summary>
        /// <value type="String"></value>
        this.m_RawData.setStringValue('ID', value);
        return value;
    },
    
    get_name: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeData$get_name() {
        /// <summary>
        /// Gets or sets the name.
        /// </summary>
        /// <value type="String"></value>
        return this.m_RawData.getStringValue('Name', '');
    },
    set_name: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeData$set_name(value) {
        /// <summary>
        /// Gets or sets the name.
        /// </summary>
        /// <value type="String"></value>
        this.m_RawData.setStringValue('Name', value);
        return value;
    },
    
    get_description: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeData$get_description() {
        /// <summary>
        /// Gets or sets the description.
        /// </summary>
        /// <value type="String"></value>
        return this.m_RawData.getStringValue('Description', '');
    },
    set_description: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeData$set_description(value) {
        /// <summary>
        /// Gets or sets the description.
        /// </summary>
        /// <value type="String"></value>
        this.m_RawData.setStringValue('Description', value);
        return value;
    },
    
    get_rules: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeData$get_rules() {
        /// <summary>
        /// Gets the rule collection.
        /// </summary>
        /// <value type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleCollectionData"></value>
        if (this._m_Rules$1 == null) {
            this._m_Rules$1 = new Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleCollectionData(this.m_RawData.getChild('Rules', true));
        }
        return this._m_Rules$1;
    },
    
    get_lastModifiedDateUtc: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeData$get_lastModifiedDateUtc() {
        /// <summary>
        /// Gets or sets the datetime (DateTime.Ticks) of the last modification.
        /// </summary>
        /// <value type="String"></value>
        return this.m_RawData.getStringValue('LastModifiedDateUtc', '');
    },
    set_lastModifiedDateUtc: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeData$set_lastModifiedDateUtc(value) {
        /// <summary>
        /// Gets or sets the datetime (DateTime.Ticks) of the last modification.
        /// </summary>
        /// <value type="String"></value>
        this.m_RawData.setStringValue('LastModifiedDateUtc', value);
        return value;
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeDictionaryData

Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeDictionaryData = function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeDictionaryData(p_RawData) {
    /// <summary>
    /// Dictionary of <see cref="T:Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeData" />.
    /// </summary>
    /// <param name="p_RawData" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeRawData">
    /// The underlying content of the objects.
    /// </param>
    Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeDictionaryData.initializeBase(this, [ p_RawData, true ]);
}
Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeDictionaryData.prototype = {
    
    createInstance: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeDictionaryData$createInstance(p_RawData) {
        /// <param name="p_RawData" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeRawData">
        /// </param>
        /// <returns type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeBaseData"></returns>
        return new Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeData(p_RawData);
    },
    get_item: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeDictionaryData$get_item(p_Key) {
        /// <summary>
        /// Gets or sets the object associated with the specified key.
        /// </summary>
        /// <param name="p_Key" type="String">
        /// The key of the value to get or set.
        /// </param>
        /// <param name="value" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeData">
        /// </param>
        /// <returns type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeData"></returns>
        return Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeDictionaryData.callBaseMethod(this, 'getObject', [ p_Key ]);
    },
    set_item: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeDictionaryData$set_item(p_Key, value) {
        /// <summary>
        /// Gets or sets the object associated with the specified key.
        /// </summary>
        /// <param name="p_Key" type="String">
        /// The key of the value to get or set.
        /// </param>
        /// <param name="value" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeData">
        /// </param>
        /// <returns type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeData"></returns>
        Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeDictionaryData.callBaseMethod(this, 'setObject', [ p_Key, value ]);
        return value;
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeDefinitionsData

Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeDefinitionsData = function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeDefinitionsData(p_RawData) {
    /// <summary>
    /// Holds all the information about the SharePoint scopes. This is the main data object and is persisted at the site collection level.
    /// </summary>
    /// <param name="p_RawData" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeRawData">
    /// The underlying content of the object.
    /// </param>
    /// <field name="_m_Scopes$1" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeDictionaryData">
    /// </field>
    /// <field name="_m_DefaultScopeConfig$1" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeConfigData">
    /// </field>
    /// <field name="_m_SiteScopeConfigs$1" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeConfigDictionaryData">
    /// </field>
    Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeDefinitionsData.initializeBase(this, [ p_RawData ]);
}
Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeDefinitionsData.prototype = {
    _m_Scopes$1: null,
    _m_DefaultScopeConfig$1: null,
    _m_SiteScopeConfigs$1: null,
    
    get_scopes: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeDefinitionsData$get_scopes() {
        /// <summary>
        /// Gets the scope collection.
        /// </summary>
        /// <value type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeDictionaryData"></value>
        if (this._m_Scopes$1 == null) {
            this._m_Scopes$1 = new Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeDictionaryData(this.m_RawData.getChild('Scopes', true));
        }
        return this._m_Scopes$1;
    },
    
    get_defaultScopeConfig: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeDefinitionsData$get_defaultScopeConfig() {
        /// <summary>
        /// Gets the default (site collection) scope selector configuration.
        /// </summary>
        /// <value type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeConfigData"></value>
        if (this._m_DefaultScopeConfig$1 == null) {
            this._m_DefaultScopeConfig$1 = new Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeConfigData(this.m_RawData.getChild('DefaultScopeConfig', true));
        }
        return this._m_DefaultScopeConfig$1;
    },
    set_defaultScopeConfig: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeDefinitionsData$set_defaultScopeConfig(value) {
        /// <summary>
        /// Gets the default (site collection) scope selector configuration.
        /// </summary>
        /// <value type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeConfigData"></value>
        this._m_DefaultScopeConfig$1 = null;
        this.m_RawData.setChild('DefaultScopeConfig', value.getRawData());
        return value;
    },
    
    get_siteScopeConfigs: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeDefinitionsData$get_siteScopeConfigs() {
        /// <summary>
        /// Gets the scope selector configuration of every site.
        /// </summary>
        /// <value type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeConfigDictionaryData"></value>
        if (this._m_SiteScopeConfigs$1 == null) {
            this._m_SiteScopeConfigs$1 = new Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeConfigDictionaryData(this.m_RawData.getChild('SiteScopeConfigs', true));
        }
        return this._m_SiteScopeConfigs$1;
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeFieldData

Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeFieldData = function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeFieldData(p_RawData) {
    /// <summary>
    /// Holds information about a field.
    /// </summary>
    /// <param name="p_RawData" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeRawData">
    /// The underlying content of the object.
    /// </param>
    Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeFieldData.initializeBase(this, [ p_RawData ]);
}
Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeFieldData.prototype = {
    
    get_name: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeFieldData$get_name() {
        /// <summary>
        /// Gets or sets the field's name.
        /// (Used only for rules of type <see cref="F:Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleTypeEnum.Field" />.)
        /// </summary>
        /// <value type="String"></value>
        return this.m_RawData.getStringValue('Name', '');
    },
    set_name: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeFieldData$set_name(value) {
        /// <summary>
        /// Gets or sets the field's name.
        /// (Used only for rules of type <see cref="F:Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleTypeEnum.Field" />.)
        /// </summary>
        /// <value type="String"></value>
        this.m_RawData.setStringValue('Name', value);
        return value;
    },
    
    get_type: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeFieldData$get_type() {
        /// <summary>
        /// Gets or sets the field's type.
        /// </summary>
        /// <value type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeFieldTypeEnum"></value>
        return this.m_RawData.getIntValue('Type', 0);
    },
    set_type: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeFieldData$set_type(value) {
        /// <summary>
        /// Gets or sets the field's type.
        /// </summary>
        /// <value type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeFieldTypeEnum"></value>
        this.m_RawData.setIntValue('Type', value);
        return value;
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeFieldDictionaryData

Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeFieldDictionaryData = function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeFieldDictionaryData(p_RawData) {
    /// <summary>
    /// Dictionary of <see cref="T:Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeFieldData" />.
    /// </summary>
    /// <param name="p_RawData" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeRawData">
    /// The underlying content of the objects.
    /// </param>
    Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeFieldDictionaryData.initializeBase(this, [ p_RawData, true ]);
}
Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeFieldDictionaryData.prototype = {
    
    createInstance: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeFieldDictionaryData$createInstance(p_RawData) {
        /// <param name="p_RawData" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeRawData">
        /// </param>
        /// <returns type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeBaseData"></returns>
        return new Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeFieldData(p_RawData);
    },
    get_item: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeFieldDictionaryData$get_item(p_Key) {
        /// <summary>
        /// Gets or sets the object associated with the specified key.
        /// </summary>
        /// <param name="p_Key" type="String">
        /// The key of the value to get or set.
        /// </param>
        /// <param name="value" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeFieldData">
        /// </param>
        /// <returns type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeFieldData"></returns>
        return Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeFieldDictionaryData.callBaseMethod(this, 'getObject', [ p_Key ]);
    },
    set_item: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeFieldDictionaryData$set_item(p_Key, value) {
        /// <summary>
        /// Gets or sets the object associated with the specified key.
        /// </summary>
        /// <param name="p_Key" type="String">
        /// The key of the value to get or set.
        /// </param>
        /// <param name="value" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeFieldData">
        /// </param>
        /// <returns type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeFieldData"></returns>
        Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeFieldDictionaryData.callBaseMethod(this, 'setObject', [ p_Key, value ]);
        return value;
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleData

Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleData = function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeRuleData(p_RawData) {
    /// <summary>
    /// Holds information about a SharePoint scope rule.
    /// </summary>
    /// <param name="p_RawData" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeRawData">
    /// The underlying content of the object.
    /// </param>
    Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleData.initializeBase(this, [ p_RawData ]);
}
Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleData.prototype = {
    
    get_ruleType: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeRuleData$get_ruleType() {
        /// <summary>
        /// Gets or sets the rule's type.
        /// </summary>
        /// <value type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleTypeEnum"></value>
        return this.m_RawData.getIntValue('RuleType', 0);
    },
    set_ruleType: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeRuleData$set_ruleType(value) {
        /// <summary>
        /// Gets or sets the rule's type.
        /// </summary>
        /// <value type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleTypeEnum"></value>
        this.m_RawData.setIntValue('RuleType', value);
        return value;
    },
    
    get_fieldName: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeRuleData$get_fieldName() {
        /// <summary>
        /// Gets or sets the field's name.
        /// (Used only for rules of type <see cref="F:Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleTypeEnum.Field" />.)
        /// </summary>
        /// <value type="String"></value>
        return this.m_RawData.getStringValue('FieldName', '');
    },
    set_fieldName: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeRuleData$set_fieldName(value) {
        /// <summary>
        /// Gets or sets the field's name.
        /// (Used only for rules of type <see cref="F:Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleTypeEnum.Field" />.)
        /// </summary>
        /// <value type="String"></value>
        this.m_RawData.setStringValue('FieldName', value);
        return value;
    },
    
    get_content: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeRuleData$get_content() {
        /// <summary>
        /// Gets or sets the rule's content.
        /// (Used for all rule types.)
        /// </summary>
        /// <value type="String"></value>
        return this.m_RawData.getStringValue('Content', '');
    },
    set_content: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeRuleData$set_content(value) {
        /// <summary>
        /// Gets or sets the rule's content.
        /// (Used for all rule types.)
        /// </summary>
        /// <value type="String"></value>
        this.m_RawData.setStringValue('Content', value);
        return value;
    },
    
    get_ruleAction: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeRuleData$get_ruleAction() {
        /// <summary>
        /// Gets or sets the rule's action.
        /// </summary>
        /// <value type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleActionEnum"></value>
        return this.m_RawData.getIntValue('RuleAction', 0);
    },
    set_ruleAction: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeRuleData$set_ruleAction(value) {
        /// <summary>
        /// Gets or sets the rule's action.
        /// </summary>
        /// <value type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleActionEnum"></value>
        this.m_RawData.setIntValue('RuleAction', value);
        return value;
    },
    
    get_siteID_: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeRuleData$get_siteID_() {
        /// <summary>
        /// Gets or sets the site ID (GUID).
        /// (Used as an optimization for web address rules.)
        /// </summary>
        /// <value type="String"></value>
        return this.m_RawData.getStringValue('SiteID_', '');
    },
    set_siteID_: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeRuleData$set_siteID_(value) {
        /// <summary>
        /// Gets or sets the site ID (GUID).
        /// (Used as an optimization for web address rules.)
        /// </summary>
        /// <value type="String"></value>
        this.m_RawData.setStringValue('SiteID_', value);
        return value;
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleCollectionData

Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleCollectionData = function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeRuleCollectionData(p_RawData) {
    /// <summary>
    /// Collection of <see cref="T:Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleData" />.
    /// </summary>
    /// <param name="p_RawData" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeRawData">
    /// The underlying content of the objects.
    /// </param>
    Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleCollectionData.initializeBase(this, [ p_RawData ]);
}
Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleCollectionData.prototype = {
    
    add: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeRuleCollectionData$add(p_Object) {
        /// <summary>
        /// Adds a new object at the end of the collection.
        /// </summary>
        /// <param name="p_Object" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleData">
        /// New object.
        /// </param>
        Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleCollectionData.callBaseMethod(this, 'add', [ p_Object ]);
    },
    
    insert: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeRuleCollectionData$insert(p_Index, p_Object) {
        /// <summary>
        /// Inserts a new object at a specified index in the collection.
        /// </summary>
        /// <param name="p_Index" type="Number" integer="true">
        /// Index in the collection where to add the new object.
        /// </param>
        /// <param name="p_Object" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleData">
        /// New object.
        /// </param>
        Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleCollectionData.callBaseMethod(this, 'insert', [ p_Index, p_Object ]);
    },
    
    createInstance: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeRuleCollectionData$createInstance(p_RawData) {
        /// <param name="p_RawData" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeRawData">
        /// </param>
        /// <returns type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeBaseData"></returns>
        return new Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleData(p_RawData);
    },
    get_item: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeRuleCollectionData$get_item(p_Index) {
        /// <summary>
        /// Gets or sets the object at a specified index in the collection.
        /// </summary>
        /// <param name="p_Index" type="Number" integer="true">
        /// Index in the collection.
        /// </param>
        /// <param name="value" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleData">
        /// </param>
        /// <returns type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleData"></returns>
        return Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleCollectionData.callBaseMethod(this, 'getObjectAt', [ p_Index ]);
    },
    set_item: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeRuleCollectionData$set_item(p_Index, value) {
        /// <summary>
        /// Gets or sets the object at a specified index in the collection.
        /// </summary>
        /// <param name="p_Index" type="Number" integer="true">
        /// Index in the collection.
        /// </param>
        /// <param name="value" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleData">
        /// </param>
        /// <returns type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleData"></returns>
        Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleCollectionData.callBaseMethod(this, 'setObjectAt', [ p_Index, value ]);
        return value;
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeConfigData

Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeConfigData = function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeConfigData(p_RawData) {
    /// <summary>
    /// Holds information about a SharePoint scope selector configuration.
    /// </summary>
    /// <param name="p_RawData" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeRawData">
    /// The underlying content of the object.
    /// </param>
    /// <field name="_m_SelectedScopeIDs$1" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeStringIntDictionaryData">
    /// </field>
    Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeConfigData.initializeBase(this, [ p_RawData ]);
}
Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeConfigData.prototype = {
    _m_SelectedScopeIDs$1: null,
    
    get_showScopeSelectorDropDown: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeConfigData$get_showScopeSelectorDropDown() {
        /// <summary>
        /// Gets or sets whether the scope selector drop-down is shown beside the search box.
        /// </summary>
        /// <value type="Boolean"></value>
        return this.m_RawData.getBoolValue('ShowScopeSelectorDropDown', true);
    },
    set_showScopeSelectorDropDown: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeConfigData$set_showScopeSelectorDropDown(value) {
        /// <summary>
        /// Gets or sets whether the scope selector drop-down is shown beside the search box.
        /// </summary>
        /// <value type="Boolean"></value>
        this.m_RawData.setBoolValue('ShowScopeSelectorDropDown', value);
        return value;
    },
    
    get_showScopeSelectorFacet: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeConfigData$get_showScopeSelectorFacet() {
        /// <summary>
        /// Gets or sets whether the scope selector facet is shown in the search interface.
        /// </summary>
        /// <value type="Boolean"></value>
        return this.m_RawData.getBoolValue('ShowScopeSelectorFacet', true);
    },
    set_showScopeSelectorFacet: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeConfigData$set_showScopeSelectorFacet(value) {
        /// <summary>
        /// Gets or sets whether the scope selector facet is shown in the search interface.
        /// </summary>
        /// <value type="Boolean"></value>
        this.m_RawData.setBoolValue('ShowScopeSelectorFacet', value);
        return value;
    },
    
    get_selectedScopeIDs: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeConfigData$get_selectedScopeIDs() {
        /// <summary>
        /// Gets the scope ID collection.
        /// </summary>
        /// <value type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeStringIntDictionaryData"></value>
        if (this._m_SelectedScopeIDs$1 == null) {
            this._m_SelectedScopeIDs$1 = new Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeStringIntDictionaryData(this.m_RawData.getChild('SelectedScopeIDs', true), true);
        }
        return this._m_SelectedScopeIDs$1;
    },
    
    get_defaultScopeID: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeConfigData$get_defaultScopeID() {
        /// <summary>
        /// Gets or sets the ID of the default scope.
        /// </summary>
        /// <value type="String"></value>
        return this.m_RawData.getStringValue('DefaultScopeID', '');
    },
    set_defaultScopeID: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeConfigData$set_defaultScopeID(value) {
        /// <summary>
        /// Gets or sets the ID of the default scope.
        /// </summary>
        /// <value type="String"></value>
        this.m_RawData.setStringValue('DefaultScopeID', value);
        return value;
    },
    
    get_lastModifiedDateUtc: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeConfigData$get_lastModifiedDateUtc() {
        /// <summary>
        /// Gets or sets the datetime (DateTime.Ticks) of the last modification.
        /// </summary>
        /// <value type="String"></value>
        return this.m_RawData.getStringValue('LastModifiedDateUtc', '');
    },
    set_lastModifiedDateUtc: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeConfigData$set_lastModifiedDateUtc(value) {
        /// <summary>
        /// Gets or sets the datetime (DateTime.Ticks) of the last modification.
        /// </summary>
        /// <value type="String"></value>
        this.m_RawData.setStringValue('LastModifiedDateUtc', value);
        return value;
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeConfigDictionaryData

Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeConfigDictionaryData = function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeConfigDictionaryData(p_RawData) {
    /// <summary>
    /// Collection of <see cref="T:Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeConfigData" />.
    /// </summary>
    /// <param name="p_RawData" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeRawData">
    /// The underlying content of the objects.
    /// </param>
    Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeConfigDictionaryData.initializeBase(this, [ p_RawData, true ]);
}
Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeConfigDictionaryData.prototype = {
    
    createInstance: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeConfigDictionaryData$createInstance(p_RawData) {
        /// <param name="p_RawData" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeRawData">
        /// </param>
        /// <returns type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeBaseData"></returns>
        return new Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeConfigData(p_RawData);
    },
    get_item: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeConfigDictionaryData$get_item(p_Key) {
        /// <summary>
        /// Gets or sets the object associated with the specified key.
        /// </summary>
        /// <param name="p_Key" type="String">
        /// The key of the value to get or set.
        /// </param>
        /// <param name="value" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeConfigData">
        /// </param>
        /// <returns type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeConfigData"></returns>
        return Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeConfigDictionaryData.callBaseMethod(this, 'getObject', [ p_Key ]);
    },
    set_item: function Coveo_CES_Web_Search_SharePoint_SharePointScopes_SharePointScopeConfigDictionaryData$set_item(p_Key, value) {
        /// <summary>
        /// Gets or sets the object associated with the specified key.
        /// </summary>
        /// <param name="p_Key" type="String">
        /// The key of the value to get or set.
        /// </param>
        /// <param name="value" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeConfigData">
        /// </param>
        /// <returns type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeConfigData"></returns>
        Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeConfigDictionaryData.callBaseMethod(this, 'setObject', [ p_Key, value ]);
        return value;
    }
}


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="timeZoneParameter" type="String" static="true">
    /// The query string parameter used for passing the time zone id.
    /// </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 initial interface name.
    /// </field>
    /// <field name="interfaceToLoadParameter" type="String" static="true">
    /// The query string parameter used for the name of the interface to load.
    /// </field>
    /// <field name="iconSizeParameter" type="String" static="true">
    /// The query string parameter used for passing the icon size.
    /// </field>
    /// <field name="facetIdParameter" type="String" static="true">
    /// The query string parameter used for passing the facet id.
    /// </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="maxQuickViewSizeParameter" type="String" static="true">
    /// The query string parameter used to pass the maximum quick view size (in bytes).
    /// </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="excelXmlDataSourceParameter" type="String" static="true">
    /// The query string parameter to use to export the query results to an XML data source for Microsoft Excel.
    /// </field>
    /// <field name="openSearchParameter" type="String" static="true">
    /// The query string parameter to use to retrieve the OpenSearch description document.
    /// </field>
    /// <field name="openSearchSuggestParameter" type="String" static="true">
    /// The query string parameter to use to retrieve query suggestions through OpenSearch.
    /// </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="caseIDParameter" type="String" static="true">
    /// The query string parameter to specify the id of a support case.
    /// </field>
    /// <field name="chartIDParameter" type="String" static="true">
    /// The query string parameter to specify the id of the chart to serve.
    /// </field>
    /// <field name="chartWidthParameter" type="String" static="true">
    /// The query string parameter to specify the width of the chart to serve.
    /// </field>
    /// <field name="chartHeightParameter" type="String" static="true">
    /// The query string parameter to specify the height of the chart to serve.
    /// </field>
    /// <field name="disableAnalyticsLoggingParameter" type="String" static="true">
    /// The query string parameter to disable the analytics logging.
    /// </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="outlookVersion" type="String" static="true">
    /// The query string parameter used to pass the version of Microsoft Outlook.
    /// </field>
    /// <field name="searchBarAutoCompletionsParameter" type="String" static="true">
    /// The query string parameter used to retrieve auto-completions for 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
    /// (constant also defined in FacetScript.cs).
    /// </field>
    /// <field name="outlookAddInIsCollapsedParameter" type="String" static="true">
    /// The query string parameter to signal if the sidebar is collapsed or not.
    /// </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>
    /// <field name="outlookBackgroundStyleColorPair" type="String" static="true">
    /// The quey string parameter to specify the background color to apply.
    /// </field>
    /// <field name="outlookStyleFontFamilyPair" type="String" static="true">
    /// The query string parameter to specify the font family to apply.
    /// </field>
    /// <field name="outlookSelectedStyleColorPair" type="String" static="true">
    /// The query string parameter to specify the selected conversation color.
    /// </field>
    /// <field name="outlookSchemeName" type="String" static="true">
    /// The name of the active scheme in Outlook.
    /// </field>
    /// <field name="outlookTabBackgroundStyleColorPair" type="String" static="true">
    /// The query string parameter to specify the tab background color to apply.
    /// </field>
    /// <field name="outlookStrokeStyleColorPair" type="String" static="true">
    /// The query string parameter to specify the color of the stroke.
    /// </field>
    /// <field name="interfaceReloaded" type="String" static="true">
    /// The query string parameter to specify that the interface was reloaded because the
    /// interface settings were changed by an administrator.
    /// </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.StateEnum

Coveo.CES.Web.Search.Scripts.Controls.StateEnum = function() { 
    /// <summary>
    /// Enumerates the various state possible for a media player.
    /// </summary>
    /// <field name="ready" type="Number" integer="true" static="true">
    /// Player is ready but not yet started.
    /// </field>
    /// <field name="playing" type="Number" integer="true" static="true">
    /// Currently playing.
    /// </field>
    /// <field name="stopped" type="Number" integer="true" static="true">
    /// Currently stopped.
    /// </field>
    /// <field name="paused" type="Number" integer="true" static="true">
    /// Currently paused.
    /// </field>
    /// <field name="buffering" type="Number" integer="true" static="true">
    /// Currently buffering.
    /// </field>
    /// <field name="ended" type="Number" integer="true" static="true">
    /// Media playback has ended by itself.
    /// </field>
};
Coveo.CES.Web.Search.Scripts.Controls.StateEnum.prototype = {
    ready: 0, 
    playing: 1, 
    stopped: 2, 
    paused: 3, 
    buffering: 4, 
    ended: 5
}
Coveo.CES.Web.Search.Scripts.Controls.StateEnum.registerEnum('Coveo.CES.Web.Search.Scripts.Controls.StateEnum', false);


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.IMediaPlayer

Coveo.CES.Web.Search.Scripts.Controls.IMediaPlayer = function() { 
    /// <summary>
    /// Generic MediaPlayer Interface.
    /// </summary>
};
Coveo.CES.Web.Search.Scripts.Controls.IMediaPlayer.prototype = {
    get_id : null,
    tearDown : null,
    play : null,
    pause : null,
    stop : null,
    getPosition : null,
    setPosition : null,
    getState : null,
    getStatus : null,
    createPlayerElement : null,
    createPlayerString : null,
    isReady : null
}
Coveo.CES.Web.Search.Scripts.Controls.IMediaPlayer.registerInterface('Coveo.CES.Web.Search.Scripts.Controls.IMediaPlayer');


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls._facetScriptItem

Coveo.CES.Web.Search.Scripts.Controls._facetScriptItem = function Coveo_CES_Web_Search_Scripts_Controls__facetScriptItem(p_Facet) {
    /// <summary>
    /// Information about an item in the facet.
    /// </summary>
    /// <param name="p_Facet" type="Coveo.CES.Web.Search.Scripts.Controls.FacetScript">
    /// Facet containing the item.
    /// </param>
    /// <field name="_hovereD_STYLE_NAME_SUFFIX" type="String" static="true">
    /// </field>
    /// <field name="_removE_HOVERED_STYLE_NAME_SUFFIX" type="String" static="true">
    /// </field>
    /// <field name="_m_MouseDownHandler" type="Function">
    /// </field>
    /// <field name="_m_MouseOverHandler" type="Function">
    /// </field>
    /// <field name="_m_MouseOutHandler" type="Function">
    /// </field>
    /// <field name="_m_ClickHandler" type="Function">
    /// </field>
    /// <field name="_m_RemoveClickHandler" type="Function">
    /// </field>
    /// <field name="_m_RemoveMouseOverHandler" type="Function">
    /// </field>
    /// <field name="_m_RemoveMouseOutHandler" type="Function">
    /// </field>
    /// <field name="facet" type="Coveo.CES.Web.Search.Scripts.Controls.FacetScript">
    /// </field>
    /// <field name="value" type="String">
    /// </field>
    /// <field name="element" type="Object" domElement="true">
    /// </field>
    /// <field name="op" type="String">
    /// </field>
    /// <field name="removeLinkElem" type="Object" domElement="true">
    /// </field>
    /// <field name="cssClassBeforeSelection" type="String">
    /// </field>
    /// <field name="clickedWithTheMouse" type="Boolean">
    /// </field>
    Coveo.CNL.Web.Scripts.CNLAssert.notNull(p_Facet);
    this.facet = p_Facet;
}
Coveo.CES.Web.Search.Scripts.Controls._facetScriptItem.prototype = {
    _m_MouseDownHandler: null,
    _m_MouseOverHandler: null,
    _m_MouseOutHandler: null,
    _m_ClickHandler: null,
    _m_RemoveClickHandler: null,
    _m_RemoveMouseOverHandler: null,
    _m_RemoveMouseOutHandler: null,
    facet: null,
    value: null,
    element: null,
    op: null,
    removeLinkElem: null,
    cssClassBeforeSelection: null,
    clickedWithTheMouse: false,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls__facetScriptItem$initialize() {
        /// <summary>
        /// Initializes the item.
        /// </summary>
        this.element.setAttribute('tabIndex', 0);
        this._m_MouseDownHandler = ss.Delegate.create(this, this._item_MouseDown);
        this._m_MouseOverHandler = ss.Delegate.create(this, this._item_MouseOver);
        this._m_MouseOutHandler = ss.Delegate.create(this, this._item_MouseOut);
        this._m_ClickHandler = ss.Delegate.create(this, this._item_Click);
        this.element.attachEvent('onmousedown', this._m_MouseDownHandler);
        this.element.attachEvent('onmouseover', this._m_MouseOverHandler);
        this.element.attachEvent('onmouseout', this._m_MouseOutHandler);
        this.element.attachEvent('onclick', this._m_ClickHandler);
        if (this.removeLinkElem != null) {
            this._m_RemoveMouseOverHandler = ss.Delegate.create(this, this._removeLink_MouseOver);
            this._m_RemoveMouseOutHandler = ss.Delegate.create(this, this._removeLink_MouseOut);
            this._m_RemoveClickHandler = ss.Delegate.create(this, this._removeLink_Click);
            this.removeLinkElem.attachEvent('onmouseover', this._m_RemoveMouseOverHandler);
            this.removeLinkElem.attachEvent('onmouseout', this._m_RemoveMouseOutHandler);
            this.removeLinkElem.attachEvent('onclick', this._m_RemoveClickHandler);
        }
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls__facetScriptItem$tearDown() {
        /// <summary>
        /// Releases the item.
        /// </summary>
        this.element.detachEvent('onmousedown', this._m_MouseDownHandler);
        this.element.detachEvent('onmouseover', this._m_MouseOverHandler);
        this.element.detachEvent('onmouseout', this._m_MouseOutHandler);
        this.element.detachEvent('onclick', this._m_ClickHandler);
        if (this.removeLinkElem != null) {
            this.removeLinkElem.detachEvent('onmouseover', this._m_RemoveMouseOverHandler);
            this.removeLinkElem.detachEvent('onmouseout', this._m_RemoveMouseOutHandler);
            this.removeLinkElem.detachEvent('onclick', this._m_RemoveClickHandler);
        }
    },
    
    _item_MouseDown: function Coveo_CES_Web_Search_Scripts_Controls__facetScriptItem$_item_MouseDown() {
        /// <summary>
        /// Callback for when the user clicks on the item with the mouse.
        /// </summary>
        this.element.style['outline'] = 'none';
        this.clickedWithTheMouse = true;
    },
    
    _item_MouseOver: function Coveo_CES_Web_Search_Scripts_Controls__facetScriptItem$_item_MouseOver() {
        /// <summary>
        /// Callback for when the mouse enters the item.
        /// </summary>
        if (this.facet._canQueueAsyncItemCalls()) {
            this.element.className += '_Hovered';
        }
    },
    
    _item_MouseOut: function Coveo_CES_Web_Search_Scripts_Controls__facetScriptItem$_item_MouseOut() {
        /// <summary>
        /// Callback for when the mouse leaves the item.
        /// </summary>
        this.element.className = this.element.className.replaceAll('_Hovered', '');
    },
    
    _item_Click: function Coveo_CES_Web_Search_Scripts_Controls__facetScriptItem$_item_Click() {
        /// <summary>
        /// Callback for when the user clicks on the item.
        /// </summary>
        this.facet._startAsyncItemCall(this, this.op);
    },
    
    _removeLink_MouseOver: function Coveo_CES_Web_Search_Scripts_Controls__facetScriptItem$_removeLink_MouseOver() {
        /// <summary>
        /// Callback for when the mouse enters the remove link.
        /// </summary>
        this.element.className += '_RemoveHovered';
        window.event.cancelBubble = true;
    },
    
    _removeLink_MouseOut: function Coveo_CES_Web_Search_Scripts_Controls__facetScriptItem$_removeLink_MouseOut() {
        /// <summary>
        /// Callback for when the mouse exits the remove link.
        /// </summary>
        this.element.className = this.element.className.replaceAll('_RemoveHovered', '');
        window.event.cancelBubble = true;
    },
    
    _removeLink_Click: function Coveo_CES_Web_Search_Scripts_Controls__facetScriptItem$_removeLink_Click() {
        /// <summary>
        /// Callback for when the user clicks on the remove link.
        /// </summary>
        this.facet._startAsyncItemCall(this, 'r');
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls._facetScriptSearchItem

Coveo.CES.Web.Search.Scripts.Controls._facetScriptSearchItem = function Coveo_CES_Web_Search_Scripts_Controls__facetScriptSearchItem(p_Facet, p_Index) {
    /// <summary>
    /// Information about an item in the search popup.
    /// </summary>
    /// <param name="p_Facet" type="Coveo.CES.Web.Search.Scripts.Controls.FacetScript">
    /// Facet containing the item.
    /// </param>
    /// <param name="p_Index" type="Number" integer="true">
    /// Index of the item in the list.
    /// </param>
    /// <field name="_hovereD_STYLE_NAME_SUFFIX" type="String" static="true">
    /// </field>
    /// <field name="_removE_HOVERED_STYLE_NAME_SUFFIX" type="String" static="true">
    /// </field>
    /// <field name="_m_MouseOverHandler" type="Function">
    /// </field>
    /// <field name="_m_MouseOutHandler" type="Function">
    /// </field>
    /// <field name="_m_ClickHandler" type="Function">
    /// </field>
    /// <field name="_m_RemoveClickHandler" type="Function">
    /// </field>
    /// <field name="_m_RemoveMouseOverHandler" type="Function">
    /// </field>
    /// <field name="_m_RemoveMouseOutHandler" type="Function">
    /// </field>
    /// <field name="facet" type="Coveo.CES.Web.Search.Scripts.Controls.FacetScript">
    /// </field>
    /// <field name="value" type="String">
    /// </field>
    /// <field name="element" type="Object" domElement="true">
    /// </field>
    /// <field name="removeLinkElem" type="Object" domElement="true">
    /// </field>
    /// <field name="index" type="Number" integer="true">
    /// </field>
    Coveo.CNL.Web.Scripts.CNLAssert.notNull(p_Facet);
    this.facet = p_Facet;
    this.index = p_Index;
}
Coveo.CES.Web.Search.Scripts.Controls._facetScriptSearchItem.prototype = {
    _m_MouseOverHandler: null,
    _m_MouseOutHandler: null,
    _m_ClickHandler: null,
    _m_RemoveClickHandler: null,
    _m_RemoveMouseOverHandler: null,
    _m_RemoveMouseOutHandler: null,
    facet: null,
    value: null,
    element: null,
    removeLinkElem: null,
    index: 0,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls__facetScriptSearchItem$initialize() {
        /// <summary>
        /// Initializes the item.
        /// </summary>
        this._m_MouseOverHandler = ss.Delegate.create(this, this.item_MouseOver);
        this._m_MouseOutHandler = ss.Delegate.create(this, this.item_MouseOut);
        this._m_ClickHandler = ss.Delegate.create(this, this.item_Click);
        this.element.attachEvent('onmouseover', this._m_MouseOverHandler);
        this.element.attachEvent('onmouseout', this._m_MouseOutHandler);
        this.element.attachEvent('onclick', this._m_ClickHandler);
        this._m_RemoveMouseOverHandler = ss.Delegate.create(this, this._removeLink_MouseOver);
        this._m_RemoveMouseOutHandler = ss.Delegate.create(this, this._removeLink_MouseOut);
        this._m_RemoveClickHandler = ss.Delegate.create(this, this.removeLink_Click);
        this.removeLinkElem.attachEvent('onmouseover', this._m_RemoveMouseOverHandler);
        this.removeLinkElem.attachEvent('onmouseout', this._m_RemoveMouseOutHandler);
        this.removeLinkElem.attachEvent('onclick', this._m_RemoveClickHandler);
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls__facetScriptSearchItem$tearDown() {
        /// <summary>
        /// Releases the item.
        /// </summary>
        this.element.detachEvent('onmouseover', this._m_MouseOverHandler);
        this.element.detachEvent('onmouseout', this._m_MouseOutHandler);
        this.element.detachEvent('onclick', this._m_ClickHandler);
        this.removeLinkElem.detachEvent('onmouseover', this._m_RemoveMouseOverHandler);
        this.removeLinkElem.detachEvent('onmouseout', this._m_RemoveMouseOutHandler);
        this.removeLinkElem.detachEvent('onclick', this._m_RemoveClickHandler);
    },
    
    isSelected: function Coveo_CES_Web_Search_Scripts_Controls__facetScriptSearchItem$isSelected() {
        /// <summary>
        /// Gets whether the item is presently selected.
        /// </summary>
        /// <returns type="Boolean"></returns>
        return (this.element.className.indexOf(' CesFacetSearchLine_Hovered') !== -1 || this.element.className.indexOf(' CesFacetSearchLine_RemoveHovered') !== -1);
    },
    
    _getNormalClassName: function Coveo_CES_Web_Search_Scripts_Controls__facetScriptSearchItem$_getNormalClassName() {
        /// <summary>
        /// Gets the normal (not hovered) class name.
        /// </summary>
        /// <returns type="String"></returns>
        return this.element.className.replaceAll(' CesFacetSearchLine_Hovered', '').replaceAll(' CesFacetSearchLine_RemoveHovered', '');
    },
    
    item_MouseOver: function Coveo_CES_Web_Search_Scripts_Controls__facetScriptSearchItem$item_MouseOver() {
        /// <summary>
        /// Callback for when the mouse enters the item.
        /// </summary>
        if (this.facet._m_SelectedSearchItem != null) {
            this.facet._m_SelectedSearchItem.item_MouseOut();
            this.facet._m_SelectedSearchItem = null;
        }
        this.element.className = this._getNormalClassName() + ' CesFacetSearchLine_Hovered';
        this.facet._m_SelectedSearchItem = this;
    },
    
    item_MouseOut: function Coveo_CES_Web_Search_Scripts_Controls__facetScriptSearchItem$item_MouseOut() {
        /// <summary>
        /// Callback for when the mouse leaves the item.
        /// </summary>
        this.element.className = this._getNormalClassName();
    },
    
    item_Click: function Coveo_CES_Web_Search_Scripts_Controls__facetScriptSearchItem$item_Click() {
        /// <summary>
        /// Callback for when the user clicks on the item.
        /// </summary>
        this.facet._searchItemClicked(this);
    },
    
    _removeLink_MouseOver: function Coveo_CES_Web_Search_Scripts_Controls__facetScriptSearchItem$_removeLink_MouseOver() {
        /// <summary>
        /// Callback for when mouse enters the remove link.
        /// </summary>
        if (this.facet._m_SelectedSearchItem != null) {
            this.facet._m_SelectedSearchItem.item_MouseOut();
            this.facet._m_SelectedSearchItem = null;
        }
        this.element.className = this._getNormalClassName() + ' CesFacetSearchLine_RemoveHovered';
        window.event.cancelBubble = true;
        this.facet._m_SelectedSearchItem = this;
    },
    
    _removeLink_MouseOut: function Coveo_CES_Web_Search_Scripts_Controls__facetScriptSearchItem$_removeLink_MouseOut() {
        /// <summary>
        /// Callback for when mouse exits the remove link.
        /// </summary>
        this.element.className = this._getNormalClassName();
        window.event.cancelBubble = true;
    },
    
    removeLink_Click: function Coveo_CES_Web_Search_Scripts_Controls__facetScriptSearchItem$removeLink_Click() {
        /// <summary>
        /// Callback for when the user clicks on the remove link.
        /// </summary>
        this.facet._searchItemRemoveClicked(this);
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.LegacyFacetScript

Coveo.CES.Web.Search.Scripts.Controls.LegacyFacetScript = function Coveo_CES_Web_Search_Scripts_Controls_LegacyFacetScript() {
    /// <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_OnClickElsewhereEvent$2" type="Coveo.CNL.Web.Scripts.OnClickElsewhereEvent">
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.LegacyFacetScript.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.LegacyFacetScript.prototype = {
    m_Main: null,
    m_Header: null,
    m_Popup: null,
    m_Showing: false,
    _m_OnClickElsewhereEvent$2: null,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_LegacyFacetScript$initialize() {
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_Main);
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_Header);
        Coveo.CES.Web.Search.Scripts.Controls.LegacyFacetScript.callBaseMethod(this, 'initialize');
        this.addOnClickAttribute(this.m_Header, ss.Delegate.create(this, this._header_Click$2), true);
        if (this.m_Popup != null) {
            this._m_OnClickElsewhereEvent$2 = new Coveo.CNL.Web.Scripts.OnClickElsewhereEvent([ this.m_Main ], ss.Delegate.create(this, this._main_ClickElsewhere$2), true);
        }
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_LegacyFacetScript$tearDown() {
        if (this._m_OnClickElsewhereEvent$2 != null) {
            this._m_OnClickElsewhereEvent$2.dispose();
            this._m_OnClickElsewhereEvent$2 = null;
        }
        Coveo.CES.Web.Search.Scripts.Controls.LegacyFacetScript.callBaseMethod(this, 'tearDown');
    },
    
    fillItems: function Coveo_CES_Web_Search_Scripts_Controls_LegacyFacetScript$fillItems(p_Callback) {
        /// <param name="p_Callback" type="Coveo.CNL.Web.Scripts.Ajax.Function">
        /// </param>
    },
    
    hideItems: function Coveo_CES_Web_Search_Scripts_Controls_LegacyFacetScript$hideItems(p_Callback) {
        /// <param name="p_Callback" type="Coveo.CNL.Web.Scripts.Ajax.Function">
        /// </param>
    },
    
    _fillItemsCallback$2: function Coveo_CES_Web_Search_Scripts_Controls_LegacyFacetScript$_fillItemsCallback$2(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$2: function Coveo_CES_Web_Search_Scripts_Controls_LegacyFacetScript$_hideItemsCallback$2(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$2: function Coveo_CES_Web_Search_Scripts_Controls_LegacyFacetScript$_header_Click$2() {
        if (!this.m_Showing) {
            if (this.m_Popup != null) {
                this.m_Popup.style.visibility = 'hidden';
            }
            this.fillItems(ss.Delegate.create(this, this._fillItemsCallback$2));
        }
        else if (this.m_Popup == null) {
            this.hideItems(ss.Delegate.create(this, this._hideItemsCallback$2));
        }
    },
    
    _main_ClickElsewhere$2: function Coveo_CES_Web_Search_Scripts_Controls_LegacyFacetScript$_main_ClickElsewhere$2() {
        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._facetScriptAsyncItemCall

Coveo.CES.Web.Search.Scripts.Controls._facetScriptAsyncItemCall = function Coveo_CES_Web_Search_Scripts_Controls__facetScriptAsyncItemCall() {
    /// <summary>
    /// Information about an item in the facet.
    /// </summary>
    /// <field name="item" type="Coveo.CES.Web.Search.Scripts.Controls._facetScriptItem">
    /// </field>
    /// <field name="op" type="String">
    /// </field>
    /// <field name="callSeqNo" type="Number" integer="true">
    /// </field>
}
Coveo.CES.Web.Search.Scripts.Controls._facetScriptAsyncItemCall.prototype = {
    item: null,
    op: null,
    callSeqNo: 0
}


////////////////////////////////////////////////////////////////////////////////
// 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="_hidE_SEARCH_POPUP_TIMER_DELAY$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_searcH_ICON_TIMER_DELAY$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_scrolL_ANIM_TICK_COUNT$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_scrolL_ANIM_DELAY$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_faceT_SCROLL_TIMER_DELAY$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_searcH_KEYUP_TIMER_DELAY$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_outlooK_ELLIPSIS_TIMER_DELAY$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_jS_ENTER$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_jS_ESC$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_jS_DEL$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_jS_UP_ARROW$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_jS_DOWN_ARROW$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_iteM_MAIN_STYLES$1" type="Array" elementType="String">
    /// </field>
    /// <field name="_normaL_LINE_CHECKED$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_normaL_LINE_NOT_CHECKED_HOVERED$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_normaL_LINE_CHECKED_HOVERED$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_removeD_LINE$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_removeD_LINE_HOVERED$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_faceT_STYLE_NAME$1" type="String" static="true">
    /// </field>
    /// <field name="_disableD_FACET_STYLE_NAME$1" type="String" static="true">
    /// </field>
    /// <field name="_ellipsiS_ELEM_STYLE_NAME$1" type="String" static="true">
    /// </field>
    /// <field name="_checkboX_ELEM_STYLE_NAME$1" type="String" static="true">
    /// </field>
    /// <field name="_removE_ELEM_STYLE_NAME$1" type="String" static="true">
    /// </field>
    /// <field name="_texT_ELEM_STYLE_NAME$1" type="String" static="true">
    /// </field>
    /// <field name="_icoN_ELEM_STYLE_NAME$1" type="String" static="true">
    /// </field>
    /// <field name="_sidE_CAPTION_ELEM_STYLE_NAME$1" type="String" static="true">
    /// </field>
    /// <field name="_suB_CAPTION_ELEM_STYLE_NAME$1" type="String" static="true">
    /// </field>
    /// <field name="_noN_FOCUS_TEXT_STYLE_NAME$1" type="String" static="true">
    /// </field>
    /// <field name="_dropdowN_CONTAINER_STYLE_NAME$1" type="String" static="true">
    /// </field>
    /// <field name="_outlooK_ADDIN_PARAMETER$1" type="String" static="true">
    /// </field>
    /// <field name="_seL_MODE_OR$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_seL_MODE_AND$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_ellipsiS_LEFT$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_ellipsiS_RIGHT$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_faceT_ZONE_RIGHT$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_faceT_ZONE_TOP$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_faceT_ZONE_LEFT$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_s_Instances$1" type="Object" static="true">
    /// </field>
    /// <field name="_s_DocumentKeyDownHandler$1" type="Function" static="true">
    /// </field>
    /// <field name="_s_FocusControl$1" type="String" static="true">
    /// </field>
    /// <field name="_s_FocusFacet$1" type="String" static="true">
    /// </field>
    /// <field name="_s_ClickSeqNo$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_s_AsyncItemFacet$1" type="Coveo.CES.Web.Search.Scripts.Controls.FacetScript" static="true">
    /// </field>
    /// <field name="_s_SearchedFacet$1" type="Coveo.CES.Web.Search.Scripts.Controls.FacetScript" static="true">
    /// </field>
    /// <field name="_s_WaitingForAjaxResponse$1" type="Coveo.CES.Web.Search.Scripts.Controls._ajaxCall" static="true">
    /// </field>
    /// <field name="_s_ScrollPosBeforePostBack$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_s_IgnoreNextFeedback$1" type="Boolean" static="true">
    /// </field>
    /// <field name="_s_SearchPopupShown$1" type="Boolean" static="true">
    /// </field>
    /// <field name="_s_SearchPopupScrollCausedByKeyUp$1" type="Boolean" static="true">
    /// </field>
    /// <field name="_s_SearchPopupScrollHeightBefore$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_s_SearchPopupScrollStartPos$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_s_SearchPopupScrollTimer$1" type="Coveo.CNL.Web.Scripts.Timeout" static="true">
    /// </field>
    /// <field name="_s_AnimDelta$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_s_AnimTickNo$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_s_MouseCapture$1" type="Coveo.CNL.Web.Scripts.MouseCapture" static="true">
    /// </field>
    /// <field name="_s_TopSpacerElem$1" type="Object" domElement="true" static="true">
    /// </field>
    /// <field name="_s_BottomSpacerElem$1" type="Object" domElement="true" static="true">
    /// </field>
    /// <field name="_s_LastFacetPositioned$1" type="Coveo.CES.Web.Search.Scripts.Controls.FacetScript" static="true">
    /// </field>
    /// <field name="_s_CollapseTopSpacerTimer$1" type="Coveo.CNL.Web.Scripts.Timeout" static="true">
    /// </field>
    /// <field name="_s_FacetToHideDropDownFor$1" type="Coveo.CES.Web.Search.Scripts.Controls.FacetScript" static="true">
    /// </field>
    /// <field name="_s_OutlookEllipsisTimer$1" type="Coveo.CNL.Web.Scripts.Timeout" static="true">
    /// </field>
    /// <field name="_s_OutlookLastWidth$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_m_Items$1" type="Object">
    /// </field>
    /// <field name="_m_AsyncItemCalls$1" type="Object">
    /// </field>
    /// <field name="_m_CollapseExpandClickHandler$1" type="Function">
    /// </field>
    /// <field name="_m_SearchBoxKeyDownHandler$1" type="Function">
    /// </field>
    /// <field name="_m_SearchBoxKeyUpHandler$1" type="Function">
    /// </field>
    /// <field name="_m_SearchBoxFocusHandler$1" type="Function">
    /// </field>
    /// <field name="_m_SearchBoxBlurHandler$1" type="Function">
    /// </field>
    /// <field name="_m_ClearSearchBoxClickHandler$1" type="Function">
    /// </field>
    /// <field name="_m_EraserClickHandler$1" type="Function">
    /// </field>
    /// <field name="_m_SelectionModeClickHandler$1" type="Function">
    /// </field>
    /// <field name="_m_MoreLinkClickHandler$1" type="Function">
    /// </field>
    /// <field name="_m_LessLinkClickHandler$1" type="Function">
    /// </field>
    /// <field name="_m_MoreLink$1" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_LessLink$1" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_Eraser$1" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_NormalIconUrl$1" type="String">
    /// </field>
    /// <field name="_m_LastSearchTextSent$1" type="String">
    /// </field>
    /// <field name="_m_HideSearchPopupTimer$1" type="Coveo.CNL.Web.Scripts.Timeout">
    /// </field>
    /// <field name="_m_SearchIconTimer$1" type="Coveo.CNL.Web.Scripts.Timeout">
    /// </field>
    /// <field name="_m_SearchItems$1" type="Array">
    /// </field>
    /// <field name="_m_SearchKeyUpTimer$1" type="Coveo.CNL.Web.Scripts.Timeout">
    /// </field>
    /// <field name="_m_SelectedSearchItem" type="Coveo.CES.Web.Search.Scripts.Controls._facetScriptSearchItem">
    /// </field>
    /// <field name="_m_OnClickElsewhereEvent$1" type="Coveo.CNL.Web.Scripts.OnClickElsewhereEvent">
    /// </field>
    /// <field name="m_FacetElemID" type="String">
    /// ID of the facet element in the DOM (set by the AJAX framework).
    /// </field>
    /// <field name="m_SelectionMode" type="Number" integer="true">
    /// Current selection mode (set by the AJAX framework).
    /// </field>
    /// <field name="m_SearchBox" type="Object" domElement="true">
    /// The search box element (set by the AJAX framework).
    /// </field>
    /// <field name="m_ClearSearchLink" type="Object" domElement="true">
    /// The clear link next to the search box (set by the AJAX framework).
    /// </field>
    /// <field name="m_SearchPopup" type="Object" domElement="true">
    /// The popup element that appears under the search box (set by the AJAX framework).
    /// </field>
    /// <field name="m_CollExpElem" type="Object" domElement="true">
    /// The collapse/expand element in the title bar (set by the AJAX framework).
    /// </field>
    /// <field name="m_DropDownContainer" type="Object" domElement="true">
    /// The dropdown popup (set by the AJAX framework).
    /// </field>
    /// <field name="m_EraserElemID" type="String">
    /// The eraser element in the facet's header (set by the AJAX framework).
    /// </field>
    /// <field name="m_SelectionModeIcon" type="Object" domElement="true">
    /// The selection mode icon element in the facet's header (set by the AJAX framework).
    /// </field>
    /// <field name="m_NonFocusText" type="String">
    /// Text displayed in the search box when no text is entered in it (set by the AJAX framework).
    /// </field>
    /// <field name="m_MoreLinkID" type="String">
    /// ID of the more link in the DOM (set by the AJAX framework).
    /// </field>
    /// <field name="m_LessLinkID" type="String">
    /// ID of the fewer link in the DOM (set by the AJAX framework).
    /// </field>
    /// <field name="m_IconElem" type="Object" domElement="true">
    /// The icon element (set by the AJAX framework).
    /// </field>
    /// <field name="m_LoadingIconUrl" type="String">
    /// The URL of the animated icon used to show that the facet is working (set by the AJAX framework).
    /// </field>
    /// <field name="m_Ellipsis" type="Number" integer="true">
    /// The side of the ellipsis relative to the caption.
    /// </field>
    /// <field name="m_FacetZone" type="Number" integer="true">
    /// The zone where the facet is located.
    /// </field>
    /// <field name="m_IsCollapsed" type="Boolean">
    /// A value indicating whether the facet is collapsed.
    /// </field>
    /// <field name="m_IsDropDownFacet" type="Boolean">
    /// A value indicating whether the facet is a dropdown facet.
    /// </field>
    /// <field name="_asynC_ITEM_OP_SELECT" type="String" static="true">
    /// </field>
    /// <field name="_asynC_ITEM_OP_REMOVE" type="String" static="true">
    /// </field>
    /// <field name="_asynC_ITEM_OP_UNREMOVE" type="String" static="true">
    /// </field>
    /// <field name="_reT_XML_SEARCH_ITEM_VALUE" type="String" static="true">
    /// </field>
    /// <field name="_reT_XML_SEARCH_ITEM_ELEM_ID" type="String" static="true">
    /// </field>
    /// <field name="_reT_XML_SEARCH_ITEM_REMOVE_ELEM_ID" type="String" static="true">
    /// </field>
    this._iteM_MAIN_STYLES$1 = [ 'CesFacetNormalLine_NotChecked_RemoveHovered', 'CesFacetNormalLine_NotChecked_Hovered', 'CesFacetNormalLine_NotChecked', 'CesFacetNormalLine_Checked_RemoveHovered', 'CesFacetNormalLine_Checked_Hovered', 'CesFacetNormalLine_Checked', 'CesFacetRemovedLine_RemoveHovered', 'CesFacetRemovedLine_Hovered', 'CesFacetRemovedLine' ];
    this._m_Items$1 = {};
    this._m_AsyncItemCalls$1 = {};
    this._m_SearchItems$1 = [];
    Coveo.CES.Web.Search.Scripts.Controls.FacetScript.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._searchPopupScrollTimer_Tick$1 = function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_searchPopupScrollTimer_Tick$1(arg) {
    /// <summary>
    /// Callback of the search popup scroll timer.
    /// </summary>
    /// <param name="arg" type="Object">
    /// </param>
    var docElem = Coveo.CNL.Web.Scripts.DOMUtilities.getDocumentElemForScroll();
    ++Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AnimTickNo$1;
    var scrollPixels = Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AnimDelta$1 * (Math.cos(Math.PI * Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AnimTickNo$1 / 50) - 1) / 2;
    var newScrollTop = Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchPopupScrollStartPos$1 - scrollPixels;
    if (docElem.scrollTop < newScrollTop) {
        docElem.scrollTop = newScrollTop;
        var scrollHeightAfter = docElem.scrollHeight;
        if (scrollHeightAfter > Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchPopupScrollHeightBefore$1) {
            Coveo.CES.Web.Search.Scripts.Controls.FacetScript._addBottomPadding$1(Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchedFacet$1._getFacetElem().parentNode, scrollHeightAfter - Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchPopupScrollHeightBefore$1);
        }
        if (Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AnimTickNo$1 < 50) {
            Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchPopupScrollTimer$1 = new Coveo.CNL.Web.Scripts.Timeout(Coveo.CES.Web.Search.Scripts.Controls.FacetScript._searchPopupScrollTimer_Tick$1, null, 10);
        }
        else {
            Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchPopupScrollTimer$1 = null;
        }
    }
}
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._mouseCapture_MouseMoveEventHandler$1 = function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_mouseCapture_MouseMoveEventHandler$1() {
    if (Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_CollapseTopSpacerTimer$1 == null && !Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchPopupShown$1 && Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_TopSpacerElem$1 != null && Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_TopSpacerElem$1.style.height !== '0px') {
        var firstAndLastFacets = new Array(2);
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._getFirstAndLastFacets$1(Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_LastFacetPositioned$1, firstAndLastFacets);
        var firstFacetElem = firstAndLastFacets[0]._getFacetElem();
        var lastFacetElem = firstAndLastFacets[1]._getFacetElem();
        var firstFacetRect = Coveo.CNL.Web.Scripts.DOMUtilities.getElementBounds(firstFacetElem);
        var lastFacetRect = Coveo.CNL.Web.Scripts.DOMUtilities.getElementBounds(lastFacetElem);
        var scrollPos = Coveo.CNL.Web.Scripts.DOMUtilities.getScrollingAmount();
        var mouseX = window.event.clientX + scrollPos.width;
        var mouseY = window.event.clientY + scrollPos.height;
        if (mouseX < firstFacetRect.left || mouseX > firstFacetRect.right || mouseY < firstFacetRect.top || mouseY > lastFacetRect.bottom) {
            Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AnimDelta$1 = Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_TopSpacerElem$1.offsetHeight;
            Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AnimTickNo$1 = 0;
            Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_CollapseTopSpacerTimer$1 = new Coveo.CNL.Web.Scripts.Timeout(Coveo.CES.Web.Search.Scripts.Controls.FacetScript._collapseTopSpacerTimer_Tick$1, null, 10);
        }
    }
    if (Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_FacetToHideDropDownFor$1 != null) {
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_FacetToHideDropDownFor$1._hideDropDownNow();
    }
    Coveo.CES.Web.Search.Scripts.Controls.FacetScript._removeBottomPaddingIfOk$1();
}
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._collapseTopSpacerTimer_Tick$1 = function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_collapseTopSpacerTimer_Tick$1(arg) {
    /// <summary>
    /// Callback of the top spacer collapsing timer.
    /// </summary>
    /// <param name="arg" type="Object">
    /// </param>
    Coveo.CNL.Web.Scripts.CNLAssert.notNull(Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_TopSpacerElem$1);
    ++Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AnimTickNo$1;
    var scrollHeight = Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AnimDelta$1 + Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AnimDelta$1 * (Math.cos(Math.PI * Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AnimTickNo$1 / 50) - 1) / 2;
    Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_TopSpacerElem$1.style.height = scrollHeight + 'px';
    if (Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AnimTickNo$1 < 50) {
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_CollapseTopSpacerTimer$1 = new Coveo.CNL.Web.Scripts.Timeout(Coveo.CES.Web.Search.Scripts.Controls.FacetScript._collapseTopSpacerTimer_Tick$1, null, 10);
    }
    else {
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_CollapseTopSpacerTimer$1 = null;
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_TopSpacerElem$1.parentNode.removeChild(Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_TopSpacerElem$1);
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_TopSpacerElem$1 = null;
    }
}
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._outlookEllipsisTimer_Tick$1 = function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_outlookEllipsisTimer_Tick$1(arg) {
    /// <summary>
    /// Callback of the Outlook sidebar timer.
    /// </summary>
    /// <param name="arg" type="Object">
    /// </param>
    var doIt = false;
    var $dict1 = Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_Instances$1;
    for (var $key2 in $dict1) {
        var entry = { key: $key2, value: $dict1[$key2] };
        var firstFacet = entry.value;
        var facetElem = firstFacet._getFacetElem();
        if (facetElem != null) {
            var jqFacet = $(facetElem);
            var facetWidth = jqFacet.outerWidth();
            if (facetWidth !== Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_OutlookLastWidth$1) {
                doIt = true;
                Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_OutlookLastWidth$1 = facetWidth;
            }
        }
        break;
    }
    if (doIt) {
        var $dict3 = Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_Instances$1;
        for (var $key4 in $dict3) {
            var entry = { key: $key4, value: $dict3[$key4] };
            var facet = entry.value;
            facet._showEllipsisForLongItems$1(null);
        }
    }
    Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_OutlookEllipsisTimer$1 = new Coveo.CNL.Web.Scripts.Timeout(Coveo.CES.Web.Search.Scripts.Controls.FacetScript._outlookEllipsisTimer_Tick$1, null, 1000);
}
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._document_KeyDown$1 = function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_document_KeyDown$1() {
    /// <summary>
    /// Callback for when the user presses the ESC key.
    /// </summary>
    if (Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AsyncItemFacet$1 != null) {
        return;
    }
    if (window.event.keyCode === 27 && Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchedFacet$1 != null) {
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchedFacet$1._clearSearch();
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchedFacet$1 = null;
    }
    else if (window.event.keyCode === 13 || window.event.keyCode === 46) {
        var srcElem = window.event.srcElement;
        var srcFacet = Coveo.CES.Web.Search.Scripts.Controls.FacetScript._getFacetContainingElement$1(srcElem.id);
        if (srcFacet != null) {
            if (srcElem.getAttribute('tabIndex') != null) {
                if (window.event.keyCode === 46) {
                    var srcItem = srcFacet._getItemFromElement$1(srcElem);
                    if (srcItem != null && srcItem.removeLinkElem != null) {
                        srcItem.removeLinkElem.click();
                    }
                }
                else if (window.event.keyCode === 13) {
                    srcElem.click();
                }
                else {
                    Coveo.CNL.Web.Scripts.CNLAssert.fail();
                }
                window.event.cancelBubble = true;
                window.event.returnValue = false;
            }
        }
    }
}
Coveo.CES.Web.Search.Scripts.Controls.FacetScript.beginFeedback = function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$beginFeedback(p_FacetElemID) {
    /// <summary>
    /// Called when a postback is being started.
    /// </summary>
    /// <param name="p_FacetElemID" type="String">
    /// Facet that is triggering the postback.
    /// </param>
    Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(p_FacetElemID);
    if (!Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_IgnoreNextFeedback$1) {
        var facetScript = Coveo.CES.Web.Search.Scripts.Controls.FacetScript._getFacetContainingElement$1(p_FacetElemID);
        facetScript._saveFacetPosition$1();
        facetScript._showLoadingIcon$1();
        facetScript._disableOtherFacets$1();
    }
}
Coveo.CES.Web.Search.Scripts.Controls.FacetScript.endFeedback = function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$endFeedback(p_FacetElemID) {
    /// <summary>
    /// Called when a postback is complete.
    /// </summary>
    /// <param name="p_FacetElemID" type="String">
    /// Facet that triggered the postback.
    /// </param>
    Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(p_FacetElemID);
    if (!Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_IgnoreNextFeedback$1) {
        var facetScript = Coveo.CES.Web.Search.Scripts.Controls.FacetScript._getFacetContainingElement$1(p_FacetElemID);
        if (facetScript != null) {
            facetScript._enableOtherFacets$1();
            facetScript._hideLoadingIcon$1();
            facetScript._restoreFacetPosition$1();
        }
    }
}
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._getFacetContainingElement$1 = function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_getFacetContainingElement$1(p_ElemID) {
    /// <summary>
    /// Finds the instance of <see cref="T:Coveo.CES.Web.Search.Scripts.Controls.FacetScript" /> that contains a given
    /// child element.
    /// </summary>
    /// <param name="p_ElemID" type="String">
    /// Child element.
    /// </param>
    /// <returns type="Coveo.CES.Web.Search.Scripts.Controls.FacetScript"></returns>
    var retFacet = null;
    var $dict1 = Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_Instances$1;
    for (var $key2 in $dict1) {
        var entry = { key: $key2, value: $dict1[$key2] };
        var facet = entry.value;
        if (p_ElemID.startsWith(facet.m_FacetElemID)) {
            retFacet = facet;
            break;
        }
    }
    return retFacet;
}
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._getFirstAndLastFacets$1 = function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_getFirstAndLastFacets$1(p_This, p_OutFirstAndLastFacets) {
    /// <summary>
    /// Finds the first and last facets in the same toolbar than a given facet.
    /// </summary>
    /// <param name="p_This" type="Coveo.CES.Web.Search.Scripts.Controls.FacetScript">
    /// Reference facet.
    /// </param>
    /// <param name="p_OutFirstAndLastFacets" type="Array" elementType="FacetScript">
    /// Found facets.
    /// </param>
    Coveo.CNL.Web.Scripts.CNLAssert.check(p_OutFirstAndLastFacets.length === 2);
    var thisFacetElem = p_This._getFacetElem();
    var thisFacetPos = Coveo.CNL.Web.Scripts.DOMUtilities.getElementPosition(thisFacetElem);
    var topSoFar = 1000000;
    var bottomSoFar = -1000000;
    p_OutFirstAndLastFacets[0] = p_This;
    p_OutFirstAndLastFacets[1] = p_This;
    var $dict1 = Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_Instances$1;
    for (var $key2 in $dict1) {
        var entry = { key: $key2, value: $dict1[$key2] };
        var testFacet = entry.value;
        var testFacetElem = testFacet._getFacetElem();
        var testFacetPos = Coveo.CNL.Web.Scripts.DOMUtilities.getElementPosition(testFacetElem);
        if (testFacetPos.left === thisFacetPos.left) {
            if (testFacetElem.clientHeight > 0 && testFacetPos.top < topSoFar) {
                p_OutFirstAndLastFacets[0] = testFacet;
                topSoFar = testFacetPos.top;
            }
            if (testFacetElem.clientHeight > 0 && testFacetPos.top > bottomSoFar) {
                p_OutFirstAndLastFacets[1] = testFacet;
                bottomSoFar = testFacetPos.top;
            }
        }
    }
}
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._addBottomPadding$1 = function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_addBottomPadding$1(p_ToolbarElem, p_NeededPagePadding) {
    /// <summary>
    /// Adds padding to the bottom of the facet toolbar.
    /// </summary>
    /// <param name="p_ToolbarElem" type="Object" domElement="true">
    /// Facet toolbar element.
    /// </param>
    /// <param name="p_NeededPagePadding" type="Number" integer="true">
    /// Needed additional padding at the bottom of the page.
    /// </param>
    if (Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_BottomSpacerElem$1 == null) {
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_BottomSpacerElem$1 = document.createElement('div');
        p_ToolbarElem.appendChild(Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_BottomSpacerElem$1);
    }
    var spacerTop = Coveo.CNL.Web.Scripts.DOMUtilities.getElementPosition(Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_BottomSpacerElem$1).top;
    var pageBottom = Coveo.CNL.Web.Scripts.DOMUtilities.getDocumentElemForScroll().scrollHeight;
    var newHeight = pageBottom - spacerTop + p_NeededPagePadding;
    if (newHeight >= 0) {
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_BottomSpacerElem$1.style.height = newHeight + 'px';
    }
}
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._removeBottomPaddingIfOk$1 = function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_removeBottomPaddingIfOk$1() {
    /// <summary>
    /// Reduces or completely removes the bottom padding.
    /// </summary>
    if (Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_BottomSpacerElem$1 != null) {
        var documentHeight = Coveo.CNL.Web.Scripts.DOMUtilities.getWindowSize().height;
        var scrollPos = Coveo.CNL.Web.Scripts.DOMUtilities.getScrollingAmount().height;
        var spacerRect = Coveo.CNL.Web.Scripts.DOMUtilities.getElementBounds(Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_BottomSpacerElem$1);
        if (scrollPos + documentHeight < spacerRect.top) {
            Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_BottomSpacerElem$1.parentNode.removeChild(Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_BottomSpacerElem$1);
            Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_BottomSpacerElem$1 = null;
        }
        else if (scrollPos + documentHeight < spacerRect.bottom) {
            Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_BottomSpacerElem$1.style.height = (scrollPos + documentHeight - spacerRect.top) + 'px';
        }
    }
}
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._searchBoxKeyEventName$1 = function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_searchBoxKeyEventName$1() {
    /// <summary>
    /// Being bound to javascript event onkeyup instead of onkeypress is better,
    /// because it is called after the content of the edit box is updated and
    /// therefore would normally avoid the need of a timer here.  But the
    /// onkeyup event does not work from within the Outlook sidebar.  This
    /// method chooses between both events.
    /// </summary>
    /// <returns type="String"></returns>
    return (!Coveo.CES.Web.Search.Scripts.Controls.FacetScript._isInOutlookSideBar$1()) ? 'onkeyup' : 'onkeypress';
}
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._isInOutlookSideBar$1 = function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_isInOutlookSideBar$1() {
    /// <summary>
    /// Determines whether we are running in the Outlook sidebar.
    /// </summary>
    /// <returns type="Boolean"></returns>
    return (window.location.search.toLowerCase().indexOf('outlookaddin=1') !== -1);
}
Coveo.CES.Web.Search.Scripts.Controls.FacetScript.prototype = {
    _m_CollapseExpandClickHandler$1: null,
    _m_SearchBoxKeyDownHandler$1: null,
    _m_SearchBoxKeyUpHandler$1: null,
    _m_SearchBoxFocusHandler$1: null,
    _m_SearchBoxBlurHandler$1: null,
    _m_ClearSearchBoxClickHandler$1: null,
    _m_EraserClickHandler$1: null,
    _m_SelectionModeClickHandler$1: null,
    _m_MoreLinkClickHandler$1: null,
    _m_LessLinkClickHandler$1: null,
    _m_MoreLink$1: null,
    _m_LessLink$1: null,
    _m_Eraser$1: null,
    _m_NormalIconUrl$1: null,
    _m_LastSearchTextSent$1: null,
    _m_HideSearchPopupTimer$1: null,
    _m_SearchIconTimer$1: null,
    _m_SearchKeyUpTimer$1: null,
    _m_SelectedSearchItem: null,
    _m_OnClickElsewhereEvent$1: null,
    m_FacetElemID: null,
    m_SelectionMode: 0,
    m_SearchBox: null,
    m_ClearSearchLink: null,
    m_SearchPopup: null,
    m_CollExpElem: null,
    m_DropDownContainer: null,
    m_EraserElemID: null,
    m_SelectionModeIcon: null,
    m_NonFocusText: null,
    m_MoreLinkID: null,
    m_LessLinkID: null,
    m_IconElem: null,
    m_LoadingIconUrl: null,
    m_Ellipsis: 0,
    m_FacetZone: 0,
    m_IsCollapsed: false,
    m_IsDropDownFacet: false,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$initialize() {
        Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(this.m_FacetElemID);
        Coveo.CNL.Web.Scripts.CNLAssert.check(!this.m_SelectionMode || this.m_SelectionMode === 1);
        Coveo.CNL.Web.Scripts.CNLAssert.check(!this.m_FacetZone || this.m_FacetZone === 1 || this.m_FacetZone === 2);
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_CollExpElem);
        if (!Object.getKeyCount(Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_Instances$1)) {
            Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_DocumentKeyDownHandler$1 = Coveo.CES.Web.Search.Scripts.Controls.FacetScript._document_KeyDown$1;
            document.attachEvent('onkeydown', Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_DocumentKeyDownHandler$1);
            if (Coveo.CES.Web.Search.Scripts.Controls.FacetScript._isInOutlookSideBar$1()) {
                Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_OutlookEllipsisTimer$1 = new Coveo.CNL.Web.Scripts.Timeout(Coveo.CES.Web.Search.Scripts.Controls.FacetScript._outlookEllipsisTimer_Tick$1, null, 1000);
            }
            Coveo.CNL.Web.Scripts.CNLAssert.isNull(Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_MouseCapture$1);
            Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_MouseCapture$1 = new Coveo.CNL.Web.Scripts.MouseCapture(Coveo.CES.Web.Search.Scripts.Controls.FacetScript._mouseCapture_MouseMoveEventHandler$1, null, null);
            Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_MouseCapture$1.set_cancelBubble(false);
        }
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_Instances$1[this.m_FacetElemID] = this;
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript.callBaseMethod(this, 'initialize');
        if (this.m_IconElem != null) {
            this._m_NormalIconUrl$1 = this.m_IconElem.src;
        }
        if (this.m_SearchBox != null) {
            this._m_LastSearchTextSent$1 = this.m_SearchBox.value;
            if (this.m_NonFocusText != null && (!this.m_SearchBox.value || this.m_SearchBox.value === this.m_NonFocusText)) {
                if (this.m_SearchBox.className.indexOf('CesFacetSearchBoxInputNonFocus') === -1) {
                    this.m_SearchBox.className += ' ' + 'CesFacetSearchBoxInputNonFocus';
                }
                this.m_SearchBox.value = this.m_NonFocusText;
            }
            else {
                this.m_ClearSearchLink.style.visibility = 'visible';
            }
            this._m_SearchBoxKeyDownHandler$1 = ss.Delegate.create(this, this._searchBox_KeyDown$1);
            this.m_SearchBox.attachEvent('onkeydown', this._m_SearchBoxKeyDownHandler$1);
            this._m_SearchBoxKeyUpHandler$1 = ss.Delegate.create(this, this._searchBox_KeyUp$1);
            this.m_SearchBox.attachEvent(Coveo.CES.Web.Search.Scripts.Controls.FacetScript._searchBoxKeyEventName$1(), this._m_SearchBoxKeyUpHandler$1);
            this._m_SearchBoxFocusHandler$1 = ss.Delegate.create(this, this._searchBox_Focus$1);
            this.m_SearchBox.attachEvent('onfocus', this._m_SearchBoxFocusHandler$1);
            this._m_SearchBoxBlurHandler$1 = ss.Delegate.create(this, this._searchBox_Blur$1);
            this.m_SearchBox.attachEvent('onblur', this._m_SearchBoxBlurHandler$1);
            this._m_ClearSearchBoxClickHandler$1 = ss.Delegate.create(this, this._clearSearchBoxLink_Click$1);
            this.m_ClearSearchLink.attachEvent('onclick', this._m_ClearSearchBoxClickHandler$1);
        }
        this._m_CollapseExpandClickHandler$1 = ss.Delegate.create(this, this._collapseExpandLink_Click$1);
        this.m_CollExpElem.attachEvent('onclick', this._m_CollapseExpandClickHandler$1);
        this.m_CollExpElem.setAttribute('tabIndex', 0);
        this._m_Eraser$1 = document.getElementById(this.m_EraserElemID);
        if (this._m_Eraser$1 != null) {
            this._m_EraserClickHandler$1 = ss.Delegate.create(this, this._eraser_Click$1);
            this._m_Eraser$1.attachEvent('onclick', this._m_EraserClickHandler$1);
            this._m_Eraser$1.setAttribute('tabIndex', 0);
        }
        if (this.m_SelectionModeIcon != null) {
            this._m_SelectionModeClickHandler$1 = ss.Delegate.create(this, this._selectionModeIcon_Click$1);
            this.m_SelectionModeIcon.attachEvent('onclick', this._m_SelectionModeClickHandler$1);
            this.m_SelectionModeIcon.setAttribute('tabIndex', 0);
        }
        this._m_MoreLink$1 = ((String.isNullOrEmpty(this.m_MoreLinkID)) ? null : document.getElementById(this.m_MoreLinkID));
        if (this._m_MoreLink$1 != null) {
            this._m_MoreLinkClickHandler$1 = ss.Delegate.create(this, this._moreLink_Click$1);
            this._m_MoreLink$1.attachEvent('onclick', this._m_MoreLinkClickHandler$1);
            this._m_MoreLink$1.setAttribute('tabIndex', 0);
        }
        this._m_LessLink$1 = ((String.isNullOrEmpty(this.m_LessLinkID)) ? null : document.getElementById(this.m_LessLinkID));
        if (this._m_LessLink$1 != null) {
            this._m_LessLinkClickHandler$1 = ss.Delegate.create(this, this._lessLink_Click$1);
            this._m_LessLink$1.attachEvent('onclick', this._m_LessLinkClickHandler$1);
            this._m_LessLink$1.setAttribute('tabIndex', 0);
        }
        if (this.m_IsDropDownFacet && !this.m_IsCollapsed) {
            this._m_OnClickElsewhereEvent$1 = new Coveo.CNL.Web.Scripts.OnClickElsewhereEvent([ this._getFacetElem() ], ss.Delegate.create(this, this._facet_ClickElsewhere$1), true);
        }
        Coveo.CNL.Web.Scripts.Ajax.AjaxManagerScript.registerClientFeedback(this.get_ownerId(), new Coveo.CES.Web.Search.Scripts.Controls.FacetScriptFeedback(this.m_FacetElemID));
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$tearDown() {
        Coveo.CNL.Web.Scripts.Ajax.AjaxManagerScript.unregisterClientFeedback(this.get_ownerId());
        var $dict1 = this._m_Items$1;
        for (var $key2 in $dict1) {
            var entry = { key: $key2, value: $dict1[$key2] };
            var item = entry.value;
            item.tearDown();
        }
        this._releaseSearchItems$1();
        if (Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_FacetToHideDropDownFor$1 === this) {
            Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_FacetToHideDropDownFor$1 = null;
        }
        if (this._m_CollapseExpandClickHandler$1 != null) {
            this.m_CollExpElem.detachEvent('onclick', this._m_CollapseExpandClickHandler$1);
        }
        if (this._m_SearchBoxKeyDownHandler$1 != null) {
            this.m_SearchBox.detachEvent('onkeydown', this._m_SearchBoxKeyDownHandler$1);
        }
        if (this._m_SearchBoxKeyUpHandler$1 != null) {
            this.m_SearchBox.detachEvent(Coveo.CES.Web.Search.Scripts.Controls.FacetScript._searchBoxKeyEventName$1(), this._m_SearchBoxKeyUpHandler$1);
        }
        if (this._m_SearchBoxFocusHandler$1 != null) {
            this.m_SearchBox.detachEvent('onfocus', this._m_SearchBoxFocusHandler$1);
        }
        if (this._m_SearchBoxBlurHandler$1 != null) {
            this.m_SearchBox.detachEvent('onblur', this._m_SearchBoxBlurHandler$1);
        }
        if (this._m_ClearSearchBoxClickHandler$1 != null) {
            this.m_ClearSearchLink.detachEvent('onclick', this._m_ClearSearchBoxClickHandler$1);
        }
        if (this._m_EraserClickHandler$1 != null) {
            this._m_Eraser$1.detachEvent('onclick', this._m_EraserClickHandler$1);
        }
        if (this._m_SelectionModeClickHandler$1 != null) {
            this.m_SelectionModeIcon.detachEvent('onclick', this._m_SelectionModeClickHandler$1);
        }
        if (this._m_MoreLinkClickHandler$1 != null) {
            this._m_MoreLink$1.detachEvent('onclick', this._m_MoreLinkClickHandler$1);
        }
        if (this._m_LessLinkClickHandler$1 != null) {
            this._m_LessLink$1.detachEvent('onclick', this._m_LessLinkClickHandler$1);
        }
        if (this._m_HideSearchPopupTimer$1 != null) {
            this._m_HideSearchPopupTimer$1.cancel();
        }
        if (this._m_SearchIconTimer$1 != null) {
            this._m_SearchIconTimer$1.cancel();
        }
        if (this._m_SearchKeyUpTimer$1 != null) {
            this._m_SearchKeyUpTimer$1.cancel();
        }
        if (this._m_OnClickElsewhereEvent$1 != null) {
            this._m_OnClickElsewhereEvent$1.dispose();
            this._m_OnClickElsewhereEvent$1 = null;
        }
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript.callBaseMethod(this, 'tearDown');
        delete Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_Instances$1[this.m_FacetElemID];
        if (!Object.getKeyCount(Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_Instances$1)) {
            document.detachEvent('onkeydown', Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_DocumentKeyDownHandler$1);
            Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_DocumentKeyDownHandler$1 = null;
            if (Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_MouseCapture$1 != null) {
                Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_MouseCapture$1.dispose();
                Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_MouseCapture$1 = null;
            }
            if (Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_OutlookEllipsisTimer$1 != null) {
                Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_OutlookEllipsisTimer$1.cancel();
                Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_OutlookEllipsisTimer$1 = null;
            }
            if (Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchPopupScrollTimer$1 != null) {
                Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchPopupScrollTimer$1.cancel();
                Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchPopupScrollTimer$1 = null;
            }
            if (Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_CollapseTopSpacerTimer$1 != null) {
                Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_CollapseTopSpacerTimer$1.cancel();
                Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_CollapseTopSpacerTimer$1 = null;
            }
            if (Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_TopSpacerElem$1 != null) {
                Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_TopSpacerElem$1.parentNode.removeChild(Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_TopSpacerElem$1);
                Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_TopSpacerElem$1 = null;
            }
            if (Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_BottomSpacerElem$1 != null) {
                Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_BottomSpacerElem$1.parentNode.removeChild(Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_BottomSpacerElem$1);
                Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_BottomSpacerElem$1 = null;
            }
        }
    },
    
    initializeFacetItem: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$initializeFacetItem(p_ItemValue, p_ItemElemID, p_Op, p_RemoveElemID) {
        /// <summary>
        /// Repeatedly called after Initialze() to initialize each item.
        /// </summary>
        /// <param name="p_ItemValue" type="String">
        /// The value of the item.
        /// </param>
        /// <param name="p_ItemElemID" type="String">
        /// The ID of the element.
        /// </param>
        /// <param name="p_Op" type="String">
        /// Code of the operation when the item is clicked.
        /// </param>
        /// <param name="p_RemoveElemID" type="String">
        /// The ID of the remove link.
        /// </param>
        Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(p_ItemElemID);
        Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(p_ItemValue);
        var item = new Coveo.CES.Web.Search.Scripts.Controls._facetScriptItem(this);
        item.value = p_ItemValue;
        item.element = document.getElementById(p_ItemElemID);
        item.op = p_Op;
        item.removeLinkElem = ((String.isNullOrEmpty(p_RemoveElemID)) ? null : document.getElementById(p_RemoveElemID));
        this._m_Items$1[item.value] = item;
        item.initialize();
    },
    
    initComplete: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$initComplete() {
        /// <summary>
        /// Called once after every call to InitializeFacetItem().
        /// </summary>
        this._restoreFocus$1();
        if (this.m_IsDropDownFacet && !this.m_IsCollapsed) {
            var jqDropDownParent = $(this._getFacetElem());
            this.m_DropDownContainer.style.minWidth = jqDropDownParent.outerWidth(true) + 'px';
        }
        this._showEllipsisForLongItems$1(null);
    },
    
    registerDropDownHidingOnMouseLeave: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$registerDropDownHidingOnMouseLeave() {
        /// <summary>
        /// Called by the server to register the drop-down collapsing on the mouse leave event.
        /// </summary>
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_FacetToHideDropDownFor$1 = this;
    },
    
    _hideDropDownNow: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_hideDropDownNow() {
        /// <summary>
        /// Called when the mouse is leaving the (drop-down) facet to automatically close the popup.
        /// </summary>
        var scrollPos = Coveo.CNL.Web.Scripts.DOMUtilities.getScrollingAmount();
        var mouseX = window.event.clientX + scrollPos.width;
        var mouseY = window.event.clientY + scrollPos.height;
        var facetElem = this._getFacetElem();
        var popupElem = $(facetElem).children('.' + 'CesDropDownFacetContainer').get(0);
        var facetRect = Coveo.CNL.Web.Scripts.DOMUtilities.getElementBounds(facetElem);
        var popupRect = Coveo.CNL.Web.Scripts.DOMUtilities.getElementBounds(popupElem);
        if (!facetRect.isPtInside(mouseX, mouseY) && !popupRect.isPtInside(mouseX, mouseY)) {
            this.hideDropDown();
            Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_FacetToHideDropDownFor$1 = null;
        }
    },
    
    _startAsyncItemCall: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_startAsyncItemCall(p_Item, p_Op) {
        /// <summary>
        /// The user clicked on an item to select/remove/unremove it.
        /// </summary>
        /// <param name="p_Item" type="Coveo.CES.Web.Search.Scripts.Controls._facetScriptItem">
        /// Item clicked.
        /// </param>
        /// <param name="p_Op" type="String">
        /// Code of the operation.
        /// </param>
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(p_Item);
        Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(p_Op);
        if (!this._canQueueAsyncItemCalls()) {
            return;
        }
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AsyncItemFacet$1 = this;
        this._saveFocus$1((p_Item.clickedWithTheMouse) ? null : p_Item.element);
        var isCancelling;
        if (Object.keyExists(this._m_AsyncItemCalls$1, p_Item.value)) {
            delete this._m_AsyncItemCalls$1[p_Item.value];
            isCancelling = true;
        }
        else {
            var call = new Coveo.CES.Web.Search.Scripts.Controls._facetScriptAsyncItemCall();
            call.item = p_Item;
            call.op = p_Op;
            call.callSeqNo = Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_ClickSeqNo$1;
            this._m_AsyncItemCalls$1[p_Item.value] = call;
            isCancelling = false;
        }
        var opValueArray = new Array(Object.getKeyCount(this._m_AsyncItemCalls$1));
        var valueNo = 0;
        var $dict1 = this._m_AsyncItemCalls$1;
        for (var $key2 in $dict1) {
            var entry = { key: $key2, value: $dict1[$key2] };
            var call = entry.value;
            opValueArray[valueNo++] = [ call.op, call.item.value ];
        }
        ++Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_ClickSeqNo$1;
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_WaitingForAjaxResponse$1 = 2;
        this.valueClick(opValueArray, Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_ClickSeqNo$1, ss.Delegate.create(this, this._asyncItemCallComplete$1));
        switch (p_Op) {
            case 's':
                var newStyleName = ((p_Item.element.className.indexOf(this._iteM_MAIN_STYLES$1[5]) !== -1) ? this._iteM_MAIN_STYLES$1[1] : this._iteM_MAIN_STYLES$1[4]);
                this._changeItemStyleName$1(p_Item.element, newStyleName);
                break;
            case 'r':
                if (p_Item.cssClassBeforeSelection == null) {
                    p_Item.cssClassBeforeSelection = p_Item.element.className;
                    this._changeItemStyleName$1(p_Item.element, this._iteM_MAIN_STYLES$1[7]);
                }
                else {
                    p_Item.element.className = p_Item.cssClassBeforeSelection;
                    p_Item.cssClassBeforeSelection = null;
                }
                break;
            case 'ur':
                if (isCancelling) {
                    this._changeItemStyleName$1(p_Item.element, this._iteM_MAIN_STYLES$1[8]);
                }
                else {
                    this._changeItemStyleName$1(p_Item.element, this._iteM_MAIN_STYLES$1[1]);
                }
                break;
            default:
                Coveo.CNL.Web.Scripts.CNLAssert.fail();
                break;
        }
        this._showEllipsisForLongItems$1(null);
        window.event.cancelBubble = true;
        window.event.returnValue = false;
    },
    
    _asyncItemCallComplete$1: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_asyncItemCallComplete$1(p_Return) {
        /// <summary>
        /// Callback for when the call to the server method is complete.
        /// </summary>
        /// <param name="p_Return" type="Object">
        /// Call's return value.
        /// </param>
        Coveo.CNL.Web.Scripts.CNLAssert.check(Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AsyncItemFacet$1 === this);
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_WaitingForAjaxResponse$1 = 0;
        var callSeqNo = p_Return;
        var toRemove = [];
        var $dict1 = this._m_AsyncItemCalls$1;
        for (var $key2 in $dict1) {
            var entry = { key: $key2, value: $dict1[$key2] };
            var call = entry.value;
            if (call.callSeqNo < Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_ClickSeqNo$1) {
                ArrayPrototype_add(toRemove, entry.key);
                call.item.cssClassBeforeSelection = null;
            }
        }
        var $enum3 = ss.IEnumerator.getEnumerator(toRemove);
        while ($enum3.moveNext()) {
            var value = $enum3.current;
            delete this._m_AsyncItemCalls$1[value];
        }
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AsyncItemFacet$1 = null;
    },
    
    _searchItemClicked: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_searchItemClicked(p_Item) {
        /// <summary>
        /// The user clicked on an item in the search popup.
        /// </summary>
        /// <param name="p_Item" type="Coveo.CES.Web.Search.Scripts.Controls._facetScriptSearchItem">
        /// Item clicked.
        /// </param>
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(p_Item);
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchedFacet$1 = this;
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchPopupShown$1 = false;
        this._saveFocus$1(null);
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_WaitingForAjaxResponse$1 = 2;
        this.searchValueClick(p_Item.value, ss.Delegate.create(this, this._searchValueClickComplete$1));
        window.event.cancelBubble = true;
        window.event.returnValue = false;
    },
    
    _searchValueClickComplete$1: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_searchValueClickComplete$1(p_Return) {
        /// <summary>
        /// Callback for when the call to the server method is complete.
        /// </summary>
        /// <param name="p_Return" type="Object">
        /// Call's return value.
        /// </param>
        Coveo.CNL.Web.Scripts.CNLAssert.check(Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchedFacet$1 === this);
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_WaitingForAjaxResponse$1 = 0;
    },
    
    _searchItemRemoveClicked: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_searchItemRemoveClicked(p_Item) {
        /// <summary>
        /// The user clicked on an item's remove link in the search popup.
        /// </summary>
        /// <param name="p_Item" type="Coveo.CES.Web.Search.Scripts.Controls._facetScriptSearchItem">
        /// Item clicked.
        /// </param>
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(p_Item);
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchedFacet$1 = this;
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchPopupShown$1 = false;
        this._saveFocus$1(null);
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_WaitingForAjaxResponse$1 = 2;
        this.searchValueRemove(p_Item.value, ss.Delegate.create(this, this._searchValueClickComplete$1));
        window.event.cancelBubble = true;
        window.event.returnValue = false;
    },
    
    _canQueueAsyncItemCalls: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_canQueueAsyncItemCalls() {
        /// <summary>
        /// Checks if async item operations can be started and added to this facet's queue.
        /// (Batching clicks from 2 facets at the same time is not supported.)
        /// </summary>
        /// <returns type="Boolean"></returns>
        return (Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AsyncItemFacet$1 == null || (Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AsyncItemFacet$1 === this && !this.m_SelectionMode)) && Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_WaitingForAjaxResponse$1 !== 1;
    },
    
    _clearSearch: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_clearSearch() {
        /// <summary>
        /// Called by a static method when ESC is pressed.
        /// </summary>
        Coveo.CNL.Web.Scripts.CNLAssert.check(Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchedFacet$1 === this);
        if (this._m_SearchKeyUpTimer$1 != null) {
            this._m_SearchKeyUpTimer$1.cancel();
            this._m_SearchKeyUpTimer$1 = null;
        }
        if (this.m_ClearSearchLink != null && this.m_ClearSearchLink.style.visibility !== 'hidden') {
            this.m_ClearSearchLink.focus();
            this._clearSearchBoxLink_Click$1();
            window.event.cancelBubble = true;
            window.event.returnValue = false;
        }
    },
    
    _getFacetElem: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_getFacetElem() {
        /// <summary>
        /// Gets the facet's element from the DOM.
        /// </summary>
        /// <returns type="Object" domElement="true"></returns>
        return document.getElementById(this.m_FacetElemID);
    },
    
    showMoreOrLessValues: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$showMoreOrLessValues(p_Sign, p_Callback) {
        /// <param name="p_Sign" type="Number" integer="true">
        /// </param>
        /// <param name="p_Callback" type="Coveo.CNL.Web.Scripts.Ajax.Function">
        /// </param>
    },
    
    searchBoxTyping: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$searchBoxTyping(p_Text, p_Callback) {
        /// <param name="p_Text" type="String">
        /// </param>
        /// <param name="p_Callback" type="Coveo.CNL.Web.Scripts.Ajax.Function">
        /// </param>
        /// <returns type="Array" elementType="Array"></returns>
        return null;
    },
    
    valueClick: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$valueClick(p_OpValuePairs, p_CallSeqNo, p_Callback) {
        /// <param name="p_OpValuePairs" type="Array" elementType="Array">
        /// </param>
        /// <param name="p_CallSeqNo" type="Number" integer="true">
        /// </param>
        /// <param name="p_Callback" type="Coveo.CNL.Web.Scripts.Ajax.Function">
        /// </param>
        /// <returns type="Number" integer="true"></returns>
        return 0;
    },
    
    searchValueClick: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$searchValueClick(p_Value, p_Callback) {
        /// <param name="p_Value" type="String">
        /// </param>
        /// <param name="p_Callback" type="Coveo.CNL.Web.Scripts.Ajax.Function">
        /// </param>
    },
    
    searchValueRemove: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$searchValueRemove(p_Value, p_Callback) {
        /// <param name="p_Value" type="String">
        /// </param>
        /// <param name="p_Callback" type="Coveo.CNL.Web.Scripts.Ajax.Function">
        /// </param>
    },
    
    clearFacet: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$clearFacet(p_Callback) {
        /// <param name="p_Callback" type="Coveo.CNL.Web.Scripts.Ajax.Function">
        /// </param>
    },
    
    switchSelectionMode: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$switchSelectionMode(p_Callback) {
        /// <param name="p_Callback" type="Coveo.CNL.Web.Scripts.Ajax.Function">
        /// </param>
    },
    
    expandCollapse: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$expandCollapse() {
    },
    
    hideDropDown: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$hideDropDown() {
    },
    
    _getItemFromElement$1: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_getItemFromElement$1(p_ItemElem) {
        /// <summary>
        /// Finds the instance of <see cref="T:Coveo.CES.Web.Search.Scripts.Controls.FacetScriptItem" /> that corresponds
        /// to an item element.
        /// </summary>
        /// <param name="p_ItemElem" type="Object" domElement="true">
        /// Item element.
        /// </param>
        /// <returns type="Coveo.CES.Web.Search.Scripts.Controls._facetScriptItem"></returns>
        var retItem = null;
        var $dict1 = this._m_Items$1;
        for (var $key2 in $dict1) {
            var entry = { key: $key2, value: $dict1[$key2] };
            var item = entry.value;
            if (item.element === p_ItemElem) {
                retItem = item;
                break;
            }
        }
        return retItem;
    },
    
    _releaseSearchItems$1: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_releaseSearchItems$1() {
        /// <summary>
        /// Releases search items.
        /// </summary>
        var $enum1 = ss.IEnumerator.getEnumerator(this._m_SearchItems$1);
        while ($enum1.moveNext()) {
            var item = $enum1.current;
            item.tearDown();
        }
        this._m_SelectedSearchItem = null;
        ArrayPrototype_clear(this._m_SearchItems$1);
    },
    
    _showEllipsisForLongItems$1: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_showEllipsisForLongItems$1(arg) {
        /// <summary>
        /// Intelligently clips the items.
        /// </summary>
        /// <param name="arg" type="Object">
        /// </param>
        var isCssEffective = [ true ];
        var $dict1 = this._m_Items$1;
        for (var $key2 in $dict1) {
            var entry = { key: $key2, value: $dict1[$key2] };
            var item = entry.value;
            this._clipThisItem$1(item.element, -1, isCssEffective);
        }
        if (!isCssEffective[0]) {
            window.setTimeout(ss.Delegate.create(this, this._showEllipsisForLongItems$1), 0);
        }
    },
    
    _clipThisItem$1: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_clipThisItem$1(p_ItemElem, p_PopupWidth, p_IsCssEffective) {
        /// <summary>
        /// Intelligently clips one item (either a normal item or a search item).
        /// </summary>
        /// <param name="p_ItemElem" type="Object" domElement="true">
        /// Element (DIV) of the element to clip.
        /// </param>
        /// <param name="p_PopupWidth" type="Number" integer="true">
        /// -1 = Not a search item; 0 = Search item (non-IE7); Other = Search item's max width (patch for IE7).
        /// </param>
        /// <param name="p_IsCssEffective" type="Array" elementType="Boolean">
        /// Whether our CSS is effective.  (Array because Script# doesn't support ref parameters."/&gt;
        /// </param>
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(p_IsCssEffective);
        Coveo.CNL.Web.Scripts.CNLAssert.check(p_IsCssEffective.length === 1);
        var jqItem = $(p_ItemElem);
        var jqText = jqItem.children('.' + 'CesFacetLineText').first();
        var jqEllipsis = jqItem.children('.' + 'CesFacetLineEllipsis').first();
        var caption = jqText.attr('coveoCaption').htmlDecode();
        if (p_PopupWidth === -1) {
            jqText.text(caption);
        }
        var captionWidth = jqText.outerWidth(true);
        jqEllipsis.css('display', 'none');
        var availWidth;
        if (p_IsCssEffective[0]) {
            availWidth = ((p_PopupWidth <= 0) ? jqItem.width() : p_PopupWidth - (jqItem.outerWidth() - jqItem.width()) - 2);
            if (this.m_IsDropDownFacet) {
                var sizeOutsideWindow = jqItem.outerWidth(true) - (Coveo.CNL.Web.Scripts.DOMUtilities.getWindowSize().width - jqItem.offset().left);
                if (sizeOutsideWindow > 0) {
                    availWidth -= sizeOutsideWindow;
                }
            }
            if (Coveo.CNL.Web.Scripts.BrowserHelper.get_ieDocumentMode() <= 7 && Coveo.CNL.Web.Scripts.BrowserHelper.get_isIE()) {
                if (!availWidth) {
                    p_IsCssEffective[0] = false;
                }
                else {
                    availWidth -= 8;
                }
            }
            if (availWidth > 0) {
                jqItem.children().not('.' + 'CesFacetLineText').not('.' + 'CesFacetLineSubCaption').not('.' + 'CesFacetLineEllipsis').each(function(i, e) {
                    var o = $(e);
                    availWidth -= o.outerWidth(true);
                    if (p_IsCssEffective[0]) {
                        if ((e.className === 'CesFacetLineCheckBox' && !o.outerWidth(true)) || (e.className === 'CesFacetLineIcon' && !o.innerWidth())) {
                            p_IsCssEffective[0] = false;
                        }
                    }
                });
            }
        }
        else {
            availWidth = 40;
        }
        if (captionWidth > availWidth) {
            jqEllipsis.css('display', 'inline-block');
            availWidth -= jqEllipsis.outerWidth(true);
        }
        if (captionWidth <= availWidth) {
            p_ItemElem.title = '';
        }
        else {
            p_ItemElem.title = caption;
            var spanElem = jqText.get(0);
            if (this.m_Ellipsis === 1) {
                var delta = 4;
                while (captionWidth > availWidth && jqText.text().length > 0) {
                    var childNodes = spanElem.childNodes;
                    if (childNodes.length <= 0) {
                        break;
                    }
                    captionWidth = -1;
                    var lastChild = childNodes[childNodes.length - 1];
                    if (lastChild.nodeType === 3) {
                        var text = lastChild.nodeValue;
                        if (text.length > 1) {
                            if (delta >= text.length) {
                                delta = 1;
                            }
                            lastChild.nodeValue = text.substr(0, text.length - delta).trim();
                            captionWidth = jqText.outerWidth(true);
                            if (delta > 1 && captionWidth <= availWidth) {
                                delta = 1;
                                lastChild.nodeValue = text.substr(0, text.length - delta).trim();
                                captionWidth = -1;
                            }
                        }
                        else {
                            spanElem.removeChild(lastChild);
                        }
                    }
                    else {
                        spanElem.removeChild(lastChild);
                    }
                    if (captionWidth === -1) {
                        captionWidth = jqText.outerWidth(true);
                    }
                }
            }
            else if (!this.m_Ellipsis) {
                var delta = 4;
                while (captionWidth > availWidth && jqText.text().length > 0) {
                    var childNodes = spanElem.childNodes;
                    if (childNodes.length <= 0) {
                        break;
                    }
                    captionWidth = -1;
                    var firstChild = childNodes[0];
                    if (firstChild.nodeType === 3) {
                        var text = firstChild.nodeValue;
                        if (text.length > 1) {
                            if (delta >= text.length) {
                                delta = 1;
                            }
                            firstChild.nodeValue = text.substr(delta).trim();
                            captionWidth = jqText.outerWidth(true);
                            if (delta > 1 && captionWidth <= availWidth) {
                                delta = 1;
                                firstChild.nodeValue = text.substr(delta).trim();
                                captionWidth = -1;
                            }
                        }
                        else {
                            spanElem.removeChild(firstChild);
                        }
                    }
                    else {
                        spanElem.removeChild(firstChild);
                    }
                    if (captionWidth === -1) {
                        captionWidth = jqText.outerWidth(true);
                    }
                }
            }
            else {
                Coveo.CNL.Web.Scripts.CNLAssert.failWithMessage('Unsupported clipping mode.');
            }
            if (availWidth < 0) {
                var jqSideCaption = jqItem.children('.' + 'CesFacetLineSideCaption');
                var cssDict = {};
                cssDict['max-width'] = (jqSideCaption.outerWidth() + availWidth) + 'px';
                cssDict['overflow'] = 'hidden';
                cssDict['text-overflow'] = 'ellipsis';
                jqSideCaption.css(cssDict);
            }
        }
    },
    
    _changeItemStyleName$1: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_changeItemStyleName$1(p_ItemElem, p_NewStyleName) {
        /// <summary>
        /// Change the item's main CSS class to a different one.
        /// </summary>
        /// <param name="p_ItemElem" type="Object" domElement="true">
        /// Item's element.
        /// </param>
        /// <param name="p_NewStyleName" type="String">
        /// Name of the new desired main style.
        /// </param>
        var $enum1 = ss.IEnumerator.getEnumerator(this._iteM_MAIN_STYLES$1);
        while ($enum1.moveNext()) {
            var styleName = $enum1.current;
            var pos = p_ItemElem.className.indexOf(styleName);
            if (pos !== -1) {
                p_ItemElem.className = p_ItemElem.className.replaceAll(styleName, p_NewStyleName);
                break;
            }
        }
    },
    
    _showLoadingIcon$1: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_showLoadingIcon$1() {
        /// <summary>
        /// Switch the icon to the animation that shows that the facet is working.
        /// </summary>
        if (this.m_IconElem != null) {
            this.m_IconElem.src = this.m_LoadingIconUrl;
        }
    },
    
    _hideLoadingIcon$1: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_hideLoadingIcon$1() {
        /// <summary>
        /// Switch back to the normal icon.
        /// </summary>
        if (this.m_IconElem != null) {
            this.m_IconElem.src = this._m_NormalIconUrl$1;
        }
    },
    
    _saveFocus$1: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_saveFocus$1(p_FocusElement) {
        /// <summary>
        /// Save the ID of the control having the focus in order to be able to set
        /// the focus back on it later (typically after a postback).
        /// </summary>
        /// <param name="p_FocusElement" type="Object" domElement="true">
        /// Control currently having the focus.
        /// </param>
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_FocusControl$1 = ((p_FocusElement != null) ? p_FocusElement.id : null);
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_FocusFacet$1 = this.m_FacetElemID;
    },
    
    _restoreFocus$1: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_restoreFocus$1() {
        /// <summary>
        /// Set the focus back on the control that had it.
        /// </summary>
        if (Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_FocusFacet$1 === this.m_FacetElemID) {
            if (Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_FocusControl$1 != null) {
                var focusElem = document.getElementById(Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_FocusControl$1);
                if (focusElem != null) {
                    focusElem.focus();
                }
            }
            Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_FocusControl$1 = null;
            Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_FocusFacet$1 = null;
        }
    },
    
    _disableOtherFacets$1: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_disableOtherFacets$1() {
        /// <summary>
        /// Have the other facets to look disabled.
        /// </summary>
        var $dict1 = Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_Instances$1;
        for (var $key2 in $dict1) {
            var entry = { key: $key2, value: $dict1[$key2] };
            var facet = entry.value;
            if (facet !== this) {
                var facetElem = facet._getFacetElem().children[0];
                if (facetElem.className.indexOf('CesDisabled') === -1) {
                    var className = facetElem.className;
                    className = className.replaceAll('CesFacet', 'CesFacet' + ' ' + 'CesDisabled');
                    facetElem.className = className;
                }
            }
            if (facet.m_SearchBox != null) {
                facet.m_SearchBox.disabled = true;
            }
        }
    },
    
    _enableOtherFacets$1: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_enableOtherFacets$1() {
        /// <summary>
        /// Re-enable the other facets.
        /// </summary>
        var $dict1 = Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_Instances$1;
        for (var $key2 in $dict1) {
            var entry = { key: $key2, value: $dict1[$key2] };
            var facet = entry.value;
            if (facet !== this) {
                var facetElem = facet._getFacetElem();
                facetElem.children[0].className = facetElem.children[0].className.replaceAll('CesDisabled', '').trim();
            }
            if (facet.m_SearchBox != null) {
                facet.m_SearchBox.disabled = false;
            }
        }
    },
    
    _saveFacetPosition$1: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_saveFacetPosition$1() {
        /// <summary>
        /// Saves the facet's position to allow automatically scrolling the page after
        /// the AJAX call to have it at the same position on the screen.
        /// </summary>
        var facetElem = this._getFacetElem();
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_ScrollPosBeforePostBack$1 = Coveo.CNL.Web.Scripts.DOMUtilities.getElementPosition(facetElem).top - Coveo.CNL.Web.Scripts.DOMUtilities.getScrollingAmount().height;
    },
    
    _restoreFacetPosition$1: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_restoreFacetPosition$1() {
        /// <summary>
        /// Moves the facet back to its position before the AJAX call.
        /// </summary>
        var facetElem = this._getFacetElem();
        if (facetElem == null) {
            return;
        }
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_LastFacetPositioned$1 = this;
        var docElem = Coveo.CNL.Web.Scripts.DOMUtilities.getDocumentElemForScroll();
        var scrollPosAfter = Coveo.CNL.Web.Scripts.DOMUtilities.getElementPosition(facetElem).top - docElem.scrollTop;
        var scrollDelta = Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_ScrollPosBeforePostBack$1 - scrollPosAfter;
        if (scrollDelta > docElem.scrollTop) {
            var firstAndLastFacets = new Array(2);
            Coveo.CES.Web.Search.Scripts.Controls.FacetScript._getFirstAndLastFacets$1(this, firstAndLastFacets);
            var firstFacetElem = firstAndLastFacets[0]._getFacetElem();
            if (Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_TopSpacerElem$1 == null) {
                Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_TopSpacerElem$1 = document.createElement('div');
                firstFacetElem.parentNode.insertBefore(Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_TopSpacerElem$1, firstFacetElem);
            }
            Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_TopSpacerElem$1.style.height = (scrollDelta - docElem.scrollTop) + 'px';
        }
        else {
            var documentHeight = Coveo.CNL.Web.Scripts.DOMUtilities.getWindowSize().height;
            if (this.m_FacetZone !== 1 && docElem.scrollTop - scrollDelta + documentHeight > docElem.scrollHeight) {
                var newTargetScrollTop = docElem.scrollTop - scrollDelta;
                var curMaxTargetScrollTop = docElem.scrollHeight - documentHeight;
                Coveo.CES.Web.Search.Scripts.Controls.FacetScript._addBottomPadding$1(facetElem.parentNode, newTargetScrollTop - curMaxTargetScrollTop);
            }
        }
        docElem.scrollTop -= scrollDelta;
    },
    
    _moreLink_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_moreLink_Click$1() {
        /// <summary>
        /// Callback for when the user clicks on the more link.
        /// </summary>
        if (Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AsyncItemFacet$1 != null) {
            return;
        }
        this._saveFocus$1(null);
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_WaitingForAjaxResponse$1 = 2;
        this.showMoreOrLessValues(1, ss.Delegate.create(this, this._moreLessLinkComplete$1));
    },
    
    _lessLink_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_lessLink_Click$1() {
        /// <summary>
        /// Callback for when the user clicks on the fewer link.
        /// </summary>
        if (Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AsyncItemFacet$1 != null) {
            return;
        }
        this._saveFocus$1(null);
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_WaitingForAjaxResponse$1 = 2;
        this.showMoreOrLessValues(-1, ss.Delegate.create(this, this._moreLessLinkComplete$1));
    },
    
    _moreLessLinkComplete$1: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_moreLessLinkComplete$1(p_Return) {
        /// <summary>
        /// Callback for when the call to the server method is complete.
        /// </summary>
        /// <param name="p_Return" type="Object">
        /// Call's return value.
        /// </param>
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_WaitingForAjaxResponse$1 = 0;
        if (this._m_MoreLinkClickHandler$1 != null) {
            this._m_MoreLink$1.detachEvent('onclick', this._m_MoreLinkClickHandler$1);
            this._m_MoreLinkClickHandler$1 = null;
        }
        if (this._m_LessLinkClickHandler$1 != null) {
            this._m_LessLink$1.detachEvent('onclick', this._m_LessLinkClickHandler$1);
            this._m_LessLinkClickHandler$1 = null;
        }
        this._m_MoreLink$1 = ((String.isNullOrEmpty(this.m_MoreLinkID)) ? null : document.getElementById(this.m_MoreLinkID));
        if (this._m_MoreLink$1 != null) {
            this._m_MoreLinkClickHandler$1 = ss.Delegate.create(this, this._moreLink_Click$1);
            this._m_MoreLink$1.attachEvent('onclick', this._m_MoreLinkClickHandler$1);
            this._m_MoreLink$1.setAttribute('tabIndex', 0);
        }
        this._m_LessLink$1 = ((String.isNullOrEmpty(this.m_LessLinkID)) ? null : document.getElementById(this.m_LessLinkID));
        if (this._m_LessLink$1 != null) {
            this._m_LessLinkClickHandler$1 = ss.Delegate.create(this, this._lessLink_Click$1);
            this._m_LessLink$1.attachEvent('onclick', this._m_LessLinkClickHandler$1);
            this._m_LessLink$1.setAttribute('tabIndex', 0);
        }
    },
    
    _searchBox_KeyDown$1: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_searchBox_KeyDown$1() {
        /// <summary>
        /// Callback for when the user presses a key (onkeydown).
        /// Processes keyboard navigation within the search popup.
        /// </summary>
        if (window.event.keyCode === 40) {
            if (this._m_SearchItems$1.length > 0) {
                var selIndex;
                if (this._m_SelectedSearchItem == null) {
                    selIndex = 0;
                }
                else {
                    selIndex = Math.min(this._m_SelectedSearchItem.index + 1, this._m_SearchItems$1.length - 1);
                }
                var newSelItem = this._m_SearchItems$1[selIndex];
                newSelItem.item_MouseOver();
                Coveo.CNL.Web.Scripts.CNLAssert.check(this._m_SelectedSearchItem === newSelItem);
            }
            window.event.cancelBubble = true;
            window.event.returnValue = false;
        }
        else if (window.event.keyCode === 38) {
            if (this._m_SearchItems$1.length > 0) {
                var selIndex;
                if (this._m_SelectedSearchItem == null) {
                    selIndex = 0;
                }
                else {
                    selIndex = Math.max(this._m_SelectedSearchItem.index - 1, 0);
                }
                var newSelItem = this._m_SearchItems$1[selIndex];
                newSelItem.item_MouseOver();
                Coveo.CNL.Web.Scripts.CNLAssert.check(this._m_SelectedSearchItem === newSelItem);
            }
            window.event.cancelBubble = true;
            window.event.returnValue = false;
        }
        else if (window.event.keyCode === 13) {
            if (this._m_SelectedSearchItem != null && this._m_SelectedSearchItem.isSelected()) {
                this._m_SelectedSearchItem.item_Click();
            }
            window.event.cancelBubble = true;
            window.event.returnValue = false;
        }
        else if (window.event.keyCode === 46 && window.event.ctrlKey) {
            if (this._m_SelectedSearchItem != null && this._m_SelectedSearchItem.isSelected()) {
                this._m_SelectedSearchItem.removeLink_Click();
            }
            window.event.cancelBubble = true;
            window.event.returnValue = false;
        }
    },
    
    _searchBox_KeyUp$1: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_searchBox_KeyUp$1() {
        /// <summary>
        /// Callback for when the user presses a key (either onkeyup or onkeypress).
        /// Calls the server to populate the search popup.
        /// </summary>
        if (Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AsyncItemFacet$1 != null || window.event.keyCode === 40 || window.event.keyCode === 40 || window.event.keyCode === 13 || (window.event.keyCode === 46 && window.event.ctrlKey)) {
            return;
        }
        if (this._m_SearchKeyUpTimer$1 != null) {
            this._m_SearchKeyUpTimer$1.cancel();
            this._m_SearchKeyUpTimer$1 = null;
        }
        if (this._m_SearchIconTimer$1 != null) {
            this._m_SearchIconTimer$1.cancel();
            this._m_SearchIconTimer$1 = null;
        }
        var keyUpCode = ss.Delegate.create(this, function(arg) {
            if (this.m_SearchBox.value !== this._m_LastSearchTextSent$1) {
                Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchPopupScrollCausedByKeyUp$1 = true;
                this._m_LastSearchTextSent$1 = this.m_SearchBox.value;
                Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_IgnoreNextFeedback$1 = true;
                this.searchBoxTyping(this.m_SearchBox.value, ss.Delegate.create(this, this._searchBoxTypingComplete$1));
                if (this.m_IconElem != null) {
                    this._m_SearchIconTimer$1 = new Coveo.CNL.Web.Scripts.Timeout(ss.Delegate.create(this, function(arg2) {
                        this.m_IconElem.src = this.m_LoadingIconUrl;
                        this._m_SearchIconTimer$1 = null;
                    }), null, 250);
                }
            }
        });
        if (Coveo.CES.Web.Search.Scripts.Controls.FacetScript._searchBoxKeyEventName$1() === 'onkeyup') {
            keyUpCode(null);
        }
        else {
            this._m_SearchKeyUpTimer$1 = new Coveo.CNL.Web.Scripts.Timeout(keyUpCode, null, 10);
        }
    },
    
    _searchBoxTypingComplete$1: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_searchBoxTypingComplete$1(p_Return) {
        /// <summary>
        /// Callback for when the call to the server method is complete.
        /// </summary>
        /// <param name="p_Return" type="Object">
        /// Call's return value.
        /// </param>
        window.setTimeout(function() {
            Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_IgnoreNextFeedback$1 = false;
        }, 0);
        if (this._m_SearchIconTimer$1 != null) {
            this._m_SearchIconTimer$1.cancel();
            this._m_SearchIconTimer$1 = null;
        }
        if (this.m_IconElem != null) {
            this.m_IconElem.src = this._m_NormalIconUrl$1;
        }
        this._releaseSearchItems$1();
        var items = p_Return;
        if (items.childNodes.length > 0) {
            var docElem = Coveo.CNL.Web.Scripts.DOMUtilities.getDocumentElemForScroll();
            Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchPopupScrollHeightBefore$1 = docElem.scrollHeight;
            var scrollLeft = docElem.scrollLeft;
            var windowSize = Coveo.CNL.Web.Scripts.DOMUtilities.getWindowSize();
            this.m_SearchPopup.style.width = '';
            this.m_SearchPopup.style.display = 'block';
            Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchPopupShown$1 = true;
            var parent = this.m_SearchBox.parentNode.parentNode.parentNode.parentNode.parentNode;
            var rrect = Coveo.CNL.Web.Scripts.DOMUtilities.getElementBounds(parent);
            var parentClassName = (this.m_IsDropDownFacet) ? '.' + 'CesDropDownFacetContainer' : '.' + 'CesFacet';
            var searchBoxWidth = $(parent).parents(parentClassName).first().width();
            this.m_SearchPopup.style.minWidth = searchBoxWidth + 'px';
            var searchPopupWidth = $(this.m_SearchPopup).outerWidth();
            var maxWidth = ((Coveo.CES.Web.Search.Scripts.Controls.FacetScript._isInOutlookSideBar$1()) ? searchBoxWidth : Math.min(searchBoxWidth * 16 / 9, windowSize.width));
            var forcePopupWidth = false;
            if (searchPopupWidth >= maxWidth) {
                searchPopupWidth = maxWidth;
                forcePopupWidth = true;
            }
            else if (Coveo.CNL.Web.Scripts.BrowserHelper.get_isIE()) {
                forcePopupWidth = true;
            }
            if (forcePopupWidth) {
                this.m_SearchPopup.style.width = searchPopupWidth + 'px';
            }
            var popupLeft = rrect.left;
            var tmpRight = popupLeft + searchPopupWidth - scrollLeft;
            if (tmpRight > windowSize.width) {
                popupLeft -= tmpRight - windowSize.width;
            }
            Coveo.CNL.Web.Scripts.DOMUtilities.setElementPosition(this.m_SearchPopup, new Coveo.CNL.Web.Scripts.ElementPosition(popupLeft, rrect.bottom - 1));
            var isCssEffective = [ true ];
            for (var itemNo = 0; itemNo < items.childNodes.length; ++itemNo) {
                var itemNode = items.childNodes[itemNo];
                var itemValue = (itemNode.attributes.getNamedItem('Value')).value;
                var itemElemID = (itemNode.attributes.getNamedItem('ItemElemID')).value;
                var removeElemID = (itemNode.attributes.getNamedItem('RemoveElemID')).value;
                var item = new Coveo.CES.Web.Search.Scripts.Controls._facetScriptSearchItem(this, itemNo);
                item.value = itemValue;
                item.element = document.getElementById(itemElemID);
                item.removeLinkElem = document.getElementById(removeElemID);
                ArrayPrototype_add(this._m_SearchItems$1, item);
                item.initialize();
                this._clipThisItem$1(item.element, ((Coveo.CNL.Web.Scripts.BrowserHelper.get_ieDocumentMode() >= 8) ? 0 : searchPopupWidth), isCssEffective);
            }
            (this._m_SearchItems$1[0]).item_MouseOver();
            if (Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchPopupScrollCausedByKeyUp$1) {
                var scrollPos = Coveo.CNL.Web.Scripts.DOMUtilities.getScrollingAmount().height;
                var popupBottom = Coveo.CNL.Web.Scripts.DOMUtilities.getElementPosition(this.m_SearchPopup).top + this.m_SearchPopup.clientHeight;
                if (popupBottom > scrollPos + windowSize.height) {
                    Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchPopupScrollStartPos$1 = docElem.scrollTop;
                    Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AnimDelta$1 = popupBottom - (scrollPos + windowSize.height) + 10;
                    Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AnimTickNo$1 = 0;
                    Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchPopupScrollTimer$1 = new Coveo.CNL.Web.Scripts.Timeout(Coveo.CES.Web.Search.Scripts.Controls.FacetScript._searchPopupScrollTimer_Tick$1, null, 10);
                }
                else {
                    Coveo.CES.Web.Search.Scripts.Controls.FacetScript._removeBottomPaddingIfOk$1();
                }
            }
        }
        else {
            this.m_SearchPopup.style.display = 'none';
            Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchPopupShown$1 = false;
        }
    },
    
    _searchBox_Focus$1: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_searchBox_Focus$1() {
        /// <summary>
        /// Callback for when the search box gains the focus.
        /// </summary>
        if (this.m_NonFocusText != null) {
            if (this.m_SearchBox.className.indexOf(' ' + 'CesFacetSearchBoxInputNonFocus') !== -1) {
                this.m_SearchBox.value = '';
                this.m_SearchBox.className = this.m_SearchBox.className.replaceAll(' ' + 'CesFacetSearchBoxInputNonFocus', '');
            }
            else if (!!this.m_SearchBox.value) {
                this._m_LastSearchTextSent$1 = '';
                this._searchBox_KeyUp$1();
                Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchPopupScrollCausedByKeyUp$1 = false;
            }
            this.m_ClearSearchLink.style.visibility = 'visible';
        }
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchedFacet$1 = this;
    },
    
    _searchBox_Blur$1: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_searchBox_Blur$1() {
        /// <summary>
        /// Callback for when the search box loses the focus.
        /// </summary>
        if (this.m_NonFocusText != null) {
            if (!this.m_SearchBox.value) {
                this.m_SearchBox.className += ' ' + 'CesFacetSearchBoxInputNonFocus';
                this.m_SearchBox.value = this.m_NonFocusText;
                this.m_ClearSearchLink.style.visibility = 'hidden';
            }
        }
        this._m_HideSearchPopupTimer$1 = new Coveo.CNL.Web.Scripts.Timeout(ss.Delegate.create(this, function(arg) {
            this.m_SearchPopup.style.display = 'none';
            Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchPopupShown$1 = false;
            this._releaseSearchItems$1();
        }), null, 250);
    },
    
    _clearSearchBoxLink_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_clearSearchBoxLink_Click$1() {
        /// <summary>
        /// Callback for when the user clicks on the X next to the search box to clear it.
        /// </summary>
        if (Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AsyncItemFacet$1 != null) {
            return;
        }
        this._saveFocus$1(null);
        this.m_CollExpElem.focus();
        this.m_SearchBox.value = '';
        this._searchBox_KeyUp$1();
        this._searchBox_Blur$1();
        this.m_ClearSearchLink.style.visibility = 'hidden';
    },
    
    _collapseExpandLink_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_collapseExpandLink_Click$1() {
        /// <summary>
        /// Callback for when the user clicks on the collapse/expand link.
        /// </summary>
        if (Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AsyncItemFacet$1 != null) {
            return;
        }
        this._saveFocus$1(this.m_CollExpElem);
        this.expandCollapse();
        window.event.cancelBubble = true;
    },
    
    _facet_ClickElsewhere$1: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_facet_ClickElsewhere$1() {
        /// <summary>
        /// Callback for when the user clicks elsewhere than on the collapse/expand link.
        /// </summary>
        this.hideDropDown();
    },
    
    _selectionModeIcon_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_selectionModeIcon_Click$1() {
        /// <summary>
        /// Callback for when the user clicks on the selection mode icon (OR/AND).
        /// </summary>
        if (Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AsyncItemFacet$1 != null) {
            return;
        }
        this._saveFocus$1(null);
        this._saveFacetPosition$1();
        this._showLoadingIcon$1();
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_WaitingForAjaxResponse$1 = 2;
        this.switchSelectionMode(ss.Delegate.create(this, this._switchSelectionModeComplete$1));
        window.event.cancelBubble = true;
        window.event.returnValue = false;
    },
    
    _switchSelectionModeComplete$1: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_switchSelectionModeComplete$1(p_Return) {
        /// <summary>
        /// Callback for when the call to the server method is complete.
        /// </summary>
        /// <param name="p_Return" type="Object">
        /// Call's return value.
        /// </param>
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_WaitingForAjaxResponse$1 = 0;
        this._hideLoadingIcon$1();
        this._restoreFacetPosition$1();
    },
    
    _eraser_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_eraser_Click$1() {
        /// <summary>
        /// Callback for when the user clicks on the eraser to clear the facet.
        /// </summary>
        if (Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AsyncItemFacet$1 != null && Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AsyncItemFacet$1 !== this) {
            return;
        }
        if (Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AsyncItemFacet$1 != null) {
            Coveo.CNL.Web.Scripts.CNLAssert.check(Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AsyncItemFacet$1 === this);
            Object.clearKeys(this._m_AsyncItemCalls$1);
            Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AsyncItemFacet$1 = null;
        }
        this._saveFocus$1(null);
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_WaitingForAjaxResponse$1 = 1;
        this.clearFacet(ss.Delegate.create(this, this._clearFacetComplete));
        window.event.cancelBubble = true;
        window.event.returnValue = false;
    },
    
    _clearFacetComplete: function Coveo_CES_Web_Search_Scripts_Controls_FacetScript$_clearFacetComplete(p_Return) {
        /// <summary>
        /// Callback for when the call to the server method is complete.
        /// </summary>
        /// <param name="p_Return" type="Object">
        /// Call's return value.
        /// </param>
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_WaitingForAjaxResponse$1 = 0;
        var $dict1 = this._m_Items$1;
        for (var $key2 in $dict1) {
            var entry = { key: $key2, value: $dict1[$key2] };
            var item = entry.value;
            item.cssClassBeforeSelection = null;
        }
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AsyncItemFacet$1 = null;
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.FacetScriptFeedback

Coveo.CES.Web.Search.Scripts.Controls.FacetScriptFeedback = function Coveo_CES_Web_Search_Scripts_Controls_FacetScriptFeedback(p_FacetElemID) {
    /// <summary>
    /// Feedback that is triggered by postbacks within facets.
    /// </summary>
    /// <param name="p_FacetElemID" type="String">
    /// The target facet.
    /// </param>
    /// <field name="_m_FacetElemID$2" type="String">
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.FacetScriptFeedback.initializeBase(this);
    Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(p_FacetElemID);
    this._m_FacetElemID$2 = p_FacetElemID;
    this.m_InitialDelay = 0;
}
Coveo.CES.Web.Search.Scripts.Controls.FacetScriptFeedback.prototype = {
    _m_FacetElemID$2: null,
    
    beginFeedback: function Coveo_CES_Web_Search_Scripts_Controls_FacetScriptFeedback$beginFeedback() {
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript.beginFeedback(this._m_FacetElemID$2);
    },
    
    endFeedback: function Coveo_CES_Web_Search_Scripts_Controls_FacetScriptFeedback$endFeedback() {
        Coveo.CES.Web.Search.Scripts.Controls.FacetScript.endFeedback(this._m_FacetElemID$2);
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.VerticalMasterAndDetailScript

Coveo.CES.Web.Search.Scripts.Controls.VerticalMasterAndDetailScript = function Coveo_CES_Web_Search_Scripts_Controls_VerticalMasterAndDetailScript() {
    /// <summary>
    /// Client side code for the VerticalMasterAndDetail control.
    /// </summary>
    /// <field name="_resizE_TIMEOUT_DELAY$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_m_ResizeTimeout$1" type="Coveo.CNL.Web.Scripts.Timeout">
    /// </field>
    /// <field name="_m_WindowResizeEventHandler$1" type="Function">
    /// </field>
    /// <field name="_m_PreviousRootTop$1" type="Number" integer="true">
    /// </field>
    /// <field name="_m_PreviousWindowHeight$1" type="Number" integer="true">
    /// </field>
    /// <field name="m_Root" type="Object" domElement="true">
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.VerticalMasterAndDetailScript.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.VerticalMasterAndDetailScript.prototype = {
    _m_ResizeTimeout$1: null,
    _m_WindowResizeEventHandler$1: null,
    _m_PreviousRootTop$1: 0,
    _m_PreviousWindowHeight$1: 0,
    m_Root: null,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_VerticalMasterAndDetailScript$initialize() {
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_Root);
        this._m_WindowResizeEventHandler$1 = ss.Delegate.create(this, this._window_Resize$1);
        window.attachEvent('onresize', this._m_WindowResizeEventHandler$1);
        this._m_ResizeTimeout$1 = new Coveo.CNL.Web.Scripts.Timeout(ss.Delegate.create(this, this._resizeTimeoutCallback$1), null, 500);
        this._resizeSections$1();
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_VerticalMasterAndDetailScript$tearDown() {
        window.detachEvent('onresize', this._m_WindowResizeEventHandler$1);
        this._m_WindowResizeEventHandler$1 = null;
        this._m_ResizeTimeout$1.cancel();
    },
    
    _resizeSections$1: function Coveo_CES_Web_Search_Scripts_Controls_VerticalMasterAndDetailScript$_resizeSections$1() {
        /// <summary>
        /// Resizes all the sections depending on the current state.
        /// </summary>
        var rootTop = Coveo.CNL.Web.Scripts.DOMUtilities.getElementPosition(this.m_Root).top;
        var windowHeight = document.documentElement.clientHeight;
        if (rootTop !== this._m_PreviousRootTop$1 || windowHeight !== this._m_PreviousWindowHeight$1) {
            var rootHeight = Math.max(windowHeight - rootTop, 0);
            this.m_Root.style.height = rootHeight + 'px';
            this._m_PreviousRootTop$1 = rootTop;
            this._m_PreviousWindowHeight$1 = windowHeight;
        }
    },
    
    _resizeTimeoutCallback$1: function Coveo_CES_Web_Search_Scripts_Controls_VerticalMasterAndDetailScript$_resizeTimeoutCallback$1(arg) {
        /// <summary>
        /// Callback for the timeout used to regularly check for size updates.
        /// </summary>
        /// <param name="arg" type="Object">
        /// </param>
        this._resizeSections$1();
        this._m_ResizeTimeout$1 = new Coveo.CNL.Web.Scripts.Timeout(ss.Delegate.create(this, this._resizeTimeoutCallback$1), null, 500);
    },
    
    _window_Resize$1: function Coveo_CES_Web_Search_Scripts_Controls_VerticalMasterAndDetailScript$_window_Resize$1() {
        this._resizeSections$1();
        this._m_ResizeTimeout$1.cancel();
        this._m_ResizeTimeout$1 = new Coveo.CNL.Web.Scripts.Timeout(ss.Delegate.create(this, this._resizeTimeoutCallback$1), null, 500);
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.BaseChartScript

Coveo.CES.Web.Search.Scripts.Controls.BaseChartScript = function Coveo_CES_Web_Search_Scripts_Controls_BaseChartScript() {
    /// <summary>
    /// Client side code for the BaseChart control.
    /// </summary>
    /// <field name="_resizE_CHECK_DELAY$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_m_ImageLoadEventHandler$1" type="Function">
    /// </field>
    /// <field name="_m_Request$1" type="XMLHttpRequest">
    /// </field>
    /// <field name="_m_InitialSizeTimeout$1" type="Coveo.CNL.Web.Scripts.Timeout">
    /// </field>
    /// <field name="_m_CheckSizeTimeout$1" type="Coveo.CNL.Web.Scripts.Timeout">
    /// </field>
    /// <field name="_m_ChangeSizeTimeout$1" type="Coveo.CNL.Web.Scripts.Timeout">
    /// </field>
    /// <field name="_m_FirstRequest$1" type="Boolean">
    /// </field>
    /// <field name="_m_FirstLoad$1" type="Boolean">
    /// </field>
    /// <field name="_m_LastSeenWidth$1" type="Number" integer="true">
    /// </field>
    /// <field name="_m_LastSeenHeight$1" type="Number" integer="true">
    /// </field>
    /// <field name="_m_LastRequestedWidth$1" type="Number" integer="true">
    /// </field>
    /// <field name="_m_LastRequestedHeight$1" type="Number" integer="true">
    /// </field>
    /// <field name="m_Image" type="Object" domElement="true">
    /// The element that holds image to attach the map to.
    /// </field>
    /// <field name="m_Loading" type="Object" domElement="true">
    /// The element that holds the content to display while loading
    /// </field>
    /// <field name="m_CookieUrlPrefix" type="String">
    /// The prefix of the image map url when the map doesn't fit in the cookie.
    /// </field>
    /// <field name="m_ImageMapIdSuffix" type="String">
    /// The suffix of the image map HTML tag id.
    /// </field>
    /// <field name="m_BaseImageUri" type="String">
    /// The base uri for the image, to which we should add desired width and height
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.BaseChartScript.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.BaseChartScript.prototype = {
    _m_ImageLoadEventHandler$1: null,
    _m_Request$1: null,
    _m_InitialSizeTimeout$1: null,
    _m_CheckSizeTimeout$1: null,
    _m_ChangeSizeTimeout$1: null,
    _m_FirstRequest$1: true,
    _m_FirstLoad$1: true,
    _m_LastSeenWidth$1: 0,
    _m_LastSeenHeight$1: 0,
    _m_LastRequestedWidth$1: 0,
    _m_LastRequestedHeight$1: 0,
    m_Image: null,
    m_Loading: null,
    m_CookieUrlPrefix: null,
    m_ImageMapIdSuffix: null,
    m_BaseImageUri: null,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_BaseChartScript$initialize() {
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_Image);
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_Loading);
        Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(this.m_CookieUrlPrefix);
        Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(this.m_ImageMapIdSuffix);
        Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(this.m_BaseImageUri);
        this._m_ImageLoadEventHandler$1 = ss.Delegate.create(this, this._image_OnLoad$1);
        this.m_Image.attachEvent('onload', this._m_ImageLoadEventHandler$1);
        this._m_InitialSizeTimeout$1 = new Coveo.CNL.Web.Scripts.Timeout(ss.Delegate.create(this, this._performInitialSizing$1), null, 0);
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_BaseChartScript$tearDown() {
        this.m_Image.detachEvent('onload', this._m_ImageLoadEventHandler$1);
        this._m_ImageLoadEventHandler$1 = null;
        if (this._m_InitialSizeTimeout$1 != null) {
            this._m_InitialSizeTimeout$1.cancel();
        }
        if (this._m_CheckSizeTimeout$1 != null) {
            this._m_CheckSizeTimeout$1.cancel();
        }
        if (this._m_ChangeSizeTimeout$1 != null) {
            this._m_ChangeSizeTimeout$1.cancel();
        }
    },
    
    _requestCallback$1: function Coveo_CES_Web_Search_Scripts_Controls_BaseChartScript$_requestCallback$1() {
        /// <summary>
        /// Callback for the image map XmlHttpRequest.
        /// </summary>
        if (this._m_Request$1.readyState === 4) {
            Coveo.CNL.Web.Scripts.Ajax.Profiler.log('Response has been received.');
            if (this._m_Request$1.status === 200) {
                this._createImageMap$1(this._m_Request$1.responseText);
            }
            this._m_Request$1 = null;
        }
    },
    
    _createImageMap$1: function Coveo_CES_Web_Search_Scripts_Controls_BaseChartScript$_createImageMap$1(p_MapHtml) {
        /// <summary>
        /// Creates the image map element and binds the chart image to it.
        /// </summary>
        /// <param name="p_MapHtml" type="String">
        /// The image map HTML markup.
        /// </param>
        Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(p_MapHtml);
        var spanElem = document.createElement('span');
        this.m_Image.parentNode.appendChild(spanElem);
        spanElem.style.display = 'none';
        spanElem.innerHTML = p_MapHtml;
        eval("setTimeout(\"var elem = document.getElementById('" + this.m_Image.id + "'); if (elem) elem.useMap='#" + this.m_Image.id + this.m_ImageMapIdSuffix + "';\", 0);");
    },
    
    _performInitialSizing$1: function Coveo_CES_Web_Search_Scripts_Controls_BaseChartScript$_performInitialSizing$1(arg) {
        /// <summary>
        /// Performs the initial sizing of the chart.
        /// </summary>
        /// <param name="arg" type="Object">
        /// </param>
        this._m_InitialSizeTimeout$1 = null;
        this._setImageUriWithProperSize$1(null);
        Coveo.CNL.Web.Scripts.CNLAssert.check(!!this._m_LastRequestedWidth$1);
        Coveo.CNL.Web.Scripts.CNLAssert.check(!!this._m_LastRequestedHeight$1);
        this._m_LastSeenWidth$1 = this._m_LastRequestedWidth$1;
        this._m_LastSeenHeight$1 = this._m_LastRequestedHeight$1;
        this._m_CheckSizeTimeout$1 = new Coveo.CNL.Web.Scripts.Timeout(ss.Delegate.create(this, this._checkIfSizeHasChanged$1), null, 500);
    },
    
    _checkIfSizeHasChanged$1: function Coveo_CES_Web_Search_Scripts_Controls_BaseChartScript$_checkIfSizeHasChanged$1(arg) {
        /// <summary>
        /// Checks if the size of the image has changed, and triggers a reload if needed.
        /// </summary>
        /// <param name="arg" type="Object">
        /// </param>
        Coveo.CNL.Web.Scripts.CNLAssert.check(!!this._m_LastSeenWidth$1);
        Coveo.CNL.Web.Scripts.CNLAssert.check(!!this._m_LastSeenHeight$1);
        var image = $(this.m_Image);
        if (!!this.m_Image.offsetWidth && !!this.m_Image.offsetHeight) {
            var width = image.outerWidth();
            var height = image.outerHeight();
            if (width !== this._m_LastSeenWidth$1 || height !== this._m_LastSeenHeight$1) {
                this._m_LastSeenWidth$1 = width;
                this._m_LastSeenHeight$1 = height;
                if (this._m_ChangeSizeTimeout$1 != null) {
                    this._m_ChangeSizeTimeout$1.cancel();
                }
                this._m_ChangeSizeTimeout$1 = new Coveo.CNL.Web.Scripts.Timeout(ss.Delegate.create(this, this._setImageUriWithProperSize$1), null, 1000);
            }
        }
        this._m_CheckSizeTimeout$1 = new Coveo.CNL.Web.Scripts.Timeout(ss.Delegate.create(this, this._checkIfSizeHasChanged$1), null, 500);
    },
    
    _setImageUriWithProperSize$1: function Coveo_CES_Web_Search_Scripts_Controls_BaseChartScript$_setImageUriWithProperSize$1(arg) {
        /// <summary>
        /// Sets the uri of the image to one that contains the needed width and height.
        /// </summary>
        /// <param name="arg" type="Object">
        /// </param>
        Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(this.m_BaseImageUri);
        var image = $(this.m_Image);
        if (!!this.m_Image.offsetWidth && !!this.m_Image.offsetHeight) {
            var width = image.outerWidth();
            var height = image.outerHeight();
            if (width !== this._m_LastRequestedWidth$1 || height !== this._m_LastRequestedHeight$1) {
                var uri = this.m_BaseImageUri;
                uri += '&width=' + width;
                uri += '&height=' + height;
                this.m_Image.src = uri;
                this._m_LastRequestedWidth$1 = width;
                this._m_LastRequestedHeight$1 = height;
                if (this._m_FirstRequest$1) {
                    this.m_Image.style.display = 'none';
                    this.m_Image.style.visibility = 'visible';
                    this.m_Loading.style.display = '';
                    this._m_FirstRequest$1 = false;
                }
            }
        }
        else {
            this._m_LastRequestedWidth$1 = -1;
            this._m_LastRequestedHeight$1 = -1;
        }
    },
    
    _image_OnLoad$1: function Coveo_CES_Web_Search_Scripts_Controls_BaseChartScript$_image_OnLoad$1() {
        if (this._m_FirstLoad$1) {
            this.m_Loading.style.display = 'none';
            this.m_Image.style.display = 'none';
            var image = $(this.m_Image);
            image.fadeIn('fast');
            this._m_FirstLoad$1 = false;
        }
        var cookie = Coveo.CNL.Web.Scripts.CookieUtilities.getCookie(this.m_Image.id);
        if (cookie != null) {
            var prefixLength = this.m_CookieUrlPrefix.length;
            if (cookie.length > prefixLength && cookie.substr(0, prefixLength) === this.m_CookieUrlPrefix) {
                var url = cookie.substr(prefixLength, cookie.length - prefixLength);
                this._m_Request$1 = Coveo.CNL.Web.Scripts.Utilities.createGetXmlHttpRequest(url);
                this._m_Request$1.onreadystatechange = ss.Delegate.create(this, this._requestCallback$1);
                this._m_Request$1.send();
            }
            else {
                this._createImageMap$1(cookie);
            }
            Coveo.CNL.Web.Scripts.CookieUtilities.setCookie(this.m_Image.id, '', -1);
        }
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.MasterAndDetailScript

Coveo.CES.Web.Search.Scripts.Controls.MasterAndDetailScript = function Coveo_CES_Web_Search_Scripts_Controls_MasterAndDetailScript() {
    /// <summary>
    /// Client side code for the MasterAndDetail control.
    /// </summary>
    /// <field name="_resizE_TIMEOUT_DELAY$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_animatioN_DURATION$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_animatioN_TIMEOUT_DELAY$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_m_ResizeTimeout$1" type="Coveo.CNL.Web.Scripts.Timeout">
    /// </field>
    /// <field name="_m_WindowResizeEventHandler$1" type="Function">
    /// </field>
    /// <field name="_m_PreviousRootTop$1" type="Number" integer="true">
    /// </field>
    /// <field name="_m_PreviousWindowHeight$1" type="Number" integer="true">
    /// </field>
    /// <field name="_m_DetailHeightWhenCollapsed$1" type="Number" integer="true">
    /// </field>
    /// <field name="_m_AnimationTimeout$1" type="Coveo.CNL.Web.Scripts.Timeout">
    /// </field>
    /// <field name="_m_AnimationProgress$1" type="Coveo.CNL.Web.Scripts.Ajax.PercentTimer">
    /// </field>
    /// <field name="_m_StartDetailHeight$1" type="Number" integer="true">
    /// </field>
    /// <field name="_m_EndDetailHeight$1" type="Number" integer="true">
    /// </field>
    /// <field name="_m_HeaderMouseDownEventHandler$1" type="Function">
    /// </field>
    /// <field name="_m_HeaderMouseCapture$1" type="Coveo.CNL.Web.Scripts.MouseCapture">
    /// </field>
    /// <field name="m_Root" type="Object" domElement="true">
    /// </field>
    /// <field name="m_Master" type="Object" domElement="true">
    /// </field>
    /// <field name="m_Detail" type="Object" domElement="true">
    /// </field>
    /// <field name="m_ExpandedDetailHeader" type="Object" domElement="true">
    /// </field>
    /// <field name="m_ExpandedDetailBody" type="Object" domElement="true">
    /// </field>
    /// <field name="m_CollapsedDetail" type="Object" domElement="true">
    /// </field>
    /// <field name="m_DetailExpanded" type="Boolean">
    /// </field>
    /// <field name="m_OldDetailHeightWhenExpanded" type="Number" integer="true">
    /// </field>
    /// <field name="m_DetailHeightWhenExpanded" type="Number" integer="true">
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.MasterAndDetailScript.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.MasterAndDetailScript.prototype = {
    _m_ResizeTimeout$1: null,
    _m_WindowResizeEventHandler$1: null,
    _m_PreviousRootTop$1: 0,
    _m_PreviousWindowHeight$1: 0,
    _m_DetailHeightWhenCollapsed$1: 0,
    _m_AnimationTimeout$1: null,
    _m_AnimationProgress$1: null,
    _m_StartDetailHeight$1: 0,
    _m_EndDetailHeight$1: 0,
    _m_HeaderMouseDownEventHandler$1: null,
    _m_HeaderMouseCapture$1: null,
    m_Root: null,
    m_Master: null,
    m_Detail: null,
    m_ExpandedDetailHeader: null,
    m_ExpandedDetailBody: null,
    m_CollapsedDetail: null,
    m_DetailExpanded: false,
    m_OldDetailHeightWhenExpanded: 0,
    m_DetailHeightWhenExpanded: 0,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_MasterAndDetailScript$initialize() {
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_Root);
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_Master);
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_Detail);
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_ExpandedDetailHeader);
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_ExpandedDetailBody);
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_CollapsedDetail);
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(!!this.m_DetailHeightWhenExpanded);
        this._m_WindowResizeEventHandler$1 = ss.Delegate.create(this, this._window_Resize$1);
        window.attachEvent('onresize', this._m_WindowResizeEventHandler$1);
        this._m_HeaderMouseDownEventHandler$1 = ss.Delegate.create(this, this._header_MouseDown$1);
        this.m_ExpandedDetailHeader.attachEvent('onmousedown', this._m_HeaderMouseDownEventHandler$1);
        this._m_ResizeTimeout$1 = new Coveo.CNL.Web.Scripts.Timeout(ss.Delegate.create(this, this._resizeTimeoutCallback$1), null, 500);
        this._resizeSections$1(true);
        this.m_ExpandedDetailHeader.style.display = (this.m_DetailExpanded) ? 'block' : 'none';
        this.m_ExpandedDetailBody.style.display = (this.m_DetailExpanded) ? 'block' : 'none';
        this.m_CollapsedDetail.style.display = (this.m_DetailExpanded) ? 'none' : 'block';
        this._m_DetailHeightWhenCollapsed$1 = Coveo.CNL.Web.Scripts.DOMUtilities.getElementSize(this.m_CollapsedDetail).height;
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_MasterAndDetailScript$tearDown() {
        window.detachEvent('onresize', this._m_WindowResizeEventHandler$1);
        this._m_WindowResizeEventHandler$1 = null;
        this.m_ExpandedDetailHeader.detachEvent('onmousedown', this._m_HeaderMouseDownEventHandler$1);
        this._m_HeaderMouseDownEventHandler$1 = null;
        if (this._m_HeaderMouseCapture$1 != null) {
            this._m_HeaderMouseCapture$1.dispose();
        }
        this._m_ResizeTimeout$1.cancel();
        if (this._m_AnimationTimeout$1 != null) {
            this._m_AnimationTimeout$1.cancel();
        }
    },
    
    expandDetailSection: function Coveo_CES_Web_Search_Scripts_Controls_MasterAndDetailScript$expandDetailSection() {
        /// <summary>
        /// Expands the detail section.
        /// </summary>
        Coveo.CNL.Web.Scripts.CNLAssert.check(!this.m_DetailExpanded);
        this.m_DetailExpanded = true;
        this.m_ExpandedDetailHeader.style.display = 'block';
        this.m_ExpandedDetailBody.style.display = 'block';
        this.m_CollapsedDetail.style.display = 'none';
        this._m_StartDetailHeight$1 = this._m_DetailHeightWhenCollapsed$1;
        this._m_EndDetailHeight$1 = this.m_DetailHeightWhenExpanded;
        this._m_AnimationTimeout$1 = new Coveo.CNL.Web.Scripts.Timeout(ss.Delegate.create(this, this._animateTimeoutCallback$1), null, 10);
        this._m_AnimationProgress$1 = new Coveo.CNL.Web.Scripts.Ajax.PercentTimer(150, Coveo.CNL.Web.Scripts.Ajax.EasingFunction.slowFastSlow);
        this._m_AnimationProgress$1.ensureStarted();
    },
    
    collapseDetailSection: function Coveo_CES_Web_Search_Scripts_Controls_MasterAndDetailScript$collapseDetailSection() {
        /// <summary>
        /// Collapses the detail section.
        /// </summary>
        Coveo.CNL.Web.Scripts.CNLAssert.check(this.m_DetailExpanded);
        if (this._m_HeaderMouseCapture$1 != null) {
            this._m_HeaderMouseCapture$1.dispose();
            this._m_HeaderMouseCapture$1 = null;
        }
        this.m_DetailExpanded = false;
        this.m_ExpandedDetailHeader.style.display = 'none';
        this.m_ExpandedDetailBody.style.display = 'none';
        this.m_CollapsedDetail.style.display = 'block';
        this._m_StartDetailHeight$1 = this.m_DetailHeightWhenExpanded;
        this._m_EndDetailHeight$1 = this._m_DetailHeightWhenCollapsed$1;
        this.m_Detail.style.height = Math.max(this._m_StartDetailHeight$1, 0) + 'px';
        this._m_AnimationTimeout$1 = new Coveo.CNL.Web.Scripts.Timeout(ss.Delegate.create(this, this._animateTimeoutCallback$1), null, 10);
        this._m_AnimationProgress$1 = new Coveo.CNL.Web.Scripts.Ajax.PercentTimer(150, Coveo.CNL.Web.Scripts.Ajax.EasingFunction.slowFastSlow);
        this._m_AnimationProgress$1.ensureStarted();
    },
    
    updateExpandedDetailHeight: function Coveo_CES_Web_Search_Scripts_Controls_MasterAndDetailScript$updateExpandedDetailHeight(p_Height) {
        /// <summary>
        /// Updates the preferred detail height in the user profile, following a
        /// resize done by the user on the client side.
        /// </summary>
        /// <param name="p_Height" type="Number" integer="true">
        /// The new detail section height.
        /// </param>
    },
    
    _resizeSections$1: function Coveo_CES_Web_Search_Scripts_Controls_MasterAndDetailScript$_resizeSections$1(p_Force) {
        /// <summary>
        /// Resizes all the sections depending on the current state.
        /// </summary>
        /// <param name="p_Force" type="Boolean">
        /// Whether to force resizing the sections, even if the parameters haven't changed since last time.
        /// </param>
        var windowHeight = document.documentElement.clientHeight;
        var rootTop = Coveo.CNL.Web.Scripts.DOMUtilities.getElementPosition(this.m_Root).top;
        if (p_Force || windowHeight !== this._m_PreviousWindowHeight$1 || rootTop !== this._m_PreviousRootTop$1) {
            var rootHeight = Math.max(windowHeight - rootTop, 0);
            this.m_Root.style.height = rootHeight + 'px';
            if (this.m_DetailExpanded) {
                var availableDetailHeight = Math.min(this.m_DetailHeightWhenExpanded, rootHeight);
                Coveo.CNL.Web.Scripts.CNLAssert.check(availableDetailHeight >= 0);
                Coveo.CNL.Web.Scripts.CNLAssert.check(rootHeight >= availableDetailHeight);
                this.m_Master.style.height = (rootHeight - availableDetailHeight) + 'px';
                this.m_Detail.style.height = availableDetailHeight + 'px';
                var expandedHeaderHeight = Coveo.CNL.Web.Scripts.DOMUtilities.getElementSize(this.m_ExpandedDetailHeader).height;
                this.m_ExpandedDetailBody.style.height = Math.max(availableDetailHeight - expandedHeaderHeight, 0) + 'px';
            }
            else {
                this.m_Detail.style.height = '';
                var collapsedDetailHeight = Coveo.CNL.Web.Scripts.DOMUtilities.getElementSize(this.m_CollapsedDetail).height;
                this.m_Master.style.height = Math.max(rootHeight - collapsedDetailHeight, 0) + 'px';
            }
            this._m_PreviousWindowHeight$1 = windowHeight;
            this._m_PreviousRootTop$1 = rootTop;
        }
    },
    
    _resizeTimeoutCallback$1: function Coveo_CES_Web_Search_Scripts_Controls_MasterAndDetailScript$_resizeTimeoutCallback$1(arg) {
        /// <summary>
        /// Callback for the timeout used to regularly check for size updates.
        /// </summary>
        /// <param name="arg" type="Object">
        /// </param>
        if (this._m_AnimationTimeout$1 == null) {
            this._resizeSections$1(false);
            this._m_ResizeTimeout$1 = new Coveo.CNL.Web.Scripts.Timeout(ss.Delegate.create(this, this._resizeTimeoutCallback$1), null, 500);
        }
    },
    
    _animateTimeoutCallback$1: function Coveo_CES_Web_Search_Scripts_Controls_MasterAndDetailScript$_animateTimeoutCallback$1(arg) {
        /// <summary>
        /// Callback for the timeout used to animate expands and collapses.
        /// </summary>
        /// <param name="arg" type="Object">
        /// </param>
        if (this._m_AnimationProgress$1.isFinished()) {
            this._m_AnimationTimeout$1 = null;
            this._m_AnimationProgress$1 = null;
            this._resizeSections$1(true);
        }
        else {
            var rootHeight = Coveo.CNL.Web.Scripts.DOMUtilities.getElementSize(this.m_Root).height;
            var detailHeight = (this._m_StartDetailHeight$1 + (this._m_EndDetailHeight$1 - this._m_StartDetailHeight$1) * this._m_AnimationProgress$1.getPercentage());
            var masterHeight = rootHeight - detailHeight;
            this.m_Master.style.height = Math.max(masterHeight, 0) + 'px';
            this.m_Detail.style.height = Math.max(detailHeight, 0) + 'px';
            this._m_AnimationTimeout$1 = new Coveo.CNL.Web.Scripts.Timeout(ss.Delegate.create(this, this._animateTimeoutCallback$1), null, 10);
        }
    },
    
    _window_Resize$1: function Coveo_CES_Web_Search_Scripts_Controls_MasterAndDetailScript$_window_Resize$1() {
        if (this._m_AnimationTimeout$1 == null) {
            this._resizeSections$1(false);
            this._m_ResizeTimeout$1.cancel();
            this._m_ResizeTimeout$1 = new Coveo.CNL.Web.Scripts.Timeout(ss.Delegate.create(this, this._resizeTimeoutCallback$1), null, 500);
        }
    },
    
    _header_MouseDown$1: function Coveo_CES_Web_Search_Scripts_Controls_MasterAndDetailScript$_header_MouseDown$1() {
        Coveo.CNL.Web.Scripts.CNLAssert.isNull(this._m_HeaderMouseCapture$1);
        this.m_OldDetailHeightWhenExpanded = this.m_DetailHeightWhenExpanded;
        this._m_HeaderMouseCapture$1 = new Coveo.CNL.Web.Scripts.MouseCapture(ss.Delegate.create(this, this._headerMouseCapture_MouseMove$1), null, ss.Delegate.create(this, this._headerMouseCapture_MouseUp$1));
        window.event.returnValue = false;
        window.event.cancelBubble = true;
    },
    
    _headerMouseCapture_MouseMove$1: function Coveo_CES_Web_Search_Scripts_Controls_MasterAndDetailScript$_headerMouseCapture_MouseMove$1() {
        var expandedHeaderHeight = Coveo.CNL.Web.Scripts.DOMUtilities.getElementSize(this.m_ExpandedDetailHeader).height;
        this.m_DetailHeightWhenExpanded += this._m_HeaderMouseCapture$1.get_offsetY();
        this.m_DetailHeightWhenExpanded = Math.max(this.m_DetailHeightWhenExpanded, expandedHeaderHeight);
        var rootHeight = Coveo.CNL.Web.Scripts.DOMUtilities.getElementSize(this.m_Root).height;
        this.m_DetailHeightWhenExpanded = Math.min(this.m_DetailHeightWhenExpanded, rootHeight);
        this._resizeSections$1(true);
    },
    
    _headerMouseCapture_MouseUp$1: function Coveo_CES_Web_Search_Scripts_Controls_MasterAndDetailScript$_headerMouseCapture_MouseUp$1() {
        this._m_HeaderMouseCapture$1.dispose();
        this._m_HeaderMouseCapture$1 = null;
        if (this.m_OldDetailHeightWhenExpanded !== this.m_DetailHeightWhenExpanded) {
            this.updateExpandedDetailHeight(this.m_DetailHeightWhenExpanded);
        }
    }
}


////////////////////////////////////////////////////////////////////////////////
// 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$2" type="Coveo.CNL.Web.Scripts.OnClickElsewhereEvent">
    /// </field>
    /// <field name="_m_Showing$2" 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$2: null,
    _m_Showing$2: 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);
        }
        Coveo.CES.Web.Search.Scripts.Controls.ContextualDropDownScript.callBaseMethod(this, 'initialize');
        this.addOnClickAttribute(this.m_HotSpot, ss.Delegate.create(this, this._hotSpot_Click$2), true);
        this.m_DropDown.attachEvent('onclick', ss.Delegate.create(this, this._dropDown_Click$2));
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_ContextualDropDownScript$tearDown() {
        this.m_HotSpot = null;
        this.m_DropDown = null;
        if (this._m_OnClickElsewhere$2 != null) {
            this._m_OnClickElsewhere$2.dispose();
            this._m_OnClickElsewhere$2 = null;
        }
        Coveo.CES.Web.Search.Scripts.Controls.ContextualDropDownScript.callBaseMethod(this, 'tearDown');
    },
    
    _hotSpot_Click$2: function Coveo_CES_Web_Search_Scripts_Controls_ContextualDropDownScript$_hotSpot_Click$2() {
        if (!this._m_Showing$2) {
            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$2 = true;
            Coveo.CNL.Web.Scripts.CNLAssert.isNull(this._m_OnClickElsewhere$2);
            this._m_OnClickElsewhere$2 = new Coveo.CNL.Web.Scripts.OnClickElsewhereEvent([ this.m_HotSpot, this.m_DropDown ], ss.Delegate.create(this, this._document_ClickElsewhere$2), true);
        }
        else {
            this._hideDropdown$2();
        }
    },
    
    _dropDown_Click$2: function Coveo_CES_Web_Search_Scripts_Controls_ContextualDropDownScript$_dropDown_Click$2() {
        this._hideDropdown$2();
    },
    
    _document_ClickElsewhere$2: function Coveo_CES_Web_Search_Scripts_Controls_ContextualDropDownScript$_document_ClickElsewhere$2() {
        this._hideDropdown$2();
    },
    
    _hideDropdown$2: function Coveo_CES_Web_Search_Scripts_Controls_ContextualDropDownScript$_hideDropdown$2() {
        /// <summary>
        /// Hides the dropdown.
        /// </summary>
        if (this._m_Showing$2) {
            Coveo.CNL.Web.Scripts.CNLAssert.notNull(this._m_OnClickElsewhere$2);
            this.m_DropDown.style.display = 'none';
            if (Coveo.CNL.Web.Scripts.BrowserHelper.get_isIE6()) {
                this.m_IFrame.style.display = 'none';
            }
            this._m_OnClickElsewhere$2.dispose();
            this._m_OnClickElsewhere$2 = null;
            this._m_Showing$2 = 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);
    Coveo.CNL.Web.Scripts.CNLAssert.fail();
    var html = new ss.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) {
        p_Window.close();
        eval(p_OnSuccess);
    }
    else {
        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() {
                    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, false);
    },
    
    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.FirstTimeSetupStatusScript

Coveo.CES.Web.Search.Scripts.Controls.FirstTimeSetupStatusScript = function Coveo_CES_Web_Search_Scripts_Controls_FirstTimeSetupStatusScript() {
    /// <summary>
    /// Client side code for a status icon feedback.
    /// </summary>
    /// <field name="_s_Instances$1" type="Object" static="true">
    /// </field>
    /// <field name="_s_CurrentFeedbackIconElem$1" type="Object" domElement="true" static="true">
    /// </field>
    /// <field name="_s_CurrentFeedbackIconSrc$1" type="String" static="true">
    /// </field>
    /// <field name="_s_CurrentFeedbackIconVisibility$1" type="String" static="true">
    /// </field>
    /// <field name="m_ButtonElemID" type="String">
    /// The button that triggers this status icon feedback (set by the AJAX framework).
    /// </field>
    /// <field name="m_IconElemID" type="String">
    /// The status icon element (set by the AJAX framework).
    /// </field>
    /// <field name="m_LoadingIconUrl" type="String">
    /// The URL of the animated icon used to show that the page is working (set by the AJAX framework).
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.FirstTimeSetupStatusScript.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.FirstTimeSetupStatusScript._startLoadingFeedback$1 = function Coveo_CES_Web_Search_Scripts_Controls_FirstTimeSetupStatusScript$_startLoadingFeedback$1(p_ButtonElemID) {
    /// <summary>
    /// Called when a postback is being started.
    /// </summary>
    /// <param name="p_ButtonElemID" type="String">
    /// </param>
    if (Coveo.CES.Web.Search.Scripts.Controls.FirstTimeSetupStatusScript._s_CurrentFeedbackIconElem$1 != null) {
        Coveo.CES.Web.Search.Scripts.Controls.FirstTimeSetupStatusScript._s_CurrentFeedbackIconElem$1.src = Coveo.CES.Web.Search.Scripts.Controls.FirstTimeSetupStatusScript._s_CurrentFeedbackIconSrc$1;
        Coveo.CES.Web.Search.Scripts.Controls.FirstTimeSetupStatusScript._s_CurrentFeedbackIconElem$1.style.visibility = Coveo.CES.Web.Search.Scripts.Controls.FirstTimeSetupStatusScript._s_CurrentFeedbackIconVisibility$1;
        Coveo.CES.Web.Search.Scripts.Controls.FirstTimeSetupStatusScript._s_CurrentFeedbackIconElem$1 = null;
    }
    var $dict1 = Coveo.CES.Web.Search.Scripts.Controls.FirstTimeSetupStatusScript._s_Instances$1;
    for (var $key2 in $dict1) {
        var entry = { key: $key2, value: $dict1[$key2] };
        var instance = entry.value;
        if (instance.m_ButtonElemID === p_ButtonElemID) {
            var iconElem = document.getElementById(instance.m_IconElemID);
            Coveo.CES.Web.Search.Scripts.Controls.FirstTimeSetupStatusScript._s_CurrentFeedbackIconElem$1 = iconElem;
            if (iconElem != null) {
                Coveo.CES.Web.Search.Scripts.Controls.FirstTimeSetupStatusScript._s_CurrentFeedbackIconSrc$1 = Coveo.CES.Web.Search.Scripts.Controls.FirstTimeSetupStatusScript._s_CurrentFeedbackIconElem$1.src;
                Coveo.CES.Web.Search.Scripts.Controls.FirstTimeSetupStatusScript._s_CurrentFeedbackIconVisibility$1 = Coveo.CES.Web.Search.Scripts.Controls.FirstTimeSetupStatusScript._s_CurrentFeedbackIconElem$1.style.visibility;
                iconElem.src = instance.m_LoadingIconUrl;
                iconElem.style.visibility = 'visible';
            }
            break;
        }
    }
}
Coveo.CES.Web.Search.Scripts.Controls.FirstTimeSetupStatusScript.prototype = {
    m_ButtonElemID: null,
    m_IconElemID: null,
    m_LoadingIconUrl: null,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_FirstTimeSetupStatusScript$initialize() {
        Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(this.m_ButtonElemID);
        Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(this.m_IconElemID);
        Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(this.m_LoadingIconUrl);
        Coveo.CES.Web.Search.Scripts.Controls.FirstTimeSetupStatusScript.callBaseMethod(this, 'initialize');
        Coveo.CES.Web.Search.Scripts.Controls.FirstTimeSetupStatusScript._s_CurrentFeedbackIconElem$1 = null;
        Coveo.CES.Web.Search.Scripts.Controls.FirstTimeSetupStatusScript._s_Instances$1[this.m_ButtonElemID] = this;
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_FirstTimeSetupStatusScript$tearDown() {
        Coveo.CES.Web.Search.Scripts.Controls.FirstTimeSetupStatusScript.callBaseMethod(this, 'tearDown');
        delete Coveo.CES.Web.Search.Scripts.Controls.FirstTimeSetupStatusScript._s_Instances$1[this.m_ButtonElemID];
    }
}


////////////////////////////////////////////////////////////////////////////////
// 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="Function">
    /// </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 = ss.Delegate.create(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.ResultSidePanelCloseLinkScript

Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelCloseLinkScript = function Coveo_CES_Web_Search_Scripts_Controls_ResultSidePanelCloseLinkScript() {
    /// <summary>
    /// Client side code for the ResultSidePanelCloseLink control.
    /// </summary>
    /// <field name="_m_OnClickEvent$1" type="Function">
    /// </field>
    /// <field name="m_ImageElem" type="Object" domElement="true">
    /// The element we are attached to (set by the AJAX framework).
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelCloseLinkScript.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelCloseLinkScript.prototype = {
    _m_OnClickEvent$1: null,
    m_ImageElem: null,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_ResultSidePanelCloseLinkScript$initialize() {
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_ImageElem);
        this._m_OnClickEvent$1 = ss.Delegate.create(this, this._image_OnClick$1);
        this.m_ImageElem.attachEvent('onclick', this._m_OnClickEvent$1);
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_ResultSidePanelCloseLinkScript$tearDown() {
        this.m_ImageElem.detachEvent('onclick', this._m_OnClickEvent$1);
    },
    
    _image_OnClick$1: function Coveo_CES_Web_Search_Scripts_Controls_ResultSidePanelCloseLinkScript$_image_OnClick$1() {
        Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._hidePopup();
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelToModalBoxLinkScript

Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelToModalBoxLinkScript = function Coveo_CES_Web_Search_Scripts_Controls_ResultSidePanelToModalBoxLinkScript() {
    /// <summary>
    /// Client side code for the ResultSidePanelToModalBoxLinkScript control.
    /// </summary>
    /// <field name="_m_OnClickEvent$1" type="Function">
    /// </field>
    /// <field name="m_ImageElem" type="Object" domElement="true">
    /// The element we are attached to (set by the AJAX framework).
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelToModalBoxLinkScript.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelToModalBoxLinkScript.prototype = {
    _m_OnClickEvent$1: null,
    m_ImageElem: null,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_ResultSidePanelToModalBoxLinkScript$initialize() {
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_ImageElem);
        this._m_OnClickEvent$1 = ss.Delegate.create(this, this._image_OnClick$1);
        this.m_ImageElem.attachEvent('onclick', this._m_OnClickEvent$1);
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_ResultSidePanelToModalBoxLinkScript$tearDown() {
        this.m_ImageElem.detachEvent('onclick', this._m_OnClickEvent$1);
    },
    
    _image_OnClick$1: function Coveo_CES_Web_Search_Scripts_Controls_ResultSidePanelToModalBoxLinkScript$_image_OnClick$1() {
        Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._switchToModalBox();
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.DateParamsScript

Coveo.CES.Web.Search.Scripts.Controls.DateParamsScript = function Coveo_CES_Web_Search_Scripts_Controls_DateParamsScript() {
    /// <summary>
    /// Client side code for the DateParams control.
    /// </summary>
    /// <field name="m_AnytimeRadioButton" type="Object" domElement="true">
    /// The RadioButton element reference for the anytime selection into the DateParams.
    /// </field>
    /// <field name="m_InTheLastRadioButton" type="Object" domElement="true">
    /// The RadioButton element reference for the duration selection into the DateParams.
    /// </field>
    /// <field name="m_BetweenRadioButton" type="Object" domElement="true">
    /// The RadioButton element reference for the "Between" selection into the DateParams.
    /// </field>
    /// <field name="m_MinimumDate" type="Object" domElement="true">
    /// The DateParams element reference for the minimum date selection (enabled by the m_BetweenRadioButton).
    /// </field>
    /// <field name="m_MaximumDate" type="Object" domElement="true">
    /// The DateParams element reference for the maximum date selection (enabled by the m_BetweenRadioButton).
    /// </field>
    /// <field name="m_ModifiedInTheLast" type="Object" domElement="true">
    /// The DateParams element reference for the duration selection (enabled by the m_InTheLastRadioButton).
    /// </field>
    /// <field name="_m_RadioButtonClickEventHandler$1" type="Function">
    /// The event handler to handle the RadioButton click event.
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.DateParamsScript.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.DateParamsScript.prototype = {
    m_AnytimeRadioButton: null,
    m_InTheLastRadioButton: null,
    m_BetweenRadioButton: null,
    m_MinimumDate: null,
    m_MaximumDate: null,
    m_ModifiedInTheLast: null,
    _m_RadioButtonClickEventHandler$1: null,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_DateParamsScript$initialize() {
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_AnytimeRadioButton);
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_InTheLastRadioButton);
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_BetweenRadioButton);
        this._m_RadioButtonClickEventHandler$1 = ss.Delegate.create(this, this._radioButton_Click$1);
        this.m_AnytimeRadioButton.attachEvent('onclick', this._m_RadioButtonClickEventHandler$1);
        this.m_InTheLastRadioButton.attachEvent('onclick', this._m_RadioButtonClickEventHandler$1);
        this.m_BetweenRadioButton.attachEvent('onclick', this._m_RadioButtonClickEventHandler$1);
        this._radioButton_Click$1();
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_DateParamsScript$tearDown() {
        if (this._m_RadioButtonClickEventHandler$1 != null) {
            this.m_AnytimeRadioButton.detachEvent('onclick', this._m_RadioButtonClickEventHandler$1);
            this.m_InTheLastRadioButton.detachEvent('onclick', this._m_RadioButtonClickEventHandler$1);
            this.m_BetweenRadioButton.detachEvent('onclick', this._m_RadioButtonClickEventHandler$1);
        }
        this._m_RadioButtonClickEventHandler$1 = null;
    },
    
    _radioButton_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_DateParamsScript$_radioButton_Click$1() {
        /// <summary>
        /// From the current radio button selection enable/disable their control
        /// accordingly.
        /// </summary>
        if ((this.m_BetweenRadioButton).checked) {
            Coveo.CNL.Web.Scripts.DOMUtilities.changeEnableStateOfChildren(this.m_MinimumDate, false, false);
            Coveo.CNL.Web.Scripts.DOMUtilities.changeEnableStateOfChildren(this.m_MaximumDate, false, false);
            Coveo.CNL.Web.Scripts.DOMUtilities.changeEnableStateOfChildren(this.m_ModifiedInTheLast, true, true);
        }
        else if ((this.m_AnytimeRadioButton).checked) {
            Coveo.CNL.Web.Scripts.DOMUtilities.changeEnableStateOfChildren(this.m_MinimumDate, true, true);
            Coveo.CNL.Web.Scripts.DOMUtilities.changeEnableStateOfChildren(this.m_MaximumDate, true, true);
            Coveo.CNL.Web.Scripts.DOMUtilities.changeEnableStateOfChildren(this.m_ModifiedInTheLast, true, true);
        }
        else {
            Coveo.CNL.Web.Scripts.CNLAssert.check((this.m_InTheLastRadioButton).checked);
            Coveo.CNL.Web.Scripts.DOMUtilities.changeEnableStateOfChildren(this.m_MinimumDate, true, true);
            Coveo.CNL.Web.Scripts.DOMUtilities.changeEnableStateOfChildren(this.m_MaximumDate, true, true);
            Coveo.CNL.Web.Scripts.DOMUtilities.changeEnableStateOfChildren(this.m_ModifiedInTheLast, false, false);
        }
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.NoticesScript

Coveo.CES.Web.Search.Scripts.Controls.NoticesScript = function Coveo_CES_Web_Search_Scripts_Controls_NoticesScript() {
    /// <summary>
    /// Client side code for the Notices control.
    /// </summary>
    /// <field name="_m_JMain$1" type="jQueryObject">
    /// </field>
    /// <field name="_m_JCloseButton$1" type="jQueryObject">
    /// </field>
    /// <field name="m_Main" type="Object" domElement="true">
    /// </field>
    /// <field name="m_CloseButton" type="Object" domElement="true">
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.NoticesScript.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.NoticesScript.prototype = {
    _m_JMain$1: null,
    _m_JCloseButton$1: null,
    m_Main: null,
    m_CloseButton: null,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_NoticesScript$initialize() {
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_Main);
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_CloseButton);
        this._m_JMain$1 = $(this.m_Main);
        this._m_JCloseButton$1 = $(this.m_CloseButton);
        this._m_JCloseButton$1.bind('click', ss.Delegate.create(this, function(p_Event) {
            this._hideNotice$1();
        }));
        Coveo.CES.Web.Search.Scripts.Controls.NoticesScript.callBaseMethod(this, 'initialize');
        this._displayNotice$1();
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_NoticesScript$tearDown() {
        this._m_JCloseButton$1.unbind('click');
        Coveo.CES.Web.Search.Scripts.Controls.NoticesScript.callBaseMethod(this, 'tearDown');
    },
    
    _displayNotice$1: function Coveo_CES_Web_Search_Scripts_Controls_NoticesScript$_displayNotice$1() {
        /// <summary>
        /// Display the notice
        /// </summary>
        var main = $(this.m_Main);
        $(ss.Delegate.create(this, function() {
            new Coveo.CNL.Web.Scripts.Timeout(ss.Delegate.create(this, function(arg) {
                this._m_JMain$1.slideToggle('fast');
            }), null, 500);
        }));
    },
    
    _hideNotice$1: function Coveo_CES_Web_Search_Scripts_Controls_NoticesScript$_hideNotice$1() {
        /// <summary>
        /// Hides the notice
        /// </summary>
        this._m_JMain$1.slideToggle('fast');
    }
}


////////////////////////////////////////////////////////////////////////////////
// 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>
    /// <field name="_coreV4_CSS_URL$1" type="Array" elementType="Array">
    /// </field>
    /// <field name="_searcH_CSS_URL$1" type="Array" elementType="Array">
    /// </field>
    /// <field name="_defaulT_SEARCH_CSS_URL$1" type="String" static="true">
    /// </field>
    /// <field name="m_OurSearchUrl" type="String">
    /// </field>
    /// <field name="m_SearchRootStyle" type="String">
    /// </field>
    this._coreV4_CSS_URL$1 = [ [ '/corev4.css' ], [ '/corev4-', '.css' ] ];
    this._searcH_CSS_URL$1 = [ [ '/search.css' ], [ '/search-', '.css' ] ];
    Coveo.CES.Web.Search.Scripts.Controls.SharePointSearchBoxScript.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.SharePointSearchBoxScript._stringMatches$1 = function Coveo_CES_Web_Search_Scripts_Controls_SharePointSearchBoxScript$_stringMatches$1(p_Str, p_Patterns) {
    /// <param name="p_Str" type="String">
    /// </param>
    /// <param name="p_Patterns" type="Array" elementType="Array">
    /// </param>
    /// <returns type="Boolean"></returns>
    var retMatch = false;
    for (var patternNo = 0; patternNo < p_Patterns.length; ++patternNo) {
        var startIndex = 0;
        for (var partNo = 0; startIndex !== -1 && partNo < p_Patterns[patternNo].length; ++partNo) {
            var partStr = p_Patterns[patternNo][partNo];
            startIndex = p_Str.indexOf(partStr, startIndex);
            if (startIndex !== -1) {
                startIndex += partStr.length;
            }
        }
        if (startIndex !== -1) {
            retMatch = true;
            break;
        }
    }
    return retMatch;
}
Coveo.CES.Web.Search.Scripts.Controls.SharePointSearchBoxScript.prototype = {
    m_OurSearchUrl: null,
    m_SearchRootStyle: null,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_SharePointSearchBoxScript$initialize() {
        var OurSearch = '{0}' + this.m_OurSearchUrl + '?q="{1}"';
        var s_MossPerson = new RegExp('(.+)Person\\.aspx.*', 'i');
        var s_MossPeopleResults = new RegExp('https?://.+/PeopleResults\\.aspx\\?.*k=(\\w+:)?"(.+)"', 'i');
        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');
                if (hrefAttribute != null) {
                    var match = s_MossPeopleResults.exec(hrefAttribute.value);
                    if (match != null && match.length > 0) {
                        hrefAttribute.value = String.format(OurSearch, person[1], match[2]);
                    }
                }
            }
        }
        var headColl = document.documentElement.getElementsByTagName('head');
        if (headColl.length >= 1) {
            var headElem = headColl[0];
            var foundCorev4 = false;
            var foundSearch = false;
            for (var childNo = 0; childNo < headElem.childNodes.length; ++childNo) {
                var tagName = headElem.childNodes[childNo].tagName;
                if (tagName != null && tagName.toLowerCase() === 'link') {
                    var relAttr = headElem.childNodes[childNo].attributes.getNamedItem('rel');
                    var typeAttr = headElem.childNodes[childNo].attributes.getNamedItem('type');
                    var hrefAttr = headElem.childNodes[childNo].attributes.getNamedItem('href');
                    if (relAttr != null && typeAttr != null && hrefAttr != null && relAttr.value === 'stylesheet' && typeAttr.value === 'text/css') {
                        var hrefStr = hrefAttr.value.toLowerCase();
                        if (Coveo.CES.Web.Search.Scripts.Controls.SharePointSearchBoxScript._stringMatches$1(hrefStr, this._coreV4_CSS_URL$1)) {
                            foundCorev4 = true;
                        }
                        else if (Coveo.CES.Web.Search.Scripts.Controls.SharePointSearchBoxScript._stringMatches$1(hrefStr, this._searcH_CSS_URL$1)) {
                            foundSearch = true;
                        }
                    }
                }
            }
            if (foundCorev4) {
                if (!foundSearch) {
                    var elem = document.createElement('link');
                    elem.setAttribute('rel', 'stylesheet');
                    elem.setAttribute('type', 'text/css');
                    elem.setAttribute('href', '/_layouts/1033/styles/themable/search.css');
                    headElem.appendChild(elem);
                }
                var divColl = document.documentElement.getElementsByTagName('div');
                for (var divNo = 0; divNo < divColl.length; ++divNo) {
                    var popup = divColl[divNo];
                    if (popup.id.indexOf('_PlaceHolderSearchArea_') !== -1 && popup.id.endsWith('_Popup')) {
                        popup.parentNode.removeChild(popup);
                        document.documentElement.getElementsByTagName('form')[0].appendChild(popup);
                        popup.className = this.m_SearchRootStyle;
                        break;
                    }
                }
            }
        }
    }
}


////////////////////////////////////////////////////////////////////////////////
// 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_NonFocusText" type="String">
    /// </field>
    /// <field name="m_NonFocusCssClass" type="String">
    /// </field>
    /// <field name="_m_OnFocusHandler$1" type="Function">
    /// </field>
    /// <field name="_m_OnBlurHandler$1" type="Function">
    /// </field>
    /// <field name="_m_OnKeyPressHandler$1" type="Function">
    /// </field>
    /// <field name="_m_SearchButtonClickEventHandler$1" type="Function">
    /// </field>
    /// <field name="_m_LinkButtonClickEventHandler$1" type="Function">
    /// </field>
    /// <field name="_m_PopupOnMouseOver$1" type="Function">
    /// </field>
    /// <field name="_m_PopupOnMouseOut$1" type="Function">
    /// </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_NonFocusText: null,
    m_NonFocusCssClass: 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 = ss.Delegate.create(this, this._textBox_KeyPress$1);
        this.m_TextBox.attachEvent('onkeydown', this._m_OnKeyPressHandler$1);
        this._m_SearchButtonClickEventHandler$1 = ss.Delegate.create(this, this._searchButton_Click$1);
        this.m_SearchButton.attachEvent('onclick', this._m_SearchButtonClickEventHandler$1);
        if (this.m_LinkButton != null) {
            this._m_LinkButtonClickEventHandler$1 = ss.Delegate.create(this, this._linkButton_Click$1);
            this.m_LinkButton.attachEvent('onclick', this._m_LinkButtonClickEventHandler$1);
        }
        if (this.m_NonFocusText != null && (!this.m_TextBox.value || this.m_TextBox.value === this.m_NonFocusText)) {
            this._timerTick$1(null);
            window.setTimeout(ss.Delegate.create(this, this._timerTick$1), 10);
        }
        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_PopupOnMouseOver$1 = ss.Delegate.create(this, this._popup_OnMouseOver$1);
            this.m_Popup.attachEvent('onmouseover', this._m_PopupOnMouseOver$1);
            this._m_PopupOnMouseOut$1 = ss.Delegate.create(this, this._popup_OnMouseOut$1);
            this.m_Popup.attachEvent('onmouseout', this._m_PopupOnMouseOut$1);
        }
        this._m_OnFocusHandler$1 = ss.Delegate.create(this, this._textBox_Focus$1);
        this.m_TextBox.attachEvent('onfocus', this._m_OnFocusHandler$1);
        this._m_OnBlurHandler$1 = ss.Delegate.create(this, this._textBox_Blur$1);
        this.m_TextBox.attachEvent('onblur', this._m_OnBlurHandler$1);
    },
    
    _timerTick$1: function Coveo_CES_Web_Search_Scripts_Controls_SearchBoxScript$_timerTick$1(arg) {
        /// <param name="arg" type="Object">
        /// </param>
        if (this.m_TextBox.className.indexOf(this.m_NonFocusCssClass) === -1) {
            this.m_TextBox.className += ' ' + this.m_NonFocusCssClass;
        }
        this.m_TextBox.value = this.m_NonFocusText;
    },
    
    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.Function">
        /// </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(ss.Delegate.create(this, this._updateResults$1), null, 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(arg) {
        /// <summary>
        /// Launches the server calls to update the results.
        /// </summary>
        /// <param name="arg" type="Object">
        /// </param>
        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, ss.Delegate.create(this, this._updateResultsCallback$1));
            }
            else {
                var scope = '';
                var argName = '&' + 'sc'.toLowerCase() + '=';
                var argStart = this.m_Target.toLowerCase().indexOf(argName);
                if (argStart !== -1) {
                    argStart += argName.length;
                    var argEnd = this.m_Target.indexOf('&', argStart);
                    if (argEnd === -1) {
                        argEnd = this.m_Target.length;
                    }
                    scope = this.m_Target.substring(argStart, argEnd);
                }
                this.serverUpdateResults(this.m_TextBox.value, scope, ss.Delegate.create(this, this._updateResultsCallback$1));
            }
        }
        else {
            this._hidePopup$1(null);
        }
    },
    
    _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(arg) {
        /// <summary>
        /// Schedules hiding the popup (when the user stops using the search box).
        /// </summary>
        /// <param name="arg" type="Object">
        /// </param>
        this._cancelHidePopup$1();
        this._m_HideTimeout$1 = new Coveo.CNL.Web.Scripts.Timeout(ss.Delegate.create(this, this._hidePopup$1), null, 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(arg) {
        /// <summary>
        /// Hides the popup containing quick results.
        /// </summary>
        /// <param name="arg" type="Object">
        /// </param>
        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 query = ((this.m_NonFocusText == null || this.m_TextBox.className.indexOf(' ' + this.m_NonFocusCssClass) === -1) ? this.m_TextBox.value : '');
        var uri = this.m_Target;
        uri += '&' + 'q' + '=' + encodeURIComponent(query);
        if (this.m_ScopeDropDownList != null && !!this.m_ScopeDropDownList.value) {
            uri += '&' + 'sc' + '=' + encodeURIComponent(this.m_ScopeDropDownList.value);
        }
        uri += '&' + 'tz' + '=' + encodeURIComponent(eval('jstz.determine_timezone().name()').toString());
        window.navigate(uri);
    },
    
    _textBox_Focus$1: function Coveo_CES_Web_Search_Scripts_Controls_SearchBoxScript$_textBox_Focus$1() {
        if (this.m_SearchAsYouType) {
            this._cancelHidePopup$1();
            this._m_HasFocus$1 = true;
        }
        if (this.m_NonFocusText != null) {
            if (this.m_TextBox.className.indexOf(' ' + this.m_NonFocusCssClass) !== -1) {
                this.m_TextBox.value = '';
                this.m_TextBox.className = this.m_TextBox.className.replaceAll(' ' + this.m_NonFocusCssClass, '');
            }
        }
        if (this.m_SearchAsYouType) {
            if (!!this.m_TextBox.value) {
                this._scheduleUpdateResults$1();
            }
            if (!this._m_WakeUpSent$1) {
                var uri = this.m_Target;
                uri += '&' + 'wakeup' + '=1';
                var request = Coveo.CNL.Web.Scripts.Utilities.createGetXmlHttpRequest(uri);
                request.send('');
                this._m_WakeUpSent$1 = true;
            }
        }
    },
    
    _textBox_Blur$1: function Coveo_CES_Web_Search_Scripts_Controls_SearchBoxScript$_textBox_Blur$1() {
        if (this.m_SearchAsYouType) {
            if (!this._m_OverResults$1) {
                this._scheduleHidePopup$1(null);
            }
            this._cancelUpdateResults$1();
            this._m_HasFocus$1 = false;
        }
        if (this.m_NonFocusText != null) {
            if (!this.m_TextBox.value) {
                this.m_TextBox.className += ' ' + this.m_NonFocusCssClass;
                this.m_TextBox.value = this.m_NonFocusText;
            }
        }
    },
    
    _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(null);
        }
        this._m_OverResults$1 = false;
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.TableResultListFunnelPopupScript

Coveo.CES.Web.Search.Scripts.Controls.TableResultListFunnelPopupScript = function Coveo_CES_Web_Search_Scripts_Controls_TableResultListFunnelPopupScript() {
    /// <summary>
    /// Client side code for the pop-up facet control in the TableResultList.
    /// </summary>
    /// <field name="_m_OnClickElsewhereEvent$2" type="Coveo.CNL.Web.Scripts.OnClickElsewhereEvent">
    /// </field>
    /// <field name="_m_OnClickElementHandler$2" type="Function">
    /// </field>
    /// <field name="m_Popup" type="Object" domElement="true">
    /// </field>
    /// <field name="m_Checkbox" type="Object" domElement="true">
    /// </field>
    /// <field name="m_ItemsTable" type="Object" domElement="true">
    /// </field>
    /// <field name="m_Count" type="Number" integer="true">
    /// </field>
    /// <field name="m_SelectedCount" type="Number" integer="true">
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.TableResultListFunnelPopupScript.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.TableResultListFunnelPopupScript.prototype = {
    _m_OnClickElsewhereEvent$2: null,
    _m_OnClickElementHandler$2: null,
    m_Popup: null,
    m_Checkbox: null,
    m_ItemsTable: null,
    m_Count: 0,
    m_SelectedCount: 0,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_TableResultListFunnelPopupScript$initialize() {
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_Popup);
        Coveo.CES.Web.Search.Scripts.Controls.TableResultListFunnelPopupScript.callBaseMethod(this, 'initialize');
        this._m_OnClickElsewhereEvent$2 = new Coveo.CNL.Web.Scripts.OnClickElsewhereEvent([ this.m_Popup ], ss.Delegate.create(this, this._main_ClickElsewhere$2), true);
        this.addOnClickAttribute(this.m_Checkbox, ss.Delegate.create(this, this.selectAllClicked), true);
        this._m_OnClickElementHandler$2 = ss.Delegate.create(this, this.elementClicked);
        for (var i = 0; i < this.m_ItemsTable.rows.length; i++) {
            var row = this.m_ItemsTable.rows[i];
            var elem = row.cells[0].getElementsByTagName('input')[0];
            elem.attachEvent('onclick', this._m_OnClickElementHandler$2);
        }
        this.m_Checkbox.checked = this.m_SelectedCount > 0;
        Coveo.CNL.Web.Scripts.DOMUtilities.setOpacity(this.m_Checkbox, (this.m_SelectedCount === this.m_Count) ? 1 : 0.5);
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_TableResultListFunnelPopupScript$tearDown() {
        if (this._m_OnClickElsewhereEvent$2 != null) {
            this._m_OnClickElsewhereEvent$2.dispose();
            this._m_OnClickElsewhereEvent$2 = null;
        }
        for (var i = 0; i < this.m_ItemsTable.rows.length; i++) {
            var row = this.m_ItemsTable.rows[i];
            var elem = row.cells[0].getElementsByTagName('input')[0];
            elem.detachEvent('onclick', this._m_OnClickElementHandler$2);
        }
        Coveo.CES.Web.Search.Scripts.Controls.TableResultListFunnelPopupScript.callBaseMethod(this, 'tearDown');
    },
    
    cancelChanges: function Coveo_CES_Web_Search_Scripts_Controls_TableResultListFunnelPopupScript$cancelChanges(p_Callback) {
        /// <param name="p_Callback" type="Coveo.CNL.Web.Scripts.Ajax.Function">
        /// </param>
    },
    
    selectAllClicked: function Coveo_CES_Web_Search_Scripts_Controls_TableResultListFunnelPopupScript$selectAllClicked() {
        for (var i = 0; i < this.m_ItemsTable.rows.length; i++) {
            var item = (this.m_ItemsTable.rows[i]).cells[0].getElementsByTagName('input')[0];
            item.checked = this.m_Checkbox.checked;
        }
        Coveo.CNL.Web.Scripts.DOMUtilities.setOpacity(this.m_Checkbox, 1);
    },
    
    elementClicked: function Coveo_CES_Web_Search_Scripts_Controls_TableResultListFunnelPopupScript$elementClicked() {
        if ((window.event.srcElement).checked) {
            this.m_SelectedCount++;
        }
        else {
            this.m_SelectedCount--;
        }
        this.m_Checkbox.checked = this.m_SelectedCount > 0;
        Coveo.CNL.Web.Scripts.DOMUtilities.setOpacity(this.m_Checkbox, (this.m_SelectedCount === this.m_Count) ? 1 : 0.5);
    },
    
    _main_ClickElsewhere$2: function Coveo_CES_Web_Search_Scripts_Controls_TableResultListFunnelPopupScript$_main_ClickElsewhere$2() {
        this.cancelChanges(ss.Delegate.create(this, this._cancelChangesCallback$2));
    },
    
    _cancelChangesCallback$2: function Coveo_CES_Web_Search_Scripts_Controls_TableResultListFunnelPopupScript$_cancelChangesCallback$2(p_Return) {
        /// <param name="p_Return" type="Object">
        /// </param>
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.TableResultListScript

Coveo.CES.Web.Search.Scripts.Controls.TableResultListScript = function Coveo_CES_Web_Search_Scripts_Controls_TableResultListScript() {
    /// <summary>
    /// Client side code for the TableResultList.
    /// </summary>
    /// <field name="m_Table" type="Object" domElement="true">
    /// </field>
    /// <field name="m_MaxLines" type="Number" integer="true">
    /// </field>
    /// <field name="m_FixedLines" type="Number" integer="true">
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.TableResultListScript.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.TableResultListScript.prototype = {
    m_Table: null,
    m_MaxLines: 0,
    m_FixedLines: 0,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_TableResultListScript$initialize() {
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_Table);
        Coveo.CES.Web.Search.Scripts.Controls.TableResultListScript.callBaseMethod(this, 'initialize');
        if (this.m_MaxLines > 0 || this.m_FixedLines > 0) {
            for (var i = 0; i < this.m_Table.rows.length; i++) {
                var row = this.m_Table.rows[i];
                for (var j = 0; j < row.cells.length; j++) {
                    var cell = row.cells[j];
                    if (!!cell.tagName.compareTo('th', true)) {
                        this._ellipsisContentOf$1(cell);
                    }
                }
            }
        }
    },
    
    _ellipsisContentOf$1: function Coveo_CES_Web_Search_Scripts_Controls_TableResultListScript$_ellipsisContentOf$1(p_Cell) {
        /// <summary>
        /// Ellipsis the content of a cell with a maximum height or a fixed height.
        /// </summary>
        /// <param name="p_Cell" type="Object" domElement="true">
        /// The <see cref="T:System.Html.TableCellElement" /> to ellipsis.
        /// </param>
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(p_Cell);
        var ellipsis = document.createElement('div');
        ellipsis.style.right = '0';
        ellipsis.style.bottom = '0';
        ellipsis.innerHTML = '&#133;';
        ellipsis.style.fontSize = p_Cell.currentStyle.fontSize;
        ellipsis.style.zIndex = Coveo.CNL.Web.Scripts.DOMUtilities.getNextHighestZindex();
        ellipsis.style.backgroundColor = 'inherit';
        ellipsis.style.position = 'absolute';
        var oldContent = document.createElement('div');
        oldContent.style.width = p_Cell.currentStyle.width;
        oldContent.style.overflow = 'hidden';
        oldContent.style.textOverflow = '';
        oldContent.style.position = 'relative';
        oldContent.style.backgroundColor = 'inherit';
        var stringContent = p_Cell.innerText;
        ellipsis = oldContent.appendChild(ellipsis);
        for (var i = 0; i < p_Cell.childNodes.length; i++) {
            oldContent.appendChild(p_Cell.childNodes[i]);
        }
        p_Cell.innerHTML = '';
        oldContent = p_Cell.appendChild(oldContent);
        var lineSize = ellipsis.clientHeight;
        var height = lineSize;
        if (this.m_FixedLines === -1) {
            height = this.m_MaxLines * lineSize;
            oldContent.style.maxHeight = height.toString() + 'px';
        }
        else {
            height = this.m_FixedLines * lineSize;
            oldContent.style.height = height.toString() + 'px';
        }
        var paddingTop = parseInt(p_Cell.currentStyle.paddingTop.replaceAll('px', ''));
        var paddingBottom = parseInt(p_Cell.currentStyle.paddingBottom.replaceAll('px', ''));
        if (oldContent.scrollHeight <= height + paddingTop + paddingBottom) {
            oldContent.removeChild(ellipsis);
        }
        else {
            oldContent.title = stringContent;
        }
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.SilverlightMediaPlayer

Coveo.CES.Web.Search.Scripts.Controls.SilverlightMediaPlayer = function Coveo_CES_Web_Search_Scripts_Controls_SilverlightMediaPlayer(p_XAPUrl) {
    /// <summary>
    /// Client side code for the Player class: version Silverlight.
    /// </summary>
    /// <param name="p_XAPUrl" type="String">
    /// The url of the media player xap file.
    /// </param>
    /// <field name="_objecT_ID" type="String" static="true">
    /// </field>
    /// <field name="_m_PlayerElement" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_XAPUrl" type="String">
    /// </field>
    this._m_XAPUrl = p_XAPUrl;
}
Coveo.CES.Web.Search.Scripts.Controls.SilverlightMediaPlayer.prototype = {
    _m_PlayerElement: null,
    _m_XAPUrl: null,
    
    get_id: function Coveo_CES_Web_Search_Scripts_Controls_SilverlightMediaPlayer$get_id() {
        /// <value type="String"></value>
        return 'coveoMediaPlayer';
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_SilverlightMediaPlayer$tearDown() {
        this._m_XAPUrl = null;
        this._m_PlayerElement = null;
    },
    
    play: function Coveo_CES_Web_Search_Scripts_Controls_SilverlightMediaPlayer$play() {
        this._getControlElement().Play();
    },
    
    pause: function Coveo_CES_Web_Search_Scripts_Controls_SilverlightMediaPlayer$pause() {
        this._getControlElement().Pause();
    },
    
    stop: function Coveo_CES_Web_Search_Scripts_Controls_SilverlightMediaPlayer$stop() {
        this._getControlElement().Stop();
    },
    
    getPosition: function Coveo_CES_Web_Search_Scripts_Controls_SilverlightMediaPlayer$getPosition() {
        /// <returns type="Number"></returns>
        return parseFloat(this._getControlElement().GetPosition().toString());
    },
    
    setPosition: function Coveo_CES_Web_Search_Scripts_Controls_SilverlightMediaPlayer$setPosition(p_Position) {
        /// <param name="p_Position" type="Number">
        /// </param>
        this._getControlElement().SetPosition(p_Position);
    },
    
    getState: function Coveo_CES_Web_Search_Scripts_Controls_SilverlightMediaPlayer$getState() {
        /// <returns type="Coveo.CES.Web.Search.Scripts.Controls.StateEnum"></returns>
        switch (this._getControlElement().GetState().toString()) {
            case 'Paused':
                return 3;
            case 'Playing':
                return 1;
            case 'Buffering':
                return 4;
            case 'Stopped':
            default:
                return 2;
        }
    },
    
    getStatus: function Coveo_CES_Web_Search_Scripts_Controls_SilverlightMediaPlayer$getStatus() {
        /// <returns type="String"></returns>
        return this._getControlElement().GetState().toString();
    },
    
    createPlayerElement: function Coveo_CES_Web_Search_Scripts_Controls_SilverlightMediaPlayer$createPlayerElement(p_Uri, p_Height, p_Width) {
        /// <param name="p_Uri" type="String">
        /// </param>
        /// <param name="p_Height" type="String">
        /// </param>
        /// <param name="p_Width" type="String">
        /// </param>
        /// <returns type="Object" domElement="true"></returns>
        var elem = document.createElement('div');
        elem.setAttribute('id', this.get_id());
        elem.style.width = p_Width;
        elem.style.height = p_Height;
        var obj = document.createElement('object');
        obj.setAttribute('id', 'SilverlightControl');
        obj.setAttribute('data', 'data:application/x-silverlight-2,');
        obj.setAttribute('type', 'application/x-silverlight-2');
        obj.setAttribute('width', '100%');
        obj.setAttribute('height', '100%');
        var sourceParam = document.createElement('param');
        sourceParam.setAttribute('name', 'source');
        sourceParam.setAttribute('value', this._m_XAPUrl);
        var minRuntimeParam = document.createElement('param');
        minRuntimeParam.setAttribute('name', 'minRuntimeVersion');
        minRuntimeParam.setAttribute('value', '4.0.50401.0');
        var autoUpgradeParam = document.createElement('param');
        autoUpgradeParam.setAttribute('name', 'autoUpgrade');
        autoUpgradeParam.setAttribute('value', 'true');
        var windowlessParam = document.createElement('param');
        windowlessParam.setAttribute('name', 'windowless');
        windowlessParam.setAttribute('value', 'true');
        var initParamsParam = document.createElement('param');
        initParamsParam.setAttribute('name', 'initParams');
        initParamsParam.setAttribute('value', 'MediaUri=' + p_Uri);
        var dwnLnk = document.createElement('a');
        dwnLnk.setAttribute('href', 'http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50401.0');
        dwnLnk.setAttribute('style', 'text-decoration:none');
        var dwnImg = document.createElement('img');
        dwnImg.src = 'http://go.microsoft.com/fwlink/?LinkId=161376';
        dwnImg.alt = 'Get Microsoft Silverlight';
        dwnImg.style.borderStyle = 'none';
        var historyFrame = document.createElement('iframe');
        historyFrame.setAttribute('id', '_sl_historyFrame');
        historyFrame.setAttribute('style', 'visibility:hidden;height:0px;width:0px;border:0px');
        dwnLnk.appendChild(dwnImg);
        obj.appendChild(dwnLnk);
        obj.appendChild(sourceParam);
        obj.appendChild(minRuntimeParam);
        obj.appendChild(autoUpgradeParam);
        obj.appendChild(windowlessParam);
        obj.appendChild(initParamsParam);
        elem.appendChild(obj);
        elem.appendChild(historyFrame);
        return elem;
    },
    
    createPlayerString: function Coveo_CES_Web_Search_Scripts_Controls_SilverlightMediaPlayer$createPlayerString(p_Uri, p_Height, p_Width) {
        /// <param name="p_Uri" type="String">
        /// </param>
        /// <param name="p_Height" type="String">
        /// </param>
        /// <param name="p_Width" type="String">
        /// </param>
        /// <returns type="String"></returns>
        var sb = new ss.StringBuilder();
        sb.append('<div id="' + this.get_id() + '" style="height:' + p_Height + '; width:' + p_Width + '">');
        sb.append('<object ID="' + 'SilverlightControl' + '" data="data:application/x-silverlight-2" type="application/x-silverlight-2" width="100%" height="100%" >');
        sb.append('<param name="initParams" value="MediaUri=' + p_Uri + '" >');
        sb.append('<param name="source" value="' + this._m_XAPUrl + '"/>');
        sb.append('<param name="windowless" value="true"/>');
        sb.append('<param name="autoUpgrade" value="true"/>');
        sb.append('<param name="minRuntimeVersion" value="4.0.50401.0"/>');
        sb.append('<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50401.0" >');
        sb.append('<img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none" />');
        sb.append('</a>');
        sb.append('</object>');
        sb.append('<iframe id="_sl_historyFrame" style="visibility:hidden; height:0px; width:0px; border:0px" />');
        sb.append('</div>');
        return sb.toString();
    },
    
    isReady: function Coveo_CES_Web_Search_Scripts_Controls_SilverlightMediaPlayer$isReady() {
        /// <returns type="Boolean"></returns>
        return !ss.isNullOrUndefined(this._getControlElement());
    },
    
    _getControlElement: function Coveo_CES_Web_Search_Scripts_Controls_SilverlightMediaPlayer$_getControlElement() {
        /// <summary>
        /// Get the DOM Element element used to interact with Silverlight Media Player.
        /// </summary>
        /// <returns type="Object" domElement="true"></returns>
        try {
            if (ss.isNullOrUndefined(this._m_PlayerElement)) {
                this._m_PlayerElement = document.getElementById('SilverlightControl');
            }
            return this._m_PlayerElement.Content.mediaPlayer;
        }
        catch ($e1) {
            return null;
        }
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.WindowsMediaPlayer

Coveo.CES.Web.Search.Scripts.Controls.WindowsMediaPlayer = function Coveo_CES_Web_Search_Scripts_Controls_WindowsMediaPlayer() {
    /// <summary>
    /// Client side code for the Player class: version Windows Media Player.
    /// </summary>
    /// <field name="_clasS_ID" type="String" static="true">
    /// </field>
    /// <field name="_m_PlayerElement" type="Object" domElement="true">
    /// </field>
}
Coveo.CES.Web.Search.Scripts.Controls.WindowsMediaPlayer.prototype = {
    _m_PlayerElement: null,
    
    get_id: function Coveo_CES_Web_Search_Scripts_Controls_WindowsMediaPlayer$get_id() {
        /// <value type="String"></value>
        return 'coveoMediaPlayer';
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_WindowsMediaPlayer$tearDown() {
        if (!ss.isNullOrUndefined(this._m_PlayerElement)) {
            this._getPlayerElement().close();
        }
        this._m_PlayerElement = null;
    },
    
    play: function Coveo_CES_Web_Search_Scripts_Controls_WindowsMediaPlayer$play() {
        this._getControlElement().play();
    },
    
    pause: function Coveo_CES_Web_Search_Scripts_Controls_WindowsMediaPlayer$pause() {
        this._getControlElement().pause();
    },
    
    stop: function Coveo_CES_Web_Search_Scripts_Controls_WindowsMediaPlayer$stop() {
        this._getControlElement().stop();
    },
    
    getPosition: function Coveo_CES_Web_Search_Scripts_Controls_WindowsMediaPlayer$getPosition() {
        /// <returns type="Number"></returns>
        return parseFloat(this._getControlElement().currentPosition.toString());
    },
    
    setPosition: function Coveo_CES_Web_Search_Scripts_Controls_WindowsMediaPlayer$setPosition(p_Position) {
        /// <param name="p_Position" type="Number">
        /// </param>
        this._getControlElement().currentPosition = p_Position;
    },
    
    getState: function Coveo_CES_Web_Search_Scripts_Controls_WindowsMediaPlayer$getState() {
        /// <returns type="Coveo.CES.Web.Search.Scripts.Controls.StateEnum"></returns>
        switch (this._getPlayerElement().playState.toString()) {
            case '1':
                return 2;
            case '2':
                return 3;
            case '3':
                return 1;
            case '6':
                return 4;
            case '8':
                return 5;
            case '10':
                return 0;
            default:
                return 2;
        }
    },
    
    getStatus: function Coveo_CES_Web_Search_Scripts_Controls_WindowsMediaPlayer$getStatus() {
        /// <returns type="String"></returns>
        return this._getPlayerElement().status.toString();
    },
    
    createPlayerElement: function Coveo_CES_Web_Search_Scripts_Controls_WindowsMediaPlayer$createPlayerElement(p_Uri, p_Height, p_Width) {
        /// <param name="p_Uri" type="String">
        /// </param>
        /// <param name="p_Height" type="String">
        /// </param>
        /// <param name="p_Width" type="String">
        /// </param>
        /// <returns type="Object" domElement="true"></returns>
        var elem = document.createElement('object');
        elem.setAttribute('classid', 'CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6');
        elem.setAttribute('stretchToFit', true);
        elem.setAttribute('windowlessVideo', true);
        elem.setAttribute('uiMode', 'none');
        elem.setAttribute('URL', p_Uri);
        elem.style.width = p_Width;
        elem.style.height = p_Height;
        return elem;
    },
    
    createPlayerString: function Coveo_CES_Web_Search_Scripts_Controls_WindowsMediaPlayer$createPlayerString(p_Uri, p_Height, p_Width) {
        /// <param name="p_Uri" type="String">
        /// </param>
        /// <param name="p_Height" type="String">
        /// </param>
        /// <param name="p_Width" type="String">
        /// </param>
        /// <returns type="String"></returns>
        var sb = new ss.StringBuilder();
        sb.append('<object ID="' + this.get_id() + '" classid="' + 'CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6' + '" style="height:' + p_Height + '; width:' + p_Width + '" >');
        sb.append('<param name="URL" value="' + p_Uri + '" >');
        sb.append('<param name="stretchToFit" value="true"/>');
        sb.append('<param name="windowlessVideo" value="true"/>');
        sb.append('<param name="autostart" value="true"/>');
        sb.append('<param name="uiMode" value="none"/>');
        sb.append('</object>');
        return sb.toString();
    },
    
    isReady: function Coveo_CES_Web_Search_Scripts_Controls_WindowsMediaPlayer$isReady() {
        /// <returns type="Boolean"></returns>
        return !ss.isNullOrUndefined(this._getControlElement());
    },
    
    _getPlayerElement: function Coveo_CES_Web_Search_Scripts_Controls_WindowsMediaPlayer$_getPlayerElement() {
        /// <summary>
        /// Gets the DOM Element element used to interact with Windows Media Player.
        /// </summary>
        /// <returns type="Object" domElement="true"></returns>
        try {
            if (ss.isNullOrUndefined(this._m_PlayerElement)) {
                this._m_PlayerElement = document.getElementById(this.get_id());
            }
            return this._m_PlayerElement.object;
        }
        catch ($e1) {
            return null;
        }
    },
    
    _getControlElement: function Coveo_CES_Web_Search_Scripts_Controls_WindowsMediaPlayer$_getControlElement() {
        /// <summary>
        /// Gets the DOM Element element used to interact with Windows Media Player's controls.
        /// </summary>
        /// <returns type="Object" domElement="true"></returns>
        try {
            return this._getPlayerElement().controls;
        }
        catch ($e1) {
            return null;
        }
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls._resultSidePanelHotSpotStateBeforeShowingPopup

Coveo.CES.Web.Search.Scripts.Controls._resultSidePanelHotSpotStateBeforeShowingPopup = function Coveo_CES_Web_Search_Scripts_Controls__resultSidePanelHotSpotStateBeforeShowingPopup() {
    /// <summary>
    /// Holds state to restore when the popup is closed.
    /// </summary>
    /// <field name="m_OriginalDocumentOverflow" type="String">
    /// </field>
    /// <field name="m_OriginalScrollPos" type="Coveo.CNL.Web.Scripts.ElementSize">
    /// </field>
    /// <field name="m_OriginalDocumentWidth" type="String">
    /// </field>
    /// <field name="m_OriginalDocumentHeight" type="String">
    /// </field>
    /// <field name="m_WindowSize" type="Coveo.CNL.Web.Scripts.ElementSize">
    /// </field>
}
Coveo.CES.Web.Search.Scripts.Controls._resultSidePanelHotSpotStateBeforeShowingPopup.prototype = {
    m_OriginalDocumentOverflow: null,
    m_OriginalScrollPos: null,
    m_OriginalDocumentWidth: null,
    m_OriginalDocumentHeight: null,
    m_WindowSize: null
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls._resultSidePanelHotSpotMouseState

Coveo.CES.Web.Search.Scripts.Controls._resultSidePanelHotSpotMouseState = function Coveo_CES_Web_Search_Scripts_Controls__resultSidePanelHotSpotMouseState() {
    /// <summary>
    /// Holds the mouse state.
    /// </summary>
    /// <field name="biG_COORDINATE" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="m_LastMouseClickTimeStamp" type="Date">
    /// </field>
    /// <field name="m_LastResultMouseMoveTimeStamp" type="Date">
    /// </field>
    /// <field name="m_LastMouseX" type="Number" integer="true">
    /// </field>
    /// <field name="m_LastMouseY" type="Number" integer="true">
    /// </field>
    /// <field name="m_LastHotSpotLeft" type="Number" integer="true">
    /// </field>
    /// <field name="m_LastPopupTop" type="Number" integer="true">
    /// </field>
    this.m_LastMouseClickTimeStamp = Date.get_now();
    this.m_LastResultMouseMoveTimeStamp = Date.get_now();
    this.m_LastHotSpotLeft = 3000000;
    this.m_LastPopupTop = 3000000;
}
Coveo.CES.Web.Search.Scripts.Controls._resultSidePanelHotSpotMouseState.prototype = {
    m_LastMouseX: 0,
    m_LastMouseY: 0
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript

Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript = function Coveo_CES_Web_Search_Scripts_Controls_ResultSidePanelHotSpotScript() {
    /// <summary>
    /// Client side code for the ResultSidePanelHotSpot control.
    /// </summary>
    /// <field name="_dwelL_AND_LEAVE_DELAY$2" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_quicK_TIMER_DELAY_MS$2" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_normaL_TIMER_DELAY_MS$2" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_margiN_BEFORE_CLOSING_POPUP$2" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_s_Instances$2" type="Array" static="true">
    /// </field>
    /// <field name="_s_CurrentlyShownInPopup$2" type="Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript" static="true">
    /// </field>
    /// <field name="_s_CurrentlyHovered$2" type="Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript" static="true">
    /// </field>
    /// <field name="_s_PopupMouseCapture$2" type="Coveo.CNL.Web.Scripts.MouseCapture" static="true">
    /// </field>
    /// <field name="_s_HeaderAndBodyTimerDefaultMillis$2" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_s_SidePopupElemBeforeAsyncCall$2" type="Object" domElement="true" static="true">
    /// </field>
    /// <field name="_s_MoveResizePopupTimer$2" type="Coveo.CNL.Web.Scripts.Timeout" static="true">
    /// </field>
    /// <field name="_s_MouseState$2" type="Coveo.CES.Web.Search.Scripts.Controls._resultSidePanelHotSpotMouseState" static="true">
    /// </field>
    /// <field name="_s_StateBeforeShowingPopup$2" type="Coveo.CES.Web.Search.Scripts.Controls._resultSidePanelHotSpotStateBeforeShowingPopup" static="true">
    /// </field>
    /// <field name="_m_HotSpotElem" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_PopupParentElem" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_MouseMoveResultEvent" type="Function">
    /// </field>
    /// <field name="_m_OnDwellResultEvent" type="Coveo.CNL.Web.Scripts.OnDwellEvent">
    /// </field>
    /// <field name="_m_OnDwellHotSpotEvent" type="Coveo.CNL.Web.Scripts.OnDwellEvent">
    /// </field>
    /// <field name="_m_OnLeaveMany" type="Coveo.CNL.Web.Scripts.OnLeaveManyEvent">
    /// </field>
    /// <field name="_m_OnFocusEvent" type="Function">
    /// </field>
    /// <field name="_m_OnBlurEvent" type="Function">
    /// </field>
    /// <field name="m_ResultElem" type="Object" domElement="true">
    /// The element for the search result (set by the AJAX framework).
    /// </field>
    /// <field name="m_SidePopupElemID" type="String">
    /// The ID of the popup element (set by the AJAX framework).
    /// (Cannot be of type Element, because the popup is deleted and re-created at each AJAX call.)
    /// </field>
    /// <field name="m_UnhoveredCssClass" type="String">
    /// The name of the CSS class for the hot spot element when unhovered (set by the AJAX framework).
    /// </field>
    /// <field name="m_HoveredCssClass" type="String">
    /// The name of the CSS class for the hot spot element when hovered (set by the AJAX framework).
    /// </field>
    /// <field name="m_ToModalBoxCssClass" type="String">
    /// The name of the CSS class for the hot spot element when not enough space to show the popup (set by the AJAX framework).
    /// </field>
    /// <field name="m_PopupTopID" type="String">
    /// The reference element the popup should align its top with (set by the AJAX framework).
    /// </field>
    /// <field name="m_PopupMinWidth" type="Number" integer="true">
    /// Minimum width necessary in the browser to allow showing the popup (set by the AJAX framework).
    /// </field>
    /// <field name="m_PopupMinHeight" type="Number" integer="true">
    /// Minimum height necessary in the browser to allow showing the popup (set by the AJAX framework).
    /// </field>
    /// <field name="m_PopupHorzMargin" type="Number" integer="true">
    /// Horizontal size adjustment (because borders and padding specified in the template might
    /// not be taken into consideration in children's size computed by the browsers).
    /// </field>
    /// <field name="m_PopupVertMargin" type="Number" integer="true">
    /// Vertical size adjustment (because borders and padding specified in the template might
    /// not be taken into consideration in children's size computed by the browsers).
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._hidePopup = function Coveo_CES_Web_Search_Scripts_Controls_ResultSidePanelHotSpotScript$_hidePopup() {
    /// <summary>
    /// Close the popup and release its resources.
    /// </summary>
    if (Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_CurrentlyShownInPopup$2 != null) {
        Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_CurrentlyShownInPopup$2._m_PopupParentElem.style.display = 'none';
        Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_CurrentlyShownInPopup$2 = null;
    }
    if (Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_StateBeforeShowingPopup$2 != null) {
        var docElem = ((Coveo.CNL.Web.Scripts.BrowserHelper.get_standardMode()) ? document.documentElement : document.body);
        docElem.style.overflow = Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_StateBeforeShowingPopup$2.m_OriginalDocumentOverflow;
        document.documentElement.scrollLeft = Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_StateBeforeShowingPopup$2.m_OriginalScrollPos.width;
        document.documentElement.scrollTop = Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_StateBeforeShowingPopup$2.m_OriginalScrollPos.height;
        if (Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_StateBeforeShowingPopup$2.m_OriginalDocumentWidth != null) {
            document.documentElement.style.width = Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_StateBeforeShowingPopup$2.m_OriginalDocumentWidth;
            document.documentElement.style.height = Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_StateBeforeShowingPopup$2.m_OriginalDocumentHeight;
        }
        Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_StateBeforeShowingPopup$2 = null;
    }
    if (Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_MoveResizePopupTimer$2 != null) {
        Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_MoveResizePopupTimer$2.cancel();
        Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_MoveResizePopupTimer$2 = null;
    }
}
Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._switchToModalBox = function Coveo_CES_Web_Search_Scripts_Controls_ResultSidePanelHotSpotScript$_switchToModalBox() {
    /// <summary>
    /// Close the popup and open the quick view modal box instead.
    /// </summary>
    if (Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_CurrentlyShownInPopup$2 != null) {
        var curHotSpot = Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_CurrentlyShownInPopup$2;
        Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._hidePopup();
        curHotSpot._hideHotSpot();
        curHotSpot.showQuickViewModalBox();
    }
}
Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._popupMouseCapture_MouseMove$2 = function Coveo_CES_Web_Search_Scripts_Controls_ResultSidePanelHotSpotScript$_popupMouseCapture_MouseMove$2() {
    if (Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_CurrentlyShownInPopup$2 != null && Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_StateBeforeShowingPopup$2 != null) {
        Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_MouseState$2.m_LastMouseX = window.event.clientX;
        Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_MouseState$2.m_LastMouseY = window.event.clientY;
        Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_MouseState$2.m_LastHotSpotLeft = Coveo.CNL.Web.Scripts.DOMUtilities.getElementPosition(Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_CurrentlyShownInPopup$2._m_HotSpotElem).left - Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_StateBeforeShowingPopup$2.m_OriginalScrollPos.width;
        Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_MouseState$2.m_LastPopupTop = ((Coveo.CNL.Web.Scripts.BrowserHelper.get_standardMode() && !Coveo.CNL.Web.Scripts.BrowserHelper.get_isIE6()) ? Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_CurrentlyShownInPopup$2._m_PopupParentElem.offsetTop : 0);
        if (Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_MouseState$2.m_LastMouseX < Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_MouseState$2.m_LastHotSpotLeft - 20 || Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_MouseState$2.m_LastMouseY < Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_MouseState$2.m_LastPopupTop) {
            if (Date.get_now().getTime() - Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_MouseState$2.m_LastResultMouseMoveTimeStamp.getTime() > 500) {
                Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_CurrentlyShownInPopup$2._hideHotSpot();
            }
            Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._hidePopup();
        }
    }
    else {
        Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_MouseState$2.m_LastMouseX = window.event.clientX;
        Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_MouseState$2.m_LastMouseY = window.event.clientY;
        Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_MouseState$2.m_LastHotSpotLeft = 3000000;
        Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_MouseState$2.m_LastPopupTop = 3000000;
    }
}
Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._popupMouseCapture_MouseDown$2 = function Coveo_CES_Web_Search_Scripts_Controls_ResultSidePanelHotSpotScript$_popupMouseCapture_MouseDown$2() {
    Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_MouseState$2.m_LastMouseClickTimeStamp = Date.get_now();
}
Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._moveResizePopupTimer_Tick$2 = function Coveo_CES_Web_Search_Scripts_Controls_ResultSidePanelHotSpotScript$_moveResizePopupTimer_Tick$2(arg) {
    /// <summary>
    /// Callback of the timer for moving and resizing the popup.
    /// This timer is also responsible of processing the end of an async call.
    /// </summary>
    /// <param name="arg" type="Object">
    /// </param>
    var timerDelayMillis = 500;
    if (Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_SidePopupElemBeforeAsyncCall$2 != null) {
        var currentSidePopupElem = Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_CurrentlyShownInPopup$2._getSidePopupElem();
        if (currentSidePopupElem !== Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_SidePopupElemBeforeAsyncCall$2) {
            Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_SidePopupElemBeforeAsyncCall$2 = null;
            Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_CurrentlyShownInPopup$2._m_PopupParentElem.style.display = 'block';
            Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_CurrentlyShownInPopup$2._m_PopupParentElem.style.zIndex = Coveo.CNL.Web.Scripts.DOMUtilities.getNextHighestZindex();
            Coveo.CNL.Web.Scripts.DOMUtilities.s_HeaderAndBodyTimerMillis = Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_HeaderAndBodyTimerDefaultMillis$2;
            if (Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_StateBeforeShowingPopup$2 == null) {
                var windowSizeBefore = Coveo.CNL.Web.Scripts.DOMUtilities.getWindowSize();
                var docElem = ((Coveo.CNL.Web.Scripts.BrowserHelper.get_standardMode()) ? document.documentElement : document.body);
                Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_StateBeforeShowingPopup$2 = new Coveo.CES.Web.Search.Scripts.Controls._resultSidePanelHotSpotStateBeforeShowingPopup();
                Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_StateBeforeShowingPopup$2.m_OriginalScrollPos = Coveo.CNL.Web.Scripts.DOMUtilities.getScrollingAmount();
                Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_StateBeforeShowingPopup$2.m_OriginalDocumentOverflow = docElem.style.overflow;
                docElem.style.overflow = 'hidden';
                docElem.scrollLeft = Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_StateBeforeShowingPopup$2.m_OriginalScrollPos.width;
                docElem.scrollTop = Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_StateBeforeShowingPopup$2.m_OriginalScrollPos.height;
                Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_StateBeforeShowingPopup$2.m_WindowSize = Coveo.CNL.Web.Scripts.DOMUtilities.getWindowSize();
                if (Coveo.CNL.Web.Scripts.BrowserHelper.get_standardMode() && !Coveo.CNL.Web.Scripts.BrowserHelper.get_isIE6()) {
                    Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_StateBeforeShowingPopup$2.m_OriginalDocumentWidth = document.documentElement.style.width;
                    Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_StateBeforeShowingPopup$2.m_OriginalDocumentHeight = document.documentElement.style.height;
                    Coveo.CNL.Web.Scripts.DOMUtilities.setElementSize(document.documentElement, windowSizeBefore);
                }
            }
        }
        else {
            timerDelayMillis = 10;
        }
    }
    if (timerDelayMillis === 500) {
        Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_CurrentlyShownInPopup$2._moveResizePopup(false);
    }
    if (Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_MoveResizePopupTimer$2 != null) {
        Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_MoveResizePopupTimer$2 = new Coveo.CNL.Web.Scripts.Timeout(Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._moveResizePopupTimer_Tick$2, null, timerDelayMillis);
    }
}
Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript.prototype = {
    _m_HotSpotElem: null,
    _m_PopupParentElem: null,
    _m_MouseMoveResultEvent: null,
    _m_OnDwellResultEvent: null,
    _m_OnDwellHotSpotEvent: null,
    _m_OnLeaveMany: null,
    _m_OnFocusEvent: null,
    _m_OnBlurEvent: null,
    m_ResultElem: null,
    m_SidePopupElemID: null,
    m_UnhoveredCssClass: null,
    m_HoveredCssClass: null,
    m_ToModalBoxCssClass: null,
    m_PopupTopID: null,
    m_PopupMinWidth: 0,
    m_PopupMinHeight: 0,
    m_PopupHorzMargin: 0,
    m_PopupVertMargin: 0,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_ResultSidePanelHotSpotScript$initialize() {
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_ResultElem);
        Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(this.m_SidePopupElemID);
        Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(this.m_UnhoveredCssClass);
        Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(this.m_HoveredCssClass);
        Coveo.CNL.Web.Scripts.CNLAssert.notEmpty(this.m_ToModalBoxCssClass);
        if (!Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_Instances$2.length) {
            Coveo.CNL.Web.Scripts.CNLAssert.isNull(Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_SidePopupElemBeforeAsyncCall$2);
            Coveo.CNL.Web.Scripts.CNLAssert.isNull(Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_CurrentlyShownInPopup$2);
            Coveo.CNL.Web.Scripts.CNLAssert.isNull(Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_CurrentlyHovered$2);
            Coveo.CNL.Web.Scripts.CNLAssert.isNull(Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_PopupMouseCapture$2);
            Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_PopupMouseCapture$2 = new Coveo.CNL.Web.Scripts.MouseCapture(Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._popupMouseCapture_MouseMove$2, Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._popupMouseCapture_MouseDown$2, null);
            Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_PopupMouseCapture$2.set_cancelBubble(false);
        }
        ArrayPrototype_add(Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_Instances$2, this);
        Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript.callBaseMethod(this, 'initialize');
        this._m_HotSpotElem = this.m_ResultElem.children[0].children[0].children[1];
        this._m_PopupParentElem = this._getSidePopupElem().parentNode;
        this._m_OnDwellResultEvent = new Coveo.CNL.Web.Scripts.OnDwellEvent(this.m_ResultElem, 100, ss.Delegate.create(this, this._result_OnDwell$2));
        this._m_OnDwellHotSpotEvent = new Coveo.CNL.Web.Scripts.OnDwellEvent(this._m_HotSpotElem, 100, ss.Delegate.create(this, this._hotSpot_OnDwell$2));
        this._m_OnLeaveMany = new Coveo.CNL.Web.Scripts.OnLeaveManyEvent([ this.m_ResultElem ], 100, ss.Delegate.create(this, this._result_OnLeaveMany$2));
        this.addOnClickAttribute(this._m_HotSpotElem, ss.Delegate.create(this, this._hotSpot_OnClick$2), true);
        this._m_MouseMoveResultEvent = ss.Delegate.create(this, this._result_OnMouseMove$2);
        this.m_ResultElem.attachEvent('onmousemove', this._m_MouseMoveResultEvent);
        this._m_OnFocusEvent = ss.Delegate.create(this, this._hotSpot_OnFocus$2);
        this._m_HotSpotElem.attachEvent('onfocus', this._m_OnFocusEvent);
        this._m_OnBlurEvent = ss.Delegate.create(this, this._hotSpot_OnBlur$2);
        this._m_HotSpotElem.attachEvent('onblur', this._m_OnBlurEvent);
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_ResultSidePanelHotSpotScript$tearDown() {
        if (this._m_OnDwellResultEvent != null) {
            this._m_OnDwellResultEvent.dispose();
        }
        if (this._m_OnDwellHotSpotEvent != null) {
            this._m_OnDwellHotSpotEvent.dispose();
        }
        if (this._m_OnLeaveMany != null) {
            this._m_OnLeaveMany.dispose();
        }
        if (this._m_MouseMoveResultEvent != null) {
            this.m_ResultElem.detachEvent('onmousemove', this._m_MouseMoveResultEvent);
        }
        if (this._m_OnFocusEvent != null) {
            this._m_HotSpotElem.detachEvent('onfocus', this._m_OnFocusEvent);
        }
        if (this._m_OnBlurEvent != null) {
            this._m_HotSpotElem.detachEvent('onblur', this._m_OnBlurEvent);
        }
        Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript.callBaseMethod(this, 'tearDown');
        ArrayPrototype_remove(Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_Instances$2, this);
        if (!Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_Instances$2.length) {
            Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._hidePopup();
            Coveo.CNL.Web.Scripts.DOMUtilities.s_HeaderAndBodyTimerMillis = Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_HeaderAndBodyTimerDefaultMillis$2;
            if (Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_PopupMouseCapture$2 != null) {
                Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_PopupMouseCapture$2.dispose();
                Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_PopupMouseCapture$2 = null;
            }
            Coveo.CNL.Web.Scripts.CNLAssert.isNull(Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_CurrentlyShownInPopup$2);
            Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_SidePopupElemBeforeAsyncCall$2 = null;
            Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_CurrentlyHovered$2 = null;
        }
    },
    
    _getSidePopupElem: function Coveo_CES_Web_Search_Scripts_Controls_ResultSidePanelHotSpotScript$_getSidePopupElem() {
        /// <summary>
        /// Retrieve the popup element in the DOM.
        /// </summary>
        /// <returns type="Object" domElement="true"></returns>
        return document.getElementById(this.m_SidePopupElemID);
    },
    
    _hideHotSpot: function Coveo_CES_Web_Search_Scripts_Controls_ResultSidePanelHotSpotScript$_hideHotSpot() {
        /// <summary>
        /// Hide the result's hot spot.
        /// (Not private because of a Script#'s limitation.)
        /// </summary>
        this._m_HotSpotElem.className = this.m_UnhoveredCssClass;
    },
    
    _moveResizePopup: function Coveo_CES_Web_Search_Scripts_Controls_ResultSidePanelHotSpotScript$_moveResizePopup(p_CheckEnoughSpaceOnly) {
        /// <summary>
        /// Move and resize the popup.
        /// </summary>
        /// <param name="p_CheckEnoughSpaceOnly" type="Boolean">
        /// Whether to only check if there is enough space.
        /// </param>
        /// <returns type="Boolean"></returns>
        var scrollPos = Coveo.CNL.Web.Scripts.DOMUtilities.getScrollingAmount();
        var popupTop = 0;
        if (!String.isNullOrEmpty(this.m_PopupTopID)) {
            var popupTopElem = document.getElementById(this.m_PopupTopID);
            var scrollVertPos = scrollPos.height;
            popupTop = Math.max(Coveo.CNL.Web.Scripts.DOMUtilities.getElementPosition(popupTopElem).top - scrollVertPos, 0);
        }
        var windowSize = Coveo.CNL.Web.Scripts.DOMUtilities.getWindowSize();
        var scrollHorzPos = scrollPos.width;
        var hotSpotRight = Coveo.CNL.Web.Scripts.DOMUtilities.getElementPosition(this._m_HotSpotElem).left + Coveo.CNL.Web.Scripts.DOMUtilities.getElementSize(this._m_HotSpotElem).width - scrollHorzPos - 2;
        var newWidth = Math.max(windowSize.width - hotSpotRight - this.m_PopupHorzMargin, 64);
        var newHeight = Math.max(windowSize.height - popupTop - this.m_PopupVertMargin, 64);
        var retEnoughSpace = (newWidth >= this.m_PopupMinWidth && newHeight >= this.m_PopupMinHeight);
        if (!p_CheckEnoughSpaceOnly) {
            Coveo.CNL.Web.Scripts.CNLAssert.notNull(Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_StateBeforeShowingPopup$2);
            if (windowSize.width !== Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_StateBeforeShowingPopup$2.m_WindowSize.width || windowSize.height !== Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_StateBeforeShowingPopup$2.m_WindowSize.height) {
                Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._hidePopup();
            }
            else if (retEnoughSpace) {
                Coveo.CNL.Web.Scripts.DOMUtilities.setFixedPosition(this._m_PopupParentElem, hotSpotRight, popupTop);
                Coveo.CNL.Web.Scripts.DOMUtilities.setElementSize(this._m_PopupParentElem, new Coveo.CNL.Web.Scripts.ElementSize(newWidth, newHeight));
            }
        }
        return retEnoughSpace;
    },
    
    showSidePanel: function Coveo_CES_Web_Search_Scripts_Controls_ResultSidePanelHotSpotScript$showSidePanel() {
    },
    
    showQuickViewModalBox: function Coveo_CES_Web_Search_Scripts_Controls_ResultSidePanelHotSpotScript$showQuickViewModalBox() {
    },
    
    _result_OnMouseMove$2: function Coveo_CES_Web_Search_Scripts_Controls_ResultSidePanelHotSpotScript$_result_OnMouseMove$2() {
        Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_MouseState$2.m_LastResultMouseMoveTimeStamp = Date.get_now();
    },
    
    _result_OnDwell$2: function Coveo_CES_Web_Search_Scripts_Controls_ResultSidePanelHotSpotScript$_result_OnDwell$2() {
        if (Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_CurrentlyHovered$2 !== this && Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_CurrentlyHovered$2 != null) {
            Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_CurrentlyHovered$2._hideHotSpot();
        }
        this._m_HotSpotElem.className = ((this._moveResizePopup(true)) ? this.m_HoveredCssClass : this.m_ToModalBoxCssClass);
        Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_CurrentlyHovered$2 = this;
    },
    
    _hotSpot_OnDwell$2: function Coveo_CES_Web_Search_Scripts_Controls_ResultSidePanelHotSpotScript$_hotSpot_OnDwell$2() {
        if (Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_CurrentlyShownInPopup$2 !== this) {
            if (Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_MoveResizePopupTimer$2 != null) {
                Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_MoveResizePopupTimer$2.cancel();
                Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_MoveResizePopupTimer$2 = null;
            }
            if (this._moveResizePopup(true)) {
                Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_CurrentlyShownInPopup$2 = this;
                Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_HeaderAndBodyTimerDefaultMillis$2 = Coveo.CNL.Web.Scripts.DOMUtilities.s_HeaderAndBodyTimerMillis;
                Coveo.CNL.Web.Scripts.DOMUtilities.s_HeaderAndBodyTimerMillis = 10;
                Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_SidePopupElemBeforeAsyncCall$2 = this._getSidePopupElem();
                Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_MoveResizePopupTimer$2 = new Coveo.CNL.Web.Scripts.Timeout(Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._moveResizePopupTimer_Tick$2, null, 10);
                this.showSidePanel();
            }
        }
    },
    
    _hotSpot_OnClick$2: function Coveo_CES_Web_Search_Scripts_Controls_ResultSidePanelHotSpotScript$_hotSpot_OnClick$2() {
        if (Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_CurrentlyShownInPopup$2 == null) {
            Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._hidePopup();
            this._hideHotSpot();
            this.showQuickViewModalBox();
        }
    },
    
    _result_OnLeaveMany$2: function Coveo_CES_Web_Search_Scripts_Controls_ResultSidePanelHotSpotScript$_result_OnLeaveMany$2() {
        if (Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_CurrentlyHovered$2 === this && Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_CurrentlyHovered$2 !== Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_CurrentlyShownInPopup$2) {
            this._hideHotSpot();
            Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_CurrentlyHovered$2 = null;
        }
    },
    
    _hotSpot_OnFocus$2: function Coveo_CES_Web_Search_Scripts_Controls_ResultSidePanelHotSpotScript$_hotSpot_OnFocus$2() {
        this._result_OnDwell$2();
    },
    
    _hotSpot_OnBlur$2: function Coveo_CES_Web_Search_Scripts_Controls_ResultSidePanelHotSpotScript$_hotSpot_OnBlur$2() {
        if (Date.get_now().getTime() - Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_MouseState$2.m_LastMouseClickTimeStamp.getTime() > 500 && (Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_MouseState$2.m_LastMouseX < Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_MouseState$2.m_LastHotSpotLeft || Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_MouseState$2.m_LastMouseY < Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_MouseState$2.m_LastPopupTop) && (!Coveo.CNL.Web.Scripts.BrowserHelper.get_isIE() || !this._m_PopupParentElem.contains(document.activeElement))) {
            this._hideHotSpot();
        }
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.ResultImagePresenterScript

Coveo.CES.Web.Search.Scripts.Controls.ResultImagePresenterScript = function Coveo_CES_Web_Search_Scripts_Controls_ResultImagePresenterScript() {
    /// <summary>
    /// Client side code for the ResultImagePresenter control.
    /// </summary>
    /// <field name="_m_OnDwellEvent$1" type="Coveo.CNL.Web.Scripts.OnDwellEvent">
    /// </field>
    /// <field name="_m_OnLeaveMany$1" type="Coveo.CNL.Web.Scripts.OnLeaveManyEvent">
    /// </field>
    /// <field name="_m_PopupShowing$1" type="Boolean">
    /// </field>
    /// <field name="m_Image" type="Object" domElement="true">
    /// The element for the image.
    /// </field>
    /// <field name="m_Popup" type="Object" domElement="true">
    /// The element for the popup.
    /// </field>
    /// <field name="m_ImageInPopup" type="Object" domElement="true">
    /// The element for the image within the popup.
    /// </field>
    /// <field name="m_Detail" type="Object" domElement="true">
    /// The element containing the detail.
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.ResultImagePresenterScript.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.ResultImagePresenterScript.prototype = {
    _m_OnDwellEvent$1: null,
    _m_OnLeaveMany$1: null,
    _m_PopupShowing$1: false,
    m_Image: null,
    m_Popup: null,
    m_ImageInPopup: null,
    m_Detail: null,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_ResultImagePresenterScript$initialize() {
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_Image);
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_Popup);
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_ImageInPopup);
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_Detail);
        this._m_OnDwellEvent$1 = new Coveo.CNL.Web.Scripts.OnDwellEvent(this.m_Image, 200, ss.Delegate.create(this, this._image_OnDwell$1));
        this._m_OnLeaveMany$1 = new Coveo.CNL.Web.Scripts.OnLeaveManyEvent([ this.m_Image, this.m_Popup ], 200, ss.Delegate.create(this, this._popup_OnLeaveMany$1));
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_ResultImagePresenterScript$tearDown() {
        if (this._m_OnDwellEvent$1 != null) {
            this._m_OnDwellEvent$1.dispose();
        }
        if (this._m_OnLeaveMany$1 != null) {
            this._m_OnLeaveMany$1.dispose();
        }
        if (this.m_Popup != null) {
            this.m_Popup.parentNode.removeChild(this.m_Popup);
        }
    },
    
    _image_OnDwell$1: function Coveo_CES_Web_Search_Scripts_Controls_ResultImagePresenterScript$_image_OnDwell$1() {
        if (!this._m_PopupShowing$1) {
            this.m_Popup.style.visibility = 'hidden';
            this.m_Popup.style.display = 'block';
            var pos = {};
            pos['of'] = this.m_Image;
            pos['my'] = 'center center';
            pos['at'] = 'center center';
            pos['offset'] = '1 1';
            pos['collision'] = 'fit fit';
            this.m_Detail.style.display = 'none';
            this.m_ImageInPopup.style.width = '300px';
            $(this.m_Popup).position(pos);
            this.m_Detail.style.display = 'block';
            var finalPopupPosition = Coveo.CNL.Web.Scripts.DOMUtilities.getElementPosition(this.m_Popup);
            this.m_Detail.style.display = 'none';
            var imageSize = Coveo.CNL.Web.Scripts.DOMUtilities.getElementSize(this.m_Image);
            this.m_ImageInPopup.style.width = imageSize.width + 'px';
            $(this.m_Popup).position(pos);
            this.m_Detail.style.display = 'block';
            var popupAnimProperties = {};
            popupAnimProperties['left'] = finalPopupPosition.left + 'px';
            popupAnimProperties['top'] = finalPopupPosition.top + 'px';
            $(this.m_Popup).animate(popupAnimProperties, 100);
            var imageAnimProperties = {};
            imageAnimProperties['width'] = '300px';
            $(this.m_ImageInPopup).animate(imageAnimProperties, 100);
            this.m_Popup.style.visibility = 'visible';
            this._m_PopupShowing$1 = true;
        }
    },
    
    _popup_OnLeaveMany$1: function Coveo_CES_Web_Search_Scripts_Controls_ResultImagePresenterScript$_popup_OnLeaveMany$1() {
        if (this._m_PopupShowing$1) {
            this.m_Popup.style.display = 'none';
            this._m_PopupShowing$1 = false;
        }
    }
}


////////////////////////////////////////////////////////////////////////////////
// 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 = 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) {
            ArrayPrototype_add(Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript._s_RunningControls$1, this);
            this.m_Image.attachEvent('onmouseover', ss.Delegate.create(this, this._image_OnMouseOver$1));
            this.m_Image.attachEvent('onmouseout', ss.Delegate.create(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(ArrayPrototype_contains(Coveo.CES.Web.Search.Scripts.Controls.ResultPresenceIndicatorScript._s_RunningControls$1, this));
            ArrayPrototype_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.replaceAll('.unknown', '.online');
                break;
            case 1:
                src = this._m_UnknownImageUrl$1.replaceAll('.unknown', '.offline');
                break;
            case 2:
                src = this._m_UnknownImageUrl$1.replaceAll('.unknown', '.away');
                break;
            case 3:
                src = this._m_UnknownImageUrl$1.replaceAll('.unknown', '.busy');
                break;
            case 4:
                src = this._m_UnknownImageUrl$1.replaceAll('.unknown', '.away');
                break;
            case 5:
                src = this._m_UnknownImageUrl$1.replaceAll('.unknown', '.busy');
                break;
            case 6:
                src = this._m_UnknownImageUrl$1.replaceAll('.unknown', '.away');
                break;
            case 7:
                src = this._m_UnknownImageUrl$1.replaceAll('.unknown', '.busy');
                break;
            case 8:
                src = this._m_UnknownImageUrl$1.replaceAll('.unknown', '.busy');
                break;
            case 9:
                src = this._m_UnknownImageUrl$1.replaceAll('.unknown', '.dnd');
                break;
            case 15:
                src = this._m_UnknownImageUrl$1.replaceAll('.unknown', '.busy');
                break;
            case 16:
                src = this._m_UnknownImageUrl$1.replaceAll('.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="Function">
    /// </field>
    /// <field name="_m_MouseWheelEventHandler$1" type="Function">
    /// </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 = ss.Delegate.create(this, this._term_MouseDown$1);
        this._m_MouseWheelEventHandler$1 = ss.Delegate.create(this, this._term_MouseWheel$1);
        this.m_Term.attachEvent('onmousedown', this._m_MouseDownEventHandler$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('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 Player class.
    /// </summary>
    /// <field name="_m_LastPositions$1" type="Array">
    /// </field>
    /// <field name="_m_LastTerm$1" type="Number" integer="true">
    /// </field>
    /// <field name="_m_LastOccurence$1" type="Number" integer="true">
    /// </field>
    /// <field name="_m_LastCurrentWord$1" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_Positions$1" type="Array">
    /// </field>
    /// <field name="_player$1" type="Coveo.CES.Web.Search.Scripts.Controls.IMediaPlayer">
    /// </field>
    /// <field name="_m_StartCount$1" type="Number" integer="true">
    /// </field>
    /// <field name="_m_SynchronizeTimerId$1" type="Number" integer="true">
    /// </field>
    /// <field name="_m_PlayClickEventHandler$1" type="Function">
    /// </field>
    /// <field name="_m_PauseClickEventHandler$1" type="Function">
    /// </field>
    /// <field name="_m_TimeLineClickEventHandler$1" type="Function">
    /// </field>
    /// <field name="_m_TranscriptLinkClickEventHandler$1" type="Function">
    /// </field>
    /// <field name="_m_UtterancesLinkClickEventHandler$1" type="Function">
    /// </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_Length" type="Number" integer="true">
    /// The length of the stream to play.
    /// </field>
    /// <field name="m_HeadStart" type="Number" integer="true">
    /// The initial head start for this media.
    /// </field>
    /// <field name="m_XAPUrl" type="String">
    /// The url of the media player xap file.
    /// </field>
    /// <field name="m_Video" type="Boolean">
    /// Whether there is video in this media or only audio.
    /// </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>
    /// <field name="m_UtterancesLink" type="Object" domElement="true">
    /// The DOM element for the utterances link.
    /// </field>
    /// <field name="m_TranscriptLink" type="Object" domElement="true">
    /// The DOM element for the transcript link.
    /// </field>
    /// <field name="m_Utterances" type="Object" domElement="true">
    /// The DOM element for the utterances panel.
    /// </field>
    /// <field name="m_Transcript" type="Object" domElement="true">
    /// The DOM element for the transcript panel.
    /// </field>
    this._m_SynchronizeTimerId$1 = -1;
    Coveo.CES.Web.Search.Scripts.Controls.ResultPlayerScript.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.ResultPlayerScript.prototype = {
    _m_LastPositions$1: null,
    _m_LastTerm$1: 0,
    _m_LastOccurence$1: 0,
    _m_LastCurrentWord$1: null,
    _m_Positions$1: null,
    _player$1: null,
    _m_StartCount$1: 0,
    _m_PlayClickEventHandler$1: null,
    _m_PauseClickEventHandler$1: null,
    _m_TimeLineClickEventHandler$1: null,
    _m_TranscriptLinkClickEventHandler$1: null,
    _m_UtterancesLinkClickEventHandler$1: null,
    m_UtteranceUri: null,
    m_UtteranceSelectedUri: null,
    m_Length: 0,
    m_HeadStart: 0,
    m_XAPUrl: null,
    m_Video: false,
    m_Player: null,
    m_TimeLine: null,
    m_Play: null,
    m_Pause: null,
    m_Slider: null,
    m_Filler: null,
    m_Status: null,
    m_UtterancesLink: null,
    m_TranscriptLink: null,
    m_Utterances: null,
    m_Transcript: null,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_ResultPlayerScript$initialize() {
        this._m_LastPositions$1 = [];
        this._m_LastTerm$1 = 0;
        this._m_LastOccurence$1 = 0;
        this._m_LastCurrentWord$1 = null;
        this._m_StartCount$1 = 0;
        this._m_PlayClickEventHandler$1 = ss.Delegate.create(this, this._play_OnClick$1);
        this._m_PauseClickEventHandler$1 = ss.Delegate.create(this, this._pause_OnClick$1);
        this._m_TimeLineClickEventHandler$1 = ss.Delegate.create(this, this._timeLine_OnClick$1);
        this._m_TranscriptLinkClickEventHandler$1 = ss.Delegate.create(this, this._transcriptLink_OnClick$1);
        this._m_UtterancesLinkClickEventHandler$1 = ss.Delegate.create(this, this._utterancesLink_OnClick$1);
        this.m_Play.attachEvent('onclick', this._m_PlayClickEventHandler$1);
        this.m_Pause.attachEvent('onclick', this._m_PauseClickEventHandler$1);
        this.m_TimeLine.attachEvent('onclick', this._m_TimeLineClickEventHandler$1);
        if (!ss.isNullOrUndefined(this.m_TranscriptLink) && !ss.isNullOrUndefined(this.m_UtterancesLink)) {
            this.m_TranscriptLink.attachEvent('onclick', this._m_TranscriptLinkClickEventHandler$1);
            this.m_UtterancesLink.attachEvent('onclick', this._m_UtterancesLinkClickEventHandler$1);
        }
        if (Coveo.CNL.Web.Scripts.BrowserHelper.get_isIE()) {
            this._player$1 = new Coveo.CES.Web.Search.Scripts.Controls.WindowsMediaPlayer();
        }
        else {
            this._player$1 = new Coveo.CES.Web.Search.Scripts.Controls.SilverlightMediaPlayer(this.m_XAPUrl);
        }
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_ResultPlayerScript$tearDown() {
        if (this._player$1.isReady()) {
            this._player$1.stop();
        }
        if (this._m_SynchronizeTimerId$1 !== -1) {
            window.clearTimeout(this._m_SynchronizeTimerId$1);
        }
        if (!ss.isNullOrUndefined(this.m_Play)) {
            this.m_Play.detachEvent('onclick', this._m_PlayClickEventHandler$1);
            this._m_PlayClickEventHandler$1 = null;
        }
        if (!ss.isNullOrUndefined(this.m_Pause)) {
            this.m_Pause.detachEvent('onclick', this._m_PauseClickEventHandler$1);
            this._m_PauseClickEventHandler$1 = null;
        }
        if (!ss.isNullOrUndefined(this.m_TimeLine)) {
            this.m_TimeLine.detachEvent('onclick', this._m_TimeLineClickEventHandler$1);
            this._m_TimeLineClickEventHandler$1 = null;
        }
        if (!ss.isNullOrUndefined(this.m_TranscriptLink)) {
            this.m_TranscriptLink.detachEvent('onclick', this._m_TranscriptLinkClickEventHandler$1);
            this._m_TranscriptLinkClickEventHandler$1 = null;
        }
        if (!ss.isNullOrUndefined(this.m_UtterancesLink)) {
            this.m_UtterancesLink.detachEvent('onclick', this._m_UtterancesLinkClickEventHandler$1);
            this._m_UtterancesLinkClickEventHandler$1 = null;
        }
        this.m_Filler = null;
        this._m_LastCurrentWord$1 = null;
        this._m_LastPositions$1 = null;
        this.m_Pause = null;
        this.m_Play = null;
        this.m_Player = null;
        this._m_Positions$1 = null;
        this.m_Slider = null;
        this.m_Status = null;
        this.m_TimeLine = null;
        this.m_Transcript = null;
        this.m_TranscriptLink = null;
        this.m_Utterances = null;
        this.m_UtterancesLink = null;
        this._player$1.tearDown();
        this._player$1 = null;
    },
    
    _utterancesLink_OnClick$1: function Coveo_CES_Web_Search_Scripts_Controls_ResultPlayerScript$_utterancesLink_OnClick$1() {
        this.showUtterances();
    },
    
    _transcriptLink_OnClick$1: function Coveo_CES_Web_Search_Scripts_Controls_ResultPlayerScript$_transcriptLink_OnClick$1() {
        this.showTranscript();
    },
    
    _timeLine_OnClick$1: function Coveo_CES_Web_Search_Scripts_Controls_ResultPlayerScript$_timeLine_OnClick$1() {
        var tlpos = Coveo.CNL.Web.Scripts.DOMUtilities.getElementPosition(this.m_TimeLine);
        var tlsize = Coveo.CNL.Web.Scripts.DOMUtilities.getElementSize(this.m_TimeLine);
        var x = parseInt(window.event.clientX.toString());
        var percent = (x - tlpos.left) / tlsize.width;
        this._jump$1(this.m_Length * percent);
    },
    
    _play_OnClick$1: function Coveo_CES_Web_Search_Scripts_Controls_ResultPlayerScript$_play_OnClick$1() {
        this._player$1.play();
        this._synchronize$1(false);
    },
    
    _pause_OnClick$1: function Coveo_CES_Web_Search_Scripts_Controls_ResultPlayerScript$_pause_OnClick$1() {
        this._player$1.pause();
        this._synchronize$1(false);
    },
    
    showUtterances: function Coveo_CES_Web_Search_Scripts_Controls_ResultPlayerScript$showUtterances() {
        /// <summary>
        /// Shows the utterances tab.
        /// </summary>
        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';
    },
    
    showTranscript: function Coveo_CES_Web_Search_Scripts_Controls_ResultPlayerScript$showTranscript() {
        /// <summary>
        /// Shows the transcript tab.
        /// </summary>
        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$1(false);
    },
    
    createMediaPlayer: function Coveo_CES_Web_Search_Scripts_Controls_ResultPlayerScript$createMediaPlayer(p_Uri, p_Start) {
        /// <summary>
        /// Creates the media player within the page.
        /// </summary>
        /// <param name="p_Uri" type="String">
        /// The uri to load within the media player.
        /// </param>
        /// <param name="p_Start" type="Number" integer="true">
        /// The position of the first utterance.
        /// </param>
        var height = (this.m_Video) ? this.m_Player.style.height : '0px';
        var width = (this.m_Video) ? this.m_Player.style.width : '0px';
        if (!Coveo.CNL.Web.Scripts.BrowserHelper.get_isFirefox()) {
            this.m_Player.innerHTML = this._player$1.createPlayerString(p_Uri, height, width);
        }
        else {
            this.m_Player.appendChild(this._player$1.createPlayerElement(p_Uri, height, width));
        }
        this.startPlayer(p_Start);
    },
    
    startPlayer: function Coveo_CES_Web_Search_Scripts_Controls_ResultPlayerScript$startPlayer(p_Start) {
        /// <summary>
        /// Try to start the player until it's ready.
        /// </summary>
        /// <param name="p_Start" type="Number" integer="true">
        /// The head start to give to the player.
        /// </param>
        if (this._player$1.isReady()) {
            this._jump$1(this._getHeadStart$1(p_Start));
            this._synchronize$1(true);
        }
        else {
            if (this._m_StartCount$1 < 50) {
                this._m_StartCount$1++;
                this._m_SynchronizeTimerId$1 = window.setTimeout(ss.Delegate.create(this, function() {
                    this.startPlayer(p_Start);
                }), 100);
            }
            else {
                alert('Unable to start the media player.');
            }
        }
    },
    
    addUtterance: function Coveo_CES_Web_Search_Scripts_Controls_ResultPlayerScript$addUtterance(p_Start, p_Percent, p_Html) {
        /// <summary>
        /// Adds an utterance to the various displays.
        /// </summary>
        /// <param name="p_Start" type="Number" integer="true">
        /// The start time of the utterance.
        /// </param>
        /// <param name="p_Percent" type="Number" integer="true">
        /// The position expressed as a percentage.
        /// </param>
        /// <param name="p_Html" type="String">
        /// The html for displaying info about the utterance.
        /// </param>
        var utelem = document.createElement('div');
        utelem.className = 'CesUnselectedMenuItem';
        utelem.style.cursor = 'pointer';
        utelem.innerHTML = p_Html;
        this.m_Utterances.appendChild(utelem);
        var tlpos = Coveo.CNL.Web.Scripts.DOMUtilities.getElementPosition(this.m_TimeLine);
        var tlsize = Coveo.CNL.Web.Scripts.DOMUtilities.getElementSize(this.m_TimeLine);
        var tlelem = document.createElement('img');
        tlelem.setAttribute('src', this.m_UtteranceUri);
        tlelem.style.position = 'absolute';
        tlelem.style.cursor = 'pointer';
        tlelem.style.zIndex = 800;
        this.m_TimeLine.appendChild(tlelem);
        Coveo.CNL.Web.Scripts.DOMUtilities.setElementPosition(tlelem, new Coveo.CNL.Web.Scripts.ElementPosition(tlpos.left + tlsize.width * p_Percent - 6, tlpos.top + 3));
        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);
        Coveo.CNL.Web.Scripts.DOMUtilities.positionElement(ttelem, tlelem, Coveo.CNL.Web.Scripts.PositionEnum.aboveLeft);
        ttelem.style.visibility = 'hidden';
        utelem.attachEvent('onmouseover', ss.Delegate.create(this, function() {
            utelem.className = 'CesSelectedMenuItem';
            tlelem.setAttribute('src', this.m_UtteranceSelectedUri);
        }));
        utelem.attachEvent('onmouseout', ss.Delegate.create(this, function() {
            utelem.className = 'CesUnselectedMenuItem';
            tlelem.setAttribute('src', this.m_UtteranceUri);
        }));
        utelem.attachEvent('onclick', ss.Delegate.create(this, function() {
            this._jump$1(this._getHeadStart$1(p_Start));
        }));
        tlelem.attachEvent('onmouseover', ss.Delegate.create(this, function() {
            utelem.style.backgroundColor = 'lightgrey';
            tlelem.setAttribute('src', this.m_UtteranceSelectedUri);
            ttelem.style.visibility = 'visible';
        }));
        tlelem.attachEvent('onmouseout', ss.Delegate.create(this, function() {
            utelem.style.backgroundColor = '';
            tlelem.setAttribute('src', this.m_UtteranceUri);
            ttelem.style.visibility = 'hidden';
        }));
    },
    
    _highlightNextOccurence$1: function Coveo_CES_Web_Search_Scripts_Controls_ResultPlayerScript$_highlightNextOccurence$1(p_Term) {
        /// <summary>
        /// Highlights the next occurence of a term.
        /// </summary>
        /// <param name="p_Term" type="Number" integer="true">
        /// The index of the term to highlight.
        /// </param>
        this.showTranscript();
        this._removeLastHighlight$1();
        var last = this._m_LastPositions$1[p_Term];
        if (ss.isUndefined(last)) {
            last = 0;
        }
        var current = last + 1;
        if (this._getTermPart$1(p_Term, current, 1) == null) {
            current = 1;
        }
        this._highlightTerm$1(p_Term, current);
        this._m_LastPositions$1[p_Term] = current;
    },
    
    _highlightPreviousOccurence$1: function Coveo_CES_Web_Search_Scripts_Controls_ResultPlayerScript$_highlightPreviousOccurence$1(p_Term) {
        /// <summary>
        /// Highlights the previous occurence of a term.
        /// </summary>
        /// <param name="p_Term" type="Number" integer="true">
        /// The index of the term to highlight.
        /// </param>
        this.showTranscript();
        this._removeLastHighlight$1();
        var last = this._m_LastPositions$1[p_Term];
        if (ss.isUndefined(last)) {
            last = 1;
        }
        var current = last - 1;
        if (this._getTermPart$1(p_Term, current, 1) == null) {
            current = 1;
            while (this._getTermPart$1(p_Term, current, 1) != null) {
                ++current;
            }
            --current;
        }
        this._highlightTerm$1(p_Term, current);
        this._m_LastPositions$1[p_Term] = current;
    },
    
    _jump$1: function Coveo_CES_Web_Search_Scripts_Controls_ResultPlayerScript$_jump$1(p_Position) {
        /// <summary>
        /// Jumps to a given position within the clip.
        /// </summary>
        /// <param name="p_Position" type="Number">
        /// The position to which to jump.
        /// </param>
        this._player$1.setPosition(p_Position);
        this._player$1.play();
    },
    
    _synchronize$1: function Coveo_CES_Web_Search_Scripts_Controls_ResultPlayerScript$_synchronize$1(p_Auto) {
        /// <summary>
        /// Synchronizes the currently highlighted word with the position of the player.
        /// </summary>
        /// <param name="p_Auto" type="Boolean">
        /// Whether the call comes from the timer.
        /// </param>
        if (!this._player$1.isReady()) {
            return;
        }
        var found = false;
        var up = this.m_Player.parentNode;
        while (up != null) {
            if (up.tagName === 'BODY') {
                found = true;
                break;
            }
            up = up.parentNode;
        }
        if (!found) {
            this.tearDown();
            return;
        }
        switch (this._player$1.getState()) {
            case 1:
                this.m_Play.style.display = 'none';
                this.m_Pause.style.display = 'inline';
                this.m_Status.innerHTML = '';
                break;
            case 4:
                this.m_Play.style.display = 'none';
                this.m_Pause.style.display = 'inline';
                this.m_Status.innerHTML = this._player$1.getStatus();
                break;
            default:
                this.m_Play.style.display = 'inline';
                this.m_Pause.style.display = 'none';
                this.m_Status.innerHTML = '';
                break;
        }
        var slsize = Coveo.CNL.Web.Scripts.DOMUtilities.getElementSize(this.m_Slider);
        var position = this._player$1.getPosition();
        var spos = this._getTimeLinePosition$1(position / this.m_Length);
        Coveo.CNL.Web.Scripts.DOMUtilities.setElementPosition(this.m_Slider, new Coveo.CNL.Web.Scripts.ElementPosition(spos.left - slsize.width / 2, spos.top - 8));
        var tlpos = Coveo.CNL.Web.Scripts.DOMUtilities.getElementPosition(this.m_TimeLine);
        var tlsize = Coveo.CNL.Web.Scripts.DOMUtilities.getElementSize(this.m_TimeLine);
        Coveo.CNL.Web.Scripts.DOMUtilities.setElementPosition(this.m_Filler, new Coveo.CNL.Web.Scripts.ElementPosition(tlpos.left - 2, tlpos.top + 3));
        this.m_Filler.style.width = (spos.left - tlpos.left + 2).toString() + 'px';
        var delay;
        if (this.m_Transcript != null) {
            if (this._m_LastCurrentWord$1 != null) {
                this._m_LastCurrentWord$1.style.color = this._m_LastCurrentWord$1.getAttribute('BackupColor').toString();
                this._m_LastCurrentWord$1.style.backgroundColor = this._m_LastCurrentWord$1.getAttribute('BackupBackground').toString();
            }
            var beg = 0;
            var end = this._m_Positions$1.length;
            var index = 0;
            while (beg < end) {
                index = beg + Math.floor((end - beg) / 2);
                var value = this._m_Positions$1[index];
                if (value < position) {
                    beg = index + 1;
                }
                else {
                    end = index;
                }
            }
            index = Math.max(beg - 1, 0);
            this._m_LastCurrentWord$1 = document.getElementById(this.get_ownerId() + '_' + this._m_Positions$1[index]);
            if (this._m_LastCurrentWord$1 != null) {
                this._m_LastCurrentWord$1.setAttribute('BackupColor', this._m_LastCurrentWord$1.style.color);
                this._m_LastCurrentWord$1.setAttribute('BackupBackground', this._m_LastCurrentWord$1.style.backgroundColor);
                this._m_LastCurrentWord$1.style.color = 'white';
                this._m_LastCurrentWord$1.style.backgroundColor = 'maroon';
                if (!p_Auto) {
                    this._m_LastCurrentWord$1.scrollIntoView();
                }
            }
            if ((this._m_Positions$1[index]) > position) {
                delay = ((this._m_Positions$1[index]) - position) * 1000;
            }
            else if (index + 1 < this._m_Positions$1.length) {
                delay = ((this._m_Positions$1[index + 1]) - position) * 1000;
            }
            else {
                delay = 1000;
            }
            if (delay > 500) {
                delay = 500;
            }
        }
        else {
            delay = 500;
        }
        if (p_Auto) {
            this._m_SynchronizeTimerId$1 = window.setTimeout(ss.Delegate.create(this, function() {
                this._synchronize$1(true);
            }), parseInt(delay));
        }
    },
    
    _getHeadStart$1: function Coveo_CES_Web_Search_Scripts_Controls_ResultPlayerScript$_getHeadStart$1(p_Start) {
        /// <summary>
        /// Retrieves the position at which to jump for an utterance, including a head start.
        /// </summary>
        /// <param name="p_Start" type="Number" integer="true">
        /// The position at which the utterance starts.
        /// </param>
        /// <returns type="Number" integer="true"></returns>
        var pos = p_Start - this.m_HeadStart;
        if (pos < 0) {
            pos = 0;
        }
        return pos;
    },
    
    _getTimeLinePosition$1: function Coveo_CES_Web_Search_Scripts_Controls_ResultPlayerScript$_getTimeLinePosition$1(p_Percent) {
        /// <summary>
        /// Retrieves the position of a point on the timeline.
        /// </summary>
        /// <param name="p_Percent" type="Number">
        /// The percentage of the point on the timeline.
        /// </param>
        /// <returns type="Coveo.CNL.Web.Scripts.ElementPosition"></returns>
        var tlpos = Coveo.CNL.Web.Scripts.DOMUtilities.getElementPosition(this.m_TimeLine);
        var tlsize = Coveo.CNL.Web.Scripts.DOMUtilities.getElementSize(this.m_TimeLine);
        tlpos.left += (tlsize.width * p_Percent - 2);
        return tlpos;
    },
    
    _getTermPart$1: function Coveo_CES_Web_Search_Scripts_Controls_ResultPlayerScript$_getTermPart$1(p_Term, p_Occurence, p_Part) {
        /// <summary>
        /// Retrieves a specific highlight part.
        /// </summary>
        /// <param name="p_Term" type="Number" integer="true">
        /// The index of the term.
        /// </param>
        /// <param name="p_Occurence" type="Number" integer="true">
        /// The index of the occurence of the term.
        /// </param>
        /// <param name="p_Part" type="Number" integer="true">
        /// The index of the part of the term.
        /// </param>
        /// <returns type="Object" domElement="true"></returns>
        return document.getElementById('CoveoHighlight:' + p_Term + '.' + p_Occurence + '.' + p_Part);
    },
    
    _highlightTerm$1: function Coveo_CES_Web_Search_Scripts_Controls_ResultPlayerScript$_highlightTerm$1(p_Term, p_Occurence) {
        /// <summary>
        /// Highlights a term and scrolls it into view.
        /// </summary>
        /// <param name="p_Term" type="Number" integer="true">
        /// The index of the term to highlight.
        /// </param>
        /// <param name="p_Occurence" type="Number" integer="true">
        /// The index of the term occurence to highlight.
        /// </param>
        var part = 1;
        var elem = this._getTermPart$1(p_Term, p_Occurence, part);
        if (elem != null) {
            var time = parseFloat(elem.parentNode.id.substring(this.get_ownerId().length + 1, elem.parentNode.id.length));
            this._jump$1(time);
            elem.scrollIntoView();
            while (elem != null) {
                elem.setAttribute('BackupColor', elem.style.color);
                elem.setAttribute('BackupBackground', elem.style.backgroundColor);
                elem.style.color = 'white';
                elem.style.backgroundColor = 'green';
                elem = this._getTermPart$1(p_Term, p_Occurence, ++part);
            }
            this._m_LastTerm$1 = p_Term;
            this._m_LastOccurence$1 = p_Occurence;
        }
    },
    
    _removeLastHighlight$1: function Coveo_CES_Web_Search_Scripts_Controls_ResultPlayerScript$_removeLastHighlight$1() {
        /// <summary>
        /// Unhighlights the last highlighted term.
        /// </summary>
        if (!!this._m_LastTerm$1) {
            var part = 1;
            var elem = this._getTermPart$1(this._m_LastTerm$1, this._m_LastOccurence$1, part);
            while (elem != null) {
                elem.style.color = elem.getAttribute('BackupColor').toString();
                elem.style.backgroundColor = elem.getAttribute('BackupBackground').toString();
                elem = this._getTermPart$1(this._m_LastTerm$1, this._m_LastOccurence$1, ++part);
            }
        }
    }
}


////////////////////////////////////////////////////////////////////////////////
// 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.SharePoint');

////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ScopeConfigEditorLinkButtonScript

Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ScopeConfigEditorLinkButtonScript = function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeConfigEditorLinkButtonScript() {
    /// <summary>
    /// Contains the client side code for the link button to open the scope configuration editor.
    /// </summary>
    /// <field name="m_PopupPosition" type="Coveo.CNL.Web.Scripts.PositionEnum">
    /// The relative position of the popup menu to the link button.
    /// </field>
    /// <field name="m_LinkButtonElem" type="Object" domElement="true">
    /// The element for the search page link button (set by the AJAX framework).
    /// </field>
    /// <field name="m_CoveoCssUrl" type="String">
    /// The URL of the Coveo CSS file (set by the AJAX framework).
    /// </field>
    /// <field name="m_STRING_CurrentSiteCollection" type="String">
    /// The menu caption for the site collection item.
    /// </field>
    /// <field name="m_STRING_CurrentSite" type="String">
    /// The menu caption for the site item.
    /// </field>
    /// <field name="_m_PopupDivElem$1" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_SiteCollectionPopupMenuItemDivElem$1" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_SitePopupMenuItemDivElem$1" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_LinkButtonClickEventHandler$1" type="Function">
    /// </field>
    /// <field name="_m_SiteCollectionPopupMenuItemClickEventHandler$1" type="Function">
    /// </field>
    /// <field name="_m_SitePopupMenuItemClickEventHandler$1" type="Function">
    /// </field>
    /// <field name="_m_OnClickElsewhereEvent$1" type="Coveo.CNL.Web.Scripts.OnClickElsewhereEvent">
    /// </field>
    Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ScopeConfigEditorLinkButtonScript.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ScopeConfigEditorLinkButtonScript.prototype = {
    m_PopupPosition: 0,
    m_LinkButtonElem: null,
    m_CoveoCssUrl: null,
    m_STRING_CurrentSiteCollection: null,
    m_STRING_CurrentSite: null,
    _m_PopupDivElem$1: null,
    _m_SiteCollectionPopupMenuItemDivElem$1: null,
    _m_SitePopupMenuItemDivElem$1: null,
    _m_LinkButtonClickEventHandler$1: null,
    _m_SiteCollectionPopupMenuItemClickEventHandler$1: null,
    _m_SitePopupMenuItemClickEventHandler$1: null,
    _m_OnClickElsewhereEvent$1: null,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeConfigEditorLinkButtonScript$initialize() {
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this.m_LinkButtonElem);
        var headColl = document.documentElement.getElementsByTagName('head');
        if (headColl.length >= 1 && !String.isNullOrEmpty(this.m_CoveoCssUrl)) {
            var headElem = headColl[0];
            var foundCoveoCss = false;
            for (var childNo = 0; childNo < headElem.childNodes.length; ++childNo) {
                var tagName = headElem.childNodes[childNo].tagName;
                if (tagName != null && tagName.toLowerCase() === 'link') {
                    var relAttr = headElem.childNodes[childNo].attributes.getNamedItem('rel');
                    var typeAttr = headElem.childNodes[childNo].attributes.getNamedItem('type');
                    var hrefAttr = headElem.childNodes[childNo].attributes.getNamedItem('href');
                    if (relAttr != null && typeAttr != null && hrefAttr != null && relAttr.value === 'stylesheet' && typeAttr.value === 'text/css' && hrefAttr.value === this.m_CoveoCssUrl) {
                        foundCoveoCss = true;
                        break;
                    }
                }
            }
            if (!foundCoveoCss) {
                var elem = document.createElement('link');
                elem.setAttribute('rel', 'stylesheet');
                elem.setAttribute('type', 'text/css');
                elem.setAttribute('href', this.m_CoveoCssUrl);
                headElem.appendChild(elem);
            }
        }
        Coveo.CNL.Web.Scripts.CNLAssert.check(String.isNullOrEmpty(this.m_STRING_CurrentSiteCollection) === String.isNullOrEmpty(this.m_STRING_CurrentSite));
        if (!String.isNullOrEmpty(this.m_STRING_CurrentSiteCollection)) {
            this._m_PopupDivElem$1 = document.createElement('div');
            this._m_PopupDivElem$1.className = 'CesScopeEditorPopupMenu';
            this._m_PopupDivElem$1.style.zIndex = Coveo.CNL.Web.Scripts.DOMUtilities.getNextHighestZindex();
            this._m_PopupDivElem$1.style.display = 'none';
            this._m_SiteCollectionPopupMenuItemDivElem$1 = document.createElement('div');
            this._m_SiteCollectionPopupMenuItemDivElem$1.className = 'CesScopeEditorPopupMenuItem';
            this._m_SiteCollectionPopupMenuItemDivElem$1.innerText = this.m_STRING_CurrentSiteCollection;
            this._m_PopupDivElem$1.appendChild(this._m_SiteCollectionPopupMenuItemDivElem$1);
            this._m_SitePopupMenuItemDivElem$1 = document.createElement('div');
            this._m_SitePopupMenuItemDivElem$1.className = 'CesScopeEditorPopupMenuItem';
            this._m_SitePopupMenuItemDivElem$1.innerText = this.m_STRING_CurrentSite;
            this._m_PopupDivElem$1.appendChild(this._m_SitePopupMenuItemDivElem$1);
            document.documentElement.getElementsByTagName('form')[0].appendChild(this._m_PopupDivElem$1);
            this._m_SiteCollectionPopupMenuItemClickEventHandler$1 = ss.Delegate.create(this, this._siteCollectionPopupMenuItem_Click$1);
            this._m_SiteCollectionPopupMenuItemDivElem$1.attachEvent('onclick', this._m_SiteCollectionPopupMenuItemClickEventHandler$1);
            this._m_SitePopupMenuItemClickEventHandler$1 = ss.Delegate.create(this, this._sitePopupMenuItem_Click$1);
            this._m_SitePopupMenuItemDivElem$1.attachEvent('onclick', this._m_SitePopupMenuItemClickEventHandler$1);
            this._m_OnClickElsewhereEvent$1 = new Coveo.CNL.Web.Scripts.OnClickElsewhereEvent([ this._m_PopupDivElem$1 ], ss.Delegate.create(this, this._popupMenu_ClickElsewhere$1), true);
        }
        this._m_LinkButtonClickEventHandler$1 = ss.Delegate.create(this, this._linkButton_Click$1);
        this.m_LinkButtonElem.attachEvent('onclick', this._m_LinkButtonClickEventHandler$1);
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeConfigEditorLinkButtonScript$tearDown() {
        if (this._m_LinkButtonClickEventHandler$1 != null) {
            this.m_LinkButtonElem.detachEvent('onclick', this._m_LinkButtonClickEventHandler$1);
        }
        if (this._m_SiteCollectionPopupMenuItemClickEventHandler$1 != null) {
            this._m_SiteCollectionPopupMenuItemDivElem$1.detachEvent('onclick', this._m_SiteCollectionPopupMenuItemClickEventHandler$1);
        }
        if (this._m_SitePopupMenuItemClickEventHandler$1 != null) {
            this._m_SitePopupMenuItemDivElem$1.detachEvent('onclick', this._m_SitePopupMenuItemClickEventHandler$1);
        }
        if (this._m_OnClickElsewhereEvent$1 != null) {
            this._m_OnClickElsewhereEvent$1.dispose();
            this._m_OnClickElsewhereEvent$1 = null;
        }
        if (this._m_PopupDivElem$1 != null) {
            document.documentElement.getElementsByTagName('form')[0].removeChild(this._m_PopupDivElem$1);
        }
    },
    
    _linkButton_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeConfigEditorLinkButtonScript$_linkButton_Click$1() {
        if (this._m_PopupDivElem$1 != null) {
            this._m_PopupDivElem$1.style.display = 'block';
            Coveo.CNL.Web.Scripts.DOMUtilities.positionElement(this._m_PopupDivElem$1, this.m_LinkButtonElem, this.m_PopupPosition);
        }
        else {
            this.showEditorModalBox(true);
        }
        window.event.cancelBubble = true;
    },
    
    _hidePopup$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeConfigEditorLinkButtonScript$_hidePopup$1() {
        /// <summary>
        /// Hides the popup menu.
        /// </summary>
        this._m_PopupDivElem$1.style.display = 'none';
    },
    
    _siteCollectionPopupMenuItem_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeConfigEditorLinkButtonScript$_siteCollectionPopupMenuItem_Click$1() {
        this.showEditorModalBox(true);
        this._hidePopup$1();
    },
    
    _sitePopupMenuItem_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeConfigEditorLinkButtonScript$_sitePopupMenuItem_Click$1() {
        this.showEditorModalBox(false);
        this._hidePopup$1();
    },
    
    _popupMenu_ClickElsewhere$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeConfigEditorLinkButtonScript$_popupMenu_ClickElsewhere$1() {
        this._hidePopup$1();
    },
    
    showEditorModalBox: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeConfigEditorLinkButtonScript$showEditorModalBox(forDefaultConfig) {
        /// <param name="forDefaultConfig" type="Boolean">
        /// </param>
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.SharePoint._scopeConfigEditorScopeScript

Coveo.CES.Web.Search.Scripts.Controls.SharePoint._scopeConfigEditorScopeScript = function Coveo_CES_Web_Search_Scripts_Controls_SharePoint__scopeConfigEditorScopeScript() {
    /// <summary>
    /// Holds elements and event handlers for one of the scopes in the list.
    /// </summary>
    /// <field name="_m_ScopeData" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeData">
    /// </field>
    /// <field name="_m_CheckBoxElem" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_IsDefaultRadioButtonElem" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_IsDefaultClickHandler" type="Function">
    /// </field>
    /// <field name="_m_EditImageElem" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_EditClickHandler" type="Function">
    /// </field>
    /// <field name="_m_DeleteImageElem" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_DeleteClickHandler" type="Function">
    /// </field>
}
Coveo.CES.Web.Search.Scripts.Controls.SharePoint._scopeConfigEditorScopeScript.prototype = {
    _m_ScopeData: null,
    _m_CheckBoxElem: null,
    _m_IsDefaultRadioButtonElem: null,
    _m_IsDefaultClickHandler: null,
    _m_EditImageElem: null,
    _m_EditClickHandler: null,
    _m_DeleteImageElem: null,
    _m_DeleteClickHandler: null
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ScopeConfigEditorModalBoxScript

Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ScopeConfigEditorModalBoxScript = function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeConfigEditorModalBoxScript() {
    /// <summary>
    /// Contains the client logic (javascript code) for the scope selector configuration editor modal box.
    /// </summary>
    /// <field name="m_SiteID" type="String">
    /// The ID of the site whose scope configuration is being edited, or empty for the site collection default configuration (set by the AJAX framework).
    /// </field>
    /// <field name="m_ScopeConfigDataStr" type="String">
    /// The string representation of the scope selector configuration being edited (set by the AJAX framework).
    /// </field>
    /// <field name="m_ScopeDictionaryDataStr" type="String">
    /// The string representation of the whole scope collection (set by the AJAX framework).
    /// </field>
    /// <field name="m_AddIconUrl" type="String">
    /// The URL of the add icon (set by the AJAX framework).
    /// </field>
    /// <field name="m_EditIconUrl" type="String">
    /// The URL of the edit icon (set by the AJAX framework).
    /// </field>
    /// <field name="m_DeleteIconUrl" type="String">
    /// The URL of the delete icon (set by the AJAX framework).
    /// </field>
    /// <field name="m_MainPanelElem" type="Object" domElement="true">
    /// The dialog's main panel element in which all the other elements are created (set by the AJAX framework).
    /// </field>
    /// <field name="m_STRING_IntroMessage" type="String">
    /// </field>
    /// <field name="m_STRING_NameLabel" type="String">
    /// </field>
    /// <field name="m_STRING_DescriptionLabel" type="String">
    /// </field>
    /// <field name="m_STRING_DefaultQuestionMark" type="String">
    /// </field>
    /// <field name="m_STRING_UseSiteCollectionDefaultScopes" type="String">
    /// </field>
    /// <field name="m_STRING_ShowScopeSelectorNextToSearchBox" type="String">
    /// </field>
    /// <field name="m_STRING_ShowScopeFacetInSearchInterface" type="String">
    /// </field>
    /// <field name="m_STRING_CreateScope" type="String">
    /// </field>
    /// <field name="m_STRING_EditScope" type="String">
    /// </field>
    /// <field name="m_STRING_DeleteScope" type="String">
    /// </field>
    /// <field name="m_STRING_ApplyButton" type="String">
    /// </field>
    /// <field name="m_STRING_CancelButton" type="String">
    /// </field>
    /// <field name="m_STRING_DeleteScopeXQuestion" type="String">
    /// </field>
    /// <field name="_m_ScopeConfigData$1" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeConfigData">
    /// </field>
    /// <field name="_m_ScopeDictionaryData$1" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeDictionaryData">
    /// </field>
    /// <field name="_m_ScopeArray$1" type="Array">
    /// </field>
    /// <field name="_m_DefaultScope$1" type="Coveo.CES.Web.Search.Scripts.Controls.SharePoint._scopeConfigEditorScopeScript">
    /// </field>
    /// <field name="_m_UseDefaultScopesCheckBoxElem$1" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_UseDefaultScopesCheckBoxClickHandler$1" type="Function">
    /// </field>
    /// <field name="_m_HeaderDivElem$1" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_ScopeListPlaceHolderDivElem$1" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_CheckBoxesPlaceHolderCellElem$1" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_ScopeTableElem$1" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_CreateScopeAnchorElem$1" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_CreateScopeClickHandler$1" type="Function">
    /// </field>
    /// <field name="_m_ShowSelectorDropDownCheckBoxElem$1" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_ShowSelectorFacetCheckBoxElem$1" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_ApplyInputElem$1" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_ApplyButtonClickHandler$1" type="Function">
    /// </field>
    /// <field name="_m_CancelInputElem$1" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_CancelButtonClickHandler$1" type="Function">
    /// </field>
    /// <field name="_m_DialogMouseUpHandler$1" type="Function">
    /// </field>
    this._m_ScopeArray$1 = [];
    Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ScopeConfigEditorModalBoxScript.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ScopeConfigEditorModalBoxScript._compareScopesByName$1 = function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeConfigEditorModalBoxScript$_compareScopesByName$1(scope1, scope2) {
    /// <summary>
    /// Compare 2 scopes by their names (case-insensitive).
    /// </summary>
    /// <param name="scope1" type="Object">
    /// First scope to compare.
    /// </param>
    /// <param name="scope2" type="Object">
    /// Second scope to compare.
    /// </param>
    /// <returns type="Number" integer="true"></returns>
    var name1 = (scope1).get_name().toLowerCase();
    var name2 = (scope2).get_name().toLowerCase();
    return String.compare(name1, name2, true);
}
Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ScopeConfigEditorModalBoxScript.prototype = {
    m_SiteID: null,
    m_ScopeConfigDataStr: null,
    m_ScopeDictionaryDataStr: null,
    m_AddIconUrl: null,
    m_EditIconUrl: null,
    m_DeleteIconUrl: null,
    m_MainPanelElem: null,
    m_STRING_IntroMessage: null,
    m_STRING_NameLabel: null,
    m_STRING_DescriptionLabel: null,
    m_STRING_DefaultQuestionMark: null,
    m_STRING_UseSiteCollectionDefaultScopes: null,
    m_STRING_ShowScopeSelectorNextToSearchBox: null,
    m_STRING_ShowScopeFacetInSearchInterface: null,
    m_STRING_CreateScope: null,
    m_STRING_EditScope: null,
    m_STRING_DeleteScope: null,
    m_STRING_ApplyButton: null,
    m_STRING_CancelButton: null,
    m_STRING_DeleteScopeXQuestion: null,
    _m_ScopeConfigData$1: null,
    _m_ScopeDictionaryData$1: null,
    _m_DefaultScope$1: null,
    _m_UseDefaultScopesCheckBoxElem$1: null,
    _m_UseDefaultScopesCheckBoxClickHandler$1: null,
    _m_HeaderDivElem$1: null,
    _m_ScopeListPlaceHolderDivElem$1: null,
    _m_CheckBoxesPlaceHolderCellElem$1: null,
    _m_ScopeTableElem$1: null,
    _m_CreateScopeAnchorElem$1: null,
    _m_CreateScopeClickHandler$1: null,
    _m_ShowSelectorDropDownCheckBoxElem$1: null,
    _m_ShowSelectorFacetCheckBoxElem$1: null,
    _m_ApplyInputElem$1: null,
    _m_ApplyButtonClickHandler$1: null,
    _m_CancelInputElem$1: null,
    _m_CancelButtonClickHandler$1: null,
    _m_DialogMouseUpHandler$1: null,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeConfigEditorModalBoxScript$initialize() {
        Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ScopeConfigEditorModalBoxScript.callBaseMethod(this, 'initialize');
        this._m_ScopeConfigData$1 = new Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeConfigData(Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeRawData.parse(this.m_ScopeConfigDataStr || ''));
        var introDivElem = document.createElement('div');
        introDivElem.className = 'CesBottomInterSpacing';
        introDivElem.innerText = this.m_STRING_IntroMessage;
        this.m_MainPanelElem.appendChild(introDivElem);
        var spanElem;
        if (!String.isNullOrEmpty(this.m_SiteID)) {
            var useDefaultScopesCheckBoxDivElem = document.createElement('div');
            useDefaultScopesCheckBoxDivElem.className = 'CesBottomInterSpacing';
            var useDefaultScopescheckBoxLabelElem = document.createElement('label');
            this._m_UseDefaultScopesCheckBoxElem$1 = document.createElement('input');
            this._m_UseDefaultScopesCheckBoxElem$1.type = 'checkbox';
            this._m_UseDefaultScopesCheckBoxElem$1.checked = String.isNullOrEmpty(this.m_ScopeConfigDataStr);
            this._m_UseDefaultScopesCheckBoxClickHandler$1 = ss.Delegate.create(this, this._useDefaultScopesCheckBox_Click$1);
            this._m_UseDefaultScopesCheckBoxElem$1.attachEvent('onclick', this._m_UseDefaultScopesCheckBoxClickHandler$1);
            useDefaultScopescheckBoxLabelElem.appendChild(this._m_UseDefaultScopesCheckBoxElem$1);
            spanElem = document.createElement('span');
            spanElem.innerText = this.m_STRING_UseSiteCollectionDefaultScopes;
            useDefaultScopescheckBoxLabelElem.appendChild(spanElem);
            useDefaultScopesCheckBoxDivElem.appendChild(useDefaultScopescheckBoxLabelElem);
            this.m_MainPanelElem.appendChild(useDefaultScopesCheckBoxDivElem);
        }
        this._m_HeaderDivElem$1 = document.createElement('div');
        var headerTableElem = document.createElement('table');
        headerTableElem.className = 'CesScopeListHeader';
        var headerRowElem = document.createElement('tr');
        var headerCellElem;
        headerCellElem = document.createElement('td');
        headerCellElem.className = 'CesScopeListCheckBoxColumn';
        headerRowElem.appendChild(headerCellElem);
        headerCellElem = document.createElement('td');
        headerCellElem.className = 'CesScopeListNameColumn';
        headerCellElem.innerText = this.m_STRING_NameLabel;
        headerRowElem.appendChild(headerCellElem);
        headerCellElem = document.createElement('td');
        headerCellElem.className = 'CesScopeListDescriptionColumn';
        headerCellElem.innerText = this.m_STRING_DescriptionLabel;
        headerRowElem.appendChild(headerCellElem);
        headerCellElem = document.createElement('td');
        headerCellElem.className = 'CesScopeListIsDefaultColumn';
        headerCellElem.innerText = this.m_STRING_DefaultQuestionMark;
        headerRowElem.appendChild(headerCellElem);
        headerCellElem = document.createElement('td');
        headerCellElem.className = 'CesIconCell';
        headerRowElem.appendChild(headerCellElem);
        headerCellElem = document.createElement('td');
        headerCellElem.className = 'CesIconCell';
        headerRowElem.appendChild(headerCellElem);
        headerTableElem.appendChild(headerRowElem);
        this._m_HeaderDivElem$1.appendChild(headerTableElem);
        this.m_MainPanelElem.appendChild(this._m_HeaderDivElem$1);
        this._m_ScopeListPlaceHolderDivElem$1 = document.createElement('div');
        var scopeListDivElem = document.createElement('div');
        scopeListDivElem.className = 'CesScrollableList';
        this._m_ScopeTableElem$1 = document.createElement('table');
        this._m_ScopeTableElem$1.className = 'CesLineTable';
        this.updateScopes(this.m_ScopeDictionaryDataStr);
        scopeListDivElem.appendChild(this._m_ScopeTableElem$1);
        this._m_ScopeListPlaceHolderDivElem$1.appendChild(scopeListDivElem);
        var createScopeDivElem = document.createElement('div');
        createScopeDivElem.className = 'CesTopInterSpacingMinimum';
        this._m_CreateScopeAnchorElem$1 = document.createElement('a');
        this._m_CreateScopeAnchorElem$1.className = 'CesIconButton';
        var addImageElem = document.createElement('img');
        addImageElem.src = this.m_AddIconUrl;
        this._m_CreateScopeAnchorElem$1.appendChild(addImageElem);
        spanElem = document.createElement('span');
        spanElem.innerText = this.m_STRING_CreateScope;
        this._m_CreateScopeAnchorElem$1.appendChild(spanElem);
        this._m_CreateScopeClickHandler$1 = ss.Delegate.create(this, this._createScope_Click$1);
        this._m_CreateScopeAnchorElem$1.attachEvent('onclick', this._m_CreateScopeClickHandler$1);
        createScopeDivElem.appendChild(this._m_CreateScopeAnchorElem$1);
        this._m_ScopeListPlaceHolderDivElem$1.appendChild(createScopeDivElem);
        this.m_MainPanelElem.appendChild(this._m_ScopeListPlaceHolderDivElem$1);
        var checkBoxLabelElem;
        var buttonPanelTableElem = document.createElement('table');
        buttonPanelTableElem.style.width = '100%';
        var rowElem = document.createElement('tr');
        this._m_CheckBoxesPlaceHolderCellElem$1 = document.createElement('td');
        this._m_CheckBoxesPlaceHolderCellElem$1.className = 'CesTopInterSpacing';
        var showSelectorDropDownDivElem = document.createElement('div');
        checkBoxLabelElem = document.createElement('label');
        this._m_ShowSelectorDropDownCheckBoxElem$1 = document.createElement('input');
        this._m_ShowSelectorDropDownCheckBoxElem$1.type = 'checkbox';
        this._m_ShowSelectorDropDownCheckBoxElem$1.checked = this._m_ScopeConfigData$1.get_showScopeSelectorDropDown();
        checkBoxLabelElem.appendChild(this._m_ShowSelectorDropDownCheckBoxElem$1);
        spanElem = document.createElement('span');
        spanElem.innerText = this.m_STRING_ShowScopeSelectorNextToSearchBox;
        checkBoxLabelElem.appendChild(spanElem);
        showSelectorDropDownDivElem.appendChild(checkBoxLabelElem);
        this._m_CheckBoxesPlaceHolderCellElem$1.appendChild(showSelectorDropDownDivElem);
        var showSelectorFacetDivElem = document.createElement('div');
        checkBoxLabelElem = document.createElement('label');
        this._m_ShowSelectorFacetCheckBoxElem$1 = document.createElement('input');
        this._m_ShowSelectorFacetCheckBoxElem$1.type = 'checkbox';
        this._m_ShowSelectorFacetCheckBoxElem$1.checked = this._m_ScopeConfigData$1.get_showScopeSelectorFacet();
        checkBoxLabelElem.appendChild(this._m_ShowSelectorFacetCheckBoxElem$1);
        spanElem = document.createElement('span');
        spanElem.innerText = this.m_STRING_ShowScopeFacetInSearchInterface;
        checkBoxLabelElem.appendChild(spanElem);
        showSelectorFacetDivElem.appendChild(checkBoxLabelElem);
        this._m_CheckBoxesPlaceHolderCellElem$1.appendChild(showSelectorFacetDivElem);
        rowElem.appendChild(this._m_CheckBoxesPlaceHolderCellElem$1);
        var cellElem = document.createElement('td');
        cellElem.className = 'CesButtonPanelCell CesTopInterSpacing';
        this._m_ApplyInputElem$1 = document.createElement('input');
        this._m_ApplyInputElem$1.type = 'button';
        this._m_ApplyInputElem$1.className = 'CesButton';
        this._m_ApplyInputElem$1.value = this.m_STRING_ApplyButton;
        this._m_ApplyButtonClickHandler$1 = ss.Delegate.create(this, this._applyButton_Click$1);
        this._m_ApplyInputElem$1.attachEvent('onclick', this._m_ApplyButtonClickHandler$1);
        cellElem.appendChild(this._m_ApplyInputElem$1);
        this._m_CancelInputElem$1 = document.createElement('input');
        this._m_CancelInputElem$1.type = 'button';
        this._m_CancelInputElem$1.className = 'CesButton';
        this._m_CancelInputElem$1.value = this.m_STRING_CancelButton;
        this._m_CancelButtonClickHandler$1 = ss.Delegate.create(this, this._cancelButton_Click$1);
        this._m_CancelInputElem$1.attachEvent('onclick', this._m_CancelButtonClickHandler$1);
        cellElem.appendChild(this._m_CancelInputElem$1);
        rowElem.appendChild(cellElem);
        buttonPanelTableElem.appendChild(rowElem);
        this.m_MainPanelElem.appendChild(buttonPanelTableElem);
        this._m_DialogMouseUpHandler$1 = ss.Delegate.create(this, this._mouse_Events$1);
        this.m_MainPanelElem.attachEvent('onmouseup', this._m_DialogMouseUpHandler$1);
        if (this._m_UseDefaultScopesCheckBoxElem$1 != null) {
            this._useDefaultScopesCheckBox_Click$1();
        }
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeConfigEditorModalBoxScript$tearDown() {
        if (this._m_UseDefaultScopesCheckBoxElem$1 != null) {
            this._m_UseDefaultScopesCheckBoxElem$1.detachEvent('onclick', this._m_UseDefaultScopesCheckBoxClickHandler$1);
            this._m_UseDefaultScopesCheckBoxClickHandler$1 = null;
        }
        this.m_MainPanelElem.detachEvent('onmouseup', this._m_DialogMouseUpHandler$1);
        this._m_DialogMouseUpHandler$1 = null;
        this._m_CreateScopeAnchorElem$1.detachEvent('onclick', this._m_CreateScopeClickHandler$1);
        this._m_CreateScopeClickHandler$1 = null;
        this._m_ApplyInputElem$1.detachEvent('onclick', this._m_ApplyButtonClickHandler$1);
        this._m_ApplyButtonClickHandler$1 = null;
        this._m_CancelInputElem$1.detachEvent('onclick', this._m_CancelButtonClickHandler$1);
        this._m_CancelButtonClickHandler$1 = null;
        var $enum1 = ss.IEnumerator.getEnumerator(this._m_ScopeArray$1);
        while ($enum1.moveNext()) {
            var scopeScript = $enum1.current;
            scopeScript._m_IsDefaultRadioButtonElem.detachEvent('onclick', scopeScript._m_IsDefaultClickHandler);
            scopeScript._m_IsDefaultClickHandler = null;
            scopeScript._m_EditImageElem.detachEvent('onclick', scopeScript._m_EditClickHandler);
            scopeScript._m_EditClickHandler = null;
            scopeScript._m_DeleteImageElem.detachEvent('onclick', scopeScript._m_DeleteClickHandler);
            scopeScript._m_DeleteClickHandler = null;
        }
        Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ScopeConfigEditorModalBoxScript.callBaseMethod(this, 'tearDown');
    },
    
    updateScopes: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeConfigEditorModalBoxScript$updateScopes(scopeDictionaryDataStr) {
        /// <summary>
        /// Fill the scope UI table with the provided list of scopes.
        /// This method is called first while the dialog is being displayed, and is also called afterwards by the server as the result of an user action that updates a scope.
        /// </summary>
        /// <param name="scopeDictionaryDataStr" type="String">
        /// The new list of scopes.
        /// </param>
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this._m_ScopeTableElem$1);
        this.m_ScopeDictionaryDataStr = scopeDictionaryDataStr;
        this._m_ScopeDictionaryData$1 = new Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeDictionaryData(Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeRawData.parse(this.m_ScopeDictionaryDataStr || ''));
        while (this._m_ScopeTableElem$1.children.length > 0) {
            this._m_ScopeTableElem$1.removeChild(this._m_ScopeTableElem$1.firstChild);
        }
        ArrayPrototype_clear(this._m_ScopeArray$1);
        this._m_DefaultScope$1 = null;
        var scopeList = [];
        var $enum1 = ss.IEnumerator.getEnumerator(this._m_ScopeDictionaryData$1);
        while ($enum1.moveNext()) {
            var scopeData = $enum1.current;
            ArrayPrototype_add(scopeList, scopeData);
        }
        Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeCollectionData.sort(scopeList, Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ScopeConfigEditorModalBoxScript._compareScopesByName$1);
        var $enum2 = ss.IEnumerator.getEnumerator(scopeList);
        while ($enum2.moveNext()) {
            var scopeData = $enum2.current;
            var scopeScript = new Coveo.CES.Web.Search.Scripts.Controls.SharePoint._scopeConfigEditorScopeScript();
            scopeScript._m_ScopeData = scopeData;
            var scopeRowElem = document.createElement('tr');
            var scopeCellElem;
            scopeCellElem = document.createElement('td');
            scopeCellElem.className = 'CesScopeListCheckBoxColumn';
            scopeScript._m_CheckBoxElem = document.createElement('input');
            scopeScript._m_CheckBoxElem.type = 'checkbox';
            scopeScript._m_CheckBoxElem.checked = this._m_ScopeConfigData$1.get_selectedScopeIDs().containsKey(scopeData.get_id());
            scopeCellElem.appendChild(scopeScript._m_CheckBoxElem);
            scopeRowElem.appendChild(scopeCellElem);
            scopeCellElem = document.createElement('td');
            scopeCellElem.className = 'CesScopeListNameColumn';
            scopeCellElem.innerText = scopeData.get_name();
            scopeRowElem.appendChild(scopeCellElem);
            scopeCellElem = document.createElement('td');
            scopeCellElem.className = 'CesScopeListDescriptionColumn';
            scopeCellElem.innerText = scopeData.get_description();
            scopeRowElem.appendChild(scopeCellElem);
            scopeCellElem = document.createElement('td');
            scopeCellElem.className = 'CesScopeListIsDefaultColumn';
            scopeScript._m_IsDefaultRadioButtonElem = document.createElement('input');
            scopeScript._m_IsDefaultRadioButtonElem.type = 'radio';
            if (!String.compare(this._m_ScopeConfigData$1.get_defaultScopeID(), scopeData.get_id(), true)) {
                scopeScript._m_IsDefaultRadioButtonElem.checked = true;
                this._m_DefaultScope$1 = scopeScript;
            }
            scopeScript._m_IsDefaultClickHandler = ss.Delegate.create(this, this._isDefault_Click$1);
            scopeScript._m_IsDefaultRadioButtonElem.attachEvent('onclick', scopeScript._m_IsDefaultClickHandler);
            scopeCellElem.appendChild(scopeScript._m_IsDefaultRadioButtonElem);
            scopeRowElem.appendChild(scopeCellElem);
            scopeCellElem = document.createElement('td');
            scopeCellElem.className = 'CesIconCell';
            scopeScript._m_EditImageElem = document.createElement('img');
            scopeScript._m_EditImageElem.className = 'CesIconButton';
            scopeScript._m_EditImageElem.src = this.m_EditIconUrl;
            scopeScript._m_EditImageElem.title = this.m_STRING_EditScope;
            scopeScript._m_EditClickHandler = ss.Delegate.create(this, this._editScope_Click$1);
            scopeScript._m_EditImageElem.attachEvent('onclick', scopeScript._m_EditClickHandler);
            scopeCellElem.appendChild(scopeScript._m_EditImageElem);
            scopeRowElem.appendChild(scopeCellElem);
            scopeCellElem = document.createElement('td');
            scopeCellElem.className = 'CesIconCell';
            scopeScript._m_DeleteImageElem = document.createElement('img');
            scopeScript._m_DeleteImageElem.className = 'CesIconButton';
            scopeScript._m_DeleteImageElem.src = this.m_DeleteIconUrl;
            scopeScript._m_DeleteImageElem.title = this.m_STRING_DeleteScope;
            scopeScript._m_DeleteClickHandler = ss.Delegate.create(this, this._deleteScope_Click$1);
            scopeScript._m_DeleteImageElem.attachEvent('onclick', scopeScript._m_DeleteClickHandler);
            scopeCellElem.appendChild(scopeScript._m_DeleteImageElem);
            scopeRowElem.appendChild(scopeCellElem);
            this._m_ScopeTableElem$1.appendChild(scopeRowElem);
            ArrayPrototype_add(this._m_ScopeArray$1, scopeScript);
        }
    },
    
    _getClickedFacetScript$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeConfigEditorModalBoxScript$_getClickedFacetScript$1() {
        /// <summary>
        /// Finds the scope for which the user clicked on an action icon.
        /// </summary>
        /// <returns type="Coveo.CES.Web.Search.Scripts.Controls.SharePoint._scopeConfigEditorScopeScript"></returns>
        var retScopeScript = null;
        var clickedElem = window.event.srcElement;
        var scopeNo = 0;
        while (scopeNo < this._m_ScopeArray$1.length && clickedElem !== (retScopeScript = this._m_ScopeArray$1[scopeNo])._m_IsDefaultRadioButtonElem && clickedElem !== retScopeScript._m_DeleteImageElem && clickedElem !== retScopeScript._m_EditImageElem) {
            ++scopeNo;
        }
        return retScopeScript;
    },
    
    _saveSelectedScopeCheckBoxes$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeConfigEditorModalBoxScript$_saveSelectedScopeCheckBoxes$1() {
        /// <summary>
        /// Scans the scope list in the DOM and saves the selection check-boxes in the data object.
        /// </summary>
        this._m_ScopeConfigData$1.get_selectedScopeIDs().clear();
        var $enum1 = ss.IEnumerator.getEnumerator(this._m_ScopeArray$1);
        while ($enum1.moveNext()) {
            var scopeScript = $enum1.current;
            if (scopeScript._m_CheckBoxElem.checked) {
                this._m_ScopeConfigData$1.get_selectedScopeIDs().set_item(scopeScript._m_ScopeData.get_id(), 0);
            }
        }
        this._m_ScopeConfigData$1.set_defaultScopeID(((this._m_DefaultScope$1 == null) ? '' : this._m_DefaultScope$1._m_ScopeData.get_id()));
    },
    
    _useDefaultScopesCheckBox_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeConfigEditorModalBoxScript$_useDefaultScopesCheckBox_Click$1() {
        var newVisibility = ((this._m_UseDefaultScopesCheckBoxElem$1.checked) ? 'hidden' : '');
        this._m_HeaderDivElem$1.style.visibility = newVisibility;
        this._m_ScopeListPlaceHolderDivElem$1.style.visibility = newVisibility;
        this._m_CheckBoxesPlaceHolderCellElem$1.style.visibility = newVisibility;
    },
    
    _createScope_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeConfigEditorModalBoxScript$_createScope_Click$1() {
        this._saveSelectedScopeCheckBoxes$1();
        this.editScope('');
    },
    
    _isDefault_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeConfigEditorModalBoxScript$_isDefault_Click$1() {
        var scopeScript = this._getClickedFacetScript$1();
        if (scopeScript === this._m_DefaultScope$1) {
            this._m_DefaultScope$1 = null;
            scopeScript._m_IsDefaultRadioButtonElem.checked = false;
        }
        else {
            if (this._m_DefaultScope$1 != null) {
                this._m_DefaultScope$1._m_IsDefaultRadioButtonElem.checked = false;
            }
            this._m_DefaultScope$1 = scopeScript;
        }
    },
    
    _editScope_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeConfigEditorModalBoxScript$_editScope_Click$1() {
        var scopeScript = this._getClickedFacetScript$1();
        this._saveSelectedScopeCheckBoxes$1();
        this.editScope(scopeScript._m_ScopeData.get_id());
    },
    
    _deleteScope_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeConfigEditorModalBoxScript$_deleteScope_Click$1() {
        var scopeScript = this._getClickedFacetScript$1();
        this._saveSelectedScopeCheckBoxes$1();
        if (confirm(this.m_STRING_DeleteScopeXQuestion.replaceAll('{0}', scopeScript._m_ScopeData.get_name()))) {
            this.deleteScope(scopeScript._m_ScopeData.get_id());
        }
    },
    
    _applyButton_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeConfigEditorModalBoxScript$_applyButton_Click$1() {
        if (this._m_UseDefaultScopesCheckBoxElem$1 != null && this._m_UseDefaultScopesCheckBoxElem$1.checked) {
            this.applyButtonClick(this.m_SiteID, '');
        }
        else {
            this._saveSelectedScopeCheckBoxes$1();
            this._m_ScopeConfigData$1.set_showScopeSelectorDropDown(this._m_ShowSelectorDropDownCheckBoxElem$1.checked);
            this._m_ScopeConfigData$1.set_showScopeSelectorFacet(this._m_ShowSelectorFacetCheckBoxElem$1.checked);
            this.applyButtonClick(this.m_SiteID, this._m_ScopeConfigData$1.getRawData().streamAsString());
        }
    },
    
    _cancelButton_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeConfigEditorModalBoxScript$_cancelButton_Click$1() {
        this.cancelButtonClick();
    },
    
    _mouse_Events$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeConfigEditorModalBoxScript$_mouse_Events$1() {
        window.event.cancelBubble = true;
        window.event.returnValue = false;
    },
    
    editScope: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeConfigEditorModalBoxScript$editScope(scopeID) {
        /// <param name="scopeID" type="String">
        /// </param>
    },
    
    deleteScope: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeConfigEditorModalBoxScript$deleteScope(scopeID) {
        /// <param name="scopeID" type="String">
        /// </param>
    },
    
    applyButtonClick: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeConfigEditorModalBoxScript$applyButtonClick(siteID, scopeDataStr) {
        /// <param name="siteID" type="String">
        /// </param>
        /// <param name="scopeDataStr" type="String">
        /// </param>
    },
    
    cancelButtonClick: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeConfigEditorModalBoxScript$cancelButtonClick() {
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.SharePoint._scopeEditorRuleScript

Coveo.CES.Web.Search.Scripts.Controls.SharePoint._scopeEditorRuleScript = function Coveo_CES_Web_Search_Scripts_Controls_SharePoint__scopeEditorRuleScript() {
    /// <summary>
    /// Holds elements and event handlers for one of the rules in the list.
    /// </summary>
    /// <field name="_m_RuleTypeSelectElem" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_RuleTypeChangeHandler" type="Function">
    /// </field>
    /// <field name="_m_FieldNameInputElem" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_FieldNameBlurHandler" type="Function">
    /// </field>
    /// <field name="_m_FieldNameChangeHandler" type="Function">
    /// </field>
    /// <field name="_m_ContentInputElem" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_RuleActionSelectElem" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_DeleteImageElem" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_DeleteClickHandler" type="Function">
    /// </field>
    /// <field name="_m_DeleteDblClickHandler" type="Function">
    /// </field>
}
Coveo.CES.Web.Search.Scripts.Controls.SharePoint._scopeEditorRuleScript.prototype = {
    _m_RuleTypeSelectElem: null,
    _m_RuleTypeChangeHandler: null,
    _m_FieldNameInputElem: null,
    _m_FieldNameBlurHandler: null,
    _m_FieldNameChangeHandler: null,
    _m_ContentInputElem: null,
    _m_RuleActionSelectElem: null,
    _m_DeleteImageElem: null,
    _m_DeleteClickHandler: null,
    _m_DeleteDblClickHandler: null
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.SharePoint._scopeEditorFieldScript

Coveo.CES.Web.Search.Scripts.Controls.SharePoint._scopeEditorFieldScript = function Coveo_CES_Web_Search_Scripts_Controls_SharePoint__scopeEditorFieldScript() {
    /// <summary>
    /// Holds elements and event handlers for one of the fields in the completion list.
    /// </summary>
    /// <field name="_hovereD_STYLE_NAME_SUFFIX" type="String" static="true">
    /// </field>
    /// <field name="_m_MouseOverHandler" type="Function">
    /// </field>
    /// <field name="_m_MouseOutHandler" type="Function">
    /// </field>
    /// <field name="_m_ClickHandler" type="Function">
    /// </field>
    /// <field name="modalBox" type="Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ScopeEditorModalBoxScript">
    /// </field>
    /// <field name="ruleScript" type="Coveo.CES.Web.Search.Scripts.Controls.SharePoint._scopeEditorRuleScript">
    /// </field>
    /// <field name="element" type="Object" domElement="true">
    /// </field>
    /// <field name="index" type="Number" integer="true">
    /// </field>
}
Coveo.CES.Web.Search.Scripts.Controls.SharePoint._scopeEditorFieldScript.prototype = {
    _m_MouseOverHandler: null,
    _m_MouseOutHandler: null,
    _m_ClickHandler: null,
    modalBox: null,
    ruleScript: null,
    element: null,
    index: 0,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint__scopeEditorFieldScript$initialize() {
        /// <summary>
        /// Initializes the field item.
        /// </summary>
        this._m_MouseOverHandler = ss.Delegate.create(this, this.item_MouseOver);
        this._m_MouseOutHandler = ss.Delegate.create(this, this.item_MouseOut);
        this._m_ClickHandler = ss.Delegate.create(this, this.item_Click);
        this.element.attachEvent('onmouseover', this._m_MouseOverHandler);
        this.element.attachEvent('onmouseout', this._m_MouseOutHandler);
        this.element.attachEvent('onclick', this._m_ClickHandler);
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint__scopeEditorFieldScript$tearDown() {
        /// <summary>
        /// Releases the field item.
        /// </summary>
        this.element.detachEvent('onmouseover', this._m_MouseOverHandler);
        this.element.detachEvent('onmouseout', this._m_MouseOutHandler);
        this.element.detachEvent('onclick', this._m_ClickHandler);
    },
    
    isSelected: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint__scopeEditorFieldScript$isSelected() {
        /// <summary>
        /// Gets whether the item is presently selected.
        /// </summary>
        /// <returns type="Boolean"></returns>
        return (this.element.className.indexOf(' CesScopeEditorPopupMenuItem_Hovered') !== -1);
    },
    
    _getNormalClassName: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint__scopeEditorFieldScript$_getNormalClassName() {
        /// <summary>
        /// Gets the normal (not hovered) CSS class name.
        /// </summary>
        /// <returns type="String"></returns>
        return this.element.className.replaceAll(' CesScopeEditorPopupMenuItem_Hovered', '');
    },
    
    item_MouseOver: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint__scopeEditorFieldScript$item_MouseOver() {
        /// <summary>
        /// Callback for when the mouse enters the item.
        /// </summary>
        if (this.modalBox._m_SelectedFieldItem != null) {
            this.modalBox._m_SelectedFieldItem.item_MouseOut();
            this.modalBox._m_SelectedFieldItem = null;
        }
        this.element.className = this._getNormalClassName() + ' CesScopeEditorPopupMenuItem_Hovered';
        this.modalBox._m_SelectedFieldItem = this;
    },
    
    item_MouseOut: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint__scopeEditorFieldScript$item_MouseOut() {
        /// <summary>
        /// Callback for when the mouse leaves the item.
        /// </summary>
        this.element.className = this._getNormalClassName();
    },
    
    item_Click: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint__scopeEditorFieldScript$item_Click() {
        /// <summary>
        /// Callback for when the user clicks on the item.
        /// </summary>
        this.modalBox._fieldItemClicked(this);
    }
}


////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ScopeEditorModalBoxScript

Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ScopeEditorModalBoxScript = function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeEditorModalBoxScript() {
    /// <summary>
    /// Contains the client side code for the scope editor modal box.
    /// </summary>
    /// <field name="_jS_UP_ARROW$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_jS_DOWN_ARROW$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_jS_ENTER$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="_jS_TAB$1" type="Number" integer="true" static="true">
    /// </field>
    /// <field name="m_ScopeDataStr" type="String">
    /// The string representation of the scope being edited (set by the AJAX framework).
    /// </field>
    /// <field name="m_FieldDictionaryDataStr" type="String">
    /// The string representation of the list of fields for auto-completion (set by the AJAX framework).
    /// </field>
    /// <field name="m_AddIconUrl" type="String">
    /// The URL of the add icon (set by the AJAX framework).
    /// </field>
    /// <field name="m_DeleteIconUrl" type="String">
    /// The URL of the delete icon (set by the AJAX framework).
    /// </field>
    /// <field name="m_MainPanelElem" type="Object" domElement="true">
    /// The dialog's main panel element in which all the other elements are created (set by the AJAX framework).
    /// </field>
    /// <field name="m_STRING_NameLabel" type="String">
    /// </field>
    /// <field name="m_STRING_DescriptionLabel" type="String">
    /// </field>
    /// <field name="m_STRING_OptionalLabel" type="String">
    /// </field>
    /// <field name="m_STRING_RulesLabel" type="String">
    /// </field>
    /// <field name="m_STRING_AddRule" type="String">
    /// </field>
    /// <field name="m_STRING_DeleteRule" type="String">
    /// </field>
    /// <field name="m_STRING_ApplyButton" type="String">
    /// </field>
    /// <field name="m_STRING_CancelButton" type="String">
    /// </field>
    /// <field name="m_STRING_TypeFreeText" type="String">
    /// </field>
    /// <field name="m_STRING_TypeWebAddress" type="String">
    /// </field>
    /// <field name="m_STRING_TypeField" type="String">
    /// </field>
    /// <field name="m_STRING_ActionRequire" type="String">
    /// </field>
    /// <field name="m_STRING_ActionInclude" type="String">
    /// </field>
    /// <field name="m_STRING_ActionExclude" type="String">
    /// </field>
    /// <field name="_m_ScopeData$1" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeData">
    /// </field>
    /// <field name="_m_FieldDictionaryData$1" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeFieldDictionaryData">
    /// </field>
    /// <field name="_m_RuleArray$1" type="Array">
    /// </field>
    /// <field name="_m_MainPanelTableElem$1" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_NameInputElem$1" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_DescriptionInputElem$1" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_RuleTableElem$1" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_AddRuleAnchorElem$1" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_AddRuleClickHandler$1" type="Function">
    /// </field>
    /// <field name="_m_AddRuleDblClickHandler$1" type="Function">
    /// </field>
    /// <field name="_m_ApplyInputElem$1" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_ApplyButtonClickHandler$1" type="Function">
    /// </field>
    /// <field name="_m_CancelInputElem$1" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_CancelButtonClickHandler$1" type="Function">
    /// </field>
    /// <field name="_m_DialogMouseUpHandler$1" type="Function">
    /// </field>
    /// <field name="_m_FieldPopupDivElem$1" type="Object" domElement="true">
    /// </field>
    /// <field name="_m_FieldItems$1" type="Array">
    /// </field>
    /// <field name="_m_SelectedFieldItem" type="Coveo.CES.Web.Search.Scripts.Controls.SharePoint._scopeEditorFieldScript">
    /// </field>
    this._m_RuleArray$1 = [];
    this._m_FieldItems$1 = [];
    Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ScopeEditorModalBoxScript.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ScopeEditorModalBoxScript.prototype = {
    m_ScopeDataStr: null,
    m_FieldDictionaryDataStr: null,
    m_AddIconUrl: null,
    m_DeleteIconUrl: null,
    m_MainPanelElem: null,
    m_STRING_NameLabel: null,
    m_STRING_DescriptionLabel: null,
    m_STRING_OptionalLabel: null,
    m_STRING_RulesLabel: null,
    m_STRING_AddRule: null,
    m_STRING_DeleteRule: null,
    m_STRING_ApplyButton: null,
    m_STRING_CancelButton: null,
    m_STRING_TypeFreeText: null,
    m_STRING_TypeWebAddress: null,
    m_STRING_TypeField: null,
    m_STRING_ActionRequire: null,
    m_STRING_ActionInclude: null,
    m_STRING_ActionExclude: null,
    _m_ScopeData$1: null,
    _m_FieldDictionaryData$1: null,
    _m_MainPanelTableElem$1: null,
    _m_NameInputElem$1: null,
    _m_DescriptionInputElem$1: null,
    _m_RuleTableElem$1: null,
    _m_AddRuleAnchorElem$1: null,
    _m_AddRuleClickHandler$1: null,
    _m_AddRuleDblClickHandler$1: null,
    _m_ApplyInputElem$1: null,
    _m_ApplyButtonClickHandler$1: null,
    _m_CancelInputElem$1: null,
    _m_CancelButtonClickHandler$1: null,
    _m_DialogMouseUpHandler$1: null,
    _m_FieldPopupDivElem$1: null,
    _m_SelectedFieldItem: null,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeEditorModalBoxScript$initialize() {
        Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ScopeEditorModalBoxScript.callBaseMethod(this, 'initialize');
        this._m_ScopeData$1 = new Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeData(Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeRawData.parse(this.m_ScopeDataStr || ''));
        this._m_FieldDictionaryData$1 = new Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeFieldDictionaryData(Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeRawData.parse(this.m_FieldDictionaryDataStr || ''));
        var rowElem;
        var cellElem;
        var spanElem;
        this._m_MainPanelTableElem$1 = document.createElement('table');
        this._m_MainPanelTableElem$1.style.width = '100%';
        rowElem = document.createElement('tr');
        cellElem = document.createElement('td');
        cellElem.className = 'CesNameColumn';
        cellElem.innerText = this.m_STRING_NameLabel;
        rowElem.appendChild(cellElem);
        cellElem = document.createElement('td');
        cellElem.className = 'CesDescriptionColumn';
        spanElem = document.createElement('span');
        spanElem.innerText = this.m_STRING_DescriptionLabel;
        cellElem.appendChild(spanElem);
        spanElem = document.createElement('span');
        spanElem.className = 'CesOptionalCaption';
        spanElem.innerText = this.m_STRING_OptionalLabel;
        cellElem.appendChild(spanElem);
        rowElem.appendChild(cellElem);
        this._m_MainPanelTableElem$1.appendChild(rowElem);
        rowElem = document.createElement('tr');
        cellElem = document.createElement('td');
        cellElem.className = 'CesNameColumn';
        this._m_NameInputElem$1 = document.createElement('input');
        this._m_NameInputElem$1.type = 'text';
        this._m_NameInputElem$1.value = this._m_ScopeData$1.get_name();
        this._m_NameInputElem$1.style.paddingLeft = '0px';
        this._m_NameInputElem$1.style.paddingRight = '0px';
        cellElem.appendChild(this._m_NameInputElem$1);
        rowElem.appendChild(cellElem);
        cellElem = document.createElement('td');
        cellElem.className = 'CesDescriptionColumn';
        this._m_DescriptionInputElem$1 = document.createElement('input');
        this._m_DescriptionInputElem$1.type = 'text';
        this._m_DescriptionInputElem$1.value = this._m_ScopeData$1.get_description();
        this._m_DescriptionInputElem$1.style.paddingLeft = '0px';
        this._m_DescriptionInputElem$1.style.paddingRight = '0px';
        cellElem.appendChild(this._m_DescriptionInputElem$1);
        rowElem.appendChild(cellElem);
        this._m_MainPanelTableElem$1.appendChild(rowElem);
        rowElem = document.createElement('tr');
        cellElem = document.createElement('td');
        cellElem.colSpan = 2;
        cellElem.className = 'CesTopInterSpacing';
        cellElem.innerText = this.m_STRING_RulesLabel;
        rowElem.appendChild(cellElem);
        this._m_MainPanelTableElem$1.appendChild(rowElem);
        rowElem = document.createElement('tr');
        cellElem = document.createElement('td');
        cellElem.colSpan = 2;
        var ruleListDivElem = document.createElement('div');
        ruleListDivElem.className = 'CesScrollableList';
        this._m_RuleTableElem$1 = document.createElement('table');
        this._m_RuleTableElem$1.className = 'CesGridTable';
        var $enum1 = ss.IEnumerator.getEnumerator(this._m_ScopeData$1.get_rules());
        while ($enum1.moveNext()) {
            var ruleData = $enum1.current;
            this._addRuleTableRow$1(ruleData, false);
        }
        ruleListDivElem.appendChild(this._m_RuleTableElem$1);
        cellElem.appendChild(ruleListDivElem);
        rowElem.appendChild(cellElem);
        this._m_MainPanelTableElem$1.appendChild(rowElem);
        rowElem = document.createElement('tr');
        cellElem = document.createElement('td');
        cellElem.className = 'CesAddRuleCell';
        this._m_AddRuleAnchorElem$1 = document.createElement('a');
        this._m_AddRuleAnchorElem$1.className = 'CesIconButton';
        var addImageElem = document.createElement('img');
        addImageElem.src = this.m_AddIconUrl;
        this._m_AddRuleAnchorElem$1.appendChild(addImageElem);
        spanElem = document.createElement('span');
        spanElem.innerText = this.m_STRING_AddRule;
        this._m_AddRuleAnchorElem$1.appendChild(spanElem);
        this._m_AddRuleClickHandler$1 = ss.Delegate.create(this, this._addRule_Click$1);
        this._m_AddRuleAnchorElem$1.attachEvent('onclick', this._m_AddRuleClickHandler$1);
        this._m_AddRuleDblClickHandler$1 = ss.Delegate.create(this, this._addRule_DblClick$1);
        this._m_AddRuleAnchorElem$1.attachEvent('ondblclick', this._m_AddRuleDblClickHandler$1);
        cellElem.appendChild(this._m_AddRuleAnchorElem$1);
        rowElem.appendChild(cellElem);
        cellElem = document.createElement('td');
        cellElem.className = 'CesButtonPanelCell CesTopInterSpacing';
        this._m_ApplyInputElem$1 = document.createElement('input');
        this._m_ApplyInputElem$1.type = 'button';
        this._m_ApplyInputElem$1.className = 'CesButton';
        this._m_ApplyInputElem$1.value = this.m_STRING_ApplyButton;
        this._m_ApplyButtonClickHandler$1 = ss.Delegate.create(this, this._applyButton_Click$1);
        this._m_ApplyInputElem$1.attachEvent('onclick', this._m_ApplyButtonClickHandler$1);
        cellElem.appendChild(this._m_ApplyInputElem$1);
        this._m_CancelInputElem$1 = document.createElement('input');
        this._m_CancelInputElem$1.type = 'button';
        this._m_CancelInputElem$1.className = 'CesButton';
        this._m_CancelInputElem$1.value = this.m_STRING_CancelButton;
        this._m_CancelButtonClickHandler$1 = ss.Delegate.create(this, this._cancelButton_Click$1);
        this._m_CancelInputElem$1.attachEvent('onclick', this._m_CancelButtonClickHandler$1);
        cellElem.appendChild(this._m_CancelInputElem$1);
        rowElem.appendChild(cellElem);
        this._m_MainPanelTableElem$1.appendChild(rowElem);
        this.m_MainPanelElem.appendChild(this._m_MainPanelTableElem$1);
        this._m_DialogMouseUpHandler$1 = ss.Delegate.create(this, this._mouse_Events$1);
        this.m_MainPanelElem.attachEvent('onmouseup', this._m_DialogMouseUpHandler$1);
        this._m_NameInputElem$1.focus();
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeEditorModalBoxScript$tearDown() {
        this._closeFieldPopup$1();
        this.m_MainPanelElem.detachEvent('onmouseup', this._m_DialogMouseUpHandler$1);
        this._m_DialogMouseUpHandler$1 = null;
        this._m_AddRuleAnchorElem$1.detachEvent('onclick', this._m_AddRuleClickHandler$1);
        this._m_AddRuleClickHandler$1 = null;
        this._m_AddRuleAnchorElem$1.detachEvent('ondblclick', this._m_AddRuleDblClickHandler$1);
        this._m_AddRuleDblClickHandler$1 = null;
        this._m_ApplyInputElem$1.detachEvent('onclick', this._m_ApplyButtonClickHandler$1);
        this._m_ApplyButtonClickHandler$1 = null;
        this._m_CancelInputElem$1.detachEvent('onclick', this._m_CancelButtonClickHandler$1);
        this._m_CancelButtonClickHandler$1 = null;
        var $enum1 = ss.IEnumerator.getEnumerator(this._m_RuleArray$1);
        while ($enum1.moveNext()) {
            var ruleScript = $enum1.current;
            ruleScript._m_RuleTypeSelectElem.detachEvent('onchange', ruleScript._m_RuleTypeChangeHandler);
            ruleScript._m_RuleTypeChangeHandler = null;
            ruleScript._m_DeleteImageElem.detachEvent('onclick', ruleScript._m_DeleteClickHandler);
            ruleScript._m_DeleteClickHandler = null;
            ruleScript._m_DeleteImageElem.detachEvent('ondblclick', ruleScript._m_DeleteDblClickHandler);
            ruleScript._m_DeleteDblClickHandler = null;
            if (ruleScript._m_FieldNameInputElem != null) {
                ruleScript._m_FieldNameInputElem.detachEvent('onblur', ruleScript._m_FieldNameBlurHandler);
                ruleScript._m_FieldNameInputElem.detachEvent('onkeydown', ruleScript._m_FieldNameChangeHandler);
            }
        }
        Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ScopeEditorModalBoxScript.callBaseMethod(this, 'tearDown');
    },
    
    _addRuleTableRow$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeEditorModalBoxScript$_addRuleTableRow$1(ruleData, focusFirstCell) {
        /// <summary>
        /// Creates a row and its child elements in <see cref="F:Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ScopeEditorModalBoxScript.m_RuleTableElem" /> for a given <see cref="T:Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleData" />.
        /// </summary>
        /// <param name="ruleData" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleData">
        /// The <see cref="T:Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleData" /> object for which to create the table row.
        /// </param>
        /// <param name="focusFirstCell" type="Boolean">
        /// Whether to focus the first cell or not.
        /// </param>
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(ruleData);
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(this._m_RuleTableElem$1);
        var buttonPanelRowElem = this._m_MainPanelTableElem$1.lastChild;
        this._m_MainPanelTableElem$1.removeChild(buttonPanelRowElem);
        var ruleScript = new Coveo.CES.Web.Search.Scripts.Controls.SharePoint._scopeEditorRuleScript();
        var ruleRowElem = document.createElement('tr');
        var ruleCellElem;
        ruleCellElem = document.createElement('td');
        ruleCellElem.className = 'CesDropDownCell';
        ruleScript._m_RuleTypeSelectElem = document.createElement('select');
        var ruleTypeEnums = [ 0, 1, 2 ];
        var ruleTypeNames = [ this.m_STRING_TypeFreeText, this.m_STRING_TypeWebAddress, this.m_STRING_TypeField ];
        for (var ruleTypeNo = 0; ruleTypeNo < ruleTypeEnums.length; ++ruleTypeNo) {
            var optionElem = document.createElement('option');
            optionElem.value = (ruleTypeEnums[ruleTypeNo]).toString();
            optionElem.innerText = ruleTypeNames[ruleTypeNo];
            optionElem.selected = (ruleData.get_ruleType() === ruleTypeEnums[ruleTypeNo]);
            ruleScript._m_RuleTypeSelectElem.appendChild(optionElem);
        }
        ruleScript._m_RuleTypeChangeHandler = ss.Delegate.create(this, this._ruleType_Change$1);
        ruleScript._m_RuleTypeSelectElem.attachEvent('onchange', ruleScript._m_RuleTypeChangeHandler);
        ruleCellElem.appendChild(ruleScript._m_RuleTypeSelectElem);
        ruleRowElem.appendChild(ruleCellElem);
        ruleCellElem = document.createElement('td');
        ruleCellElem.className = 'CesDropDownCell';
        ruleScript._m_RuleActionSelectElem = document.createElement('select');
        var ruleActionEnums = [ 0, 1, 2 ];
        var ruleActionNames = [ this.m_STRING_ActionRequire, this.m_STRING_ActionInclude, this.m_STRING_ActionExclude ];
        for (var ruleActionNo = 0; ruleActionNo < ruleActionEnums.length; ++ruleActionNo) {
            var optionElem = document.createElement('option');
            optionElem.value = (ruleActionEnums[ruleActionNo]).toString();
            optionElem.innerText = ruleActionNames[ruleActionNo];
            optionElem.selected = (ruleData.get_ruleAction() === ruleActionEnums[ruleActionNo]);
            ruleScript._m_RuleActionSelectElem.appendChild(optionElem);
        }
        ruleCellElem.appendChild(ruleScript._m_RuleActionSelectElem);
        ruleRowElem.appendChild(ruleCellElem);
        ruleCellElem = document.createElement('td');
        ruleCellElem.className = 'CesIconCell';
        ruleScript._m_DeleteImageElem = document.createElement('img');
        ruleScript._m_DeleteImageElem.className = 'CesIconButton';
        ruleScript._m_DeleteImageElem.src = this.m_DeleteIconUrl;
        ruleScript._m_DeleteImageElem.title = this.m_STRING_DeleteRule;
        ruleScript._m_DeleteClickHandler = ss.Delegate.create(this, this._deleteRule_Click$1);
        ruleScript._m_DeleteImageElem.attachEvent('onclick', ruleScript._m_DeleteClickHandler);
        ruleScript._m_DeleteDblClickHandler = ss.Delegate.create(this, this._deleteRule_DblClick$1);
        ruleScript._m_DeleteImageElem.attachEvent('ondblclick', ruleScript._m_DeleteDblClickHandler);
        ruleCellElem.appendChild(ruleScript._m_DeleteImageElem);
        ruleRowElem.appendChild(ruleCellElem);
        this._insertRuleTypeSpecificCellsToTableRow$1(ruleData, ruleScript, ruleRowElem);
        this._m_RuleTableElem$1.appendChild(ruleRowElem);
        this._m_MainPanelTableElem$1.appendChild(buttonPanelRowElem);
        ArrayPrototype_add(this._m_RuleArray$1, ruleScript);
        if (focusFirstCell) {
            ruleScript._m_RuleTypeSelectElem.focus();
        }
    },
    
    _insertRuleTypeSpecificCellsToTableRow$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeEditorModalBoxScript$_insertRuleTypeSpecificCellsToTableRow$1(ruleData, ruleScript, ruleRowElem) {
        /// <summary>
        /// Inserts the cells to a rule row that are different depending on the rule type.
        /// </summary>
        /// <param name="ruleData" type="Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleData">
        /// The <see cref="T:Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleData" /> object for which to create the table cells.
        /// </param>
        /// <param name="ruleScript" type="Coveo.CES.Web.Search.Scripts.Controls.SharePoint._scopeEditorRuleScript">
        /// The <see cref="T:Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ScopeEditorRuleScript" /> object for which to create the table cells.
        /// </param>
        /// <param name="ruleRowElem" type="Object" domElement="true">
        /// The row to which to add the cells.
        /// </param>
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(ruleData);
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(ruleScript);
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(ruleRowElem);
        var ruleCellElem;
        var cellIndex = 1;
        if (ruleData.get_ruleType() !== 2) {
            Coveo.CNL.Web.Scripts.CNLAssert.check(!ruleData.get_ruleType() || ruleData.get_ruleType() === 1);
            ruleCellElem = document.createElement('td');
            ruleCellElem.className = 'CesTextBoxCell CesContentTextBoxCell';
            ruleCellElem.colSpan = 3;
            ruleScript._m_ContentInputElem = document.createElement('input');
            ruleScript._m_ContentInputElem.type = 'text';
            ruleScript._m_ContentInputElem.value = ruleData.get_content();
            ruleCellElem.appendChild(ruleScript._m_ContentInputElem);
            ruleRowElem.insertBefore(ruleCellElem, ruleRowElem.children[cellIndex++]);
        }
        else {
            ruleCellElem = document.createElement('td');
            ruleCellElem.className = 'CesTextBoxCell CesFieldNameTextBoxCell';
            ruleScript._m_FieldNameInputElem = document.createElement('input');
            ruleScript._m_FieldNameInputElem.type = 'text';
            ruleScript._m_FieldNameInputElem.value = ruleData.get_fieldName();
            ruleScript._m_FieldNameChangeHandler = ss.Delegate.create(this, this._fieldName_KeyDown$1);
            ruleScript._m_FieldNameInputElem.attachEvent('onkeydown', ruleScript._m_FieldNameChangeHandler);
            ruleScript._m_FieldNameBlurHandler = ss.Delegate.create(this, this._fieldName_Blur$1);
            ruleScript._m_FieldNameInputElem.attachEvent('onblur', ruleScript._m_FieldNameBlurHandler);
            ruleCellElem.appendChild(ruleScript._m_FieldNameInputElem);
            ruleRowElem.insertBefore(ruleCellElem, ruleRowElem.children[cellIndex++]);
            ruleCellElem = document.createElement('td');
            ruleCellElem.style.paddingLeft = '9px';
            ruleCellElem.style.paddingRight = '10px';
            ruleCellElem.innerText = '=';
            ruleRowElem.insertBefore(ruleCellElem, ruleRowElem.children[cellIndex++]);
            ruleCellElem = document.createElement('td');
            ruleCellElem.className = 'CesTextBoxCell CesFieldValueTextBoxCell';
            ruleScript._m_ContentInputElem = document.createElement('input');
            ruleScript._m_ContentInputElem.type = 'text';
            ruleScript._m_ContentInputElem.value = ruleData.get_content();
            ruleCellElem.appendChild(ruleScript._m_ContentInputElem);
            ruleRowElem.insertBefore(ruleCellElem, ruleRowElem.children[cellIndex++]);
        }
    },
    
    _findModifiedFieldNameIndex$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeEditorModalBoxScript$_findModifiedFieldNameIndex$1() {
        /// <summary>
        /// Finds the index of the rule whose field name text box just triggered an event.
        /// </summary>
        /// <returns type="Number" integer="true"></returns>
        var fieldNameInputElem = window.event.srcElement;
        var ruleNo = 0;
        while (ruleNo < this._m_RuleArray$1.length && fieldNameInputElem !== (this._m_RuleArray$1[ruleNo])._m_FieldNameInputElem) {
            ++ruleNo;
        }
        return ruleNo;
    },
    
    _createFieldPopup$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeEditorModalBoxScript$_createFieldPopup$1(ruleNo) {
        /// <summary>
        /// Creates and shows the field name completion popup for the text entered so far by the user.
        /// </summary>
        /// <param name="ruleNo" type="Number" integer="true">
        /// </param>
        window.setTimeout(ss.Delegate.create(this, function() {
            this._closeFieldPopup$1();
            var ruleScript = this._m_RuleArray$1[ruleNo];
            var fieldNamePart = ruleScript._m_FieldNameInputElem.value.trim().toLowerCase();
            if (!String.isNullOrEmpty(fieldNamePart)) {
                this._m_FieldPopupDivElem$1 = document.createElement('div');
                this._m_FieldPopupDivElem$1.className = 'CesScopeEditorPopupMenu';
                this._m_FieldPopupDivElem$1.style.zIndex = Coveo.CNL.Web.Scripts.DOMUtilities.getNextHighestZindex();
                this._m_FieldPopupDivElem$1.style.maxHeight = '302px';
                this._m_FieldPopupDivElem$1.style.overflowY = 'scroll';
                var fieldIndex = 0;
                var $enum1 = ss.IEnumerator.getEnumerator(this._m_FieldDictionaryData$1);
                while ($enum1.moveNext()) {
                    var fieldData = $enum1.current;
                    if (fieldData.get_name().indexOf(fieldNamePart) !== -1) {
                        var fieldScript = new Coveo.CES.Web.Search.Scripts.Controls.SharePoint._scopeEditorFieldScript();
                        fieldScript.modalBox = this;
                        fieldScript.ruleScript = ruleScript;
                        fieldScript.index = fieldIndex;
                        fieldScript.element = document.createElement('div');
                        fieldScript.element.className = 'CesScopeEditorPopupMenuItem';
                        fieldScript.element.innerText = fieldData.get_name();
                        this._m_FieldPopupDivElem$1.appendChild(fieldScript.element);
                        fieldScript.initialize();
                        ArrayPrototype_add(this._m_FieldItems$1, fieldScript);
                        ++fieldIndex;
                    }
                }
                document.documentElement.getElementsByTagName('form')[0].appendChild(this._m_FieldPopupDivElem$1);
                Coveo.CNL.Web.Scripts.DOMUtilities.positionElement(this._m_FieldPopupDivElem$1, ruleScript._m_FieldNameInputElem, Coveo.CNL.Web.Scripts.PositionEnum.belowLeft);
            }
        }), 0);
    },
    
    _closeFieldPopup$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeEditorModalBoxScript$_closeFieldPopup$1() {
        /// <summary>
        /// Closes and releases the field name completion popup.
        /// </summary>
        if (this._m_FieldPopupDivElem$1 != null) {
            var $enum1 = ss.IEnumerator.getEnumerator(this._m_FieldItems$1);
            while ($enum1.moveNext()) {
                var item = $enum1.current;
                item.tearDown();
            }
            this._m_SelectedFieldItem = null;
            ArrayPrototype_clear(this._m_FieldItems$1);
            document.documentElement.getElementsByTagName('form')[0].removeChild(this._m_FieldPopupDivElem$1);
            this._m_FieldPopupDivElem$1 = null;
        }
    },
    
    _addRule_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeEditorModalBoxScript$_addRule_Click$1() {
        var ruleData = new Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleData(null);
        this._m_ScopeData$1.get_rules().add(ruleData);
        this._addRuleTableRow$1(ruleData, true);
    },
    
    _addRule_DblClick$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeEditorModalBoxScript$_addRule_DblClick$1() {
        if (Coveo.CNL.Web.Scripts.BrowserHelper.get_isIE()) {
            this._addRule_Click$1();
        }
        else {
            window.event.cancelBubble = true;
            window.event.returnValue = false;
        }
    },
    
    _deleteRule_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeEditorModalBoxScript$_deleteRule_Click$1() {
        var deleteImageElem = window.event.srcElement;
        var ruleNo = 0;
        while (ruleNo < this._m_RuleArray$1.length && deleteImageElem !== (this._m_RuleArray$1[ruleNo])._m_DeleteImageElem) {
            ++ruleNo;
        }
        this._m_RuleTableElem$1.removeChild(this._m_RuleTableElem$1.children[ruleNo]);
        this._m_ScopeData$1.get_rules().removeAt(ruleNo);
        ArrayPrototype_removeAt(this._m_RuleArray$1, ruleNo);
    },
    
    _deleteRule_DblClick$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeEditorModalBoxScript$_deleteRule_DblClick$1() {
        if (Coveo.CNL.Web.Scripts.BrowserHelper.get_isIE()) {
            this._deleteRule_Click$1();
        }
        else {
            window.event.cancelBubble = true;
            window.event.returnValue = false;
        }
    },
    
    _ruleType_Change$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeEditorModalBoxScript$_ruleType_Change$1() {
        var ruleTypeSelectElem = window.event.srcElement;
        var ruleNo = 0;
        while (ruleNo < this._m_RuleArray$1.length && ruleTypeSelectElem !== (this._m_RuleArray$1[ruleNo])._m_RuleTypeSelectElem) {
            ++ruleNo;
        }
        var ruleData = this._m_ScopeData$1.get_rules().get_item(ruleNo);
        var ruleScript = this._m_RuleArray$1[ruleNo];
        ruleData.set_content(ruleScript._m_ContentInputElem.value);
        if (ruleData.get_ruleType() === 2) {
            ruleData.set_fieldName(ruleScript._m_FieldNameInputElem.value);
        }
        var ruleRowElem = this._m_RuleTableElem$1.children[ruleNo];
        while (ruleRowElem.children.length > 3) {
            ruleRowElem.removeChild(ruleRowElem.children[1]);
        }
        ruleData.set_ruleType(parseInt(ruleTypeSelectElem.value));
        this._insertRuleTypeSpecificCellsToTableRow$1(ruleData, ruleScript, ruleRowElem);
    },
    
    _fieldName_Blur$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeEditorModalBoxScript$_fieldName_Blur$1() {
        if (!Coveo.CNL.Web.Scripts.BrowserHelper.get_isIE() || !this._m_FieldPopupDivElem$1.contains(document.activeElement)) {
            window.setTimeout(ss.Delegate.create(this, function() {
                this._closeFieldPopup$1();
            }), 200);
        }
    },
    
    _fieldName_KeyDown$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeEditorModalBoxScript$_fieldName_KeyDown$1() {
        var isSpecialKey = (window.event.keyCode === 9);
        if (this._m_FieldPopupDivElem$1 != null) {
            if (window.event.keyCode === 38) {
                if (this._m_FieldItems$1.length > 0) {
                    var selIndex;
                    if (this._m_SelectedFieldItem == null) {
                        selIndex = 0;
                    }
                    else {
                        selIndex = Math.max(this._m_SelectedFieldItem.index - 1, 0);
                    }
                    var newSelItem = this._m_FieldItems$1[selIndex];
                    newSelItem.item_MouseOver();
                    Coveo.CNL.Web.Scripts.CNLAssert.check(this._m_SelectedFieldItem === newSelItem);
                    if (newSelItem.element.offsetTop < newSelItem.element.parentNode.scrollTop) {
                        newSelItem.element.scrollIntoView(true);
                    }
                }
                window.event.cancelBubble = true;
                window.event.returnValue = false;
                isSpecialKey = true;
            }
            else if (window.event.keyCode === 40) {
                if (this._m_FieldItems$1.length > 0) {
                    var selIndex;
                    if (this._m_SelectedFieldItem == null) {
                        selIndex = 0;
                    }
                    else {
                        selIndex = Math.min(this._m_SelectedFieldItem.index + 1, this._m_FieldItems$1.length - 1);
                    }
                    var newSelItem = this._m_FieldItems$1[selIndex];
                    newSelItem.item_MouseOver();
                    Coveo.CNL.Web.Scripts.CNLAssert.check(this._m_SelectedFieldItem === newSelItem);
                    if (newSelItem.element.offsetTop + newSelItem.element.clientHeight > newSelItem.element.parentNode.scrollTop + newSelItem.element.parentNode.clientHeight) {
                        newSelItem.element.scrollIntoView(false);
                    }
                }
                window.event.cancelBubble = true;
                window.event.returnValue = false;
                isSpecialKey = true;
            }
            else if (window.event.keyCode === 13) {
                if (this._m_SelectedFieldItem != null && this._m_SelectedFieldItem.isSelected()) {
                    this._m_SelectedFieldItem.item_Click();
                }
                window.event.cancelBubble = true;
                window.event.returnValue = false;
                isSpecialKey = true;
            }
        }
        if (!isSpecialKey) {
            this._createFieldPopup$1(this._findModifiedFieldNameIndex$1());
        }
    },
    
    _fieldItemClicked: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeEditorModalBoxScript$_fieldItemClicked(p_Item) {
        /// <summary>
        /// The user clicked on an item in the field completion popup.
        /// </summary>
        /// <param name="p_Item" type="Coveo.CES.Web.Search.Scripts.Controls.SharePoint._scopeEditorFieldScript">
        /// The item clicked.
        /// </param>
        Coveo.CNL.Web.Scripts.CNLAssert.notNull(p_Item);
        p_Item.ruleScript._m_FieldNameInputElem.value = p_Item.element.innerText;
        this._closeFieldPopup$1();
        window.event.cancelBubble = true;
        window.event.returnValue = false;
    },
    
    _applyButton_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeEditorModalBoxScript$_applyButton_Click$1() {
        this._m_ScopeData$1.set_name(this._m_NameInputElem$1.value.trim());
        this._m_ScopeData$1.set_description(this._m_DescriptionInputElem$1.value.trim());
        for (var ruleNo = 0; ruleNo < this._m_ScopeData$1.get_rules().get_count(); ++ruleNo) {
            var ruleScript = this._m_RuleArray$1[ruleNo];
            var ruleData = this._m_ScopeData$1.get_rules().get_item(ruleNo);
            ruleData.set_ruleAction(parseInt(ruleScript._m_RuleActionSelectElem.value));
            ruleData.set_content(ruleScript._m_ContentInputElem.value.trim());
            if (ruleData.get_ruleType() === 2) {
                ruleData.set_fieldName(ruleScript._m_FieldNameInputElem.value.trim().toLowerCase());
            }
        }
        this.applyButtonClick(this._m_ScopeData$1.getRawData().streamAsString());
    },
    
    _cancelButton_Click$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeEditorModalBoxScript$_cancelButton_Click$1() {
        this.cancelButtonClick();
    },
    
    _mouse_Events$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeEditorModalBoxScript$_mouse_Events$1() {
        window.event.cancelBubble = true;
        window.event.returnValue = false;
    },
    
    applyButtonClick: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeEditorModalBoxScript$applyButtonClick(scopeDataStr) {
        /// <param name="scopeDataStr" type="String">
        /// </param>
    },
    
    cancelButtonClick: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ScopeEditorModalBoxScript$cancelButtonClick() {
    }
}


////////////////////////////////////////////////////////////////////////////////
// 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="_sP_MENU_COLOR$1" type="String" static="true">
    /// </field>
    /// <field name="_sP_ONMENUCLICK_ATTR_NAME$1" type="String" static="true">
    /// </field>
    /// <field name="_m_OnMouseOver$1" type="Function">
    /// </field>
    /// <field name="_m_OnMouseOut$1" type="Function">
    /// </field>
    /// <field name="_m_OnDwellEvent$1" type="Coveo.CNL.Web.Scripts.OnDwellEvent">
    /// </field>
    /// <field name="_m_OnClick$1" type="Function">
    /// </field>
    /// <field name="_m_Request$1" type="jQueryXmlHttpRequest">
    /// </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_ClickTimer$1" type="Coveo.CNL.Web.Scripts.Timeout">
    /// </field>
    /// <field name="_m_UrlPrefixForSp2007FilePathPatch$1" type="String">
    /// </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>
    /// <field name="m_SPVersion" type="String">
    /// </field>
    /// <field name="m_SPDeleteItemMessage" 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_OnClick$1: null,
    _m_Request$1: null,
    _m_IsBusy$1: false,
    _m_QueryDone$1: false,
    _m_MouseIsOver$1: false,
    _m_ContextIsInvalid$1: false,
    _m_ClickTimer$1: null,
    _m_UrlPrefixForSp2007FilePathPatch$1: null,
    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,
    m_SPVersion: null,
    m_SPDeleteItemMessage: 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, ss.Delegate.create(this, this._spTable_OnDwell$1));
        this._m_OnMouseOver$1 = ss.Delegate.create(this, this._onMouseOver$1);
        this._m_OnMouseOut$1 = ss.Delegate.create(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() {
        if (this._m_ClickTimer$1 != null) {
            this._m_ClickTimer$1.cancel();
        }
        if (this._m_Request$1 != null) {
            this._m_Request$1.abort();
            this._m_Request$1 = null;
        }
        if (this._m_OnClick$1 != null) {
            this.m_SPTable.detachEvent('onclick', this._m_OnClick$1);
            this._m_OnClick$1 = null;
        }
        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);
        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(null);
        }
    },
    
    _resetBorder$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ResultContextualMenu$_resetBorder$1(arg) {
        /// <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>
        /// <param name="arg" type="Object">
        /// </param>
        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(ss.Delegate.create(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="ElementEvent">
        /// 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.abort();
            this._m_Request$1 = null;
        }
        var uri = String.format(this.m_SiteUri + '/_layouts/CES/AttributesSelector.aspx?ListItemId={0}&ListId={1}', this.m_ListItemId, this.m_ListId);
        var options = {};
        options.dataType = 'jsonp';
        options.success = ss.Delegate.create(this, this._onRequestComplete$1);
        this._m_Request$1 = $.ajax(uri, options);
        this._m_ContextIsInvalid$1 = true;
    },
    
    _onRequestComplete$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ResultContextualMenu$_onRequestComplete$1(p_Data, p_TextStatus, p_Request) {
        /// <summary>
        /// Update the control with the contextual menu informations received from
        /// the installed service.
        /// </summary>
        /// <param name="p_Data" type="Object">
        /// </param>
        /// <param name="p_TextStatus" type="String">
        /// </param>
        /// <param name="p_Request" type="jQueryXmlHttpRequest">
        /// </param>
        Coveo.CNL.Web.Scripts.CNLAssert.check(p_Request === this._m_Request$1);
        this._m_Request$1 = null;
        this._m_QueryDone$1 = true;
        this._m_IsBusy$1 = false;
        var mergeWithContext = p_Data.MergeWithContext;
        if (mergeWithContext != null) {
            var context = eval(this.m_SPTable.getAttribute('CTXName').toString());
            Coveo.CNL.Web.Scripts.CNLAssert.notNull(context);
            $.extend(context, mergeWithContext);
            var attributesForTable = p_Data.AttributesForTable;
            Coveo.CNL.Web.Scripts.CNLAssert.notNull(attributesForTable);
            Coveo.CNL.Web.Scripts.CNLAssert.check(!!Object.getKeyCount(attributesForTable));
            var $dict1 = attributesForTable;
            for (var $key2 in $dict1) {
                var entry = { key: $key2, value: $dict1[$key2] };
                this.m_SPTable.setAttribute(entry.key, entry.value);
            }
            if (this.m_SPVersion === '2007') {
                var filePath = attributesForTable['DRef'];
                var fileUrl = attributesForTable['Url'];
                if (filePath != null && fileUrl != null) {
                    var curIndex = 0;
                    while (curIndex !== -1 && !fileUrl.startsWith(filePath.substr(curIndex) + '/')) {
                        curIndex = filePath.indexOf('/', curIndex + 1);
                        if (curIndex !== -1) {
                            ++curIndex;
                        }
                    }
                    if (curIndex !== -1) {
                        this._m_UrlPrefixForSp2007FilePathPatch$1 = encodeURIComponent(('/' + filePath.substr(0, curIndex)));
                    }
                }
            }
            this._m_ContextIsInvalid$1 = false;
            if (this._m_MouseIsOver$1) {
                this._handleSPOnItem$1();
                if (this.m_SPVersion === '2010' && (Coveo.CNL.Web.Scripts.BrowserHelper.get_isIE() || Coveo.CNL.Web.Scripts.BrowserHelper.get_isFirefox())) {
                    eval('if (typeof(currentCtx) != "undefined") window["ctx"+currentCtx.ctxId] = currentCtx;');
                }
            }
        }
    },
    
    _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 = '#b09460';
            this.m_SPTable.style.borderTopColor = '#b09460';
            this.m_SPTable.style.borderRightColor = '#b09460';
            this.m_SPTable.style.borderBottomColor = '#b09460';
            OnItem(this.m_SPTable);
            if (this.m_SPVersion === '2013') {
                eval('if (typeof(ctx) == "undefined" && typeof(currentCtx) != "undefined") { ctx = currentCtx; }');
            }
            if (this._m_OnClick$1 == null) {
                this._m_OnClick$1 = ss.Delegate.create(this, this._spTable_OnClick$1);
                this.m_SPTable.attachEvent('onclick', this._m_OnClick$1);
            }
        }
    },
    
    _spTable_OnClick$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ResultContextualMenu$_spTable_OnClick$1() {
        this._m_ClickTimer$1 = new Coveo.CNL.Web.Scripts.Timeout(ss.Delegate.create(this, this._clickTimer_Tick$1), null, 1);
    },
    
    _clickTimer_Tick$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ResultContextualMenu$_clickTimer_Tick$1(arg) {
        /// <summary>
        /// There are 2 problems with the Delete menu item:
        /// 1) First, users tend to believe that the delete fails.
        /// 2) Under SP 2007, deleting a doc item was failing.
        /// This method modifies SharePoint's javascript code to add an info message and fix the bug.
        /// </summary>
        /// <param name="arg" type="Object">
        /// </param>
        var deleteItemElem = this._findMenuItemElement$1(document.documentElement, 'ID_DeleteItem');
        if (deleteItemElem != null) {
            var codePrefix = "alert('" + this.m_SPDeleteItemMessage.replaceAll("'", "\\'") + "');";
            var codeSuffix = '';
            this._addCodeToDeleteMenuItem$1(deleteItemElem, codePrefix, codeSuffix, false);
        }
        var deleteDocitemElem = this._findMenuItemElement$1(document.documentElement, 'ID_DeleteDocItem');
        if (deleteDocitemElem != null) {
            var codePrefix = "alert('" + this.m_SPDeleteItemMessage.replaceAll("'", "\\'") + "');";
            var codeSuffix = '';
            if (this.m_SPVersion === '2007') {
                codePrefix += 'ctx=currentCtx;';
                codeSuffix += ';delete window.ctx;';
            }
            this._addCodeToDeleteMenuItem$1(deleteDocitemElem, codePrefix, codeSuffix, true);
        }
        if (this.m_SPVersion === '2013') {
            $(document).find('li').each(function(i, elem) {
                var itemCode = elem.getAttribute('onMenuClick');
                if (itemCode != null && itemCode.startsWith('STSNavigate(') && itemCode.indexOf('/Workflow.aspx') !== -1) {
                    var pos = itemCode.indexOf('://');
                    if (pos !== -1) {
                        pos = itemCode.indexOf('//', pos + 3);
                        if (pos !== -1) {
                            itemCode = itemCode.substr(0, pos) + itemCode.substr(pos + 1);
                            elem.setAttribute('onMenuClick', itemCode);
                        }
                    }
                }
            });
        }
        this._m_ClickTimer$1 = null;
    },
    
    _addCodeToDeleteMenuItem$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ResultContextualMenu$_addCodeToDeleteMenuItem$1(p_MenuItemElem, p_CodePrefix, p_CodeSuffix, p_PatchFilePath) {
        /// <summary>
        /// Add the hack javascript to a delete menu item.
        /// </summary>
        /// <param name="p_MenuItemElem" type="Object" domElement="true">
        /// Element of the menu item.
        /// </param>
        /// <param name="p_CodePrefix" type="String">
        /// Code to add before the existing SharePoint's javascript code.
        /// </param>
        /// <param name="p_CodeSuffix" type="String">
        /// Code to add after the existing SharePoint's javascript code.
        /// </param>
        /// <param name="p_PatchFilePath" type="Boolean">
        /// Whether to apply the patch for the file path.
        /// </param>
        var nbChanges = ((this.m_SPVersion === '2013') ? 1 : 2);
        var changeNo = 0;
        while (p_MenuItemElem != null && changeNo < nbChanges) {
            var itemCode = p_MenuItemElem.getAttribute('onMenuClick');
            if (itemCode != null && !itemCode.startsWith(p_CodePrefix)) {
                if (p_PatchFilePath && this._m_UrlPrefixForSp2007FilePathPatch$1 != null) {
                    var marker = '&owsfileref=';
                    var markerPos = itemCode.indexOf(marker);
                    if (markerPos !== -1) {
                        markerPos += marker.length;
                        itemCode = itemCode.substr(0, markerPos) + this._m_UrlPrefixForSp2007FilePathPatch$1 + itemCode.substr(markerPos);
                    }
                }
                itemCode = p_CodePrefix + itemCode + p_CodeSuffix;
                p_MenuItemElem.setAttribute('onMenuClick', itemCode);
                ++changeNo;
            }
            p_MenuItemElem = p_MenuItemElem.parentNode;
        }
    },
    
    _findMenuItemElement$1: function Coveo_CES_Web_Search_Scripts_Controls_SharePoint_ResultContextualMenu$_findMenuItemElement$1(p_Elem, p_SearchedID) {
        /// <summary>
        /// Recursively searches for the menu item in the DOM.
        /// </summary>
        /// <param name="p_Elem" type="Object" domElement="true">
        /// Current element in the recursive search.
        /// </param>
        /// <param name="p_SearchedID" type="String">
        /// ID of the element to find.
        /// </param>
        /// <returns type="Object" domElement="true"></returns>
        if (p_Elem.id === p_SearchedID && ((this.m_SPVersion === '2007') ? p_Elem.tagName === 'TD' : p_Elem.getAttribute('CUICommand') == null)) {
            return p_Elem;
        }
        var childColl = p_Elem.children;
        for (var childNo = 0; childNo < childColl.length; ++childNo) {
            var childFound = this._findMenuItemElement$1(childColl[childNo], p_SearchedID);
            if (childFound != null) {
                return childFound;
            }
        }
        return null;
    }
}


Type.registerNamespace('Coveo.CES.Web.Search.Scripts.Security');

////////////////////////////////////////////////////////////////////////////////
// Coveo.CES.Web.Search.Scripts.Security.ClaimsIdentityManagerScript

Coveo.CES.Web.Search.Scripts.Security.ClaimsIdentityManagerScript = function Coveo_CES_Web_Search_Scripts_Security_ClaimsIdentityManagerScript() {
    /// <summary>
    /// Client side code for the ClaimsIdentityManager class.
    /// </summary>
    /// <field name="m_ClaimsIdentityProviderPageUri" type="String">
    /// </field>
    Coveo.CES.Web.Search.Scripts.Security.ClaimsIdentityManagerScript.initializeBase(this);
}
Coveo.CES.Web.Search.Scripts.Security.ClaimsIdentityManagerScript.prototype = {
    m_ClaimsIdentityProviderPageUri: null,
    
    initialize: function Coveo_CES_Web_Search_Scripts_Security_ClaimsIdentityManagerScript$initialize() {
        if (!String.isNullOrEmpty(this.m_ClaimsIdentityProviderPageUri)) {
            window.setTimeout(ss.Delegate.create(this, this._navigateToClaimsIdentityProvider$1), 0);
        }
    },
    
    tearDown: function Coveo_CES_Web_Search_Scripts_Security_ClaimsIdentityManagerScript$tearDown() {
    },
    
    _navigateToClaimsIdentityProvider$1: function Coveo_CES_Web_Search_Scripts_Security_ClaimsIdentityManagerScript$_navigateToClaimsIdentityProvider$1() {
        Coveo.CNL.Web.Scripts.Ajax.AjaxManagerScript.get_current().blankElementsBeforeNavigation();
        var redirectUrl = this.m_ClaimsIdentityProviderPageUri;
        var hash = window.location.hash;
        if (!String.isNullOrEmpty(hash)) {
            if (hash.charAt(0) === '#') {
                hash = hash.substr(1);
            }
            if (hash.length > 1) {
                redirectUrl += '%23' + encodeURIComponent(hash);
            }
        }
        window.navigate(redirectUrl);
    }
}


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.Web.Search.SharePoint.SharePointScopes.SharePointScopeData.registerClass('Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeData', Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeBaseData);
Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeDictionaryData.registerClass('Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeDictionaryData', Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeDictionaryData);
Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeDefinitionsData.registerClass('Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeDefinitionsData', Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeBaseData);
Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeFieldData.registerClass('Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeFieldData', Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeBaseData);
Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeFieldDictionaryData.registerClass('Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeFieldDictionaryData', Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeDictionaryData);
Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleData.registerClass('Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleData', Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeBaseData);
Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleCollectionData.registerClass('Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeRuleCollectionData', Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeCollectionData);
Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeConfigData.registerClass('Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeConfigData', Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeBaseData);
Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeConfigDictionaryData.registerClass('Coveo.CES.Web.Search.SharePoint.SharePointScopes.SharePointScopeConfigDictionaryData', Coveo.CES.Web.Search.SharePoint.SharePointScopes.PropTreeDictionaryData);
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._facetScriptItem.registerClass('Coveo.CES.Web.Search.Scripts.Controls._facetScriptItem');
Coveo.CES.Web.Search.Scripts.Controls._facetScriptSearchItem.registerClass('Coveo.CES.Web.Search.Scripts.Controls._facetScriptSearchItem');
Coveo.CES.Web.Search.Scripts.Controls.LegacyFacetScript.registerClass('Coveo.CES.Web.Search.Scripts.Controls.LegacyFacetScript', Coveo.CNL.Web.Scripts.Ajax.AjaxTabableObjectScript);
Coveo.CES.Web.Search.Scripts.Controls._facetScriptAsyncItemCall.registerClass('Coveo.CES.Web.Search.Scripts.Controls._facetScriptAsyncItemCall');
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.FacetScriptFeedback.registerClass('Coveo.CES.Web.Search.Scripts.Controls.FacetScriptFeedback', Coveo.CNL.Web.Scripts.Ajax.Feedback);
Coveo.CES.Web.Search.Scripts.Controls.VerticalMasterAndDetailScript.registerClass('Coveo.CES.Web.Search.Scripts.Controls.VerticalMasterAndDetailScript', Coveo.CNL.Web.Scripts.Ajax.AjaxObjectScript);
Coveo.CES.Web.Search.Scripts.Controls.BaseChartScript.registerClass('Coveo.CES.Web.Search.Scripts.Controls.BaseChartScript', Coveo.CNL.Web.Scripts.Ajax.AjaxObjectScript);
Coveo.CES.Web.Search.Scripts.Controls.MasterAndDetailScript.registerClass('Coveo.CES.Web.Search.Scripts.Controls.MasterAndDetailScript', 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.AjaxTabableObjectScript);
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.FirstTimeSetupStatusScript.registerClass('Coveo.CES.Web.Search.Scripts.Controls.FirstTimeSetupStatusScript', 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.ResultSidePanelCloseLinkScript.registerClass('Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelCloseLinkScript', Coveo.CNL.Web.Scripts.Ajax.AjaxObjectScript);
Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelToModalBoxLinkScript.registerClass('Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelToModalBoxLinkScript', Coveo.CNL.Web.Scripts.Ajax.AjaxObjectScript);
Coveo.CES.Web.Search.Scripts.Controls.DateParamsScript.registerClass('Coveo.CES.Web.Search.Scripts.Controls.DateParamsScript', Coveo.CNL.Web.Scripts.Ajax.AjaxObjectScript);
Coveo.CES.Web.Search.Scripts.Controls.NoticesScript.registerClass('Coveo.CES.Web.Search.Scripts.Controls.NoticesScript', 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.TableResultListFunnelPopupScript.registerClass('Coveo.CES.Web.Search.Scripts.Controls.TableResultListFunnelPopupScript', Coveo.CNL.Web.Scripts.Ajax.AjaxTabableObjectScript);
Coveo.CES.Web.Search.Scripts.Controls.TableResultListScript.registerClass('Coveo.CES.Web.Search.Scripts.Controls.TableResultListScript', Coveo.CNL.Web.Scripts.Ajax.AjaxObjectScript);
Coveo.CES.Web.Search.Scripts.Controls.SilverlightMediaPlayer.registerClass('Coveo.CES.Web.Search.Scripts.Controls.SilverlightMediaPlayer', null, Coveo.CES.Web.Search.Scripts.Controls.IMediaPlayer);
Coveo.CES.Web.Search.Scripts.Controls.WindowsMediaPlayer.registerClass('Coveo.CES.Web.Search.Scripts.Controls.WindowsMediaPlayer', null, Coveo.CES.Web.Search.Scripts.Controls.IMediaPlayer);
Coveo.CES.Web.Search.Scripts.Controls._resultSidePanelHotSpotStateBeforeShowingPopup.registerClass('Coveo.CES.Web.Search.Scripts.Controls._resultSidePanelHotSpotStateBeforeShowingPopup');
Coveo.CES.Web.Search.Scripts.Controls._resultSidePanelHotSpotMouseState.registerClass('Coveo.CES.Web.Search.Scripts.Controls._resultSidePanelHotSpotMouseState');
Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript.registerClass('Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript', Coveo.CNL.Web.Scripts.Ajax.AjaxTabableObjectScript);
Coveo.CES.Web.Search.Scripts.Controls.ResultImagePresenterScript.registerClass('Coveo.CES.Web.Search.Scripts.Controls.ResultImagePresenterScript', 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.SharePoint.ScopeConfigEditorLinkButtonScript.registerClass('Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ScopeConfigEditorLinkButtonScript', Coveo.CNL.Web.Scripts.Ajax.AjaxObjectScript);
Coveo.CES.Web.Search.Scripts.Controls.SharePoint._scopeConfigEditorScopeScript.registerClass('Coveo.CES.Web.Search.Scripts.Controls.SharePoint._scopeConfigEditorScopeScript');
Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ScopeConfigEditorModalBoxScript.registerClass('Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ScopeConfigEditorModalBoxScript', Coveo.CNL.Web.Scripts.Ajax.AjaxObjectScript);
Coveo.CES.Web.Search.Scripts.Controls.SharePoint._scopeEditorRuleScript.registerClass('Coveo.CES.Web.Search.Scripts.Controls.SharePoint._scopeEditorRuleScript');
Coveo.CES.Web.Search.Scripts.Controls.SharePoint._scopeEditorFieldScript.registerClass('Coveo.CES.Web.Search.Scripts.Controls.SharePoint._scopeEditorFieldScript');
Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ScopeEditorModalBoxScript.registerClass('Coveo.CES.Web.Search.Scripts.Controls.SharePoint.ScopeEditorModalBoxScript', Coveo.CNL.Web.Scripts.Ajax.AjaxObjectScript);
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.Security.ClaimsIdentityManagerScript.registerClass('Coveo.CES.Web.Search.Scripts.Security.ClaimsIdentityManagerScript', 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.timeZoneParameter = 'tz';
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.interfaceToLoadParameter = 'sktl';
Coveo.CES.Common.SearchInterfaceQueryString.iconSizeParameter = 'is';
Coveo.CES.Common.SearchInterfaceQueryString.facetIdParameter = 'fa';
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.maxQuickViewSizeParameter = 'mqvs';
Coveo.CES.Common.SearchInterfaceQueryString.customContentRelayParameter = 'ccr';
Coveo.CES.Common.SearchInterfaceQueryString.xmlSearchParameter = 'xml';
Coveo.CES.Common.SearchInterfaceQueryString.exportToExcelParameter = 'xls';
Coveo.CES.Common.SearchInterfaceQueryString.excelXmlDataSourceParameter = 'exds';
Coveo.CES.Common.SearchInterfaceQueryString.openSearchParameter = 'opensearch';
Coveo.CES.Common.SearchInterfaceQueryString.openSearchSuggestParameter = 'opensearchsuggest';
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.caseIDParameter = 'caseid';
Coveo.CES.Common.SearchInterfaceQueryString.chartIDParameter = 'chart';
Coveo.CES.Common.SearchInterfaceQueryString.chartWidthParameter = 'width';
Coveo.CES.Common.SearchInterfaceQueryString.chartHeightParameter = 'height';
Coveo.CES.Common.SearchInterfaceQueryString.disableAnalyticsLoggingParameter = 'disableanalyticslogging';
Coveo.CES.Common.SearchInterfaceQueryString.searchBarParameter = 'searchbar';
Coveo.CES.Common.SearchInterfaceQueryString.searchBarInfoParameter = 'searchbarinfo';
Coveo.CES.Common.SearchInterfaceQueryString.searchBarVersionParameter = 'searchbarversion';
Coveo.CES.Common.SearchInterfaceQueryString.outlookVersion = 'oaiOutlookVersion';
Coveo.CES.Common.SearchInterfaceQueryString.searchBarAutoCompletionsParameter = 'searchbarcompletions';
Coveo.CES.Common.SearchInterfaceQueryString.outlookAddInParameter = 'outlookaddin';
Coveo.CES.Common.SearchInterfaceQueryString.outlookAddInIsCollapsedParameter = 'oaiIsCollapsed';
Coveo.CES.Common.SearchInterfaceQueryString.outlookSenderEmailParameter = 'senderemail';
Coveo.CES.Common.SearchInterfaceQueryString.outlookSubjectHash = 'subjecthash';
Coveo.CES.Common.SearchInterfaceQueryString.outlookSentOn = 'senton';
Coveo.CES.Common.SearchInterfaceQueryString.outlookBackgroundStyleColorPair = 'oaiBgColor';
Coveo.CES.Common.SearchInterfaceQueryString.outlookStyleFontFamilyPair = 'oaiFontFamily';
Coveo.CES.Common.SearchInterfaceQueryString.outlookSelectedStyleColorPair = 'oaiSelectedColor';
Coveo.CES.Common.SearchInterfaceQueryString.outlookSchemeName = 'oaiSchemeName';
Coveo.CES.Common.SearchInterfaceQueryString.outlookTabBackgroundStyleColorPair = 'oaiTabColor';
Coveo.CES.Common.SearchInterfaceQueryString.outlookStrokeStyleColorPair = 'oaiStrokeColor';
Coveo.CES.Common.SearchInterfaceQueryString.interfaceReloaded = 'itfrld';
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.FacetScript._s_Instances$1 = {};
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_DocumentKeyDownHandler$1 = null;
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_FocusControl$1 = null;
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_FocusFacet$1 = null;
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_ClickSeqNo$1 = 0;
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AsyncItemFacet$1 = null;
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchedFacet$1 = null;
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_WaitingForAjaxResponse$1 = 0;
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_ScrollPosBeforePostBack$1 = 0;
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_IgnoreNextFeedback$1 = false;
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchPopupShown$1 = false;
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchPopupScrollCausedByKeyUp$1 = false;
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchPopupScrollHeightBefore$1 = 0;
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchPopupScrollStartPos$1 = 0;
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_SearchPopupScrollTimer$1 = null;
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AnimDelta$1 = 0;
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_AnimTickNo$1 = 0;
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_MouseCapture$1 = null;
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_TopSpacerElem$1 = null;
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_BottomSpacerElem$1 = null;
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_LastFacetPositioned$1 = null;
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_CollapseTopSpacerTimer$1 = null;
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_FacetToHideDropDownFor$1 = null;
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_OutlookEllipsisTimer$1 = null;
Coveo.CES.Web.Search.Scripts.Controls.FacetScript._s_OutlookLastWidth$1 = -1;
Coveo.CES.Web.Search.Scripts.Controls.SearchControlScript._s_Instances$1 = {};
Coveo.CES.Web.Search.Scripts.Controls.FirstTimeSetupStatusScript._s_Instances$1 = {};
Coveo.CES.Web.Search.Scripts.Controls.FirstTimeSetupStatusScript._s_CurrentFeedbackIconElem$1 = null;
Coveo.CES.Web.Search.Scripts.Controls.FirstTimeSetupStatusScript._s_CurrentFeedbackIconSrc$1 = null;
Coveo.CES.Web.Search.Scripts.Controls.FirstTimeSetupStatusScript._s_CurrentFeedbackIconVisibility$1 = null;
Coveo.CES.Web.Search.Scripts.Controls._resultSidePanelHotSpotMouseState.biG_COORDINATE = 3000000;
Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_Instances$2 = [];
Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_CurrentlyShownInPopup$2 = null;
Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_CurrentlyHovered$2 = null;
Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_PopupMouseCapture$2 = null;
Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_HeaderAndBodyTimerDefaultMillis$2 = 0;
Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_SidePopupElemBeforeAsyncCall$2 = null;
Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_MoveResizePopupTimer$2 = null;
Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_MouseState$2 = new Coveo.CES.Web.Search.Scripts.Controls._resultSidePanelHotSpotMouseState();
Coveo.CES.Web.Search.Scripts.Controls.ResultSidePanelHotSpotScript._s_StateBeforeShowingPopup$2 = null;
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 = [];
};
_coveoDefineJQuery();
//****************************************************************************
// 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.getAttribute("coveopageurl"), '_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 this.contentWindow.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) {
        var newScroll = -1;
        var sameHoriz = false;
        var offsetElem;
        var offsetArray;
        var i;
        var doc;
        if ((CNL_IsIE() && !CNL_IsIE6()) || CNL_IsIE11PlusStandardMode()) {
            // The horizontal scroll of scrollIntoView works differently in IE than in other browser.
            // It tries to place the term on the left side of the frame, even when it's not neccessary.
            doc = this.GetDocument();
            if (CNL_IsStandard()) {
                doc = doc.documentElement;
            } else {
                doc = doc.body;
            }
            newScroll = doc.scrollLeft;

            // Calculates the X position of the term by adding every offsetLeft
            // until there is no offsetParent left (top of the frame is reached).
            var elemPosX = 0;
            offsetElem = elem;
            offsetArray = new Array();
            i = 0;
            do {
                offsetArray[i++] = offsetElem.scrollLeft;
                elemPosX += offsetElem.offsetLeft;
            } while (offsetElem = offsetElem.offsetParent);

            if (elemPosX < newScroll) {
                // We want the term on the left side, IE will do the job.
                newScroll = -1;
            } else if (elemPosX + elem.offsetWidth > newScroll + doc.clientWidth) {
                // We want the term on the right side.
                newScroll += (elemPosX + elem.offsetWidth) - (newScroll + doc.clientWidth);
            } else {
                // Otherwise, we want to keep the same horizontal scroll.
                sameHoriz = true;
            }
        }

        var recursiveScrollFn = function (p_Elem) {
            if (p_Elem != null && p_Elem.tagName.toUpperCase() != 'BODY') {
                recursiveScrollFn(p_Elem.parentNode);
            }
            p_Elem.scrollIntoView();
        }
        recursiveScrollFn(elem);

        if (newScroll != -1) {
            offsetElem = elem;
            i = 0;
            do {
                offsetElem.scrollLeft = (sameHoriz ? offsetArray[i++] : 0);
            } while (offsetElem = offsetElem.offsetParent);

            if (!sameHoriz) {
                doc.scrollLeft = newScroll;
            }
        }

        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

