﻿/**
* Specifications                : Definition de l'objet RadioCanada
* Auteur                        : Xavier Vincent
* Date de creation              : 13 fevrier 2011
* Date de derniere modification : 17 octobre 2011
* Copyright                     : Societe de Radio-Canada 
*/
if (typeof (oProfile) == "undefined") {
    var oProfile = {};
}
if (typeof (StatsUse) == "undefined") {
    var StatsUse = 1;
}
if (typeof (RadioCanada) == 'undefined') {
    var RadioCanada = {};
}
if (typeof (RadioCanada.Lib) == 'undefined') {
    RadioCanada.Lib = {};
}
if (typeof (RadioCanada.Lib.Mod) == 'undefined') {
    RadioCanada.Lib.Mod = {};
}
if (typeof (RadioCanada.Lib.oSrc) == 'undefined') {
    RadioCanada.Lib.oSrc = {};
}
if (typeof (RadioCanada.Web) == 'undefined') {
    RadioCanada.Web = {};
}
if (typeof (RadioCanada.Mod) == 'undefined') {
    RadioCanada.Mod = {};
}

RadioCanada._isLoaded = false;
RadioCanada._cacheScripts = new Array();
RadioCanada._alreadyLoad = {};
RadioCanada._isLegacy = false;
RadioCanada._isJeunesse = false;
RadioCanada._isExtern = false;
RadioCanada._isNewMagTele = true;
RadioCanada._loadLiveInMagTele = false;
RadioCanada._log = new Array();

RadioCanada.getBaseUrl = function (pIsInternal) {
    return ("http://" + RadioCanada.getPrefix(pIsInternal) + "www.radio-canada.ca");
}

RadioCanada.buildLink = function (link) {
    if (link.indexOf('http://') < 0) {
        _urlToBuild = (RadioCanada.getBaseUrl() + link);
    }
    else {
        _urlToBuild = link;
    }

    if (!RadioCanada._isLegacy)
        return (_urlToBuild);
    else {
        if (RadioCanada._isJeunesse)
            return ("/jeunesse/quitter.asp?url=" + encodeURIComponent(_urlToBuild) + "&amp;site=Radio-Canada.ca");
        else
            return (_urlToBuild);
    }
}

RadioCanada.getDomain = function () {
    _host = document.location.hostname;
    _domain = '';
    segment = _host.split(".");

    if (segment.length >= 2) {
        _domain = segment[segment.length - 2] + "." + segment[segment.length - 1];
    }
    else {
        _domain = "radio-canada.ca";
    }

    return _domain;
}

window.AddRegionCallBack = RadioCanada.add = function (pOneScript) {
    if (typeof (pOneScript) == 'function') {


        if (RadioCanada._isLoaded) {
            RadioCanada.Lib.jQuery(document).ready(function () {
                RadioCanada._log.push('Execution directe du script');

                try {
                    pOneScript();
                }
                catch (e) {
                    RadioCanada._log.push('Erreur pendant l\'execution directe du script : ' + e.description);
                }
            });
        } else { 
            RadioCanada._cacheScripts.push(pOneScript);
        }
    }
}

RadioCanada.getPrefix = function (pIsInternal) {
    _host = document.location.hostname;
    _prefix = '';

    var match = _host.match(/([a-z0-9]+-)www/);
    if (match != null && match.length > 1)
        _prefix = match[1];
    else if (pIsInternal)
        _prefix = 'ca-';

    return _prefix;
}

if (typeof (RadioCanada.Lib.jQuery) === "undefined") {
    if (typeof ($j) !== 'undefined') {
        RadioCanada.Lib.jQuery = $j.noConflict();
        if (typeof (jQuery) === 'undefined') {
            window.jQuery = $j;
        }
    }
    else {
        RadioCanada.Lib.jQuery = jQuery.noConflict();
        window.$j = (typeof (RadioCanada.Lib.jQuery) != 'undefined') ? RadioCanada.Lib.jQuery : jQuery;
    }
}

RadioCanada.Lib.jQuery.ajaxSetup({
    cache: true
});

RadioCanada.getScript = function (pUrl, pHandler) {
    RadioCanada.Lib.jQuery.ajax({
        url: pUrl,
        dataType: "script",
        jsonp: false,
        async: false,
        success: function () {
            if (typeof (pHandler) == 'function') {
                pHandler();
            }
        },
        crossDomain: true,
        error: function (jqXHR, textStatus, errorThrown) {
        }
    });
};

