$(document).ready(function(){
 jQuery.easing.easeOutQuart = function (x, t, b, c, d) {return -c * ((t=t/d-1)*t*t*t - 1) + b;};
 jQuery.preloadImages = function(){for(var i = 0; i<arguments.length; i++){jQuery("<img>").attr("src", arguments[i]);}};
 $.preloadImages("http://www3.letelegramme.com/img/menu_on_droite.gif", "http://www3.letelegramme.com/img/menu_on_gauche.gif","http://www3.letelegramme.com/img/menu_on_centre.gif","http://www3.letelegramme.com/img/menu_on_droite.gif", "http://www3.letelegramme.com/img/menu_on_gauche.gif","http://www3.letelegramme.com/img/menu_on_centre.gif","http://www3.letelegramme.com/img/info_locale.png");
 $("li#nav_"+telegnav).each(function () {$(this).attr("class","on");$(this).next().addClass('nobg');});
 $('#x_menu').append($('#teleg_Z_menu').html());
 $('#teleg_Z_menu').empty();
 $('ul.hover > li').hover(function(){$(this).addClass("hover")},function(){$(this).removeClass("hover")});
 $('ul.faq > li').each(function(){$(this).children("h3").toggle(function(){$(this).next().slideDown('slow')},function(){$(this).next().slideUp('slow')})})
 $("li:first-child").addClass('first');
 $("li:last-child").addClass('last');
 $('ul#rien > li').hover(function() {$(this).next().addClass('nobg');if(!$(this).children('a').hasClass("hover") && $(this).children('a').attr("href").indexOf("#")!=-1 ){$(this).children('a').addClass("hover");$(this).children("ul").slideDown("slow", function(){$(this).parent().children('a').addClass("hover");$(this).addClass("on")})}},function() {$(this).children("ul").slideUp("normal",function(){$(this).parent().children('a').removeClass("hover");$(this).removeClass("on");});if(!$(this).hasClass("on")){$(this).next().removeClass('nobg');}});
 $('div#b_smenu ul > li').hover(function() {$(this).addClass('hover');if(!$(this).children('a').hasClass("hover") && $(this).children('a').attr("href").indexOf("#")!=-1 ){$(this).children('a').addClass("hover");$(this).children("ul").slideDown("slow", function(){$(this).parent().children('a').addClass("hover");$(this).addClass("on")})}},function() {$(this).children("ul").slideUp("normal",function(){$(this).parent().children('a').removeClass("hover");$(this).removeClass("on");});$(this).removeClass('hover');});
 $('ul#rien > li a').focus(function() {$(this).parent().mouseover();return false;});
 $("li#nav_"+telegnav).each(function () {$(this).attr("class","on");$(this).next().addClass('nobg');});
 jQuery(function( $ ){var txtx=0;$('#b_smenu ul li').each( function () { txtx=txtx + $(this).width()} );var txtxf=$('#b_smenu div').width();var txtxc=600   - txtxf;if(txtx > txtxc ){$('#b_smenu').children("ul").wrap('<div id="b_smenuc" style="width:'+(txtxc+26)+'px;margin:0"><div id="b_smenuscroll" style="width:'+(txtxc-6)+'px"></div></div>').parent().parent().prepend('<img src="http://www3.letelegramme.com/img/spacer.gif" id="prevmenu" class="gauche" />').prepend('<img src="http://www3.letelegramme.com/img/spacer.gif" id="nextmenu" class="droite" />');$('#b_smenuscroll').serialScroll({items:'li', prev:'#prevmenu', next:'#nextmenu', offset:0, duration:50, force:true, navigation:true, stop:true, lock:false, cycle:false, easing:'easeOutQuart', jump: false });} });
 $('ul.diaporama').innerfade();
 $('.date-pick').datePicker({startDate:'16/05/1971', endDate:new Date().asString()});
 $('.date-pick-newsletter-susp').datePicker({startDate:new Date().asString(), endDate:'31/12/2099'});
 $('.date-pock').datePicker({startDate:new Date().asString()});
 $('.date-pack').each( function () { $(this).parent().children('input.text').each( function () { $(this).change( function()  {$(this).parent().children("input.date").attr("value",$(this).parent().children("input.jj").attr("value") +"/" +$(this).parent().children("input.mm").attr("value") + "/" + $(this).parent().children("input.aaaa").attr("value"))   } )   } );   } )
 $('select.date6').change(function(){   var $toto= $(this).attr("value");$("ul.date6 li").each(function(){$(this).removeClass("on");if($(this).children("a").children("img").attr("className")==$toto){$(this).addClass("on");};})     } );
 $('#f_avisdedeces_du').bind('dpClosed',function(e, selectedDates){var d = selectedDates[0];if (d) {d = new Date(d);$('#f_avisdedeces_au').dpSetStartDate(d.addDays(0).asString());}});
 $('#f_avisdedeces_au').bind('dpClosed',function(e, selectedDates){var d = selectedDates[0];if (d) {d = new Date(d);$('#f_avisdedeces_du').dpSetEndDate(d.addDays(0).asString());}});
 $(".bloc5A ul li a").focus(function() {$(this).parent().parent().parent().parent().children(".bloc5Bon").each(function(){$(this).attr("class","bloc5B clear")});$(this).parent().parent().parent().children().children().children("a").each(function(i){$(this).attr("class","");});$(this).attr("class","on");$(this).parent().parent().parent().parent().children("#b_" + $(this).attr("name")).attr("class","bloc5Bon clear");return false});
 $(".bloc5A ul li a").click(function() {$(this).focus();return false});
 $(".bloc11A ul li a").each(function() {if($(this).attr("href").indexOf("#")!=-1 ){$(this).click(function() {var teston=0; if($(this).hasClass("on")){teston=1;};$(this).parent().parent().parent().parent().children(".bloc11Bon").each(function(){$(this).attr("class","bloc11B")});$(this).parent().parent().parent().children().children().children("a").each(function(i){$(this).attr("class","");});if(teston==0){$(this).attr("class","on");$(this).parent().parent().parent().parent().children("#b_" + $(this).attr("name")).attr("class","bloc11Bon");}else{$(this).parent().parent().parent().parent().children("#b_" + $(this).attr("name")).attr("class","bloc11B");}return false});}});
 $(".blocliveA ul li a").focus(function() {$(this).parent().parent().parent().parent().children(".blocliveBon").each(function(){$(this).attr("class","blocliveB clear")});$(this).parent().parent().parent().children().children().children("a").each(function(i){$(this).attr("class","");});$(this).attr("class","on");$(this).parent().parent().parent().parent().children("#b_" + $(this).attr("name")).attr("class","blocliveBon clear");return false});
 $(".blocliveA ul li a").click(function() {$(this).focus();return false});
 $('#news').each(function (){$(this).newsTicker({newsList: "#news",startDelay: 10,loopDelay: 5000});});//$.get("news.php",{format:1},function(xml){$("#news").html($("ul", xml)).newsTicker({newsList: "#newsticker", startDelay: 20,,loopDelay: 5000});});});
 $('#bz29').mouseover(function() {$('#b_recherche_locale div').css({background:'url(http://www3.letelegramme.com/img/bretagne292256.png) no-repeat -191px 0px transparent'})}).focus(function(){$(this).mouseover();return false;});;
 $('#bz22').mouseover(function() {$('#b_recherche_locale div').css({background:'url(http://www3.letelegramme.com/img/bretagne292256.png) no-repeat -491px 0px transparent'})}).focus(function(){$(this).mouseover();return false;});
 $('#bz56').mouseover(function() {$('#b_recherche_locale div').css({background:'url(http://www3.letelegramme.com/img/bretagne292256.png) no-repeat -791px 0px transparent'})}).focus(function(){$(this).mouseover();return false;});
 $('#b_recherche_locale div map area').mouseout(function() {$('#b_recherche_locale div').css({background:'url(http://www3.letelegramme.com/img/bretagne292256.png) no-repeat 109px 0px transparent'})});
 $('#x_calendrier').jCal({day: new Date(),days: 1,showMonths: 1,sDate: new Date(),eDate: new Date(),dCheck:	function (day) {
var maintenant = new Date();
						return (Date.parse(day) >= Date.parse(new Date(maintenant.getFullYear(),(maintenant.getMonth()),maintenant.getDate())));
					},	callback: function (day, days) {cp='';if( jQuery("#f_pagenda_ou").val() !=0){insee='&cp=' + jQuery("#f_pagenda_ou").val();}top.location.href = '/agenda/recherche.php?date='+(day.getFullYear()) + '-' + (day.getMonth()+1) + '-' + day.getDate() + cp; return true;}});
 $('a[@href^="#go_"]').each(function(i){$(this).click(function(){$.scrollTo($(this).attr('href'),500);return false;;});});
 $('ul.pair').not('ul.moitie').each(function(){$('li:even',this).addClass('pair')});
 $('table.pair').each(function(){$('tr:even',this).addClass('pair')});
 $('label').each(function(){$(this).click(function (){$(this).next().select();});})
 $('#f_recherche').each(function(){$(this).attr('value','Rechercher dans tout le site');$(this).focus(function(){if($(this).attr('value')=='Rechercher dans tout le site'){$(this).attr('value','');};});})
 $("#a_perdu").toggle(function(){$("#x_perdu").slideDown();},function(){$("#x_perdu").slideUp();});
 $("#a_ppapier_d").click(function(){$("#a_ppapier_d").hide();$("#x_ppapier_p").hide();$("#a_ppapier_p").show();$("#x_ppapier_d").slideDown('slow');return(false)});
 $("#a_ppapier_p").click(function(){$("#a_ppapier_p").hide();$("#x_ppapier_d").hide();$("#a_ppapier_d").show();$("#x_ppapier_p").slideDown('slow');return(false)});
 $("#a_pabonnement_p").toggle(function(){$("#x_pabonnement_p").slideDown();},function(){$("#x_pabonnement_p").slideUp();});
 $("#b_pabonnement_p").toggle(function(){$("#y_pabonnement_p").slideDown();},function(){$("#y_pabonnement_p").slideUp();});

 $("ul.choix").children("li").click(function(){
  $(this).parent().children("li").removeClass("hover");
  $(this).addClass("hover");
  $(this).children("input").attr("checked","checked");



  $("#f_2article_choix1").each(function(){
   if($(this).attr("checked")) {
		$("#f_2article_mode1").each(function(){$(this).attr("checked","checked");$(this).parent().show();});
		$("#f_2article_mode2").each(function(){$(this).attr("checked","");$(this).parent().hide();});
		$("#f_2article_mode3").each(function(){$(this).attr("checked","");$(this).parent().show();});
		$("#f_2article_mode4").each(function(){$(this).attr("checked","");$(this).parent().hide();});
	}
   });

  $("#f_2article_choix2").each(function(){
   if($(this).attr("checked")) {
		$("#f_2article_mode1").each(function(){$(this).attr("checked","checked");$(this).parent().show();});
		$("#f_2article_mode2").each(function(){$(this).attr("checked","");$(this).parent().hide();});
		$("#f_2article_mode3").each(function(){$(this).attr("checked","");$(this).parent().hide();});
		$("#f_2article_mode4").each(function(){$(this).parent().hide();});
	}
   });
  $("#f_2article_choix3").each(function(){
   	if($(this).attr("checked")) {
		$("#f_2article_mode1").each(function(){$(this).attr("checked","");$(this).parent().hide();});
		$("#f_2article_mode2").each(function(){$(this).attr("checked","");$(this).parent().hide();});
		$("#f_2article_mode3").each(function(){$(this).attr("checked","");$(this).parent().hide();});
		$("#f_2article_mode4").each(function(){$(this).attr("checked","checked");$(this).parent().hide();});
	}
   });
  $("#f_3pdf_choix1").each(function(){if($(this).attr("checked")) {$("#f_3pdf_mode2").each(function(){$(this).attr("checked","");$(this).parent().hide();});} else { $("#f_3pdf_mode2").each(function(){$(this).parent().show();}); } });
 });
 $('#f_commune').each(function(){$(this).attr('value','Ma commune');$(this).focus(function(){if($(this).attr('value')=='Ma commune'){$(this).attr('value','');};});})
 //$('div.bloc7bis').each(function(){$(this).next().css({width:'325px'});})
 $('#x_moins a').click(function(){$.fn.StyleSwichter({cssPath: 'http://www3.letelegramme.com/css/normal.css'}); this.blur(); return false;});
 $('#x_plus a').click(function(){$.fn.StyleSwichter({cssPath: 'http://www3.letelegramme.com/css/big.css'}); this.blur(); return false;});
 $('#x_ultraplus a').click(function(){$.fn.StyleSwichter({cssPath: 'http://www3.letelegramme.com/css/ultrabig.css'}); this.blur(); return false;});
 $('#x_ultramoins a').click(function(){$.fn.StyleSwichter({cssPath: 'http://www3.letelegramme.com/css/big.css'}); this.blur(); return false;});
 $('.auto-submit-star').rating({callback: function(value, link){$.post("/votes/vote.php", {note: value,idArticle: info_id}, function(texte) {$("#x_vote").html("<p class=petit>" + texte + "</p>");} );}});
 $("form.telegform").each(function(){eval("$(this).validate("+$(this).children('fieldset').children('input.teleg').attr("value")+");");});
 $("select").not(".fixed").each(function(){var l=$(this).width()+4;$(this).width(l);});
 $("#t_agenda tr.j td").mouseover(function(){if($(this).parent().hasClass("j")) {$(this).parent().parent().children().children().removeClass("full");$("#t_agenda td."+$(this).attr("class")).addClass("full");$("#t_agenda tr.plus td a").html("Plus...");$("#t_agenda tr.plus td.full a").html("Plus d'événements");}});
 $('#b_photos ul li a').addClass('telegbox');
 $('a.telegbox').each(function(){if($(this).children('img').attr("alt")!="")
	{$(this).wrap("<div class='x_1' style='overflow:hidden;width:"+$(this).children('img').css("width")+";height:"+$(this).children('img').css("height")+";padding:0;margin-top:"+$(this).children('img').css("marginTop")+";margin-right:"+$(this).children('img').css("marginRight")+";margin-bottom:"+$(this).children('img').css("marginBottom")+";margin-left:"+$(this).children('img').css("marginLeft")+";float:"+$(this).children('img').css("float")+";background-color:"+$(this).children('img').css("backgroundColor")+";'></div>");
	$(this).children('img').css({marginTop:0,marginRight:0,marginBottom:0,marginLeft:0,float:'none'});
	var tb_x="";
	if(!$(this).children('img').hasClass("carre"))
		{tb_x="<p><b>"+$(this).attr("title")+"</b><br />"+$(this).children('img').attr("alt")+"</p>";}
	var tb_xx="";
	if(!$(this).parent().parent().hasClass("bloc6"))
		{tb_xx=new String("<div class='x_4'>");
		if($(this).children('img').attr("id")){if($(this).children('img').attr("id")!='undefined'){tb_xx=tb_xx + new String(" <a href=\"http://photos.letelegramme.com/script/278/imagesArticles.asp?numArticle="+$(this).children('img').attr("id")+"\" class=\"cart\">Acheter</a>");}};
		tb_xx= tb_xx + new String("<a href=\"#\" class=\"zoom\">Zoom</a></div>");
		}
	$(this).parent().prepend("<div class='x_2' style='width:"+$(this).parent().css("width")+";height:"+$(this).parent().css("height")+";'><div class='x_3' style='margin-top:"+$(this).parent().css("height")+"'>"+ tb_x + tb_xx + "</div></div>");}});$('div.x_3 p').each(function () {$(this).css({opacity:0.75});});$('div.x_1').each(function() {if(!$(this).parent('div').hasClass('bloc6')){$(this).hover(function(){$(this).children('div.x_2').children('div.x_3').each(function(){$(this).animate({marginTop:$(this).parent().height()-$(this).height()+'px'},{duration: 300, easing: 'easeInOutSine', queue: false});});},function(){$(this).children('div.x_2').children('div.x_3').each(function(){$(this).animate({marginTop:$(this).parent().height()+'px'});});}).click(function(){$(this).children('a').click();}).css({cursor:'pointer'});}else{$(this).parent().hover(function(){$(this).children('div.x_1').children('div.x_2').children('div.x_3').each(function(){$(this).animate({marginTop:$(this).parent().height()-$(this).height()+'px'},{duration: 300, easing: 'easeInOutSine', queue: false});});},function(){$(this).children('div.x_1').children('div.x_2').children('div.x_3').each(function(){$(this).animate({marginTop:$(this).parent().height()+'px'});});}).click(function(){$(this).children('div.x_1').children('a').click();}).css({cursor:'pointer'});}});
 //ajout 19/1/09 ; telebox 90 e-declic
$('a.telegbox90').each(function(){if($(this).children('img').attr("alt")!="")
	{$(this).wrap("<div class='x_1' style='overflow:hidden;width:"+$(this).children('img').css("width")+";height:"+$(this).children('img').css("height")+";padding:0;margin-top:"+$(this).children('img').css("marginTop")+";margin-right:"+$(this).children('img').css("marginRight")+";margin-bottom:"+$(this).children('img').css("marginBottom")+";margin-left:"+$(this).children('img').css("marginLeft")+";float:"+$(this).children('img').css("float")+";background-color:"+$(this).children('img').css("backgroundColor")+";'></div>");
	$(this).children('img').css({marginTop:0,marginRight:0,marginBottom:0,marginLeft:0,float:'none'});
	var tb_x="";if(!$(this).children('img').hasClass("carre"))
		{tb_x="<p><b>"+$(this).attr("title")+"</b><br />"+$(this).children('img').attr("alt")+"</p>";}
	var tb_xx="";
	if(!$(this).parent().parent().hasClass("bloc6"))
		{tb_xx=new String("<div class='x_4'>");
		if($(this).children('img').attr("id")){if($(this).children('img').attr("id")!='undefined'){tb_xx=tb_xx + new String(" <a href=\"http://photos.letelegramme.com/script/278/imagesArticles.asp?numArticle="+$(this).children('img').attr("id")+"\" class=\"cart90\"></a>");}};
		tb_xx= tb_xx + new String("<a href=\"#\" class=\"zoom90\"></a></div>");
		}
	$(this).parent().prepend("<div class='x_2' style='width:"+$(this).parent().css("width")+";height:"+$(this).parent().css("height")+";'><div class='x_3' style='margin-top:"+$(this).parent().css("height")+"'>"+ tb_x + tb_xx + "</div></div>");}});$('div.x_3 p').each(function () {$(this).css({opacity:0.75});});$('div.x_1').each(function() {if(!$(this).parent('div').hasClass('bloc6')){$(this).hover(function(){$(this).children('div.x_2').children('div.x_3').each(function(){$(this).animate({marginTop:$(this).parent().height()-$(this).height()+'px'},{duration: 300, easing: 'easeInOutSine', queue: false});});},function(){$(this).children('div.x_2').children('div.x_3').each(function(){$(this).animate({marginTop:$(this).parent().height()+'px'});});}).click(function(){$(this).children('a').click();}).css({cursor:'pointer'});}else{$(this).parent().hover(function(){$(this).children('div.x_1').children('div.x_2').children('div.x_3').each(function(){$(this).animate({marginTop:$(this).parent().height()-$(this).height()+'px'},{duration: 300, easing: 'easeInOutSine', queue: false});});},function(){$(this).children('div.x_1').children('div.x_2').children('div.x_3').each(function(){$(this).animate({marginTop:$(this).parent().height()+'px'});});}).click(function(){$(this).children('div.x_1').children('a').click();}).css({cursor:'pointer'});}});

 tb_init('a.telegbox, a.telegbox90, a.thickbox'); imgLoader = new Image(); imgLoader.src = "http://www3.letelegramme.com/img/loading.gif";
 $.fn.StyleSwichter();
 //$("#developpeur").toggle(function() { $("div.payant").css("display","block"); $(this).html("Afficher tous les articles gratuits");  }, function () { $("div.payant").css("display","none"); $(this).html("Afficher tous les articles");});

 $('ul.moitie').moitie().filter('.pair').each(function(){$('li:odd:even',this).addClass('pair')}).each(function(){$('li:even:odd',this).addClass('impair')}).each(function(){$('li:even',this).addClass('pair')});
 //fonction choix edition pdf dans page choix_edition.php
 $('ul.moitie').click(function(){var $toto= $("input[@name=f_1pdf_choix]:checked").val();$("ul.date6 li").each(function(){$(this).removeClass("on");if($(this).children("a").children("img").attr("className")==$toto){$(this).addClass("on");};})});

$('select.date6').change(function(){
$("#x_1pdf").submit();
 } );
if(navigator.userAgent.toLowerCase().indexOf('chrome')+navigator.userAgent.toLowerCase().indexOf('safari')>-1){$("input.date").each(function(){$(this).removeClass("date");})}
});