//* 
//Title:      videotron.js
//Author:     nurun.com
//Updated:    April 2008

//Content:	- SLIDING NAV
//			- sIFR
//			- COLLAPSE TABLES
//			- IMAGE SIDE NAV
//			- FAQ COLLAPSE DEFINITION LIST
//			- SET SUBNAV HEIGHT
//			- LEGAL COLLPASE DEFINITION LIST 
//			- APPAREIL IMAGE NAV
//*/


// ------[ SLIDING NAV ]------------------------------------------------- //

/**
 * Extend string object with trim whitespace functions
 * Ex.: var myString = "     TEST     TEST     ";
 *      myString = myString.trim();  // 'TEST     TEST'
 *      myString = myString.ltrim(); // 'TEST     TEST     '
 *		myString = myString.rtrim(); // '     TEST     TEST'
 */
 	// Supprime les espaces en début ET fin de string
	String.prototype.trim=function(){
		return this.replace(/^\s*|\s*$/g,'');
	}
	// Supprime les espaces en début de string
	String.prototype.ltrim=function(){
		return this.replace(/^\s*/g,'');
	}
	// Supprime les espaces en fin de string
	String.prototype.rtrim=function(){
		return this.replace(/\s*$/g,'');
	}
/********** END STRING EXTEND **********/


if (typeof VIDEOTRON === "undefined" || !VIDEOTRON) {
    var VIDEOTRON = {};
}
if (typeof VIDEOTRON.widget === "undefined" || !VIDEOTRON.widget) {
    VIDEOTRON.widget = {};
}
if (typeof VIDEOTRON.util === "undefined" || !VIDEOTRON.util) {
    VIDEOTRON.util = {};
}

if (typeof VIDEOTRON_CONTENT === "undefined" || !VIDEOTRON_CONTENT) {
    var VIDEOTRON_CONTENT = document.getElementById('content');
}

/* Detecting IE */
function isIE() {
	return /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent);
}

/**
 * Creates a Panel Menu object
 * @param {String|HTMLElement} id The ID or reference to the parent element
 * @param {Object} userConfig The config object through which the panel menu is customized with optional parameters
 * @requires YAHOO.util.Dom
 * @requires YAHOO.util.Config
 * @return A Panel Menu object
 */
VIDEOTRON.widget.PanelMenu = function (id, userConfig) {
    var key;
    this.containerEl = YAHOO.util.Dom.get(id);
    if (this.containerEl) {
        this.id = this.containerEl.id;
        
        // Set default config values
        this.cfg = {
            CLASSNAME_PANEL: "panel",
            CLASSNAME_TITLE: "title",
            CLASSNAME_CONTENT: "content",
            CLASSNAME_TOGGLE: "toggle",
            CLASSNAME_OPEN: "open",
            CLASSNAME_CLOSED: "closed",
            baseFontSize: 13,
            panelAnimDuration: 0.75,
            contentAnimDuration: 0.75,
            openDelay: 0,
            minWidth: 100,
            marginOfError: 10
        };
        
        // Override defaults with user config values
        if (userConfig) {
            for (key in userConfig) {
                if (userConfig.hasOwnProperty(key)) {
                    this.cfg[key] = userConfig[key];
                }
            }
        }
        
        /* An array of HTMLElements each of which is designated a "panel" containing 
           a title, and contents, (all HTMLElements as well, defined by their class names).*/
        this.panelEls = [];
        
        // An array that will hold the panel objects created by the init function.
        this.panels = [];
    } else {
        throw "No container defined! Please provide either an ID or HTMLElement reference to the Panel Menu container.";
    }
};

VIDEOTRON.widget.PanelMenu.prototype.initContainer = function () {
    // Initialize parent container
    YAHOO.util.Event.addListener(this.containerEl, "click", this.clickHandler, this, true);
    YAHOO.util.Event.addListener(this.containerEl, "mouseover", this.overHandler, this, true);
    YAHOO.util.Event.addListener(this.containerEl, "mouseout", this.outHandler, this, true);
    YAHOO.util.Event.addListener(this.containerEl, "keyup", this.clickHandler, this, true);
    
    this.containerEl.style.position = "relative";
};

/**
 * Initializes Panels
 */
VIDEOTRON.widget.PanelMenu.prototype.initPanels = function () {
    // Shortcut to the PanelMenu states object
    var state = VIDEOTRON.widget.PanelMenu.state;

    // Cache class names used for fetching
    var el_className = this.cfg.CLASSNAME_PANEL;
    var title_className = this.cfg.CLASSNAME_TITLE;
    var content_className = this.cfg.CLASSNAME_CONTENT;
    var toggle_className = this.cfg.CLASSNAME_TOGGLE;
    
    this.panelEls = YAHOO.util.Dom.getElementsByClassName(el_className, null, this.containerEl);
    
    var i;
    var j;
    var key;
    var panel;
    var afterPanel;
    
    // Loop over panel HTML Elements and build panel objects using data gleaned from markup
    for (i = 0; this.panelEls[i]; i += 1) {
        // Get the panel element and give it an ID if it doesn't have one
        var el = this.panelEls[i];
        if (!el.id) {
            el.id = VIDEOTRON.util.generateId();
        }
        
        // Get the panel element's sibling panel elements
        var beforeEl = (this.panelEls[i - 1]) ? this.panelEls[i - 1] : null;
        var afterEl = (this.panelEls[i + 1]) ? this.panelEls[i + 1] : null;
        
        // Get the title element and its internal text
        var title = YAHOO.util.Dom.getElementsByClassName(title_className, null, el);
        title = (title && title[0]) || null;
        var title_txt = "";
        if (title) {
            title_txt = VIDEOTRON.util.getText(title);
        }
        
        // Get the content element
        var contents = YAHOO.util.Dom.getElementsByClassName(content_className, null, el);
        contents = contents || null;
        
        // Get the panel's minimum and maximum widths
        var margin = parseInt(YAHOO.util.Dom.getStyle(title, "margin-right"), 10);
        margin = (isNaN(margin)) ? 0 : margin;
        var minWidth = (title && title.offsetWidth + margin) || this.cfg.minWidth;
        var maxWidth = el.offsetWidth;
        
        // Is the panel open or closed by default?
        var panelState = (YAHOO.util.Dom.hasClass(el, "open")) ? state.OPEN : state.CLOSED;
        if (panelState === state.OPEN) {
            YAHOO.util.Dom.addClass(el, this.cfg.CLASSNAME_OPEN);
        } else {
            YAHOO.util.Dom.addClass(el, this.cfg.CLASSNAME_CLOSED);
        }
        
        // Create animation object
        var anim = new YAHOO.util.Anim(el);
        anim.duration = this.cfg.panelAnimDuration;
        anim.method = YAHOO.util.Easing.easeOutStrong; // using easeBothStrong plays havoc with collision detection routine
        
        // Build the panel object and store the properties
        this.panels[el.id] = new VIDEOTRON.widget.Panel(
            {
                el: el,
                beforeEl: beforeEl,
                afterEl: afterEl,
                maxWidth: maxWidth,
                totalMaxWidth: null,
                minWidth: minWidth,
                totalMinWidth: null,
                title: title,
                titleText: title_txt,
                contents: [],
                state: panelState,
                baseFontSize: this.cfg.baseFontSize,
                anim: anim
            });
        
        panel = this.panels[el.id];
        
        // Wire up events after panel is created (to be able to set it as anim scope)
        anim.onTween.subscribe(this.detectCollision, panel, this);
        anim.onStart.subscribe(this.handleContent, panel, this);
        
        // Store content element and its animation object
        for (j = 0; contents[j]; j += 1) {
            if (YAHOO.util.Dom.hasClass(contents[j], toggle_className)) {
                var contentAnim = new YAHOO.util.Anim(contents[j]);
                contentAnim.duration = this.cfg.contentAnimDuration;
                contentAnim.method = YAHOO.util.Easing.easeBothStrong;
                contentAnim.attributes.opacity = {
                    from: 1,
                    to: 0
                };
                panel.contents.push({
                    el: contents[j],
                    anim: contentAnim
                });
                YAHOO.util.Dom.setStyle(contents[j], "opacity", 0);
            }
        }
    }
    
    
    /* Go over panels again, this time to set relative widths with siblings which
     * wasn't possible in previous loop as all necessary data wasn't yet collected.
     * Note: This loop doesn't actually iterate over the panels array as it
     *       is a "hash" where the array items are indexed by element IDs rather
     *       than a counter integer. It is therefore impossible to do a reverse
     *       loop on such an array, and so I'm looping over the panel elements 
     *       array instead, which has the same count, and can use the panel
     *       element id as my pointer into the panels array.
     */
    var panelWidth;
    for (i = this.panelEls.length - 1; i >= 0; i -= 1) {
        panel = this.panels[this.panelEls[i].id];
        el = panel.el;
        afterEl = panel.afterEl;
        minWidth = panel.minWidth;
        maxWidth = panel.maxWidth;
        panel.totalMinWidth = minWidth + ((afterEl) ? this.panels[afterEl.id].totalMinWidth : 0);
        panel.totalMaxWidth = maxWidth + ((afterEl) ? this.panels[afterEl.id].totalMaxWidth : 0);
        el.style.position = "absolute";
        el.style.right = 0;
        // Don't size the first panel (serves as background panel, always visible)
        if (i !== 0) {
            if (panel.state === state.OPEN) {
                // If panel is open, give it its maximum width value
                panelWidth = maxWidth;
            } else if (afterEl) {
                /* If panel is not open and has a predecessor, give it its 
                   minimum width value plus its predecessors width value.
                   This compensates for the part of the panel hidden by its
                   predecessor panels. */
                panelWidth = minWidth + afterEl.offsetWidth;
            } else {
                /* If panel doesn't have a predecessor, i.e. is the last in the stack,
                   then simply give it its minimum width value. */
                panelWidth = minWidth;
            }
            el.style.width = panelWidth + "px";
        }
    }
};