RadioCanada.init = function () {
    //document.domain = "radio-canada.ca";
    if (document.location.hostname == "www.cbc.ca" && document.location.href.indexOf("liverightnow") > 0) {
        document.domain = "cbc.ca";
    } else {
        document.domain = "radio-canada.ca";
    }

    if (!RadioCanada._isLoaded) {
        RadioCanada._cacheScripts = new Array();
        var prefix = RadioCanada.getPrefix(false);

        data = { Editions: [{ "Id": 1, "Name": "Abitibi-Témiscamingue", "Key": "abitibitemiscamingue", "SyndicationId": 1, "Decalage": 0, "MedianetId": 1, "SegmentUrl": "/abitibi-temiscamingue" }, { "Id": 6, "Name": "Estrie", "Key": "estrie", "SyndicationId": 4, "Decalage": 0, "MedianetId": 6, "SegmentUrl": "/estrie" }, { "Id": 5, "Name": "Est du Québec", "Key": "estduquebec", "SyndicationId": 18, "Decalage": 0, "MedianetId": 24, "SegmentUrl": "/est-du-quebec" }, { "Id": 11, "Name": "Ottawa–Gatineau", "Key": "ottawagatineau", "SyndicationId": 6, "Decalage": 0, "MedianetId": 2, "SegmentUrl": "/ottawa-gatineau" }, { "Id": 8, "Name": "Mauricie–Centre‑du‑Québec", "Key": "mauriciecentreduquebec", "SyndicationId": 7, "Decalage": 0, "MedianetId": 8, "SegmentUrl": "/mauricie" }, { "Id": 9, "Name": "Montréal", "Key": "montreal", "SyndicationId": 8, "Decalage": 0, "MedianetId": 1, "SegmentUrl": "/montreal" }, { "Id": 12, "Name": "Québec", "Key": "quebec", "SyndicationId": 9, "Decalage": 0, "MedianetId": 13, "SegmentUrl": "/quebec" }, { "Id": 13, "Name": "Saguenay-Lac-Saint-Jean", "Key": "saguenaylacsaintjean", "SyndicationId": 10, "Decalage": 0, "MedianetId": 19, "SegmentUrl": "/saguenay-lac-saint-jean" }, { "Id": 10, "Name": "Ontario", "Key": "ontario", "SyndicationId": 11, "Decalage": 0, "MedianetId": 103, "SegmentUrl": "/ontario" }, { "Id": 11, "Name": "Ottawa–Gatineau", "Key": "ottawagatineau", "SyndicationId": 12, "Decalage": 0, "MedianetId": 2, "SegmentUrl": "/ottawa-gatineau" }, { "Id": 3, "Name": "Alberta", "Key": "alberta", "SyndicationId": 13, "Decalage": -2, "MedianetId": 10, "SegmentUrl": "/alberta" }, { "Id": 4, "Name": "Colombie‑Britannique–Yukon", "Key": "colombiebritanniqueetyukon", "SyndicationId": 14, "Decalage": -3, "MedianetId": 12, "SegmentUrl": "/colombie-britannique-et-yukon" }, { "Id": 7, "Name": "Manitoba", "Key": "manitoba", "SyndicationId": 15, "Decalage": -1, "MedianetId": 4, "SegmentUrl": "/manitoba" }, { "Id": 14, "Name": "Saskatchewan", "Key": "saskatchewan", "SyndicationId": 16, "Decalage": -2, "MedianetId": 9, "SegmentUrl": "/saskatchewan" }, { "Id": 2, "Name": "Acadie", "Key": "acadie", "SyndicationId": 17, "Decalage": 1, "MedianetId": 121, "SegmentUrl": "/acadie"}], Radios: [{ "Id": 1, "Name": "Montréal", "RegionEditionId": 9, "RegioStationId": 7, "MedianetId": 1, "GuideHoraireId": 1, "GuideHoraireName": "Montréal", "Indicatif": "CBF", "Decalage": 0, "FeedConsole": "http://www.radio-canada.ca/util/endirect/premiere.asx", "WTProfile": "", "CommentEmail": "" }, { "Id": 2, "Name": "Nouvelle-Écosse", "RegionEditionId": 2, "RegioStationId": 19, "MedianetId": 21, "GuideHoraireId": 2, "GuideHoraireName": "Nouvelle-Écosse", "Indicatif": "CBAFH", "Decalage": 0, "FeedConsole": "http://www.radio-canada.ca/util/endirect/halifax.asx", "WTProfile": "", "CommentEmail": "" }, { "Id": 3, "Name": "Île-du-Prince-Édouard", "RegionEditionId": 2, "RegioStationId": 20, "MedianetId": 23, "GuideHoraireId": 3, "GuideHoraireName": "Île-du-Prince-Édouard", "Indicatif": "CBAFC", "Decalage": 0, "FeedConsole": "http://www.radio-canada.ca/util/endirect/charlottetown.asx", "WTProfile": "", "CommentEmail": "" }, { "Id": 4, "Name": "Nouveau-Brunswick", "RegionEditionId": 2, "RegioStationId": 2, "MedianetId": 11, "GuideHoraireId": 4, "GuideHoraireName": "Nouveau-Brunswick", "Indicatif": "CBAF", "Decalage": 1, "FeedConsole": "http://www.radio-canada.ca/util/endirect/moncton.asx", "WTProfile": "", "CommentEmail": "" }, { "Id": 5, "Name": "Gaspésie-Les-Îles", "RegionEditionId": 5, "RegioStationId": 5, "MedianetId": 18, "GuideHoraireId": 5, "GuideHoraireName": "Gaspésie-Les-Îles", "Indicatif": "CBGA", "Decalage": 0, "FeedConsole": "http://www.radio-canada.ca/util/endirect/matane.asx", "WTProfile": "", "CommentEmail": "" }, { "Id": 6, "Name": "Côte-Nord", "RegionEditionId": 5, "RegioStationId": 13, "MedianetId": 20, "GuideHoraireId": 6, "GuideHoraireName": "Côte-Nord", "Indicatif": "CBSI", "Decalage": 0, "FeedConsole": "http://www.radio-canada.ca/util/endirect/septiles.asx", "WTProfile": "", "CommentEmail": "" }, { "Id": 7, "Name": "Bas-Saint-Laurent", "RegionEditionId": 5, "RegioStationId": 11, "MedianetId": 14, "GuideHoraireId": 7, "GuideHoraireName": "Bas-Saint-Laurent", "Indicatif": "CJBR", "Decalage": 0, "FeedConsole": "http://www.radio-canada.ca/util/endirect/rimouski.asx", "WTProfile": "", "CommentEmail": "" }, { "Id": 9, "Name": "Saguenay-Lac-Saint-Jean", "RegionEditionId": 13, "RegioStationId": 12, "MedianetId": 19, "GuideHoraireId": 9, "GuideHoraireName": "Saguenay - Lac-Saint-Jean", "Indicatif": "CBJ", "Decalage": 0, "FeedConsole": "http://www.radio-canada.ca/util/endirect/chicoutimi.asx", "WTProfile": "", "CommentEmail": "" }, { "Id": 10, "Name": "Québec", "RegionEditionId": 12, "RegioStationId": 9, "MedianetId": 13, "GuideHoraireId": 10, "GuideHoraireName": "Québec", "Indicatif": "CBV", "Decalage": 0, "FeedConsole": "http://www.radio-canada.ca/util/endirect/quebec.asx", "WTProfile": "", "CommentEmail": "" }, { "Id": 11, "Name": "Estrie", "RegionEditionId": 6, "RegioStationId": 4, "MedianetId": 6, "GuideHoraireId": 11, "GuideHoraireName": "Estrie", "Indicatif": "CBF_SHR", "Decalage": 0, "FeedConsole": "http://www.radio-canada.ca/util/endirect/sherbrooke.asx", "WTProfile": "", "CommentEmail": "" }, { "Id": 12, "Name": "Mauricie - Centre-du-Québec", "RegionEditionId": 8, "RegioStationId": 6, "MedianetId": 8, "GuideHoraireId": 12, "GuideHoraireName": "Mauricie - Centre-du-Québec", "Indicatif": "CBF_TR", "Decalage": 0, "FeedConsole": "http://www.radio-canada.ca/util/endirect/trois-rivieres.asx", "WTProfile": "", "CommentEmail": "" }, { "Id": 13, "Name": "Sudbury", "RegionEditionId": 10, "RegioStationId": 14, "MedianetId": 5, "GuideHoraireId": 13, "GuideHoraireName": "Sudbury", "Indicatif": "CBON", "Decalage": 0, "FeedConsole": "http://www.radio-canada.ca/util/endirect/sudbury.asx", "WTProfile": "", "CommentEmail": "" }, { "Id": 14, "Name": "Toronto", "RegionEditionId": 10, "RegioStationId": 15, "MedianetId": 3, "GuideHoraireId": 14, "GuideHoraireName": "Toronto", "Indicatif": "CJBC", "Decalage": 0, "FeedConsole": "http://www.radio-canada.ca/util/endirect/toronto.asx", "WTProfile": "", "CommentEmail": "" }, { "Id": 15, "Name": "Windsor", "RegionEditionId": 10, "RegioStationId": 17, "MedianetId": 16, "GuideHoraireId": 15, "GuideHoraireName": "Windsor", "Indicatif": "CBEF", "Decalage": 0, "FeedConsole": "http://www.radio-canada.ca/util/endirect/windsor.asx", "WTProfile": "", "CommentEmail": "" }, { "Id": 16, "Name": "Ottawa-Gatineau", "RegionEditionId": 11, "RegioStationId": 8, "MedianetId": 2, "GuideHoraireId": 16, "GuideHoraireName": "Ottawa-Gatineau", "Indicatif": "CBOF", "Decalage": 0, "FeedConsole": "http://www.radio-canada.ca/util/endirect/ottawa.asx", "WTProfile": "", "CommentEmail": "" }, { "Id": 17, "Name": "Manitoba", "RegionEditionId": 7, "RegioStationId": 18, "MedianetId": 4, "GuideHoraireId": 17, "GuideHoraireName": "Manitoba", "Indicatif": "CKSB", "Decalage": -1, "FeedConsole": "http://www.radio-canada.ca/util/endirect/winnipeg.asx", "WTProfile": "", "CommentEmail": "" }, { "Id": 18, "Name": "Saskatchewan", "RegionEditionId": 14, "RegioStationId": 10, "MedianetId": 9, "GuideHoraireId": 18, "GuideHoraireName": "Saskatchewan", "Indicatif": "CBKF", "Decalage": 0, "FeedConsole": "http://www.radio-canada.ca/util/endirect/regina.asx", "WTProfile": "", "CommentEmail": "" }, { "Id": 21, "Name": "Colombie-Britannique", "RegionEditionId": 4, "RegioStationId": 16, "MedianetId": 12, "GuideHoraireId": 21, "GuideHoraireName": "Colombie - Britannique", "Indicatif": "CBUF", "Decalage": -3, "FeedConsole": "http://www.radio-canada.ca/util/endirect/vancouver.asx", "WTProfile": "", "CommentEmail": "" }, { "Id": 22, "Name": "Alberta", "RegionEditionId": 3, "RegioStationId": 3, "MedianetId": 10, "GuideHoraireId": 22, "GuideHoraireName": "Alberta", "Indicatif": "CHFA", "Decalage": -2, "FeedConsole": "http://www.radio-canada.ca/util/endirect/edmonton.asx", "WTProfile": "", "CommentEmail": "" }, { "Id": 32, "Name": "Abitibi-Témiscamingue", "RegionEditionId": 1, "RegioStationId": 1, "MedianetId": 17, "GuideHoraireId": 32, "GuideHoraireName": "Abitibi - Témiscamingue", "Indicatif": "CBF_Rouyn", "Decalage": 0, "FeedConsole": "http://www.radio-canada.ca/util/endirect/rouyn.asx", "WTProfile": "", "CommentEmail": "" }, { "Id": 34, "Name": "Terre-Neuve", "RegionEditionId": 2, "RegioStationId": 19, "MedianetId": 21, "GuideHoraireId": 34, "GuideHoraireName": "Terre-Neuve", "Indicatif": "CBAF Terre-Neuve", "Decalage": 0, "FeedConsole": "http://www.radio-canada.ca/util/endirect/halifax.asx", "WTProfile": "", "CommentEmail": ""}], Stations: [{ "Id": 1, "Name": "Abitibi-Témiscamingue", "Address": "Société Radio-Canada\n70, avenue Principale\nRouyn-Noranda (Québec)\nJ9X 4P2", "City": "Rouyn-Noranda", "Province": "Québec", "PostalCode": "J9X 4P2", "ContactPhone": "819 762-8155", "OtherContactPhone": null, "ContactEmail": "abitibi@radio-canada.ca", "PageContactUrl": "http://www.radio-canada.ca/regions/abitibi/coordonnes.shtml", "PageFrequenceUrl": "http://www.radio-canada.ca/regions/abitibi/frequences.asp", "RegionEditionId": 1, "ByDefault": true }, { "Id": 2, "Name": "Moncton", "Address": "Société Radio-Canada\n250, avenue Université\nMoncton (Nouveau-Brunswick)\nE1C 5K3", "City": "Moncton", "Province": "Nouveau-Brunswick", "PostalCode": "E1C 5K3", "ContactPhone": "506 853-6666", "OtherContactPhone": null, "ContactEmail": "nouvelles.acadie@radio-canada.ca", "PageContactUrl": "http://www.radio-canada.ca/regions/acadie/coordonnes.shtml", "PageFrequenceUrl": "http://www.radio-canada.ca/regions/acadie/frequences.asp", "RegionEditionId": 2, "ByDefault": true }, { "Id": 19, "Name": "Halifax", "Address": "Édifice de la radio :\n5600, rue Sackville\nC.P. 3000\nHalifax (Nouvelle-Écosse)\nB3J 3E9\n\nÉdifice de la télévision :\n1840, rue Bell\nC.P. 3000\nHalifax (Nouvelle-Écosse)\nB3J 3E9", "City": "Halifax", "Province": "Nouvelle Écosse", "PostalCode": "B3J 3E9", "ContactPhone": "902 420-8311", "OtherContactPhone": null, "ContactEmail": "nouvelles.acadie@radio-canada.ca", "PageContactUrl": "http://www.radio-canada.ca/regions/acadie/coordonnes.shtml", "PageFrequenceUrl": "http://www.radio-canada.ca/regions/acadie/frequences.asp", "RegionEditionId": 2, "ByDefault": false }, { "Id": 20, "Name": "Charlottetown", "Address": "Société Radio-Canada\nC.P. 2230\nCharlottetown (Île-du-Prince-Édouard)\nC1A 8B9", "City": "Charlottetown", "Province": "Île-du-Prince-Édouard", "PostalCode": "C1A 8B9", "ContactPhone": "902 629-6400", "OtherContactPhone": null, "ContactEmail": "nouvelles.acadie@radio-canada.ca", "PageContactUrl": "http://www.radio-canada.ca/regions/acadie/coordonnes.shtml", "PageFrequenceUrl": "http://www.radio-canada.ca/regions/acadie/frequences.asp", "RegionEditionId": 2, "ByDefault": false }, { "Id": 3, "Name": "Alberta", "Address": "Société Radio-Canada\n10062 - 102e Avenue\nSuite 123 Edmonton City Centre\nEdmonton (Alberta)\nT5J 2Y8\n\nBoîte postale 555\nEdmonton (Alberta)\nT5J 2P4", "City": "Edmonton", "Province": "Alberta", "PostalCode": "T5J 2Y8", "ContactPhone": "1 888 680-2432", "OtherContactPhone": null, "ContactEmail": "nouvelles.alberta@radio-canada.ca", "PageContactUrl": "http://www.radio-canada.ca/regions/alberta/coordonnes.shtml", "PageFrequenceUrl": "http://www.radio-canada.ca/regions/alberta/frequences.asp", "RegionEditionId": 3, "ByDefault": true }, { "Id": 4, "Name": "Estrie", "Address": "Société Radio-Canada\n1335, rue King Ouest\nSherbrooke (Québec)\nJ1J 2B8", "City": "Sherbrooke", "Province": "Québec", "PostalCode": "J1J 2B8", "ContactPhone": "819 620-0000", "OtherContactPhone": null, "ContactEmail": "tjestrie@radio-canada.ca", "PageContactUrl": "http://www.radio-canada.ca/regions/estrie/coordonnes.shtml", "PageFrequenceUrl": "http://www.radio-canada.ca/regions/estrie/frequences.asp", "RegionEditionId": 6, "ByDefault": true }, { "Id": 5, "Name": "Gaspésie - Les Îles", "Address": "Société Radio-Canada\n155, rue Saint-Sacrement\nMatane (Québec)\nG4W 1Y9", "City": "Matane", "Province": "Québec", "PostalCode": "G4W 1Y9", "ContactPhone": "418 562-7844", "OtherContactPhone": null, "ContactEmail": "nouvellM@radio-canada.ca", "PageContactUrl": "http://www.radio-canada.ca/regions/gaspesie-lesiles/coordonnes.shtml", "PageFrequenceUrl": "http://www.radio-canada.ca/regions/gaspesie-lesiles/frequences.asp", "RegionEditionId": 5, "ByDefault": false }, { "Id": 6, "Name": "Mauricie - Centre-du-Québec", "Address": "Société Radio-Canada\n225 des Forges, bureau 101\nTrois-Rivières (Québec)\nG9A 2G7", "City": "Trois-Rivières", "Province": "Québec", "PostalCode": "G9A 2G7", "ContactPhone": "819 694-0114", "OtherContactPhone": null, "ContactEmail": "tjmauricie@radio-canada.ca", "PageContactUrl": "http://www.radio-canada.ca/regions/mauricie/coordonnes.shtml", "PageFrequenceUrl": "http://www.radio-canada.ca/regions/mauricie/frequences.asp", "RegionEditionId": 8, "ByDefault": true }, { "Id": 7, "Name": "Montréal", "Address": "Société Radio-Canada\n1400, boul. René-Lévesque Est\nMontréal (Québec)\nH2L 2M2", "City": "Montréal", "Province": "Québec", "PostalCode": "H2L 2M2", "ContactPhone": "514 597-5000", "OtherContactPhone": null, "ContactEmail": "nouvelles-internet@radio-canada.ca", "PageContactUrl": "", "PageFrequenceUrl": "http://www.radio-canada.ca/regions/montreal/frequences.asp", "RegionEditionId": 9, "ByDefault": true }, { "Id": 8, "Name": "Ottawa - Gatineau", "Address": "Société Radio-Canada\n181, rue Queen (Ottawa)\nK1P 1K9\nC.P. 3220, Succursale C\nOttawa, Ontario\nK1Y 1E4", "City": "Ottawa", "Province": "Ontario", "PostalCode": "K1P 1K9", "ContactPhone": "613 288-6600", "OtherContactPhone": null, "ContactEmail": "nouvelles.ottawagatineau@radio-canada.ca", "PageContactUrl": "http://www.radio-canada.ca/regions/ottawa/coordonnes.shtml", "PageFrequenceUrl": "http://www.radio-canada.ca/regions/ottawa/frequences.asp", "RegionEditionId": 11, "ByDefault": true }, { "Id": 9, "Name": "Québec", "Address": "Société Radio-Canada\n888, rue Saint-Jean\nQuébec (Québec)\nG1R 5H6", "City": "Québec", "Province": "Québec", "PostalCode": "G1R 5H6", "ContactPhone": "418 656-8206", "OtherContactPhone": null, "ContactEmail": "nouvelles.quebec@radio-canada.ca", "PageContactUrl": "http://www.radio-canada.ca/regions/quebec/coordonnes.shtml", "PageFrequenceUrl": "http://www.radio-canada.ca/regions/quebec/frequences.asp", "RegionEditionId": 12, "ByDefault": true }, { "Id": 10, "Name": "Saskatchewan", "Address": "Société Radio-Canada\n2440, rue Broad\nRégina (Saskatchewan)\nS4P 4A1", "City": "Régina", "Province": "Saskatchewan", "PostalCode": "S4P 4A1", "ContactPhone": "", "OtherContactPhone": null, "ContactEmail": "tjsask@radio-canada.ca", "PageContactUrl": "http://www.radio-canada.ca/regions/saskatchewan/coordonnes.shtml", "PageFrequenceUrl": "http://www.radio-canada.ca/regions/saskatchewan/frequences.asp", "RegionEditionId": 14, "ByDefault": true }, { "Id": 11, "Name": "Bas-Saint-Laurent", "Address": "Société Radio-Canada\n273, rue Saint-Jean-Baptiste Ouest\nRimouski (Québec)\nG5L 4J8", "City": "Rimouski", "Province": "Québec", "PostalCode": "G5L 4J8", "ContactPhone": "418 722-1600", "OtherContactPhone": null, "ContactEmail": "nouvelles.rimouski@radio-canada.ca", "PageContactUrl": "http://www.radio-canada.ca/regions/bas-st-laurent/coordonnes.shtml", "PageFrequenceUrl": "http://www.radio-canada.ca/regions/bas-st-laurent/frequences.asp", "RegionEditionId": 5, "ByDefault": true }, { "Id": 12, "Name": "Saguenay-Lac-Saint-Jean", "Address": "Société Radio-Canada\n500, rue des Saguenéens\nChicoutimi (Québec)\nG7H 6N4", "City": "Chicoutimi", "Province": "Québec", "PostalCode": "G7H 6N4", "ContactPhone": "418 696-6666", "OtherContactPhone": null, "ContactEmail": "nouvellescbj@radio-canada.ca", "PageContactUrl": "http://www.radio-canada.ca/regions/saguenay-lac/coordonnes.shtml", "PageFrequenceUrl": "http://www.radio-canada.ca/regions/saguenay-lac/frequences.asp", "RegionEditionId": 13, "ByDefault": true }, { "Id": 13, "Name": "Côte-Nord", "Address": "Société Radio-Canada\n350, rue Smith, Bureau 30\nSept-Îles (Québec)\nG4R 3X2", "City": "Sept-Îles", "Province": "Québec", "PostalCode": "G4R 3X2", "ContactPhone": "418 968-0720", "OtherContactPhone": "1 800 463-1731", "ContactEmail": "cbsi@radio-canada.ca", "PageContactUrl": "http://www.radio-canada.ca/regions/cote-nord/coordonnes.shtml", "PageFrequenceUrl": "http://www.radio-canada.ca/regions/cote-nord/frequences.asp", "RegionEditionId": 5, "ByDefault": false }, { "Id": 14, "Name": "Sudbury", "Address": "Société Radio-Canada\n15, rue MacKenzie\nSudbury (Ontario)\nP3C 4Y1", "City": "Sudbury", "Province": "Ontario", "PostalCode": "P3C 4Y1", "ContactPhone": "705 688-3286", "OtherContactPhone": null, "ContactEmail": "tjontario@radio-canada.ca", "PageContactUrl": "http://www.radio-canada.ca/regions/ontario/coordonnes.shtml", "PageFrequenceUrl": "http://www.radio-canada.ca/regions/ontario/frequences.asp", "RegionEditionId": 10, "ByDefault": false }, { "Id": 15, "Name": "Toronto", "Address": "Société Radio-Canada\n205, rue Wellington Ouest\nToronto (Ontario)\nM5V 3G7", "City": "Toronto", "Province": "Ontario", "PostalCode": "M5V 3G7", "ContactPhone": "416 205-3632", "OtherContactPhone": null, "ContactEmail": "tjontario@radio-canada.ca", "PageContactUrl": "http://www.radio-canada.ca/regions/ontario/coordonnes.shtml", "PageFrequenceUrl": "http://www.radio-canada.ca/regions/ontario/frequences.asp", "RegionEditionId": 10, "ByDefault": true }, { "Id": 16, "Name": "Colombie-Britannique\net Yukon", "Address": "Société Radio-Canada\n700 rue Hamilton\nVancouver (Colombie-Britannique)\nV6B 4A2", "City": "Vancouver", "Province": "Colombie-Britannique", "PostalCode": "V6B 4A2", "ContactPhone": "604 662-6213", "OtherContactPhone": null, "ContactEmail": "tjcb@radio-canada.ca", "PageContactUrl": "http://www.radio-canada.ca/regions/colombie-britannique/coordonnes.shtml", "PageFrequenceUrl": "http://www.radio-canada.ca/regions/colombie-britannique/frequences.asp", "RegionEditionId": 4, "ByDefault": true }, { "Id": 17, "Name": "Windsor", "Address": "Société Radio-Canada\n825, promenade Riverside Ouest\nWindsor (Ontario)\nN9A 5K9", "City": "Windsor", "Province": "Ontario", "PostalCode": "N9A 5K9", "ContactPhone": "519 255-3572", "OtherContactPhone": null, "ContactEmail": "tjontario@radio-canada.ca", "PageContactUrl": "http://www.radio-canada.ca/regions/ontario/coordonnes.shtml", "PageFrequenceUrl": "http://www.radio-canada.ca/regions/ontario/frequences.asp", "RegionEditionId": 10, "ByDefault": false }, { "Id": 18, "Name": "Manitoba", "Address": "Édifice de la télévision :\n541, avenue Portage\nWinnipeg (Manitoba)\nR3C 2H1\n\nÉdifice de la radio :\n607, rue Langevin\nSaint-Boniface (Manitoba)\nR2H 2W2", "City": "Winnipeg", "Province": "Manitoba", "PostalCode": "R3C 2H1", "ContactPhone": "204 788-3262", "OtherContactPhone": null, "ContactEmail": "manitoba@radio-canada.ca", "PageContactUrl": "http://www.radio-canada.ca/regions/manitoba/coordonnes.shtml", "PageFrequenceUrl": "http://www.radio-canada.ca/regions/manitoba/frequences.asp", "RegionEditionId": 7, "ByDefault": true}], Teles: [{ "Id": 1, "Name": "Montréal", "MedianetId": 1, "GuideHoraireId": 1, "GuideHoraireName": "Montréal", "Indicatif": "CBFT", "Decalage": 0, "FeedConsole": "", "WTProfile": "", "CommentEmail": "" }, { "Id": 9, "Name": "Saguenay-Lac-Saint-Jean", "MedianetId": 19, "GuideHoraireId": 9, "GuideHoraireName": "Saguenay - Lac-Saint-Jean", "Indicatif": "CKRS", "Decalage": 0, "FeedConsole": "", "WTProfile": "", "CommentEmail": "" }, { "Id": 10, "Name": "Québec", "MedianetId": 13, "GuideHoraireId": 10, "GuideHoraireName": "Québec", "Indicatif": "CBVT", "Decalage": 0, "FeedConsole": "", "WTProfile": "", "CommentEmail": "" }, { "Id": 11, "Name": "Estrie", "MedianetId": 6, "GuideHoraireId": 11, "GuideHoraireName": "Estrie", "Indicatif": "CKSH", "Decalage": 0, "FeedConsole": "", "WTProfile": "", "CommentEmail": "" }, { "Id": 12, "Name": "Mauricie-Centre-du-Québec", "MedianetId": 8, "GuideHoraireId": 12, "GuideHoraireName": "Mauricie - Centre-du-Québec", "Indicatif": "CKTM", "Decalage": 0, "FeedConsole": "", "WTProfile": "", "CommentEmail": "" }, { "Id": 16, "Name": "Ottawa-Gatineau", "MedianetId": 2, "GuideHoraireId": 16, "GuideHoraireName": "Ottawa-Gatineau", "Indicatif": "CBOFT", "Decalage": 0, "FeedConsole": "", "WTProfile": "", "CommentEmail": "" }, { "Id": 17, "Name": "Manitoba", "MedianetId": 4, "GuideHoraireId": 17, "GuideHoraireName": "Manitoba", "Indicatif": "CBWFT", "Decalage": -1, "FeedConsole": "", "WTProfile": "", "CommentEmail": "" }, { "Id": 18, "Name": "Saskatchewan", "MedianetId": 9, "GuideHoraireId": 18, "GuideHoraireName": "Saskatchewan", "Indicatif": "CBKFT", "Decalage": 0, "FeedConsole": "", "WTProfile": "", "CommentEmail": "" }, { "Id": 21, "Name": "Colombie-Britannique", "MedianetId": 12, "GuideHoraireId": 21, "GuideHoraireName": "Colombie - Britannique", "Indicatif": "CBUFT", "Decalage": -3, "FeedConsole": "", "WTProfile": "", "CommentEmail": "" }, { "Id": 22, "Name": "Alberta", "MedianetId": 10, "GuideHoraireId": 22, "GuideHoraireName": "Alberta", "Indicatif": "CBXFT", "Decalage": -2, "FeedConsole": "", "WTProfile": "", "CommentEmail": "" }, { "Id": 23, "Name": "Ontario", "MedianetId": 103, "GuideHoraireId": 23, "GuideHoraireName": "Ontario", "Indicatif": "CJBCT", "Decalage": 0, "FeedConsole": "", "WTProfile": "", "CommentEmail": "" }, { "Id": 24, "Name": "Est du Québec", "MedianetId": 24, "GuideHoraireId": 24, "GuideHoraireName": "Est du Québec", "Indicatif": "CJBRT", "Decalage": 0, "FeedConsole": "", "WTProfile": "", "CommentEmail": "" }, { "Id": 33, "Name": "Acadie", "MedianetId": 121, "GuideHoraireId": 33, "GuideHoraireName": "Acadie", "Indicatif": "CBAFT", "Decalage": 0, "FeedConsole": "", "WTProfile": "", "CommentEmail": "" }, { "Id": 34, "Name": "Terre-Neuve", "MedianetId": 121, "GuideHoraireId": 34, "GuideHoraireName": "Terre-Neuve", "Indicatif": "CBAFT Terre-Neuve", "Decalage": 0, "FeedConsole": "", "WTProfile": "", "CommentEmail": ""}], EspaceMusique: [{ "Id": 1, "Name": "Abitibi-Témiscamingue", "MedianetId": 2, "GuideHoraireId": 16, "GuideHoraireName": "Abitibi - Témiscamingue", "Decalage": 0, "FeedConsole": "http://www.radio-canada.ca/util/endirect/OttawaEM.asx", "WTProfile": "radio_em_ottawa", "CommentEmail": "CommentairesEM@radio-canada.ca", "WidgetRadioId": 81 }, { "Id": 2, "Name": "Est du Québec", "MedianetId": 24, "GuideHoraireId": 24, "GuideHoraireName": "Est du Québec", "Decalage": 0, "FeedConsole": "http://www.radio-canada.ca/util/endirect/RimouskiEM.asx", "WTProfile": "radio_em_rimouski", "CommentEmail": "CommentairesEM@radio-canada.ca", "WidgetRadioId": 86 }, { "Id": 3, "Name": "Saguenay-Lac-Saint-Jean", "MedianetId": 19, "GuideHoraireId": 9, "GuideHoraireName": "Saguenay - Lac-Saint-Jean", "Decalage": 0, "FeedConsole": "http://www.radio-canada.ca/util/endirect/SaguenaylacstjeanEM.asx", "WTProfile": "radio_em_saguenay", "CommentEmail": "CommentairesEM@radio-canada.ca", "WidgetRadioId": 93 }, { "Id": 4, "Name": "Québec", "MedianetId": 13, "GuideHoraireId": 10, "GuideHoraireName": "Québec", "Decalage": 0, "FeedConsole": "http://www.radio-canada.ca/util/endirect/QuebecEM.asx", "WTProfile": "radio_em_quebec", "CommentEmail": "CommentairesEM@radio-canada.ca", "WidgetRadioId": 92 }, { "Id": 5, "Name": "Montréal", "MedianetId": 1, "GuideHoraireId": 1, "GuideHoraireName": "Montréal", "Decalage": 0, "FeedConsole": "http://www.radio-canada.ca/util/endirect/espace_musique.asx", "WTProfile": "radio_em_montreal", "CommentEmail": "CommentairesEM@radio-canada.ca", "WidgetRadioId": 90 }, { "Id": 6, "Name": "Ottawa-Gatineau", "MedianetId": 2, "GuideHoraireId": 16, "GuideHoraireName": "Ottawa-Gatineau", "Decalage": 0, "FeedConsole": "http://www.radio-canada.ca/util/endirect/OttawaEM.asx", "WTProfile": "radio_em_ottawa", "CommentEmail": "CommentairesEM@radio-canada.ca", "WidgetRadioId": 91 }, { "Id": 7, "Name": "Toronto", "MedianetId": 3, "GuideHoraireId": 14, "GuideHoraireName": "Toronto", "Decalage": 0, "FeedConsole": "http://www.radio-canada.ca/util/endirect/TorontoEM.asx", "WTProfile": "radio_em_toronto", "CommentEmail": "CommentairesEM@radio-canada.ca", "WidgetRadioId": 97 }, { "Id": 8, "Name": "Sudbury", "MedianetId": 5, "GuideHoraireId": 13, "GuideHoraireName": "Sudbury", "Decalage": 0, "FeedConsole": "http://www.radio-canada.ca/util/endirect/SudburyEM.asx", "WTProfile": "radio_em_sudbury", "CommentEmail": "CommentairesEM@radio-canada.ca", "WidgetRadioId": 95 }, { "Id": 9, "Name": "Manitoba", "MedianetId": 4, "GuideHoraireId": 17, "GuideHoraireName": "Manitoba", "Decalage": -1, "FeedConsole": "http://www.radio-canada.ca/util/endirect/WinnipegEM.asx", "WTProfile": "radio_em_winnipeg", "CommentEmail": "CommentairesEM@radio-canada.ca", "WidgetRadioId": 88 }, { "Id": 10, "Name": "Alberta", "MedianetId": 4, "GuideHoraireId": 17, "GuideHoraireName": "Alberta", "Decalage": -1, "FeedConsole": "http://www.radio-canada.ca/util/endirect/WinnipegEM.asx", "WTProfile": "radio_em_winnipeg", "CommentEmail": "CommentairesEM@radio-canada.ca", "WidgetRadioId": 84 }, { "Id": 11, "Name": "Colombie-Britannique", "MedianetId": 12, "GuideHoraireId": 21, "GuideHoraireName": "Colombie - Britannique", "Decalage": -3, "FeedConsole": "http://www.radio-canada.ca/util/endirect/VancouverEM.asx", "WTProfile": "radio_em_vancouver", "CommentEmail": "CommentairesEM@radio-canada.ca", "WidgetRadioId": 85 }, { "Id": 12, "Name": "Acadie", "MedianetId": 121, "GuideHoraireId": 33, "GuideHoraireName": "Acadie", "Decalage": 1, "FeedConsole": "http://www.radio-canada.ca/util/endirect/MonctonEM.asx", "WTProfile": "radio_em_moncton", "CommentEmail": "CommentairesEM@radio-canada.ca", "WidgetRadioId": 82 }, { "Id": 14, "Name": "Estrie", "MedianetId": 6, "GuideHoraireId": 11, "GuideHoraireName": "Estrie", "Decalage": 0, "FeedConsole": "http://www.radio-canada.ca/util/endirect/sherbrookeEM.asx", "WTProfile": "radio_em_sherbrooke", "CommentEmail": "CommentairesEM@radio-canada.ca", "WidgetRadioId": 87 }, { "Id": 15, "Name": "Mauricie - Centre-du-Québec", "MedianetId": 8, "GuideHoraireId": 12, "GuideHoraireName": "Mauricie - Centre-du-Québec", "Decalage": 0, "FeedConsole": "http://www.radio-canada.ca/util/endirect/trois-rivieresEM.asx", "WTProfile": "radio_em_troisriviere", "CommentEmail": "CommentairesEM@radio-canada.ca", "WidgetRadioId": 89 }, { "Id": 16, "Name": "Saskatchewan", "MedianetId": 4, "GuideHoraireId": 17, "GuideHoraireName": "Saskatchewan", "Decalage": -1, "FeedConsole": "http://www.radio-canada.ca/util/endirect/WinnipegEM.asx", "WTProfile": "radio_em_winnipeg", "CommentEmail": "CommentairesEM@radio-canada.ca", "WidgetRadioId": 94 }, { "Id": 17, "Name": "Terre-Neuve", "MedianetId": 121, "GuideHoraireId": 33, "GuideHoraireName": "Terre-Neuve", "Decalage": 1, "FeedConsole": "http://www.radio-canada.ca/util/endirect/MonctonEM.asx", "WTProfile": "radio_em_moncton", "CommentEmail": "CommentairesEM@radio-canada.ca", "WidgetRadioId": 96 }, { "Id": 18, "Name": "Windsor", "MedianetId": 3, "GuideHoraireId": 14, "GuideHoraireName": "Windsor", "Decalage": 0, "FeedConsole": "http://www.radio-canada.ca/util/endirect/TorontoEM.asx", "WTProfile": "radio_em_toronto", "CommentEmail": "CommentairesEM@radio-canada.ca", "WidgetRadioId": 98}], Infos: [{ "Id": 1, "Name": "Abitibi-Témiscamingue", "SegmentUrl": "/abitibi-temiscamingue" }, { "Id": 2, "Name": "Acadie", "SegmentUrl": "/acadie" }, { "Id": 3, "Name": "Alberta", "SegmentUrl": "/alberta" }, { "Id": 4, "Name": "Colombie-Britannique et Yukon", "SegmentUrl": "/colombie-britannique-et-yukon" }, { "Id": 5, "Name": "Est du Québec", "SegmentUrl": "/est-du-quebec" }, { "Id": 6, "Name": "Estrie", "SegmentUrl": "/estrie" }, { "Id": 7, "Name": "Manitoba", "SegmentUrl": "/manitoba" }, { "Id": 8, "Name": "Mauricie - Centre-du-Québec", "SegmentUrl": "/mauricie" }, { "Id": 9, "Name": "Montréal", "SegmentUrl": "/montreal" }, { "Id": 10, "Name": "Ontario", "SegmentUrl": "/ontario" }, { "Id": 11, "Name": "Ottawa-Gatineau", "SegmentUrl": "/ottawa-gatineau" }, { "Id": 12, "Name": "Québec", "SegmentUrl": "/quebec" }, { "Id": 13, "Name": "Saguenay - Lac-Saint-Jean", "SegmentUrl": "/saguenay-lac-saint-jean" }, { "Id": 14, "Name": "Saskatchewan", "SegmentUrl": "/saskatchewan"}] };

        RadioCanada.Lib.oRegionalization = {};
        RadioCanada.Lib.oRegionalization.Editions = data.Editions;
        RadioCanada.Lib.oRegionalization.Radios = data.Radios;
        RadioCanada.Lib.oRegionalization.Stations = data.Stations;
        RadioCanada.Lib.oRegionalization.Teles = data.Teles;
        RadioCanada.Lib.oRegionalization.EspaceMusique = data.EspaceMusique;
        RadioCanada.Lib.oRegionalization.Infos = data.Infos;

        if (prefix == "br2-") prefix += "www.radio-canada.ca/";
        RadioCanada.getScript('http://' + prefix + 'www.r-c.ca/_js/modules/modules.regionalization.1.0.0.js', function () {
            RadioCanada.Mod.oRegionalization.init();
        });
    }
};

