/**
* Fonction pour charger un flash
*/
/*
function loadFlash(flash_path, div, width, height) {
var flashVersion = "8";
var flashvars = {
}
var params = {
allowfullscreen:"true",
allowscriptaccess:"always",
wmode:"transparent"
}
if (swfobject.hasFlashPlayerVersion("8")) {
swfobject.embedSWF(flash_path, div, width, height, flashVersion, false, flashvars, params);
}
}
/**
* Fonction fadeIn/fadeOut compatible IE
*/
(function($) {
$.fn.customFadeIn = function(speed, callback) {
$(this).fadeIn(speed, function() {
if(jQuery.browser.msie)
$(this).get(0).style.removeAttribute('filter');
if(callback != undefined)
callback();
});
};
$.fn.customFadeOut = function(speed, callback) {
$(this).fadeOut(speed, function() {
if(jQuery.browser.msie)
$(this).get(0).style.removeAttribute('filter');
if(callback != undefined)
callback();
});
};
})(jQuery);
/**
* Cette fonction est lancée à la fin du chargement de la page
* $(function() {
*/
$(document).ready(function() {
/**
* Déclaration des variables de toutes les variables
*/
var txtSize = 11;
var increase = 0;
var nbVideos = 0;
var nbArticles = 0;
var aArticles;
var aVideos;
/**
* Gestion du scroll du bloc WebTV
*/
if ($(".webtv_bloc").length > 0) {
var webTV = new (function () {
var $this = this;
this.api = $(".webtv_bloc .webtv_bloc_player_nav")
.scrollable({
vertical: true,
size: 1,
keyboard: true,
clickable: false
})
.navigator({navi:".liste_webtv_bloc", api:true});
/**
* Création de la boucle automatique
*/
/*
$this.api.begin();
this.callTimer = function() {
if (!$(".webtv_bloc .noAuto").length) {
$this.timer = setInterval(function(){
if ($this.api.getIndex() == $this.api.getSize()-1) {
$this.api.seekTo(0);
} else {
$this.api.next();
}
},3000);
}
}
$this.callTimer();
*/
/**
* Arrêt du défilement au clic sur un item de la nav
*/
$(".webtv_bloc .liste_webtv_bloc li").click(function(){
$(".webtv_bloc .webtv_bloc_player_item a").css("display", "block");
$('object[id^=playerwebtv]').remove();
$(this).children("a").blur();
var target = $(".webtv_bloc .webtv_bloc_btn a");
clearInterval($this.timer);
target.parent().removeClass("stop").addClass("play");
});
/**
* Arrêt du défilement au clic sur l'item central
*/
$(".webtv_bloc .webtv_bloc_player_nav a").click(function(e){
clearInterval($this.timer);
$(".webtv_bloc .webtv_bloc_btn a").parent().removeClass("stop").addClass("play");
});
/**
* Gestion du bouton d"action Lecture/Pause
*/
$(".webtv_bloc .webtv_bloc_btn a").click(function(e){
$(".webtv_bloc .webtv_bloc_player_item a").css("display", "block");
$('object[id^=playerwebtv]').remove();
$(this).blur();
var $titre = "";
if($(this).parent().hasClass("play")) {
$(".webtv_bloc .noAuto").removeClass("noAuto");
$this.callTimer();
$(this).parent().removeClass("play").addClass("stop");
$titre = "Arrêter le défilement des vidéos";
$(this).children("img").attr("src", $(this).children("img").attr("src").replace("webtv_play", "webtv_stop"));
$(this).children("img").attr("alt", $titre);
} else {
clearInterval($this.timer);
$(this).parent().removeClass("stop").addClass("play");
$titre = "Démarrer le défilement des vidéos";
$(this).children("img").attr("src", $(this).children("img").attr("src").replace("webtv_stop", "webtv_play"));
$(this).children("img").attr("alt", $titre);
}
return false;
});
/**
* Affichage du bouton play/pause
*/
$(".webtv_bloc .efface").each(function() {
$(this).removeClass("efface");
});
$(".webtv_bloc_nav li").each(function(i){
if (i != 0) {
$(this).removeClass("active");
}
});
return this;
})();
/**
* Lancement d'une vidéo
*/
$(".lancer_video").click(function(e){
var videoSrc = "";
var subtitleUrl = "";
var audioUrl = "";
var destDivId = $(this).parent().attr("id") + "_container";
var videoContainer = $('
');
if ($(this).siblings(".video_src")) {
videoSrc = $(this).siblings(".video_src").attr("value");
}
if ($(this).siblings(".video_subtitle")) {
subtitleUrl = $(this).siblings(".video_subtitle").attr("value");
}
if ($(this).siblings(".video_audio")) {
audioUrl = $(this).siblings(".video_audio").attr("value");
}
$(this).parent().prepend(videoContainer)
$(this).css("display", "none");
return loadVideo(videoSrc, subtitleUrl, audioUrl, destDivId, 480, 310);
});
}
/**
* Gestion du scroll du bloc A la une
*/
if ($(".a_la_une_mod_liste_contenus li").length > 1) {
$(".bloc_a_la_une_mod .active").each(function() {
$(this).removeClass("active");
});
$(".bloc_a_la_une_mod .efface").each(function() {
$(this).removeClass("efface");
});
var listUneMod = new (function () {
var $this = this;
this.api = $(".a_la_une_mod_contenus")
.scrollable({
vertical: false,
size: 1,
clickable: false,
keyboard: false
})
.navigator({
navi:".a_la_une_mod_pagination",
api: true
});
});
var UneMod = new (function () {
oScrollUneMod = this.api = $(".a_la_une_mod_pagination_div")
.scrollable({
size:5,
clickable: false,
vertical:false,
onBeforeSeek:function(){
this.getConf().disabledClass = "enable";
//alert(this.getConf().disabledClass + "; " + this.getIndex() + "; " + this.getSize());
}
});
});
$(".a_la_une_mod_pagination a").click(function(){
$(this).blur();
});
if ($(".une_contenu_visuel_image").length > 0) {
$(".une_contenu_visuel_image").hover(
function () {
$(this).children(".visuel_copyright").css("display", "block");
},
function () {
$(this).children(".visuel_copyright").css("display", "none");
}
);
};
}
$('.une_item_decription').jScrollPane();
$('.une_contenu_def').jScrollPane();
});
$(window).load(function() {
listHeight = 0;
for(indexItem = 0; indexItem < 3; indexItem++) {
//20 correspond au padding sur les li
listHeight += $($(".liste_onglets_a_la_une li")[indexItem]).height() + 20;
}
$(".onglets_a_la_une").css("height", listHeight + "px");
/*Gestion du scroll du bloc dans la même thematiques de la webtv*/
if ($(".liste_thematiques li").length > 1) {
var sites = new (function () {
var indexItemTh = 0;
var nbItemsTh = 5;
var aItems = $(".liste_thematiques li");
var listHeightTh = 0;
var oScroll;
var current_li=1;
if (nbItemsTh >= aItems.length) {
return;
}
for (indexItemTh = 0; indexItemTh 1 && aItems.length>nbItemsTh && current_li<(aItems.length)-4) || aItems.length<10 && current_li>1 ){
$(".wtv_bloc_thematique .lien_precedent").removeClass("efface");
}
if(current_li==(aItems.length)-4){
$(".wtv_bloc_thematique .lien_suivant").addClass("efface");
}
});
$(".wtv_bloc_thematique .prev").click(function() {
current_li--;
if(current_li==1){
$(".wtv_bloc_thematique .lien_precedent").addClass("efface");
}
if(current_li<(aItems.length)-4){
$(".wtv_bloc_thematique .lien_suivant").removeClass("efface");
}
});
$(".wtv_bloc_thematique .next, .wtv_bloc_thematique .prev").click(function() {
var currentIndex = 1;
var limitIndex = currentIndex + nbItemsTh - 1;
listHeightTh = 0;
for (indexItemTh = currentIndex; indexItemTh <= limitIndex; indexItemTh++) {
if (indexItemTh == aItems.length) {
limitIndex = nbItemsTh - (aItems.length - currentIndex) - 1;
indexItemTh = 0;
}
if (indexItemTh < 0) {
if (aItems[aItems.length + indexItemTh]) {
// 25 correspond au padding sur les li
listHeightTh += $(aItems[aItems.length + indexItemTh]).height() + 5;
}
} else {
if (aItems[indexItemTh]) {
// 25 correspond au padding sur les li
listHeightTh += $(aItems[indexItemTh]).height() +5;
}
}
}
$(".thematiques_scroll").animate({height:listHeightTh}, 1000);
});
})();
}
/*Fin Gestion du scroll du bloc dans la même thematiques de la webtv*/
if ($(".liste_autres_sites li").length > 1) {
var sites = new (function () {
var indexItem = 0;
var nbItems = 3;
var aItems = $(".liste_autres_sites li");
var listHeight = 0;
var oScroll;
if ($(".bloc_autres_sites_contenu #nbItems")) {
nbItems = parseInt($(".bloc_autres_sites_contenu #nbItems").attr("value"));
}
if (nbItems >= aItems.length) {
return;
}
for (indexItem = 0; indexItem < nbItems; indexItem++) {
if (aItems[indexItem]) {
// 25 correspond au padding sur les li
listHeight += $(aItems[indexItem]).height() + 25;
}
}
$(".autres_sites_scroll").css("height", listHeight + "px");
$(".bloc_autres_sites .efface").each(function() {
$(this).removeClass("efface");
});
oScroll = this.api = $(".autres_sites_scroll")
.scrollable({
size:nbItems,
clickable: false,
vertical:true
})
.circular({api: true});
$(".bloc_autres_sites .next, .bloc_autres_sites .prev").click(function() {
var currentIndex = oScroll.getIndex();
var limitIndex = currentIndex + nbItems - 1;
listHeight = 0;
for (indexItem = currentIndex; indexItem <= limitIndex; indexItem++) {
if (indexItem == aItems.length) {
limitIndex = nbItems - (aItems.length - currentIndex) - 1;
indexItem = 0;
}
if (indexItem < 0) {
if (aItems[aItems.length + indexItem]) {
// 25 correspond au padding sur les li
listHeight += $(aItems[aItems.length + indexItem]).height() + 25;
}
} else {
if (aItems[indexItem]) {
// 25 correspond au padding sur les li
listHeight += $(aItems[indexItem]).height() + 25;
}
}
}
$(".autres_sites_scroll").animate({height:listHeight}, 1000);
});
})();
}
});
function showCalendar(id, format, showsTime, showsOtherMonths) {
var el = document.getElementById(id);
if (_dynarch_popupCalendar != null) {
// we already have some calendar created
_dynarch_popupCalendar.hide(); // so we hide it first.
} else {
// first-time call, create the calendar.
var cal = new Calendar(1, null, selected, closeHandler);
// uncomment the following line to hide the week numbers
// cal.weekNumbers = false;
if (typeof showsTime == "string") {
cal.showsTime = true;
cal.time24 = (showsTime == "24");
}
if (showsOtherMonths) {
cal.showsOtherMonths = true;
}
_dynarch_popupCalendar = cal; // remember it in the global var
cal.setRange(1900, 2070); // min/max year allowed.
cal.create();
}
_dynarch_popupCalendar.setDateFormat(format); // set the specified date format
_dynarch_popupCalendar.parseDate(el.value); // try to parse the text in field
_dynarch_popupCalendar.sel = el; // inform it what input field we use
// the reference element that we pass to showAtElement is the button that
// triggers the calendar. In this example we align the calendar bottom-right
// to the button.
_dynarch_popupCalendar.showAtElement(el, "BR"); // show the calendar
//el.nextSibling
return false;
}
// This function gets called when the end-user clicks on some date.
function selected(cal, date) {
cal.sel.value = date; // just update the date in the input field.
if (cal.dateClicked && (cal.sel.id == "recDate1" || cal.sel.id == "recDate2"))
// if we add this call we close the calendar on single-click.
// just to exemplify both cases, we are using this only for the 1st
// and the 3rd field, while 2nd and 4th will still require double-click.
cal.callCloseHandler();
}
// And this gets called when the end-user clicks on the _selected_ date,
// or clicks on the "Close" button. It just hides the calendar without
// destroying it.
function closeHandler(cal) {
cal.hide(); // hide the calendar
// cal.destroy();
_dynarch_popupCalendar = null;
}
var MINUTE = 60 * 1000;
var HOUR = 60 * MINUTE;
var DAY = 24 * HOUR;
var WEEK = 7 * DAY;
//Shadowbox.init({
// players: ["html","iframe"],
// language: "fr"
//});
//fonctions liées a la recherche
function checkRub(field, state) { //tout selectionner/deselectionner
var number = document.getElementById('nbRub').value;
for (i = 0; i < number; i++) {
document.getElementById(field + i).checked = state ;
}
}
function cleanSearch() {
if (document.getElementById("me_searchField") && document.getElementById("me_searchField").value == 'Recherche') {
document.getElementById("me_searchField").value = '';
}
}
function cleanDate(date) {
if (document.getElementById(date) && ( document.getElementById(date).value == 'JJ/MM/AA' || document.getElementById(date).value == '30/11/1999') ) {
document.getElementById(date).value = '';
}
}
function validateAffine(oForm){
var listRub = new Array();
var number = document.getElementById('nbRub').value;
if ( number ){
for ( var i = 0; i < number; i ++ ) {
if ( document.getElementById('recRubAffine' + i).checked ){
listRub[i] = document.getElementById('recRubAffine' + i).value;
} else {
listRub[i] = '';
}
}
} else {
listRub = '';
}
oForm.recRub.value = listRub.join(',');
if (!oForm.recRub.value.replace(/,/gi,'') && !oForm.recCategory.value) {
/*alert("Vous devez saisir une rubrique et/ou un une thématique");*/
return false;
} else {
oForm.submit();
}
}