VIDEOTRON.widget.PanelMenu.prototype.detectCollision = function (type, status, panel) {
    var marginOfError = this.cfg.marginOfError;
    var width = panel.el.offsetWidth;
    var minWidth = panel.minWidth;
    
    var before = this.panels[panel.beforeEl.id];
    var beforeWidth = null;
    var beforeMinWidth = null;
    if (before) {
        beforeWidth = before.el.offsetWidth;
        beforeMinWidth = before.minWidth;
        // Open collision detection
        if (width > (beforeWidth - beforeMinWidth + marginOfError)) {
            if (!before.anim.isAnimated()) {
                before.move(panel);
            }
        }
    }
    
    var after = this.panels[panel.afterEl.id];
    var afterWidth = null;
    if (after) {
        afterWidth = after.el.offsetWidth;
        // Close collision detection
        if (width < (afterWidth + minWidth - marginOfError)) {
            if (!after.anim.isAnimated()) {
                after.close(this);
            }
        }
    }
};

/**
 * Contains all possible states of a Panel Menu panel.
 * CLOSED: When a panel is in its most compressed form
 * OPEN: When a panel is open (exclusive)
 */
VIDEOTRON.widget.PanelMenu.state = {
    CLOSED: 0,
    OPEN: 1,
    MOVED: 2
};

/**
 * Trigger's the current panel's open method and the close method of the one
 * that comes after it.
 * @param {HTMLElement} panelEl The panel to open
 */
VIDEOTRON.widget.PanelMenu.prototype.openPanel = function (panelEl) {
    var panel = this.panels[panelEl.id];
	var state = VIDEOTRON.widget.PanelMenu.state;
	
    if (!panel.anim.isAnimated()) {
        panel.open(this, true);
    }
    
    var after = this.panels[panel.afterEl && panel.afterEl.id];
    if (after) {
        if (!after.anim.isAnimated()) {
			after.state = state.OPEN;
            after.close(this);
        }
    }
};

VIDEOTRON.widget.PanelMenu.prototype.handleContent = function (type, status, panel) {
    var state = VIDEOTRON.widget.PanelMenu.state;
    var before = this.panels[panel.beforeEl && panel.beforeEl.id];

    // Show or hide the panel's content
    if (panel.state === state.OPEN) {
        panel.openContents();
    } else if (panel.state === state.CLOSED) {
        panel.closeContents();
    }
    
     // If you're about to overlap a "before" panel which is open, then hide its toggle contents
    if (panel.state === state.OPEN && before && before.state === state.OPEN) {
        before.closeContents();
    } else if (panel.state === state.CLOSED && before && before.state === state.OPEN) {
        before.openContents();
    }
};

VIDEOTRON.widget.PanelMenu.prototype.clickHandler = function (e) {
    e = e || event;
    var target = e.target || e.srcElement;
    var delay = this.cfg.openDelay;
    var s_className = this.cfg.CLASSNAME_PANEL;
    
    window.clearTimeout(this.overTimer);
    
    while (target) {
        if (YAHOO.util.Dom.hasClass(target, s_className)) {
            this.openPanel(target);
            break;
        }
        target = target.parentNode;
    }
};

/**
 * Called by the mouseover event of the Panel Menu container element.
 * Finds the panel that's currently under the mouse and hands it off to
 * the openPanel method.
 */
VIDEOTRON.widget.PanelMenu.prototype.overHandler = function (e) {
    e = e || event;
    var target = e.target || e.srcElement;
    var delay = this.cfg.openDelay;
    var s_className = this.cfg.CLASSNAME_PANEL;
    
    window.clearTimeout(this.overTimer);
    
    while (target) {
        if (YAHOO.util.Dom.hasClass(target, s_className)) {
            this.overTimer = window.setTimeout(
                function (that, el) {
                    return function () {
                        that.openPanel(el);
                    }
                }(this, target),
                delay);
            break;
        }
        target = target.parentNode;
    }
};

/**
 * Clears the timer that's waiting to open a panel. This is so
 * that accidental momentary hovers over the nav don't trigger
 * an open event when the mouse hasn't stayed on the panel for
 * the prescribed period of time.
 */
VIDEOTRON.widget.PanelMenu.prototype.outHandler = function (e) {
    e = e || event;
    var target = e.relatedTarget || e.toElement;
    var outOfContainer = true;

    while (target) {
        if (target === this.containerEl) {
            outOfContainer = false;
            break;
        }
        /* Use a try/catch block here because Mozilla gets lost in anonymous 
           elements and throws permission errors when trying to access their 
           properties. */
        try {
            target = target.parentNode;
        } catch (err) {
            break;
        }
    }
    if (outOfContainer) {
        window.clearTimeout(this.overTimer);
    }
};

/**
 * Renders the Panel Menu. Sets the position, states and widths of all panels.
 */
VIDEOTRON.widget.PanelMenu.prototype.render = function () {
    var i;
    var state = VIDEOTRON.widget.PanelMenu.state;
    var panel;
    
    // Initialize the panel container
    this.initContainer();
    
    // Get and initialize panels
    this.initPanels();
    
    // Make container visible
    this.containerEl.style.visibility = "visible";

    // Open whichever panel is set to open
    for (i = 0; this.panelEls[i]; i += 1) {
        panel = this.panels[this.panelEls[i].id];
        if (panel.state === state.OPEN) {
            panel.state = state.CLOSED; // otherwise open method will see that it's already open and do nothing
            panel.open(this);
        }
    }
};

/**
 * Identify this object as being a Panel Menu object coupled with its ID
 */
VIDEOTRON.widget.PanelMenu.prototype.toString = function () {
    return "PanelMenu#" + this.id;
};

/**
 * Creates a panel object and appends to it params passed to it from the initPanel method
 * @constructor
 * @param {Object} params An object containing key value pairs
 */
VIDEOTRON.widget.Panel = function (params) {
    var key;
    for (key in params) {
        if (params.hasOwnProperty(key)) {
            this[key] = params[key];
        }
    }
    this.id = "panel-" + this.el.id;
};

/**
 * Opens a panel object by widening its HTML element.
 * @param {Object} panelMenuObj A reference to the panel menu object in order 
 *                              to access the panels collection
 */
VIDEOTRON.widget.Panel.prototype.open = function (panelMenuObj) {
    var state = VIDEOTRON.widget.PanelMenu.state;
    var after;
	var before;
    var i;
    
	if(this.beforeEl) {
		before = panelMenuObj.panels[this.beforeEl.id];
	}
    // Don't do anything if the panel is already open
    if (this.state === state.OPEN) {
        return;
    } else if (!this.contents.length) {
		this.state = state.OPEN;
		if(before && before.state === state.OPEN) {
			before.close(panelMenuObj);
		}
		return;
    }
	
    this.state = state.OPEN;
    if (this.afterEl) {
        after = panelMenuObj.panels[this.afterEl.id];
    }
    var currWidth = this.el.offsetWidth;
    var newWidth = this.maxWidth;
    
    var containerX = YAHOO.util.Dom.getX(panelMenuObj.containerEl)
    var panelX = YAHOO.util.Dom.getX(this.el);

    if (containerX < panelX) {
        newWidth += (after && after.totalMinWidth) || 0;
    }
    this.anim.attributes.width = {
        from: currWidth,
        to: newWidth,
        unit: "px"
    };
    YAHOO.util.Dom.removeClass(this.el, panelMenuObj.cfg.CLASSNAME_CLOSED);
    YAHOO.util.Dom.addClass(this.el, panelMenuObj.cfg.CLASSNAME_OPEN);
    this.anim.animate();
};

/**
 * Moves a panel element out of the way of an opening sibling by 
 * increasing its width by the amount its sibling is growing.
 * @method
 * @param {Object} after A panel object referring to the panel that comes after
 *                       the one needing to be moved. Passed to gain access to 
 *                       the "after panel's" maxWidth value.
 */
VIDEOTRON.widget.Panel.prototype.move = function (after) {
    this.state = VIDEOTRON.widget.PanelMenu.state.MOVED;
    var currWidth = this.el.offsetWidth;
    var newWidth = this.minWidth + after.maxWidth;
    this.anim.attributes.width = {
        from: currWidth,
        to: newWidth,
        unit: "px"
    };
    this.anim.animate();
};

/**
 * Closes a panel object by shrinking its HTML element.
 * @param {Object} panelMenuObj A reference to the panel menu object in order 
 *                              to access the panels collection
 */
VIDEOTRON.widget.Panel.prototype.close = function (panelMenuObj) {
    var state = VIDEOTRON.widget.PanelMenu.state;
    var i;
    
    // Don't do anything if panel is already closed
    if (this.state === state.CLOSED) {
        return;
    }
    
    this.state = state.CLOSED;
    var currWidth = this.el.offsetWidth;
    var newWidth = this.totalMinWidth;
    this.anim.attributes.width = {
        from: currWidth,
        to: newWidth,
        unit: "px"
    };
    YAHOO.util.Dom.removeClass(this.el, panelMenuObj.cfg.CLASSNAME_OPEN);
    YAHOO.util.Dom.addClass(this.el, panelMenuObj.cfg.CLASSNAME_CLOSED);
    this.anim.animate();
};

VIDEOTRON.widget.Panel.prototype.closeContents = function () {
    for (i = 0; this.contents[i]; i += 1) {
        if (this.contents[i].anim) {
            this.contents[i].anim.stop()
            this.contents[i].anim.attributes.opacity = {to: 0};
            this.contents[i].anim.animate();
        }
    }
};

VIDEOTRON.widget.Panel.prototype.openContents = function () {
    for (i = 0; this.contents[i]; i += 1) {
        if (this.contents[i].anim) {
            this.contents[i].anim.stop()
            this.contents[i].anim.attributes.opacity = {to: 1};
            this.contents[i].anim.animate();
        }
    }
};


/**
 * Binds a set of child anchors to a parent container by assigning each
 * anchor's id as a class name of the parent container on hover. When the
 * mouse leaves the anchor, the class name is removed from the parent 
 * container. This allows for the manipulation of a sprite assigned
 * to the parent container relative to the current anchor being hovered on.
 * @param {String|HTMLElement} containerId The ID or reference to an element
 *                                         that is the sprite container within
 *                                         which are the links
 * @param {Object} userConfig An object literal allowing the specification of
 *                            either an ID or class name that contains the 
 *                            links. Valid keys are either "linksContainerId"
 *                            or "linksContainerClassName"
 */