RadioCanada.sanitizeValue4IdJS = function (pStr) {
    r1 = /\s/g;
    r2 = /\W/g;

    l_out = pStr;

    try {
        if (l_out.match(r1) != null) {
            l_out = l_out.replace(r1, '');
        }
        if (l_out.match(r2) != null) {
            l_out = l_out.replace(r2, '');
        }
    }
    catch (e) {

    }

    return l_out;
}

function objToString(obj) {
    var str = '';
    
    for (var p in obj) {
        if (obj.hasOwnProperty(p)) {
            str += '_' + p + '_' + RadioCanada.sanitizeValue4IdJS(obj[p]);
        }
    }
    return str;
}

window.GetRegionalizedContent = RadioCanada.load = function (pDivId, pUrl, pQueryString) {
    var module;
    var workingstring;
    var nom;
    var _url;

    if (pUrl.indexOf("radio-canada.ca") < 0) {
        _url = 'http://' + RadioCanada.getPrefix(false) + 'www.radio-canada.ca' + pUrl;
    }
    else {
        _url = pUrl;
    }

    try {
        workingstring = pUrl.substring(pUrl.indexOf("odules/") + 7);
        nom = workingstring.substring(0, workingstring.indexOf("/"));
        module = "f_" + nom + objToString(pQueryString);
    }
    catch (e) {
        module = "f_" + RadioCanada.sanitizeValue4IdJS(pDivId);
    }

    var today = new Date();
    module += '_' + today.getFullYear() + today.getHours() + today.getDate() + today.getHours() + today.getMinutes();

    if (typeof (RadioCanada._alreadyLoad[module]) == "undefined") {
        RadioCanada.Lib.jQuery.ajax({
            url: _url,
            dataType: 'jsonp',
            data: pQueryString,
            jsonpCallback: module,
            //contentType: 'application/x-www-form-urlencoded;charset=UTF-8',
            cache: true,
            crossDomain: true,
            success: function (data) {
                RadioCanada.Lib.jQuery(("#" + pDivId)).html(data.html);

                // IE 8-
                if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
                    var ieversion = new Number(RegExp.$1);
                    if (ieversion <= 8) {
                        // On trouve les fichiers CSS
                        var regex = /<link[^>]*href="([^"]*)"/g;
                        var match = regex.exec(data.html);
                        if (match) {
                            // On load les CSS manuellement
                            for (var i = 1; i < match.length; i++) {
                                document.styleSheets[1].addImport(match[i]);
                            }
                        }
                    }
                }
            }
        });

        RadioCanada._alreadyLoad[module] = true;
    }
};

