$(document).ready(function(){
$(".resultArticle div:nth-child(2n)").addClass('paire');
fondu('div.video img');
function fondu($objetFondu)
{
jQuery($objetFondu).hover(function()
{
jQuery(this).stop().animate({opacity:0.5},'fast');
},
function()
{
jQuery(this).stop().animate({opacity:1},'fast');
});
}
$('li.lien05 li li').hide();
for (var i=0;i<=20;i++) {
$('li.lien05 li li:nth-child('+i+')').show();
}
$("div.video:nth-child(3n)").after('<hr />');
//$('div#inter ul, div#inter ol').prev('p').css('margin-bottom', '0');
/**
* ---------------------------------------------------------------------------------------------------------------------------------
* JQUERY BANDEAU
* ---------------------------------------------------------------------------------------------------------------------------------
*/
var $message = "";
if ($message != "") {
$('div#footer').after('<div class="horizontal_scroller"><div class="scrollingtext">'+$message+'</div></div>');
$('div#footer').css('padding-bottom', '40px');
}
$('.horizontal_scroller').SetScroller({ velocity:   60,
direction:   'horizontal',
startfrom:   'right',
loop:   'infinite',
movetype:   'linear',
onmouseover: 'pause',
onmouseout:  'play',
onstartup:   'play',
cursor:   'auto'
});
/**
* ---------------------------------------------------------------------------------------------------------------------------------
* INFO SPECIALE
* ---------------------------------------------------------------------------------------------------------------------------------
*/
var $infoSpeciale = true;
if ($infoSpeciale == true && $('body').hasClass('testInfo')) {
$.fancybox({
'width': 600,
'height': 600,
'autoScale': true,
'transitionIn': 'fade',
'transitionOut': 'fade',
'type': 'iframe',
'overlayColor' : '#000',
'overlayOpacity' : '1',
'padding' : '0',
'showCloseButton' : false,
'href': 'http://www.blancmesnil.fr/infoSpeBudjet2012.html'
});
}
/**
* ---------------------------------------------------------------------------------------------------------------------------------
* SWFOBJECT
* ---------------------------------------------------------------------------------------------------------------------------------
*/
var $lecteurVideo = $('.lecteurVideo');
var $urlVideo = 'http://www.vodyou.fr/blancmesnil/flvplayer/flvplayer4.swf?autoplay=1&file=http://www.vodyou.fr/blancmesnil/inc/getxmlmediafile.php?f='+$lecteurVideo.html()+'.flv.xml';
$lecteurVideo.flash(
{
swf: $urlVideo,
width: 520,
height: 300,
allowFullScreen: true,
wmode: 'transparent'
}
);
var $lecteurAudio = $('.lecteurAudio');
var $urlAudio = 'dewplayer-vol.swf?mp3='+$lecteurAudio.html()+'.mp3';
$lecteurAudio.flash(
{
swf: $urlAudio,
width: 250,
height: 20,
wmode: 'transparent'
}
);
/**
* ---------------------------------------------------------------------------------------------------------------------------------
* JQUERY CORNER
* ---------------------------------------------------------------------------------------------------------------------------------
*/
$('div#comment ol li').corner();
$('.arrondi-5').corner('5px');
$('.arrondi-10').corner('10px');
/**
* ---------------------------------------------------------------------------------------------------------------------------------
* FANCY BOX
* ---------------------------------------------------------------------------------------------------------------------------------
*/

$(".fancy_iframe_800").fancybox({
'width' : 800,
'height' : '75%',
'overlayColor' : '#455862',
'overlayOpacity' : 0.9,
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'type' : 'iframe'
});

$('img.fancy').wrap(function() {
return '<a class="fancy" href="' + $(this).attr("src") + '" />';
});
$("a.fancy").fancybox({
'overlayColor' : '#000',
'transitionIn' : 'elastic',
'transitionOut' : 'elastic',
'easingIn' : 'easeOutBack',
'easingOut' : 'easeInBack',
'speedIn' : 'slow',
'speedOut' : 'slow',
'titlePosition' : 'over',
'titleShow' : true
});
$('img.fancy_noTitle').wrap(function() {
return '<a class="fancy_noTitle" href="' + $(this).attr("src") + '" />';
});
$("a.fancy_noTitle").fancybox({
'overlayColor' : '#000',
'transitionIn' : 'elastic',
'transitionOut' : 'elastic',
'easingIn' : 'easeOutBack',
'easingOut' : 'easeInBack',
'speedIn' : 'slow',
'speedOut' : 'slow',
'titleShow' : false
});
$('img.fancy_group').wrap(function() {
return '<a class="fancy_group" rel="fancy_group" href="' + $(this).attr("src") + '" />';
});
$('img.fancy_galerie').wrap(function() {
return '<a class="fancy_galerie" rel="fancy_galerie" href="' + $(this).attr("src") + '" />';
});
$('img.fancy_galerie').parent().parent().addClass('galerie');
$('img.fancy_galerie').removeAttr('height');
$('img.fancy_galerie').attr('width', '125');
$("a[rel=fancy_group], a[rel=fancy_galerie]").fancybox({
'overlayColor' : '#000',
'transitionIn' : 'elastic',
'transitionOut' : 'elastic',
'easingIn' : 'easeOutBack',
'easingOut' : 'easeInBack',
'speedIn' : 'slow',
'speedOut' : 'slow',
'titlePosition' : 'over',
'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' sur ' + currentArray.length + (title.length ? ' &nbsp;|&nbsp; ' + title : '') + '</span>';
}
});
$('p.galerie:last').after('<hr class="space" />');
$("a.fancy_iframe").fancybox({
'overlayColor' : '#000',
'width' : '75%',
'height' : '90%',
'autoScale' : false,
'transitionIn' : 'fade',
'transitionOut' : 'fade',
'type' : 'iframe'
});
loupeHover('a.fancy, a.fancy_noTitle, a.fancy_group');
function loupeHover($elements)
{
jQuery($elements).each(function()
{
var $lien = jQuery(this);
var $image = jQuery(this).contents("img");
var $titre = $image.attr('alt');
$lien.attr('title', $titre);
if(jQuery(this).attr('href').match(/(jpg|gif|jpeg|png|tif)/)) $newclass = 'loupe';
var $bg = jQuery("<span class='"+$newclass+"'></span>").appendTo(jQuery(this)),
$padding_x = parseInt($image.css('padding-left')) + parseInt($image.css('padding-right')),
$padding_y = parseInt($image.css('padding-top')) + parseInt($image.css('padding-bottom')),
$border_x = parseInt($image.css('border-left-width')) + parseInt($image.css('border-right-width')),
$border_y = parseInt($image.css('border-top-width')) + parseInt($image.css('border-bottom-width'));
jQuery(this).bind('mouseenter', function()
{
$height = parseInt($image.height()) + $padding_x + $border_x;
$width = parseInt($image.width()) + $padding_y + $border_y;
$pos = $image.position();
$bg.css({height:$height, width:$width, top:$pos.top, left:$pos.left});
});
});
fondu(jQuery($elements).contents("img"));
}
loupeGalerieHover('a.fancy_galerie');
function loupeGalerieHover($elements)
{
jQuery($elements).each(function()
{
var $lien = jQuery(this);
var $image = jQuery(this).contents("img");
var $titre = $image.attr('alt');
$lien.attr('title', $titre);
});
fondu(jQuery($elements).contents("img"));
}
/**
* ---------------------------------------------------------------------------------------------------------------------------------
* JQUERY TRUNCATE
* ---------------------------------------------------------------------------------------------------------------------------------
*/
$('.grandResume').jTruncate({ 
length: 230, 
minTrail: 0, 
moreText: "", 
lessText: "", 
ellipsisText: " [...]", 
moreAni: "fast", 
lessAni: 2000 
});
$('div.video .titreVideo').jTruncate({ 
length: 30, 
minTrail: 0, 
moreText: "", 
lessText: "", 
ellipsisText: " [...]", 
moreAni: "fast", 
lessAni: 2000 
});
/**
* ---------------------------------------------------------------------------------------------------------------------------------
* SLIDER DE LA PAGE JOURNAL INTERACTIF
* ---------------------------------------------------------------------------------------------------------------------------------
*/
// Interval (en milisecondes) entre chaque changement d'item du slider
var SLIDER_INTERVAL = 8000;
// Affichage du premier item
afficherItem(0);
/*
* Clic sur les images de droite
*/
$(".actuimgjournal>ul>li>a").click(function() {
afficherItem($('.actuimgjournal').index($(this).parents('.actuimgjournal').first()));
return false;
});
/*
* Lancement du slider
*/
var timer = setInterval(changerItem, SLIDER_INTERVAL);
/**
* Affiche l'item x du slider
*
* @param int index la position de l'item à afficher (le premier est à 0)
*/
function changerItem()
{
// On récupère l'index de l'item actuellement affiché
var index = $('.actuimgjournal').index($(".actuimgjournal>ul>li.selected").parents('.actuimgjournal').first());
// On incrémente l'index de 1
index++;
// Si l'index est égal au nombre total d'items, on repart à l'item 0 (le premier)
if (index == $('.actuimgjournal').length) index = 0;
afficherItem(index);
}
/**
* Affiche l'item x du slider
*
* @param int index la position de l'item à afficher (le premier est à 0)
*/
function afficherItem(index)
{
$(".actuimgjournal>ul>li").removeClass("selected");
var $item = $(".actuimgjournal:eq(" + index + ")>ul>li");
$item.addClass("selected");
$(".actuimgjournal>ul>li>ul>li img").remove();
$item.find('.titreActusSlide').css('display', 'none');
$item.find('.titreActusSlide').slideDown('slow');
$item.find('.descActusSlide').css('display', 'none');
$item.find('.descActusSlide').slideDown('slow');
$(".actuimgjournal>ul>li>ul>li").prepend('<img style="display: none;" src="' + $item.find("img").attr("src") + '" alt="' + $item.find("img").attr("alt") + '" />');
$item.find('img').fadeIn('slow');
}
// FIN SLIDER -----------------------------------------------------------------------------------------------------------------
/*--------------------------------------------------------------------------------------------------------------------------------*/
/*------------------------------- SHADOWBOX ATTRIBUT VIA CLASSE -------------------------------------------*/
/* -------------------------------------------------------------------------------------------------------------------------------*/
$('.ouvreShadowBox').attr({
rel: "shadowbox"
});
$('a.ouvreShadowBox').each(function() {
Shadowbox.addCache($(this)[0]);
});
/*--------------------------------------------------------------------------------------------------------------------*/
$(".resultArticle:nth-child(2n)").addClass('paire');
$('#menu>ul>li>a').each(function(){
if (!$(this).parent().hasClass("on")){
$(this).css( {backgroundPosition: "0px -67px"} )
.mouseover(function(){ 
$(this).stop().animate({backgroundPosition:"0px 0px"}, {duration:500}) 
}) 
.mouseout(function(){ 
$(this).stop().animate({backgroundPosition:"0px -67px"}, {duration:500}) 
}) }
});
$(".infoPratique,.infoPratiqueADroite,.infoPratiqueAGauche").prepend('<span class="bgInfoPratique"></span>');
$('form div > .required').prev().append('<span class=coul04> *</span>');
$('form div div .required').parent().parent().prev().append('<span class=coul04> *</span>');
$('blockquote p').before('<span class="bqstart">&#8220;</span>');
$('blockquote p').after('<span class="bqend">&#8221;</span>');
/*
$("#journalHover").stop().fadeTo("normal", "0");
$("#journalHover").mouseover(function(){
$(this).stop().fadeTo("normal", "1");
});
$("#journalHover").mouseout(function(){
$(this).stop().fadeTo("normal", "0");
});
*/
$(".sweetOpacity").prepend('<span class="sweetOpacityHover"></span>');
$(".sweetOpacityHover").stop().fadeTo("normal", 1);
$(".sweetOpacityHover").mouseover(function(){
$(this).stop().fadeTo("normal", 0);
});
$(".sweetOpacityHover").mouseout(function(){
$(this).stop().fadeTo("normal", 1);
});
});