VIDEOTRON.util.spriteNav = function (containerId, userConfig) {
    var containerEl = YAHOO.util.Dom.get(containerId);
    var linksContainerEl;
    var i;
    var a;
    
    if (userConfig) {
        if (userConfig.linksContainerId) {
            linksContainerEl = YAHOO.util.Dom.get(linksContainerId);
        } else if (userConfig.linksContainerClassName) {
            linksContainerEl = YAHOO.util.Dom.getElementsByClassName(userConfig.linksContainerClassName, null, containerEl)[0];
        }
    } else {
        linksContainerEl = containerEl;
    }
    var links = linksContainerEl.getElementsByTagName("a");
    for (i = 0; links[i]; i += 1) {
        a = links[i];
        a.onmouseover = function (containerEl) {
            return function () {
                if (!YAHOO.util.Dom.hasClass(containerEl, this.id)) {
                    YAHOO.util.Dom.addClass(containerEl, this.id);
                }
            }
        }(containerEl);
        a.onmouseout = function (containerEl) {
            return function () {
                YAHOO.util.Dom.removeClass(containerEl, this.id);
            }
        }(containerEl);
    }
};

/**
 * Extracts an HTML Element's inner text and returns it. This funciton's
 * purpose is to normalize cross browser methods for doing this into
 * one general purpose function.
 * @param {HTMLElement} el The HTML element whose text needs extracting
 * @return The HTML element's inner text
 * @type {String}
 */
VIDEOTRON.util.getText = function (el) {
    return el.innerText || el.textContent;
};

/**
 * Returns an incremented ID in the form of vid-gen0, vid-gen1, vid-gen(n)...
 * @return A unique string for use as an element ID
 * @type String
 */
VIDEOTRON.util.generateId = function () {
    if (typeof this.genIdCount === "undefined") this.genIdCount = -1;
    this.genIdCount += 1;
    return "vid-gen" + this.genIdCount;
};


// ------[ sIFR ]------------------------------------------------- //

/*	sIFR v2.0.6
	Copyright 2004 - 2008 Mark Wubben and Mike Davidson. Prior contributions by Shaun Inman and Tomas Jogin.
	
	This software is licensed under the CC-GNU LGPL <http://creativecommons.org/licenses/LGPL/2.1/>
*/