RadioCanada.executeScripts = function () {
    RadioCanada.Lib.jQuery(document).ready(function () {
        if (RadioCanada._cacheScripts.length > 0) {
            var counterScript = RadioCanada._cacheScripts.length - 1;
            while (counterScript >= 0) {
                RadioCanada._log.push('Execution du script ' + counterScript);
                try {
                    eval('RadioCanada._cacheScripts[counterScript]();');
                }
                catch (e) {
                    RadioCanada._log.push('Script ' + counterScript + ' : ' + e.description);
                }
                counterScript--;
            }
        }
    });
}

RadioCanada.executeScriptsAscending = function () {
    RadioCanada.Lib.jQuery(document).ready(function () {
        if (RadioCanada._cacheScripts.length > 0) {
            var counterScriptAsc = 0;
            while (counterScriptAsc < RadioCanada._cacheScripts.length) {
                RadioCanada._log.push('Execution du script ' + counterScriptAsc);
                try {
                    eval('RadioCanada._cacheScripts[counterScriptAsc]();');
                }
                catch (e) {
                    RadioCanada._log.push('Script ' + counterScriptAsc + ' : ' + e.description);
                }
                counterScriptAsc++;
            }
        }
    });
}

RadioCanada.updateMetaTags = function (data, HaveToUpdateStats) {
    /// <summary>
    /// Permet de mettre à jour les meta tags existants avec le JSON
    /// d'un objet MetaModel.
    /// </summary>
    if (data == null) return;

    if (typeof (RadioCanada.Lib.jQuery.address) != 'undefined') {
        RadioCanada.Lib.jQuery.address.title(data.Title);
    }

    window.StatsProfil = 'clics_' + data.MetasPubs.RCTheme + '_' + data.MetasPubs.RCSousTheme;

    RadioCanada.Lib.jQuery('meta').each(function () {
        var name = RadioCanada.Lib.jQuery(this).attr('name');

        if (name == 'dc.title' || name == 'og:title') RadioCanada.Lib.jQuery(this).attr('content', data.Title);
        else if (name == 'description' || name == 'dc.description' || name == 'og:description') RadioCanada.Lib.jQuery(this).attr('content', data.Description);
        else if (name == 'keywords' || name == 'dc.keywords') RadioCanada.Lib.jQuery(this).attr('content', data.Keywords);
        else if (name == 'copyright') RadioCanada.Lib.jQuery(this).attr('content', data.Copyright);
        else if (name == 'robots') RadioCanada.Lib.jQuery(this).attr('content', data.Robots);

        else if (name == 'fb:app_id') RadioCanada.Lib.jQuery(this).attr('content', data.FacebookAppId);

        else if (name == 'dc.creator') RadioCanada.Lib.jQuery(this).attr('content', data.MetasStats.DCCreator);
        else if (name == 'dc.date.created') RadioCanada.Lib.jQuery(this).attr('content', data.MetasStats.DCDateCreated);
        else if (name == 'dc.date.modified') RadioCanada.Lib.jQuery(this).attr('content', data.MetasStats.DCDateModified);
        else if (name == 'dc.language') RadioCanada.Lib.jQuery(this).attr('content', data.MetasStats.DCLanguage);
        else if (name == 'dc.publisher') RadioCanada.Lib.jQuery(this).attr('content', data.MetasStats.DCPublisher);

        else if (name == 'WT.sp') RadioCanada.Lib.jQuery(this).attr('content', data.MetasStats.WTSp);
        else if (name == 'WT.cg_n') RadioCanada.Lib.jQuery(this).attr('content', data.MetasStats.WTCgn);
        else if (name == 'WT.cg_s') RadioCanada.Lib.jQuery(this).attr('content', data.MetasStats.WTCgs);
        else if (name == 'WT.vt_f_tlh') RadioCanada.Lib.jQuery(this).attr('content', data.MetasStats.WTVtFTlv);

        else if (name == 'src.emission') RadioCanada.Lib.jQuery(this).attr('content', data.MetasPubs.SRCEmission);
        else if (name == 'src.niveau') RadioCanada.Lib.jQuery(this).attr('content', data.MetasPubs.SRCNiveau);
        else if (name == 'src.typedocument') RadioCanada.Lib.jQuery(this).attr('content', data.MetasPubs.SRCTypeDocument);
        else if (name == 'src.source') RadioCanada.Lib.jQuery(this).attr('content', data.MetasPubs.SRCSource);
        else if (name == 'rc.theme') RadioCanada.Lib.jQuery(this).attr('content', data.MetasPubs.RCTheme);
        else if (name == 'rc.soustheme') RadioCanada.Lib.jQuery(this).attr('content', data.MetasPubs.RCSousTheme);
        else if (name == 'rc.sujet') RadioCanada.Lib.jQuery(this).attr('content', data.MetasPubs.RCSujet);
        else if (name == 'rc.region') RadioCanada.Lib.jQuery(this).attr('content', data.MetasPubs.RCRegion);
        else if (name == 'rc.zone') RadioCanada.Lib.jQuery(this).attr('content', data.MetasPubs.RCZone);

        else if (name == 'og:url') RadioCanada.Lib.jQuery(this).attr('content', data.MetasOg.Url);
        else if (name == 'og:type') RadioCanada.Lib.jQuery(this).attr('content', data.MetasOg.Type);
        else if (name == 'og:image') RadioCanada.Lib.jQuery(this).attr('content', data.MetasOg.Image);
        else if (name == 'og:site_name') RadioCanada.Lib.jQuery(this).attr('content', data.MetasOg.SiteName);
    });
};