var hasFlash=function(){var a=6;if(navigator.appVersion.indexOf("MSIE")!=-1&&navigator.appVersion.indexOf("Windows")>-1){document.write('<script language="VBScript"\> \non error resume next \nhasFlash = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & '+a+'))) \n</script\> \n');if(window.hasFlash!=null)return window.hasFlash}if(navigator.mimeTypes&&navigator.mimeTypes["application/x-shockwave-flash"]&&navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){var b=(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description;return parseInt(b.substr(b.indexOf(".")-2,2),10)>=a}return false}();String.prototype.normalize=function(){return this.replace(/\s+/g," ")};if(Array.prototype.push==null){Array.prototype.push=function(){var i=0,a=this.length,b=arguments.length;while(i<b){this[a++]=arguments[i++]}return this.length}}if(!Function.prototype.apply){Function.prototype.apply=function(a,b){var c=[];var d,e;if(!a)a=window;if(!b)b=[];for(var i=0;i<b.length;i++){c[i]="b["+i+"]"}e="a.__applyTemp__("+c.join(",")+");";a.__applyTemp__=this;d=eval(e);a.__applyTemp__=null;return d}}function named(a){return new named.Arguments(a)}named.Arguments=function(a){this.oArgs=a};named.Arguments.prototype.constructor=named.Arguments;named.extract=function(a,b){var c,d;var i=a.length;while(i--){d=a[i];if(d!=null&&d.constructor!=null&&d.constructor==named.Arguments){c=a[i].oArgs;break}}if(c==null)return;for(e in c)if(b[e]!=null)b[e](c[e]);return};var parseSelector=function(){var a=/^([^#.>`]*)(#|\.|\>|\`)(.+)$/;function r(s,t){var u=s.split(/\s*\,\s*/);var v=[];for(var i=0;i<u.length;i++)v=v.concat(b(u[i],t));return v}function b(c,d,e){c=c.normalize().replace(" ","`");var f=c.match(a);var g,h,i,j,k,n;var l=[];if(f==null)f=[c,c];if(f[1]=="")f[1]="*";if(e==null)e="`";if(d==null)d=document;switch(f[2]){case "#":k=f[3].match(a);if(k==null)k=[null,f[3]];g=document.getElementById(k[1]);if(g==null||(f[1]!="*"&&!o(g,f[1])))return l;if(k.length==2){l.push(g);return l}return b(k[3],g,k[2]);case ".":if(e!=">")h=m(d,f[1]);else h=d.childNodes;for(i=0,n=h.length;i<n;i++){g=h[i];if(g.nodeType!=1)continue;k=f[3].match(a);if(k!=null){if(g.className==null||g.className.match("(\\s|^)"+k[1]+"(\\s|$)")==null)continue;j=b(k[3],g,k[2]);l=l.concat(j)}else if(g.className!=null&&g.className.match("(\\s|^)"+f[3]+"(\\s|$)")!=null)l.push(g)}return l;case ">":if(e!=">")h=m(d,f[1]);else h=d.childNodes;for(i=0,n=h.length;i<n;i++){g=h[i];if(g.nodeType!=1)continue;if(!o(g,f[1]))continue;j=b(f[3],g,">");l=l.concat(j)}return l;case "`":h=m(d,f[1]);for(i=0,n=h.length;i<n;i++){g=h[i];j=b(f[3],g,"`");l=l.concat(j)}return l;default:if(e!=">")h=m(d,f[1]);else h=d.childNodes;for(i=0,n=h.length;i<n;i++){g=h[i];if(g.nodeType!=1)continue;if(!o(g,f[1]))continue;l.push(g)}return l}}function m(d,o){if(o=="*"&&d.all!=null)return d.all;return d.getElementsByTagName(o)}function o(p,q){return q=="*"?true:p.nodeName.toLowerCase().replace("html:", "")==q.toLowerCase()}return r}();var sIFR=function(){var a="http://www.w3.org/1999/xhtml";var b=false;var c=false;var d;var ah=[];var al=document;var ak=al.documentElement;var am=window;var au=al.addEventListener;var av=am.addEventListener;var f=function(){var g=navigator.userAgent.toLowerCase();var f={a:g.indexOf("applewebkit")>-1,b:g.indexOf("safari")>-1,c:navigator.product!=null&&navigator.product.toLowerCase().indexOf("konqueror")>-1,d:g.indexOf("opera")>-1,e:al.contentType!=null&&al.contentType.indexOf("xml")>-1,f:true,g:true,h:null,i:null,j:null,k:null};f.l=f.a||f.c;f.m=!f.a&&navigator.product!=null&&navigator.product.toLowerCase()=="gecko";if(f.m&&g.match(/.*gecko\/(\d{8}).*/))f.j=new Number(g.match(/.*gecko\/(\d{8}).*/)[1]);f.n=g.indexOf("msie")>-1&&!f.d&&!f.l&&!f.m;f.o=f.n&&g.match(/.*mac.*/)!=null;if(f.d&&g.match(/.*opera(\s|\/)(\d+\.\d+)/))f.i=new Number(g.match(/.*opera(\s|\/)(\d+\.\d+)/)[2]);if(f.n||(f.d&&f.i<7.6))f.g=false;if(f.a&&g.match(/.*applewebkit\/(\d+).*/))f.k=new Number(g.match(/.*applewebkit\/(\d+).*/)[1]);if(am.hasFlash&&(!f.n||f.o)){var aj=(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description;f.h=parseInt(aj.charAt(aj.indexOf(".")-1))}if(g.match(/.*(windows|mac).*/)==null||f.o||f.c||(f.d&&(g.match(/.*mac.*/)!=null||f.i<7.6))||(f.b&&f.h<7)||(!f.b&&f.a&&f.k<312)||(f.m&&f.j<20020523))f.f=false;if(!f.o&&!f.m&&al.createElementNS)try{al.createElementNS(a,"i").innerHTML=""}catch(e){f.e=true}f.p=f.c||(f.a&&f.k<312);return f}();function at(){return{bIsWebKit:f.a,bIsSafari:f.b,bIsKonq:f.c,bIsOpera:f.d,bIsXML:f.e,bHasTransparencySupport:f.f,bUseDOM:f.g,nFlashVersion:f.h,nOperaVersion:f.i,nGeckoBuildDate:f.j,nWebKitVersion:f.k,bIsKHTML:f.l,bIsGecko:f.m,bIsIE:f.n,bIsIEMac:f.o,bUseInnerHTMLHack:f.p}}if(am.hasFlash==false||!al.getElementsByTagName||!al.getElementById||(f.e&&(f.p||f.n)))return{UA:at()};function af(e){if((!k.bAutoInit&&(am.event||e)!=null)||!l(e))return;b=true;for(var i=0,h=ah.length;i<h;i++)j.apply(null,ah[i]);ah=[]}var k=af;function l(e){if(c==false||k.bIsDisabled==true||((f.e&&f.m||f.l)&&e==null&&b==false)||al.getElementsByTagName("body").length==0)return false;return true}function m(n){if(f.n)return n.replace(new RegExp("%\d{0}","g"),"%25");return n.replace(new RegExp("%(?!\d)","g"),"%25")}function as(p,q){return q=="*"?true:p.nodeName.toLowerCase().replace("html:", "")==q.toLowerCase()}function o(p,q,r,s,t){var u="";var v=p.firstChild;var w,x,y,z;if(s==null)s=0;if(t==null)t="";while(v){if(v.nodeType==3){z=v.nodeValue.replace("<","&lt;");switch(r){case "lower":u+=z.toLowerCase();break;case "upper":u+=z.toUpperCase();break;default:u+=z}}else if(v.nodeType==1){if(as(v,"a")&&!v.getAttribute("href")==false){if(v.getAttribute("target"))t+="&sifr_url_"+s+"_target="+v.getAttribute("target");t+="&sifr_url_"+s+"="+m(v.getAttribute("href")).replace(/&/g,"%26");u+='<a href="asfunction:_root.launchURL,'+s+'">';s++}else if(as(v,"br"))u+="<br/>";if(v.hasChildNodes()){y=o(v,null,r,s,t);u+=y.u;s=y.s;t=y.t}if(as(v,"a"))u+="</a>"}w=v;v=v.nextSibling;if(q!=null){x=w.parentNode.removeChild(w);q.appendChild(x)}}return{"u":u,"s":s,"t":t}}function A(B){if(al.createElementNS&&f.g)return al.createElementNS(a,B);return al.createElement(B)}function C(D,E,z){var p=A("param");p.setAttribute("name",E);p.setAttribute("value",z);D.appendChild(p)}function F(p,G){var H=p.className;if(H==null)H=G;else H=H.normalize()+(H==""?"":" ")+G;p.className=H}function aq(ar){var a=ak;if(k.bHideBrowserText==false)a=al.getElementsByTagName("body")[0];if((k.bHideBrowserText==false||ar)&&a)if(a.className==null||a.className.match(/\bsIFR\-hasFlash\b/)==null)F(a, "sIFR-hasFlash")}function j(I,J,K,L,M,N,O,P,Q,R,S,r,T){if(!l())return ah.push(arguments);aq();named.extract(arguments,{sSelector:function(ap){I=ap},sFlashSrc:function(ap){J=ap},sColor:function(ap){K=ap},sLinkColor:function(ap){L=ap},sHoverColor:function(ap){M=ap},sBgColor:function(ap){N=ap},nPaddingTop:function(ap){O=ap},nPaddingRight:function(ap){P=ap},nPaddingBottom:function(ap){Q=ap},nPaddingLeft:function(ap){R=ap},sFlashVars:function(ap){S=ap},sCase:function(ap){r=ap},sWmode:function(ap){T=ap}});var U=parseSelector(I);if(U.length==0)return false;if(S!=null)S="&"+S.normalize();else S="";if(K!=null)S+="&textcolor="+K;if(M!=null)S+="&hovercolor="+M;if(M!=null||L!=null)S+="&linkcolor="+(L||K);if(O==null)O=0;if(P==null)P=0;if(Q==null)Q=0;if(R==null)R=0;if(N==null)N="#FFFFFF";if(T=="transparent")if(!f.f)T="opaque";else N="transparent";if(T==null)T="";var p,V,W,X,Y,Z,aa,ab,ac;var ad=null;for(var i=0,h=U.length;i<h;i++){p=U[i];if(p.className!=null&&p.className.match(/\bsIFR\-replaced\b/)!=null)continue;V=p.offsetWidth-R-P;W=p.offsetHeight-O-Q;aa=A("span");aa.className="sIFR-alternate";ac=o(p,aa,r);Z="txt="+m(ac.u).replace(/\+/g,"%2B").replace(/&/g,"%26").replace(/\"/g, "%22").normalize() + S + "&w=" + V + "&h=" + W + ac.t;F(p,"sIFR-replaced");if(ad==null||!f.g){if(!f.g){if(!f.n)p.innerHTML=['<embed class="sIFR-flash" type="application/x-shockwave-flash" src="',J,'" quality="best" wmode="',T,'" bgcolor="',N,'" flashvars="',Z,'" width="',V,'" height="',W,'" sifr="true"></embed>'].join("");else p.innerHTML=['<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" sifr="true" width="',V,'" height="',W,'" class="sIFR-flash"><param name="movie" value="',J,'"></param><param name="flashvars" value="',Z,'"></param><param name="quality" value="best"></param><param name="wmode" value="',T,'"></param><param name="bgcolor" value="',N,'"></param> </object>'].join('')}else{if(f.d){ab=A("object");ab.setAttribute("data",J);C(ab,"quality","best");C(ab,"wmode",T);C(ab,"bgcolor",N)}else{ab=A("embed");ab.setAttribute("src",J);ab.setAttribute("quality","best");ab.setAttribute("flashvars",Z);ab.setAttribute("wmode",T);ab.setAttribute("bgcolor",N)}ab.setAttribute("sifr","true");ab.setAttribute("type","application/x-shockwave-flash");ab.className="sIFR-flash";if(!f.l||!f.e)ad=ab.cloneNode(true)}}else ab=ad.cloneNode(true);if(f.g){if(f.d)C(ab,"flashvars",Z);else ab.setAttribute("flashvars",Z);ab.setAttribute("width",V);ab.setAttribute("height",W);ab.style.width=V+"px";ab.style.height=W+"px";p.appendChild(ab)}p.appendChild(aa);if(f.p)p.innerHTML+=""}if(f.n&&k.bFixFragIdBug)setTimeout(function(){al.title=d},0)}function ai(){d=al.title}function ae(){if(k.bIsDisabled==true)return;c=true;if(k.bHideBrowserText)aq(true);if(am.attachEvent)am.attachEvent("onload",af);else if(!f.c&&(al.addEventListener||am.addEventListener)){if(f.a&&f.k>=132&&am.addEventListener)am.addEventListener("load",function(){setTimeout("sIFR({})",1)},false);else{if(al.addEventListener)al.addEventListener("load",af,false);if(am.addEventListener)am.addEventListener("load",af,false)}}else if(typeof am.onload=="function"){var ag=am.onload;am.onload=function(){ag();af()}}else am.onload=af;if(!f.n||am.location.hash=="")k.bFixFragIdBug=false;else ai()}k.UA=at();k.bAutoInit=true;k.bFixFragIdBug=true;k.replaceElement=j;k.updateDocumentTitle=ai;k.appendToClassName=F;k.setup=ae;k.debug=function(){aq(true)};k.debug.replaceNow=function(){ae();k()};k.bIsDisabled=false;k.bHideBrowserText=true;return k}();

if(typeof sIFR == "function" && !sIFR.UA.bIsIEMac && (!sIFR.UA.bIsWebKit || sIFR.UA.nWebKitVersion >= 100)){
	sIFR.setup();
};

function sIFRinit()
{
	// ------[ Set the H1 in content-header in Copperplate Font. sIFR. ]------------------------------------------------- //	
	if(typeof sIFR == "function"){
		sIFR.replaceElement(named({sSelector:"#content div.main-title p", sFlashSrc:"/web/static/affaires/swf/frutiger-lt-std-cn.swf", sColor:"#646464", sLinkColor:"#646464", sHoverColor:"#556688", sCase: "upper", nPaddingRight:0, nPaddingLeft:0, sWmode:"transparent" }));
		sIFR.replaceElement(named({sSelector:"#content div.main-title span#anchor", sFlashSrc:"/web/static/affaires/swf/frutiger-lt-std-cn.swf", sColor:"#646464", sLinkColor:"#646464", sHoverColor:"#556688", sCase: "upper", nPaddingRight:0, nPaddingLeft:0, sWmode:"transparent" }));
		sIFR.replaceElement(named({sSelector:"div.main-title a.section", sFlashSrc:"/web/static/affaires/swf/frutiger-lt-std-cn.swf", sColor:"#646464", sLinkColor:"#646464", sHoverColor:"#556688", sCase: "upper", nPaddingRight:0, nPaddingLeft:0, sWmode:"transparent" }));
		sIFR.replaceElement(named({sSelector:"#content div.main-title h1", sFlashSrc:"/web/static/affaires/swf/frutiger-lt-std-cn.swf", sColor:"#000", sLinkColor:"#000", sHoverColor:"#000", sCase: "none", nPaddingRight:0, nPaddingLeft:0, sWmode:"transparent" }));
		sIFR.replaceElement(named({sSelector:"#content .landing-content div.main-title h2", sFlashSrc:"/web/static/affaires/swf/frutiger-lt-std-cn.swf", sColor:"#000", sLinkColor:"#000", sHoverColor:"#000", sCase: "none", nPaddingRight:0, nPaddingLeft:0, sWmode:"transparent" }));
	};
}

sIFRinit();

// ------[ IMAGE SIDE NAV ]------------------------------------------------- //
//var YAHOO;

function showSideNavImage() {
	var sideNavButton = document.getElementById("view-phone");
	if(sideNavButton) {	
		var sideNavList = document.getElementById('side-nav');
		var sideNavImage = document.getElementById('side-nav-image');
		var href = sideNavButton.getElementsByTagName('a');	
		if(href) {	
			href.onclick = function() {
				this.sideNavImage.style.display = (this.sideNavImage.style.display == "block") ? "none" : "block";
			};
		}
	}
}		

// ------[ FAQ COLLAPSE DEFINITION LIST ]------------------------------------------------- //
//var YAHOO;
function collapseUncollapseDataList(root) {

	if(root) {
		var dl = root.getElementsByTagName('dl');
		
		for (var j=0; j<dl.length; j++) {
			var dt = dl[j].getElementsByTagName('dt');
			
			dt[0].dl = dl[j];
			dt[0].onclick = function(e) { 
				this.dl.className = (this.dl.className == "opened") ? "" : "opened";
				e = e || event;
				var target = e.target || e.srcElement;
				if(target.tagName == 'A') YAHOO.util.Event.preventDefault(e);
			};
		}
	}
	
}

function faqCollapseDataList() {
	var faq = document.getElementById("collapse");
	
	//var faq = YAHOO.util.Dom.getElementsByClassName("question-reponse");
	if(!faq) return;
	
	collapseUncollapseDataList(faq);
	
	//Ajoute la gestion du lien afficher ou cacher toutes les réponses
	var showAll = document.getElementById("show-all-answers");
	var hideAll = document.getElementById("hide-all-answers");
	var allDl = document.getElementById("collapse").getElementsByTagName('dl');
	
	if (showAll && hideAll && faq) {
		showAll.onclick = function() {
			for (var j=0; j<allDl.length; j++) {
				allDl[j].className = "opened";
			}
			
			this.className = "hidden";
			hideAll.className = "arrow";
			return false;
		};

		hideAll.onclick = function() {
			for (var j=0; j<allDl.length; j++) {
				allDl[j].className = "";
			}
			
			showAll.className = "arrow";
			this.className = "hidden";
			return false;
		};
		
	}
}		
	

// ------[ LEGAL COLLPASE DEFINITION LIST ]------------------------------------------------- //
//var YAHOO;

function legalCollapseDataList() {
	var legal = YAHOO.util.Dom.getElementsByClassName("legalopened", "div", VIDEOTRON_CONTENT);

	var toggleLegal = function (lg) {
		return function(e) {
			e = e || event;
			var target = e.target || e.srcElement;
			if(target.tagName == "A") {
				lg.className = (lg.className == "legalopened") ? "legal" : "legalopened";
				if(target.href.substr(target.href.length-1) == "#") {
					YAHOO.util.Event.stopEvent(e);
			        YAHOO.util.Event.preventDefault(e);
				}
		    } else {
		    	lg.className = (lg.className == "legalopened") ? "legal" : "legalopened";
			}
	    }
	};
	
	if(legal.length) {
		var mustOpen = (/\#note-[0-9]+/.test(document.location));
		for (var j=0; j<legal.length; j++) {
			legal[j].className= (mustOpen) ? "legalopened" : "legal";
			legal[j].onclick = toggleLegal(legal[j]);
		}
	}	

	// Ajoute la gestion des clicks sur les note-X
	var doClickForAnchors = function() {
		var a = arguments[0];
		var loc=document.location.href.split('#')[0];
		var href = a.getAttribute('href');
		href = (href.indexOf(loc) == 0) ? href.substring(loc.length) : href;
		if(/^\#note-[0-9]+/.test(href)) {
			a.onclick = function(e) {
				YAHOO.util.Dom.getElementsByClassName('legal', 'div', document.body, function() {arguments[0].className = 'legalopened';});
			}
		}
	}
	var ancs = YAHOO.util.Dom.getElementsByClassName('anchor', 'a', VIDEOTRON_CONTENT, doClickForAnchors);
	var ancs = YAHOO.util.Dom.getElementsByClassName('anchor-0', 'a', VIDEOTRON_CONTENT, doClickForAnchors);
}		
	
// ------[ COLLAPSE TABLES ]------------------------------------------------- //
VIDEOTRON.util.tableCollapse = function () {
	var collapsingTables = YAHOO.util.Dom.getElementsByClassName("collapse", "table", VIDEOTRON_CONTENT);
	var heading;
	
	if(collapsingTables) {

		for (i = 0; collapsingTables[i]; i++) {
			var collapsingTable = collapsingTables[i].tBodies[0], c0 = collapsingTables[i].tHead.rows[0].cells[0];
			// Récupère les h2
			var h23 = c0.getElementsByTagName("h2");
			// Si pas de h2, récupère les h3
			if(!h23 || !h23[0]) h23 = c0.getElementsByTagName("h3");
			// Si un h2 ou un h3, récupère le premier élément
			if(h23 && h23[0]) heading = h23[0];
			// Sinon conserve la cellule
			else heading = c0;
				
			var headingA = document.createElement("a");
			headingA.href = "#";
			headingA.innerHTML = heading.innerHTML;
			headingA.onclick = function (el) {
				return function () {
					if(YAHOO.util.Dom.hasClass(el, "closed")) {
						YAHOO.util.Dom.removeClass(el, "closed");
					} else {
						YAHOO.util.Dom.addClass(el, "closed");
					}
					return false;
				}
			}(collapsingTables[i]);
			heading.innerHTML = "";
			heading.appendChild(headingA);
		}
	}
};


function initSlideShowAnim() {
	var caroussel = document.getElementById("presentation-list");
	var carousselWidth = caroussel.offsetWidth;
			
   	var elems = YAHOO.util.Dom.getChildren(caroussel);
	var dlAnims = [];
	var row = 1;
	
   	for (var i = 0; elems[i]; i += 1) {
   		if (i < 5 && row===1) {
			var dlXY = YAHOO.util.Dom.getXY(elems[i]);
			if(!isIE()) {
				dlAnims.push(new YAHOO.util.Motion(elems[i], {
						opacity: {
							from: 0,
							to: 1
						},
						points: {
							from: [
								dlXY[0] + carousselWidth + (i*200), 
								dlXY[1]
							],
							to: [
								dlXY[0], 
								dlXY[1]
							]
						}
					}
				));
			}
			else {
				dlAnims.push(new YAHOO.util.Motion(elems[i], {
						points: {
							from: [
								dlXY[0] + carousselWidth + (i*200), 
								dlXY[1]
							],
							to: [
								dlXY[0], 
								dlXY[1]
							]
						}
					}
				));
			}
			dlAnims[dlAnims.length-1].duration = 0.4 + (0.2 * i);
			dlAnims[dlAnims.length-1].method = YAHOO.util.Easing.easeOutStrong;
			elems[i].style.visibility = 'visible';
			if(i === 4 || i === elems.length-1) {
		        dlAnims[dlAnims.length-1].onComplete.subscribe(
		        	function () {
						slideShow = new VIDEOTRON.widget.Slideshow("presentation-list", "slide-controls", {groupBy: 5, slideElNodeName: "div"});
		           	}
		        );
			}
			dlAnims[i].animate();		
   		} else {
			row++;
			elems[i].style.visibility = 'visible';
   		}
   	}
}

function initSlideShowAnimAccueil() {
	var caroussel = document.getElementById("presentation-list");
		
   	var elems = document.getElementsByTagName("dl")	
	var dlAnims = [];
	var row = 1;
	
   	for (var i = 0; elems[i]; i += 1) {
   		if (i < 5 && row===1) {
			if(!isIE()) {
				dlAnims.push(new YAHOO.util.Motion(elems[i], {
						opacity: {
							from: 0,
							to: 1
						}
					}
				));
			}
			else {
				dlAnims.push(new YAHOO.util.Motion(elems[i], {
					}
				));
			}
			dlAnims[dlAnims.length-1].duration = 2;
			elems[i].style.visibility = 'visible';
			if(i === 4 || i === elems.length-1) {
		        dlAnims[dlAnims.length-1].onComplete.subscribe(
		        	function () {
						slideShow = new VIDEOTRON.widget.Slideshow("presentation-list", "slide-controls", {groupBy: 1, slideElNodeName: "div"});
		           	}
		        );
			}
			dlAnims[i].animate();		
   		} else {
			row++;
			elems[i].style.visibility = 'visible';
   		}
   	}
}

/**
 * Creates a slideshow with previous/next buttons and pips in between representing
 * the current slide among the total number of slides in the show
 */
VIDEOTRON.widget.Slideshow = function (slidesId, controlbarId, userConfig) {
    this.slidesEl = YAHOO.util.Dom.get(slidesId);
    this.controlBarEl = YAHOO.util.Dom.get(controlbarId);
    
    if (!this.slidesEl || !this.controlBarEl) return;
    
    //this.refreshSlidesElDims();
    this.slidesElDims = {
        xy: YAHOO.util.Dom.getXY(this.slidesEl),
        width: this.slidesEl.offsetWidth,
        height: this.slidesEl.offsetHeight
    };
    
    this.cfg = {
    	slideClassName: "slide",
    	slideElNodeName: "li",
    	timer: 0,
    	groupBy: false
    };
    
	// Define labels and text depending on the document language
	if(document.documentElement.lang == 'fr') {
		this.labels = {
			prevTitle: "Afficher la sélection précédente",
			nextTitle: "Afficher la sélection suivante"
		};
	} else {
		this.labels = {
			prevTitle: "Show previous selection",
			nextTitle: "Show next selection"
		};
	}
		
	for (var key in userConfig) {
		if (userConfig.hasOwnProperty(key)) {
			this.cfg[key] = userConfig[key];
		}
	}
	
	// Manually group sub elements of container into slides (grouped by 5 for example)
	//  This is useful if the markup doesn't have natural regroupments of content
    if (this.cfg.groupBy) {
    	var elems = YAHOO.util.Dom.getChildren(this.slidesEl);
    	for (var i = 0; elems[i]; i += 1) {
    		if (i % this.cfg.groupBy === 0) {
    			var groupDiv = document.createElement("div");
    			groupDiv.className = this.cfg.slideClassName;
    			this.slidesEl.appendChild(groupDiv);
   				groupDiv.appendChild(elems[i]);
    		} else {
    			if (groupDiv) {
    				groupDiv.appendChild(elems[i]);
    			}
    		}
    	}
    }
    // Get slides and make them absolute at the same time
    this.slides = YAHOO.util.Dom.getElementsByClassName(
    		this.cfg.slideClassName,
    		this.cfg.slideElNodeName,
    		this.slidesEl,
    		function (el) {
    			el.style.position = "absolute";
		    });
    this.numSlides = this.slides.length;
    
    this.slidesPtr = 0;
    this.currentSlide = function () {return this.slidesPtr+1}
    
    // Only create previous and next buttons if there is more than one slide
    if (this.numSlides > 1) {
		// Previous button
        this.prevBtn = document.createElement(this.cfg.buttonNodeName || "a");
        this.prevBtn.innerHTML = "&larr;";
		this.prevBtn.setAttribute ("href","#");
		this.prevBtn.setAttribute ("title", this.labels.prevTitle);
        this.prevBtn.className = this.cfg.prevBtnClass || "prev";
        this.prevBtn.onclick = function (that) {
            return function () {
                that.goTo(-1);
                that.resetTimer();
                return false;
            }
        }(this);
		this.prevBtn.onmouseover = function () {
			if (!YAHOO.util.Dom.hasClass(this, "hover")) {
				YAHOO.util.Dom.addClass(this, "hover");
			}
		};
		this.prevBtn.onmouseout = function () {
			YAHOO.util.Dom.removeClass(this, "hover");
		};
		this.prevBtn.onmousedown = function () {
			if (!YAHOO.util.Dom.hasClass(this, "active")) {
				YAHOO.util.Dom.addClass(this, "active");
			}
		};
		this.prevBtn.onmouseup = function () {
			YAHOO.util.Dom.removeClass(this, "active");
		};
        this.controlBarEl.appendChild(this.prevBtn);
    
		// Indicator
        this.indicator = document.createElement(this.cfg.buttonNodeName || "span");
        this.indicator.className = this.cfg.indicatorClass || "indicator";
        this.pips = [];
        for (var i=0; i<this.numSlides; i++) {
			var pip = document.createElement("a");
			if ((i+1) === this.currentSlide()) {
				pip.className = "current";
			}
			pip.onclick = function (that, num) {
				return function () {

					var dir = (that.slidesPtr > num) ? 1 : -1;
					that.goTo(dir, num);
	                that.resetTimer();
				}
			}(this, i);
			pip.onmouseover = function () {
				if (!YAHOO.util.Dom.hasClass(this, "hover")) {
					YAHOO.util.Dom.addClass(this, "hover");
				}
			};
			pip.onmouseout = function () {
				YAHOO.util.Dom.removeClass(this, "hover");
			};
			pip.onmousedown = function () {
				if (!YAHOO.util.Dom.hasClass(this, "active")) {
					YAHOO.util.Dom.addClass(this, "active");
				}
			};
			pip.onmouseup = function () {
				YAHOO.util.Dom.removeClass(this, "active");
			};
			pip.appendChild(document.createTextNode(i + 1));
			pip.setAttribute ("href","#");
			this.indicator.appendChild(pip);
			this.pips.push(pip);
        }
        this.controlBarEl.appendChild(this.indicator);

		// Next button
        this.nextBtn = document.createElement(this.cfg.buttonNodeName || "a");
		this.nextBtn.setAttribute ("href","#");
		this.nextBtn.setAttribute ("title",this.labels.nextTitle);
        this.nextBtn.innerHTML = "&rarr;";
        this.nextBtn.className = this.cfg.nextBtnClass || "next";
        this.nextBtn.onclick = function (that) {
            return function () {
                that.goTo(1);
                that.resetTimer();
                return false;
            }
        }(this);
        this.nextBtn.onmouseover = function () {
			if (!YAHOO.util.Dom.hasClass(this, "hover")) {
				YAHOO.util.Dom.addClass(this, "hover");
			}
		};
		this.nextBtn.onmouseout = function () {
			YAHOO.util.Dom.removeClass(this, "hover");
		};
		this.nextBtn.onmousedown = function () {
			if (!YAHOO.util.Dom.hasClass(this, "active")) {
				YAHOO.util.Dom.addClass(this, "active");
			}
		};
		this.nextBtn.onmouseup = function () {
			YAHOO.util.Dom.removeClass(this, "active");
		};
        this.controlBarEl.appendChild(this.nextBtn);
        
        // Get slides out of the way for Safari 2.0.x because they block page links
        for (var i=1; this.slides[i]; i++) {
            this.slides[i].style.top = "-3000px";
            this.slides[i].style.left = "-3000px";
        }
    }
    this.goTo(0); // to initialize the first slide if it has a popup
    this.setTimer(); // set automated forward timer
}

VIDEOTRON.widget.Slideshow.prototype.setTimer = function () {
    if (this.cfg.timer > 0) {
		this.slideShowInterval = window.setInterval(
			function (that) {
				return function () {
					that.goTo(1);
				}
			}(this),
			this.cfg.timer
		);
	}
}

VIDEOTRON.widget.Slideshow.prototype.resetTimer = function () {
	if (this.slideShowInterval) {
		window.clearInterval(this.slideShowInterval);
		this.setTimer();
	}
}

VIDEOTRON.widget.Slideshow.prototype.refreshSlidesElDims = function () {
    this.slidesElDims = {
        xy: YAHOO.util.Dom.getXY(this.slidesEl),
        width: this.slidesEl.offsetWidth,
        height: this.slidesEl.offsetHeight
    };
}

VIDEOTRON.widget.Slideshow.prototype.goTo = function (dir, skipTo) {
   this.slidesElDims = {
        xy: YAHOO.util.Dom.getXY(this.slidesEl),
        width: this.slidesEl.offsetWidth,
        height: this.slidesEl.offsetHeight
    };
    
    var outSlide = this.slides[this.slidesPtr];
    var outSlideXY = YAHOO.util.Dom.getXY(outSlide);
    var outSlideWidth = outSlide.offsetWidth;
    
    if (dir == -1) {
		if(!isIE()) {
			var outSlideAnim = new YAHOO.util.Motion(outSlide, {
					opacity: {
						from: 1,
						to: 0
					},
					points: {
						from: [
							this.slidesElDims.xy[0], 
							this.slidesElDims.xy[1]
						],
						to: [
							this.slidesElDims.xy[0] + this.slidesElDims.width, 
							this.slidesElDims.xy[1]
						]
					}
				}
			);
		}
		else {
			var outSlideAnim = new YAHOO.util.Motion(outSlide, {
					points: {
						from: [
							this.slidesElDims.xy[0], 
							this.slidesElDims.xy[1]
						],
						to: [
							this.slidesElDims.xy[0] + this.slidesElDims.width, 
							this.slidesElDims.xy[1]
						]
					}
				}
			);
		}
        outSlideAnim.onComplete.subscribe(
           function (el) {
               return function () {
                   el.style.top = "-3000px";
                   el.style.left = "-3000px";
               }
           }(outSlide)
        );
        outSlideAnim.duration = 0.5;
        outSlideAnim.method = YAHOO.util.Easing.easeOutStrong;

        this.slidesPtr = (this.slides[skipTo]) ? skipTo : this.slides[this.slidesPtr-1] ? this.slidesPtr-1 : this.numSlides-1;
        var inSlide = this.slides[this.slidesPtr];
        var inSlideXY = YAHOO.util.Dom.getXY(inSlide);
		if(!isIE()) {
			var inSlideAnim = new YAHOO.util.Motion(inSlide, {
					opacity: {
						from: 0,
						to: 1
					},
					points: {
						from: [
							this.slidesElDims.xy[0] - this.slidesElDims.width, 
							this.slidesElDims.xy[1]
						],
						to: [
							this.slidesElDims.xy[0], 
							this.slidesElDims.xy[1]
						]
					}
				}
			);
		}
		else {
			var inSlideAnim = new YAHOO.util.Motion(inSlide, {
					points: {
						from: [
							this.slidesElDims.xy[0] - this.slidesElDims.width, 
							this.slidesElDims.xy[1]
						],
						to: [
							this.slidesElDims.xy[0], 
							this.slidesElDims.xy[1]
						]
					}
				}
			);
		}
        inSlideAnim.duration = 0.5;
        inSlideAnim.method = YAHOO.util.Easing.easeOutStrong;
        
        outSlideAnim.animate();
        inSlideAnim.animate();
        
        
    } else if (dir == 1) {
		if(!isIE()) {
			var outSlideAnim = new YAHOO.util.Motion(outSlide, {
					opacity: {
						from: 1,
						to: 0
					},
					points: {
						from: [
							this.slidesElDims.xy[0], 
							this.slidesElDims.xy[1]
						],
						to: [
							this.slidesElDims.xy[0] - this.slidesElDims.width, 
							this.slidesElDims.xy[1]
						]
					}
				}
			);
		}
		else {
			var outSlideAnim = new YAHOO.util.Motion(outSlide, {
					points: {
						from: [
							this.slidesElDims.xy[0], 
							this.slidesElDims.xy[1]
						],
						to: [
							this.slidesElDims.xy[0] - this.slidesElDims.width, 
							this.slidesElDims.xy[1]
						]
					}
				}
			);
		}
        outSlideAnim.onComplete.subscribe(
           function (el) {
               return function () {
                   el.style.top = "-3000px";
                   el.style.left = "-3000px";
               }
           }(outSlide)
        );
        outSlideAnim.duration = 0.5;
        outSlideAnim.method = YAHOO.util.Easing.easeOutStrong;

        this.slidesPtr = (this.slides[skipTo]) ? skipTo : this.slides[this.slidesPtr+1] ? this.slidesPtr+1 : 0;
        var inSlide = this.slides[this.slidesPtr];
        var inSlideXY = YAHOO.util.Dom.getXY(inSlide);
		if(!isIE()) {
			var inSlideAnim = new YAHOO.util.Motion(inSlide, {
					opacity: {
						from: 0,
						to: 1
					},
					points: {
						from: [
							this.slidesElDims.xy[0] + this.slidesElDims.width, 
							this.slidesElDims.xy[1]
						],
						to: [
							this.slidesElDims.xy[0], 
							this.slidesElDims.xy[1]
						]
					}
				}
			);
		}
		else {
			var inSlideAnim = new YAHOO.util.Motion(inSlide, {
					points: {
						from: [
							this.slidesElDims.xy[0] + this.slidesElDims.width, 
							this.slidesElDims.xy[1]
						],
						to: [
							this.slidesElDims.xy[0], 
							this.slidesElDims.xy[1]
						]
					}
				}
			);
		}
        inSlideAnim.duration = 0.5;
        inSlideAnim.method = YAHOO.util.Easing.easeOutStrong;
        
        outSlideAnim.animate();
        inSlideAnim.animate();
    }

    if (this.indicator) {
		for (var i=0; this.pips[i]; i++) {
			if ((i+1) === this.currentSlide()) {
				this.pips[i].className = "current";
			} else {
				
				this.pips[i].className = "";
			}
		}
    }
}

// ------[ APPAREIL IMAGE NAV ]------------------------------------------------- //
function showNavImage() {
	document.getElementById('side-nav').style.display = 'none';
	document.getElementById('side-nav-image').style.display = 'block';
}

function hideNavImage() {
	document.getElementById('side-nav-image').style.display = 'none';
	document.getElementById('side-nav').style.display = 'block';
}

// ------[ GESTION DES CLICK SUR LES IMAGES DES PAGES DE COMPARAISON ]-------- //
function preparePresentationList() {

	var oList = document.getElementById("presentation-list");
	
	if(oList && oList.className == 'compare') {
		
		var dls = oList.getElementsByTagName("dl");

		for (var i=0; i < dls.length; i++) {
			// Récupère les dt dans les dl
			var dt = dls[i].getElementsByTagName("dt");

			if(dt) {
				//Récupère le label dans le premier dt
				var labels = dt[0].getElementsByTagName("label");
				if(labels.length) {
					var forId = labels[0].htmlFor;
					var dds = dls[i].getElementsByTagName("dd");
					if(dds && forId) {
						for(var j=0; j < dds.length; j++) {
							if(dds[j].className == "image") {
								dds[j].setAttribute('for', forId);
								
								dds[j].onclick = function() {
									ochk = document.getElementById(this.getAttribute('for'));
									if(ochk) ochk.checked = (ochk.checked == '') ? 'checked' : '';
								}; // onclick
							} // dds.className
						} // for j
					} // dds && forId
				} // labels
			} // dt
		} // for i
	} // oList
}

// ------[ TOP SEARCH INPUT ]------------------------------------------------- //

function setSearchEvent() {

	var oSearchInput = document.getElementById("search-input");
	var oLabelSearch = document.getElementById("search-input-label");
	
	if(oSearchInput && oLabelSearch) {
	
		oLabelSearch.style.display = 'block';
		
		oSearchInput.onfocus = function() {
			oLabelSearch.style.display = 'none';
		};
		
		oSearchInput.onblur = function() {
			if(this.value.length == 0) oLabelSearch.style.display = 'block';
		};
	}
}


var elemExtend = function() {
	return {
		text: null,
		disabled: false,
		className: ''
	};
};

// -----[ Gestion et génération des widget tooltips pour les listes ] -----//
function generateTooltipsFromUl(ulClassName, root) {
	if(!root) root = VIDEOTRON_CONTENT;
	var oUls = YAHOO.util.Dom.getElementsByClassName(ulClassName, "ul", root);
	// alert(oUls.length + " :: " + root);
	var ulTooltips = [];
	
	for(var u = 0; oUls[u]; u++) {
		var oLis = oUls[u].getElementsByTagName("li");
		var tooltipsBox = document.getElementById("tooltips-box");
		// var alltooltips = [];
		var oElems = [];
		
		for(var i = 0; oLis[i]; i++) {
			var curExtend = new elemExtend;
			curExtend.text = oLis[i].innerHTML;
			curExtend.className = '';
			curExtend.disabled = false;
			
			oLis[i].tooltip = curExtend;
		}
		var ulTooltips = new YAHOO.widget.Tooltip("alltooltips", {context:oLis, container: tooltipsBox});

		ulTooltips.contextTriggerEvent.subscribe(
			function(type, args) {
				var context = args[0];
				this.cfg.setProperty("text", context.tooltip.text);
				this.cfg.setProperty("disabled", context.tooltip.disabled);
				this.cfg.setProperty("width", "auto");
				if(context.tooltip.className) {
					YAHOO.util.Dom.addClass(context.container, context.tooltip.className);
				}
				this.cfg.refresh();
			}
		);
	}
}

// -----[ Gestion et génération des widget tooltips pour les listes ] -----//
function generateTooltipsForTagName(className, tagName) {
	
	var cTr2ul = (arguments.length > 2) ? arguments[2] : false;
	var tooltipsBox = document.getElementById("tooltips-box");

	if(tooltipsBox != null) {
		var oElems = YAHOO.util.Dom.getElementsByClassName(className, tagName, document.body);
		generateTooltipsForElements(oElems, tooltipsBox, cTr2ul);
	}
}

function generateTooltipsForElements(oElems, tipsBox) {

	var cTr2ul = (arguments.length > 2) ? arguments[2] : false;

	for(var i = 0; oElems[i]; i++) {
		var curExtend = new elemExtend;
		curExtend.text = (cTr2ul === true) ? convertTR2UL(oElems[i]) : (oElems[i].title ? oElems[i].title : oElems[i].innerHTML);
		curExtend.className = (oElems.className && YAHOO.util.Dom.hasClass(oElems[i], 'tip-normal-color')) ? 'normal-color' : '';
		curExtend.disabled = (oElems.className && YAHOO.util.Dom.hasClass(oElems[i], 'disabled-tip')) ? true : false;
		
		oElems[i].tooltip = curExtend;
	}

	var alltooltips = new YAHOO.widget.Tooltip("alltooltips", {context:oElems, container: tipsBox});

	alltooltips.contextTriggerEvent.subscribe(
		function(type, args) {
			var context = args[0];
			this.cfg.setProperty("text", context.tooltip.text);
			this.cfg.setProperty("disabled", context.tooltip.disabled);
			if(context.tooltip.className) {
				YAHOO.util.Dom.addClass(context.container, context.tooltip.className);
			}
			this.cfg.refresh();
		}
	);
	alltooltips.contextMouseOverEvent.subscribe(
		function(type, args) {
			var context = args[0];
			return !(context.tooltip.disabled);
		}
	);
	
}

function convertTR2UL(elem) {
	
	if(elem.TooltipsText) return elem.TooltipsText;
	
	var lis = [], i, duplicate;
	var tds = elem.getElementsByTagName('td');

	if(tds && typeof(tds) != 'undefined' && tds.length) {
		for(td in tds) {
			if(tds[td].title) {
				duplicate = false;
				for(i = 0; i < lis.length; i+=1) {
					if(lis[i].toLowerCase() === tds[td].title.toLowerCase()) {
						duplicate = true;
						tds[td].removeAttribute('title');
						break;
					}
				}
				if(!duplicate) {
					lis.push(tds[td].title);
					tds[td].removeAttribute('title');
				}
			}
		}
	}
	if(lis.length) {
		var html = new String('<ul>');
		for(li in lis) html += '<li>' + lis[li] + '</li>';
		html += '</ul>';
		return html;
	} else return elem.title;
}


// ------[ Generic Popup Window ]------------------------------------------------- //
function popWin(url,w,h,scroll,tools,name,center) {
	var str = "height=" + h + ",innerHeight=" + h;
	str += ",width=" + w + ",innerWidth=" + w;
	if(!center) var center = false;
	if(!scroll) scroll = 0;
	if(!tools) tools = 0;
	if(!name) name = "pop";

	if((window.screen) && (center)) {
		var ah = screen.availHeight - 30;
		var aw = screen.availWidth - 10;

		var xc = (aw - w) / 2;
		var yc = (ah - h) / 2;

		str += ",left=" + xc + ",screenX=" + xc;
		str += ",top=" + yc + ",screenY=" + yc;
		}
		
		window.open(url,name,'toolbar=' + tools + ',location=0,directories=0,status=0,menubar=0,scrollbars=' + scroll + ',resizable=1,' + str).focus();
}

// ------[ Validation de formulaire ]------------------------------------------------- //
/**
 * Creates a Form Validator object
 * @param {HTMLFormElement} Form à valider
 * @param {Object} validation object to validate the form
 * @requires YAHOO.util.Dom
 * @requires YAHOO.util.Event
 * @return A validation function (see public members)
 */
var formValidator = (function(data, validateInfo) {

	/**********
		Private members
	**********/
		var that = this; //Référence au constructeur

		/**
		 *
		 **/
		this.validateRequired = function(input) {
			// Pour les checkbox
			if(input.type == 'checkbox') return this.checked;
			// Pour les autres type de input, le value ne doit pas être vide
			// vérifi si le input est vide ou contient seulement des espaces
			return !(input.value.trim() == '');
		};

		this.validateEmail = function(input) {
			var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
			return filter.test(input.value);
		};

		this.validatePhone = function(input) {
			// 555-555-5555
			return (/^\d{3,}-\d{3,}-\d{4,}$/.test(input.value));
		};

		this.validateDateFormat = function(input) {
			// AAAA/MM/JJ
			return (/^\d{4,}\/\d{2,}\/\d{2,}$/.test(input.value));
		};
	
	
	/**********
		Public members
	**********/

	/**
	 * Loop on all elements in the form and apply validation rules 
	 * @param {HTMLFormElement} Form à valider
	 * @param {Object} validation object to validate the form
	 * @requires YAHOO.util.Dom
	 * @requires YAHOO.util.Event
	 * @return Bolean value
	 */
	return (function(data, validateInfo) {
		var from, ancestor, request, el, elem, elems, isRequired, isEmpty, isValide, isError, elem_id;	

		isError = false; // Valeur initial par défaut
		
		// Supprime tous les class error sur les div
		elems = YAHOO.util.Dom.getElementsByClassName('error', 'div', document.body);
		for(elem in elems) {
			YAHOO.util.Dom.removeClass(elems[elem], 'error');
		}
		// Suprime tous les span avec une class error
		elems = YAHOO.util.Dom.getElementsByClassName('error', 'span', document.body);
		for(elem in elems) {
			elems[elem].parentNode.removeChild(elems[elem]);
		}
		
		request = '';
		// Boucle dans les inputs pour valider leur valeur
		for(el=0; el<data.elements.length; el+=1) {
			elem = data.elements[el];
			isValide = true;
			if(elem.type != 'hidden' && typeof(elem.id) != 'undefined') {
				// Hack pour remplacer les - par des _ pour la recherche dans l'objet validator
				elem_id = elem.id.replace('-', '_');
				
				if(typeof validateInfo[elem_id] != 'undefined') {
				
					if(elem.type == 'text' || elem.type == 'textarea') elem.value = elem.value.trim();

					// Est-ce que le input est Requis ?
					isRequired = YAHOO.util.Dom.hasClass(elem, 'required');
					// Est-ce qu'il est vide ?
					isEmpty = !that.validateRequired(elem);
					
					// Si il est requis et vide, il n'est pas valide !
					if(isRequired && isEmpty) {
						isValide = false;
					// Si il est requis et PAS vide
					} else if (isRequired || !isEmpty) {
						// S'il y a une fonction de test affecté à ce input, sinon, indique que le ch
						isValide = (typeof validateInfo[elem_id]['test'] != 'undefined') ? that[validateInfo[elem_id]['test']](elem) : true;
					}
					
					// S'il est valide, ajuste le request avec ça valeur
					if(isValide) {
						request += '&' + elem.id + '=' + encodeURIComponent(elem.value);

					// S'il n'est pas valide
					} else {
						// Au moins une erreur à eu lieu
						isError = true;
						// Ajoute les class error sur tous les div.field parents
						from = elem;
						while (from = YAHOO.util.Dom.getAncestorByClassName(from, 'field')) {
							YAHOO.util.Dom.addClass(from, 'error');
							ancestor = from;
						}
						// Ajoute le span d'erreur pour le input
						var sp = document.createElement('span');
						sp.className = 'error';
						sp.innerHTML = validateInfo[elem_id]['error'];
						ancestor.appendChild(sp);
					}
				}
			}
		};
		
		if(!isError) {
			var gotos = document.getElementById('goto');
			if(gotos) {
				var params = gotos.value.split('?');
				gotos.value = params[0] + '?' + request.replace(/^&/, '');
				//alert(goto.value);
			}
			return true;
		}

		return false;
		
	});
	
})();

// ------[ Ajout de select Année et mois dans un formulaire ]------------------------------------------------- //

var updateDateValue = function () {
	var y = document.getElementById('addYear');
	var m = document.getElementById('addMonth');
	var d = document.getElementById('custom_Fin_Sans-fil_Res');
	if(y && m && d) d.value = y.value + '/' + m.value;
	//alert(d.value);
}

var makeDateSelect = function () {
	
	var startYear = __CurYear; // __CurYear est défini dans meta-css-js.jsp et provient d'une variable JAVA pour suivre l'année courrante.
	var endYear = startYear + 4;
	
	if(document.documentElement.lang == 'fr') {
		var months = ['Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','Novembre','Décembre'];
		var _month = 'Mois';
		var _year = 'Ann&eacute;e'; // MYSTÈRE !!! IE 6 ne veut pas d'accent dans cette variable !
	} else {
		var months = ['January','February','March','April','Mai','June','July','August','September','October','November','December'];
		var _month = 'Month';
		var _year = 'Year';
	}
	
	var container = document.getElementById('add-date-dropdown');
	var opt;

	if(!YAHOO.env.ua.ie) {
		
		// Crée le hidden qui va recevoir la valeur
		var hidden = document.createElement('input');
		hidden.type = 'hidden';
		hidden.name = 'custom_Fin_Sans-fil_Res';
		hidden.id = hidden.name;
		hidden.value = startYear + '/01/01';

		// Crée le select pour les année
		var addYear = document.createElement('select');
		addYear.name = 'addYear';
		addYear.id = addYear.name;
		for(var i=startYear; i<=endYear; i+=1) {
			opt = document.createElement('option');
			opt.value = i;
			opt.label = i;
			opt.innerHTML = opt.label;
			addYear.add(opt, null);
		}
	
		// Crée le select pour les mois
		var addMonth = document.createElement('select');
		addMonth.name = 'addMonth';
		addMonth.id = addMonth.name;
		for(var i in months) {
			opt = document.createElement('option');
			opt.value = (i<9 ? '0' : '') + (parseInt(i)+1) + '/01';
			opt.label = months[i];
			opt.innerHTML = opt.label;
			addMonth.add(opt, null);
		}
	
		var lblMonth = document.createElement('label');
		lblMonth.setAttribute('for', 'addMonth');
		var lblYear = document.createElement('label');
		lblYear.setAttribute('for', 'addYear');
		
	} else {

		// Crée le hidden qui va recevoir la valeur
		var hidden = document.createElement('<input type="hidden" name="custom_Fin_Sans-fil_Res" id="custom_Fin_Sans-fil_Res" value="' + startYear + '/01/01" />');

		// Crée le select pour les année
		var addYear = document.createElement('<select name="addYear" id="addYear"></select>');
		for(var i=startYear; i<=endYear; i+=1) {
			opt = document.createElement('<option value="' + i + '" label="' + i + '"></option>');
			opt.innerHTML = i;
			addYear.appendChild(opt);
		}
	
		// Crée le select pour les mois
		var addMonth = document.createElement('<select name="addMonth" id="addMonth"></select>');
		for(var i=0; i<months.length; i+=1) {
			var sValue = (i<9 ? '0' : '') + (parseInt(i)+1) + '/01'; 
			opt = document.createElement('<option value="' + sValue + '" label="' + months[i] + '"></option>');
			opt.innerHTML = months[i];
			addMonth.appendChild(opt);
		}
		
		var lblMonth = document.createElement('<label for="addMonth"></label>');
		var lblYear = document.createElement('<label for="addYear"></label>');
		
	}

	lblMonth.innerHTML = _month;
	lblMonth.className = 'longdesc';
	lblYear.innerHTML = _year;
	lblYear.className = 'longdesc';
	
	container.appendChild(lblYear);
	container.appendChild(addYear);
	container.appendChild(lblMonth);
	container.appendChild(addMonth);
	container.appendChild(hidden);

	YAHOO.util.Event.addListener('addYear', 'change', updateDateValue);
	YAHOO.util.Event.addListener('addMonth', 'change', updateDateValue);

};

// ------[ Gestion de limite de caractères dans un TEXTAREA ]------------------------------------------------- //
VIDEOTRON.util.maxCharScout = function(e,obj) {
	if(obj.lang == 'fr') {
		var maxCharScoutString = "caractères disponibles";
	} 
	else {
		var maxCharScoutString = "characters available";
	}
	var oField = document.getElementById(obj.fieldId);
	var oFieldMax = parseInt(obj.fieldMax);	
	YAHOO.util.Event.addListener(oField, 'keydown', doScout);
	function ScoutCounter(val) {
		var nbLeftField = document.getElementById("message-char-remain");
		var monSpan = document.createElement("span");
		monSpan.id = "message-char-remain-value";
		var monText = document.createTextNode("("+ val + " " + maxCharScoutString + ")");
		monSpan.appendChild(monText);
		nbLeftField.innerHTML = "";
		nbLeftField.appendChild(monSpan);
	}
	function doScout(e) {
		var oFieldString = oField.value;
		if (oFieldString.length > oFieldMax) {
			oFieldString = oFieldString.substring(0, oFieldMax);
			oField.value = oFieldString;
		}
		else {
			ScoutCounter(oFieldMax - oFieldString.length);
		}
	}
	ScoutCounter(oFieldMax - oField.value.length)
}




/********** [ Gestion de contenu alternatif ] **********/
function initVisibilityTimer(root) {

	if(!root) root = document.body;
	else if(typeof root === 'string') root = document.getElementById(root);
	var elems = YAHOO.util.Dom.getElementsByClassName('init-visibility-timer', null, root);
	
	if(elems.length) {
	    this.execTimer = window.setTimeout(
	        function (el) {
	            return function () {
	                this.showVisibilityItem(el);
	            }
	        }(elems),
	        2000);
		this.showVisibilityItem = function(elems) {
			for(var i=0; elems[i]; i+=1) {
				elems[i].style.visibility = 'inherit'; 
			}
		}
	}
	
}

/********** [ Gestion des tab list sur les page de landing ] **********/
function manageLandingTabList(ev, userConf) {
	var tablist, dts, dds, i, w, a, c;
	
	tablist = document.getElementById(userConf.dlId);
	c = document.getElementById('content');
	w = c.offsetWidth * 0.44;
	
	if(tablist) {
		dts = tablist.getElementsByTagName('dt');
		dds = tablist.getElementsByTagName('dd');

		if(dts && dds && (dts.length === dds.length)) {
			for(i = 0; dts[i]; i += 1) {
				dts[i].DD = dds[i];

				dts[i].DD.style.width = w + 'px';

				if(YAHOO.util.Dom.hasClass(dts[i], userConf.activeClass)) {
					YAHOO.util.Dom.addClass(dts[i].DD, userConf.activeClass);
				} else {
					if(!isIE()) {
						YAHOO.util.Dom.setStyle(dts[i].DD, "opacity", 0);
					}
				}

				dts[i].showDD = new YAHOO.util.Anim(dts[i].DD);
		        dts[i].showDD.duration = 0.8;
				if(!isIE()) { dts[i].showDD.attributes.opacity = {to: 1}; }

				dts[i].hideDD = new YAHOO.util.Anim(dts[i].DD);
		        dts[i].hideDD.duration = 0.8;
				if(!isIE()) { dts[i].hideDD.attributes.opacity = {to: 0}; }
				
				dts[i].a = dts[i].getElementsByTagName('a')[0];
				
				dts[i].a.onmouseover = (function (odtlist, imyIndex) {
					var dtlist = odtlist;
					var myIndex = imyIndex;
					
					return function(e) {
						/*
							e = e || event;
							var target = e.target || e.srcElement;
							if(target.tagName == 'A') YAHOO.util.Event.preventDefault(e);
						*/
						for(var i = 0; dtlist[i]; i+=1) {
							dtlist[i].showDD.stop();
							dtlist[i].hideDD.stop();
							if(YAHOO.util.Dom.hasClass(dtlist[i], userConf.activeClass)) {
								YAHOO.util.Dom.removeClass([dtlist[i], dtlist[i].DD], userConf.activeClass);
								dtlist[i].hideDD.animate();
							}
						}
						YAHOO.util.Dom.addClass([dtlist[myIndex], dtlist[myIndex].DD], userConf.activeClass);
						dtlist[myIndex].showDD.animate();
						var dt = dtlist[myIndex];
						var pc = YAHOO.util.Dom.getElementsByClassName('prim-content', 'div', document.getElementById('content'))[0];
						if(dt.DD.offsetHeight < userConf.minHeight) {
							dt.DD.style.height = userConf.minHeight/13 + 'em';
							pc.style.marginTop = dt.DD.offsetHeight/13 + 'em';
						} else {
							pc.style.marginTop = dt.DD.offsetHeight/13 + 'em';
						} 
					};
				})(dts, i);
				
				if(YAHOO.util.Dom.hasClass(dts[i], userConf.activeClass)) {
					YAHOO.util.Dom.addClass(dts[i].DD, userConf.activeClass);
					// dts[i].showDD.animate();
					var dt = dts[i];
					var pc = YAHOO.util.Dom.getElementsByClassName('prim-content', 'div', document.getElementById('content'))[0];
					if(dt.DD.offsetHeight < userConf.minHeight) {
						dt.DD.style.height = userConf.minHeight/13 + 'em';
						pc.style.marginTop = dt.DD.offsetHeight/13 + 'em';
					} else {
						pc.style.marginTop = dt.DD.offsetHeight/13 + 'em';
					}
				} else {
					YAHOO.util.Dom.removeClass(dds[i], userConf.activeClass);
					dts[i].hideDD.animate();
				}
				
				
			}
		} else {
			msg = 'Le nombre de DT ne correspond pas au nombre de DD dans la liste tab-list-content!';
			if(console && console.debug) {
				console.debug(msg);
			} else {
				alert(msg);
			}
		}
	
		 
	}
}

function landingTabListAdj(ev, userConf) {
	var tablist, dts, dds, i, w, a, c;
	
	tablist = document.getElementById(userConf.dlId);
	c = document.getElementById('content');
	w = c.offsetWidth * 0.44;
	
	if(tablist) {
		dts = tablist.getElementsByTagName('dt');
		dds = tablist.getElementsByTagName('dd');

		if(dts && dds && (dts.length === dds.length)) {
			for(i = 0; dts[i]; i += 1) {
				if(YAHOO.util.Dom.hasClass(dts[i], userConf.activeClass)) {
					YAHOO.util.Dom.addClass(dts[i].DD, userConf.activeClass);
					// dts[i].showDD.animate();
					var dt = dts[i];
					var pc = YAHOO.util.Dom.getElementsByClassName('prim-content', 'div', c)[0];
					if(dt.DD.offsetHeight < userConf.minHeight) {
						dt.DD.style.height = userConf.minHeight/13 + 'em';
						pc.style.marginTop = dt.DD.offsetHeight/13 + 'em';
					} else {
						pc.style.marginTop = dt.DD.offsetHeight/13 + 'em';
					}
				} else {
					YAHOO.util.Dom.removeClass(dds[i], userConf.activeClass);
					dts[i].hideDD.animate();
				}
			}
		}
	}
}

/********** INITIALISATION DES FONCTIONNALITÉS GÉNÉRIQUE **********/
var initVideotronScript = function () {
	if(!window.OVERLAY_LATE_INIT) {
		legalCollapseDataList();
		setSearchEvent();
		preparePresentationList();
		showSideNavImage();
		faqCollapseDataList();
	}
}
YAHOO.util.Event.addListener(window,"load",initVideotronScript);	