RadioCanada.getParameterByName = function (name) {
    /// <summary>
    /// Permet d'obtenir la valeur d'un paramètre du query string de la page.
    /// </summary>
    name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regexS = "[\\?&]" + name + "=([^&#]*)";
    var regex = new RegExp(regexS);
    var results = regex.exec(window.location.href);
    if (results == null)
        return null;
    else
        return decodeURIComponent(results[1].replace(/\+/g, " "));
};

RadioCanada.getQueryParams = function (val) {
    //Use the window.location.search if we don't have a val.
    var query = val || window.location.search;
    query = query.split('?')[1]
    var pairs = query.split('&');
    var retval = {};
    var check = [];
    for (var i = 0; i < pairs.length; i++) {
        check = pairs[i].split('=');
        retval[decodeURIComponent(check[0])] = decodeURIComponent(check[1]);
    }

    return retval;
};

RadioCanada.writeLog = function (exceptionObj) {
    if (typeof (exceptionObj) != 'undefined' && typeof (exceptionObj.status) != 'undefined' && exceptionObj.status == 'trace') {
        RadioCanada._log.push(exceptionObj.description);
    }
    else {
        RadioCanada._log.push('Erreur : ' + exceptionObj.description);
    }
};

RadioCanada.getTimeStamp = function (type) {
    var rightNow = new Date();

    if (type == "year") {
        return '' + rightNow.getFullYear();
    }
    else {
        if (type == "month") {
            return '' + rightNow.getFullYear() + eval(rightNow.getMonth() + 1);
        }
        else {
            if (type == "day") {
                return '' + rightNow.getFullYear() + eval(rightNow.getMonth() + 1) + rightNow.getDate();
            }
            else {
                if (type == "hour") {
                    return '' + rightNow.getFullYear() + eval(rightNow.getMonth() + 1) + rightNow.getDate() + rightNow.getHours();
                }
                else {
                    if (type == "minute") {
                        return '' + rightNow.getFullYear() + eval(rightNow.getMonth() + 1) + rightNow.getDate() + rightNow.getHours() + rightNow.getMinutes();
                    }
                    else {
                        if (type == "second") {
                            return '' + rightNow.getFullYear() + eval(rightNow.getMonth() + 1) + rightNow.getDate() + rightNow.getHours() + rightNow.getMinutes() + rightNow.getSeconds();
                        }
                        else {
                            return '' + rightNow.getFullYear() + eval(rightNow.getMonth() + 1) + rightNow.getDate() + rightNow.getHours() + rightNow.getMinutes() + rightNow.getSeconds() + rightNow.getMilliseconds();
                        }
                    }
                }
            }
        }
    }
};

RadioCanada.init();



//jquery
var modeleBase = function () {
    if (typeof ($) == "undefined") { if (typeof (RadioCanada.Lib.jQuery) != "undefined") { var $ = RadioCanada.Lib.jQuery; } else { $ = jQuery; } }



    function ajouterHoverPlay($monPlay, premierHover) {
        var $monLien = $monPlay.parent(),
        nbHoverExistant = $monLien.find('.hover').length,
        mesClasse = $monPlay.attr('class');


        $monPlay.addClass('fade-jquery');


        if (nbHoverExistant == 0) {
            $monLien.append('<span class="' + mesClasse + ' hover"></span>');
        


        if (($("html").hasClass("ie8") || $("html").hasClass("ie7"))) {

            var a = $(" .hover", $monLien).hide();
            $monLien.hover(function () {
                if (!$(this).hasClass("selected")) {
                    a.show()
                    $monPlay.hide();
                }
            }, function () {
                if (!$monLien.hasClass("selected")) {
                    a.hide();
                    $monPlay.show();
                }
            });

            
                a.show()
                $monPlay.hide();
           
        } else {

            var a = $(" .hover", $monLien).css("opacity", 0);

            $monLien.hover(function () {


                if (!$monLien.hasClass("selected")) {
                    $monPlay.stop().fadeTo(500, 0);
                    a.stop().fadeTo(500, 1, function () {
                        //$monPlay.show()
                    })
                }
            }, function () {
                if (!$monLien.hasClass("selected")) {
                    $monPlay.stop().fadeTo(500, 1);
                    a.stop().fadeTo(500, 0, function () {
                        //$monPlay.hide()
                    })
                }
            });

           
                $monPlay.stop().fadeTo(500, 0);
                a.stop().fadeTo(500, 1, function () {
                    //$monPlay.show()
                });


            }

        }
    };




    return {

        // public method
        // can be accessed from outside
        init: function (colors, elementClique) {



            $(".link-news, .lienImage").live('hover', function () {
                $elementPlay = $(this).find('.play');
                //on ne fait pas le fade sur le xx-small
                if ($elementPlay.length > 0 && !$elementPlay.hasClass('xx-small')) {
                    ajouterHoverPlay($(this).find('.play'), true);
                }
            });


        }
    };
};

RadioCanada.Lib.jQuery('document').ready(function () {
    var monModeleBase = modeleBase();
    monModeleBase.init();
});


