var cs_prive=window.location.pathname.match(/\/ecrire\/$/)!=null;
jQuery.fn.cs_todo=function(){return this.not('.cs_done').addClass('cs_done')};
var onglet_actif=0;
jQuery.fn.montre_onglet=function(selector){
if(this.is('.onglets_titre')){
var contenu='#'+this[0].id.replace(/titre/,'contenu');
var bloc=this.parent().parent();
bloc.children('.selected').removeClass('selected').end()
.children('.onglets_liste').children('.selected').removeClass('selected');
jQuery(contenu).addClass('selected');
this.addClass('selected')}
if(this.is('.onglets_contenu')){
var titre=this[0].id.replace(/contenu/,'titre');
jQuery('#'+titre).montre_onglet()}
return this};
function onglets_init(){
var cs_bloc=jQuery('div.onglets_bloc_initial',this);
if(cs_bloc.length){
cs_bloc.prepend('<div class="onglets_liste"></div>')
.children('.onglets_contenu').each(function(i){
this.id='onglets_contenu_'+i;
jQuery(this).parent().children('.onglets_liste').append(
'<h2 id="'+'onglets_titre_'+i+'" class="onglets_titre">'+this.firstChild.innerHTML+'</h2>'
)})
.children('h2').remove();
jQuery('div.onglets_liste',this).each(function(){
this.firstChild.className+=' selected';
this.nextSibling.className+=' selected'});
jQuery('h2.onglets_titre',this).hover(
function(){
jQuery(this).addClass('hover')
},function(){
jQuery(this).removeClass('hover')
}
);
jQuery('div.onglets_bloc_initial',this)
.attr('class','onglets_bloc').each(function(i){this.id='ongl_'+i});
jQuery('h2.onglets_titre',this).click(function(e){
jQuery(this).montre_onglet();
return false});
jQuery('h2.onglets_titre a',this).click(function(e){
jQuery(this).parents('h2').click();
if(e.stopPropagation)e.stopPropagation();
e.cancelBubble=true;
return false});
if(onglet_get&&(this==document)){
sel=jQuery('#onglets_titre_'+onglet_get);
sel.click()}
jQuery('.spip_note['+cs_sel_jQuery+'name^=nb], .spip_note['+cs_sel_jQuery+'id^=nb]').each(function(i){
jQuery(this).click(function(e){
var href=this.href.substring(this.href.lastIndexOf("#"));
jQuery(href).parents('.onglets_contenu').eq(0).montre_onglet();
return true})})}
}
function get_onglet(url){
tab=url.search.match(/[?&]onglet=([0-9]*)/)||url.hash.match(/#onglet([0-9]*)/);
if(tab==null)return false;
return tab[1]}
var onglet_get=get_onglet(window.location);
var sommaire_sel='div.cs_sommaire_titre_avec_fond, div.cs_sommaire_titre_sans_fond';
function cs_sommaire_init(){
jQuery(sommaire_sel,this)
.cs_todo()
.click(function(){
jQuery(this).toggleClass('cs_sommaire_replie')
.next().toggleClass('cs_sommaire_invisible')
return false})}
function cs_sommaire_cookie(){
if(typeof jQuery.cookie!='function')return;
var replie=jQuery.cookie('cs_sommaire');
jQuery.cookie('cs_sommaire',null);
if(Number(replie))
jQuery(sommaire_sel).eq(0).addClass('cs_sommaire_replie')
.next().toggleClass('cs_sommaire_invisible');
jQuery(window).bind('unload',function(){
jQuery.cookie('cs_sommaire',
Number(jQuery(sommaire_sel).eq(0).is('.cs_sommaire_replie'))
)})}
function lancerlien(a,b){x='ma'+'ilto'+':'+a+'@'+b;return x}
jQuery.fn.blocs_toggle_slide_dist=function(selector){
this.toggleClass('blocs_slide');
if(typeof jQuery.fn.blocs_toggle_slide=='function')
return this.blocs_toggle_slide();
return this.is(".blocs_slide")?this.slideUp(blocs_slide):this.slideDown(blocs_slide)};
jQuery.fn.blocs_set_title=function(selector){
var title=this.parent().find('.blocs_title:last').text();
if(!title)title=blocs_title_def;
title=title.split(blocs_title_sep);
this.children('a').attr('title',title[jQuery(this).is('.blocs_replie')?0:1]);
return this};
jQuery.fn.blocs_toggle=function(){
if(!this.length)return this;
var cible=this.is('.cs_blocs')?this.children('.blocs_titre').eq(0):this;
cible.toggleClass('blocs_replie').blocs_set_title();
var dest=this[0].id.match('^cs_bloc_id_')?jQuery('div.'+this[0].id):cible.next();
if(blocs_slide==='aucun'){
dest.toggleClass('blocs_invisible');
if(dest.is('div.blocs_resume'))dest.next().toggleClass('blocs_invisible')}else{
dest.blocs_toggle_slide_dist();
if(dest.is('div.blocs_resume'))dest.next().blocs_toggle_slide_dist()}
var lien=cible.children();
var url=lien.attr("href");
if(url!='javascript:;'){
lien.attr("href",'javascript:;');
cible.parent().children(".blocs_destination")
.load(url)}
return this};
jQuery.fn.blocs_replie_tout=function(){
if(blocs_replier_tout){
var cible=this.is('.cs_blocs')?this:this.parents('div.cs_blocs');
var lignee=cible.children('.blocs_titre');
jQuery('.blocs_titre').not('.blocs_replie').not(lignee).blocs_toggle()}
return this}
var blocs_clic_ajax=null;
function blocs_init(){
jQuery('.blocs_titre',this).cs_todo()
.click(function(){
jQuery(this).blocs_replie_tout().blocs_toggle();
return false})
.each(function(){
jQuery(this).blocs_set_title()});
jQuery('.blocs_destination a.replier_bloc',this).cs_todo()
.click(function(){
s=jQuery(this).parents('.cs_blocs:first');
if(typeof jQuery.fn.scrollTo=="function")jQuery('body').scrollTo(s,500,
{margin:true,onAfter:function(){s.blocs_replie_tout().blocs_toggle()}});
else s.blocs_replie_tout().blocs_toggle();
return false});
jQuery('.spip_note['+cs_sel_jQuery+'name^=nb], .spip_note['+cs_sel_jQuery+'id^=nb]').each(function(i){
jQuery(this).click(function(e){
var href=this.href.substring(this.href.lastIndexOf("#"));
href=jQuery(href).parents('.cs_blocs').eq(0).children('.blocs_titre').eq(0);
old_blocs_slide=blocs_slide;
if(blocs_slide!='aucun')blocs_slide=-1;
if(href.is('.blocs_replie'))href.click();
blocs_slide=old_blocs_slide;
return true})})}
document.write('<style type="text/css">div.blocs_invisible{display:none;}</style>');
function cs_blocs_cookie(){
if(typeof jQuery.cookie!='function')return;
var blocs_cookie_name='blocs'+window.location.pathname+window.location.search
blocs_cookie_name=blocs_cookie_name.replace(/[ ;,=]/,'_');
var deplies=jQuery.cookie(blocs_cookie_name);
jQuery.cookie(blocs_cookie_name,null);
if(deplies)
jQuery(deplies).blocs_replie_tout().blocs_toggle();
jQuery(window).bind('unload',function(){
jQuery.cookie(blocs_cookie_name,blocs_deplies())})}
function blocs_deplies(){
var deplies='';
jQuery('.cs_blocs').each(function(){
var numero=/cs_bloc\d+/.exec(this.className);
if(numero==null)return;
replie=jQuery(this).children('.blocs_titre').eq(0).is('.blocs_replie');
if(!replie)deplies+=(deplies.length?', ':'')+'div.'+numero[0]});
return deplies.length?deplies:null}
function blocs_get_pagination(url){
tab=url.match(/#pagination([0-9]+)/);
if(tab==null)return false;
return tab[1]}
var blocs_pagination=blocs_get_pagination(window.location.hash);
var blocs_replier_tout=0;
var blocs_millisec=100;
var blocs_slide='aucun';
var blocs_title_sep=/\|\|/g;
var blocs_title_def='D\u00e9plier||Replier';

var cs_init=function(){
onglets_init.apply(this);
cs_sommaire_init.apply(this);
if(!cs_prive)jQuery("a.spip_out,a.spip_url,a.spip_glossaire",this).attr("target","_blank");
jQuery('span.spancrypt',this).attr('class','cryptOK').html('&#6'+'4;');
jQuery("a["+cs_sel_jQuery+"title*='..']",this).each(function(){
this.title=this.title.replace(/\.\..t\.\./,'[@]')});
blocs_init.apply(this)}
if(typeof onAjaxLoad=='function')onAjaxLoad(cs_init);
if(window.jQuery){
var cs_sel_jQuery=typeof jQuery(document).selector=='undefined'?'@':'';
var cs_CookiePlugin="prive/javascript/jquery.cookie.js";
jQuery(document).ready(function(){
if(jQuery("div.cs_sommaire").length){
jQuery("div.decoupe_haut").css("display","none");
if(cs_CookiePlugin)jQuery.getScript(cs_CookiePlugin,cs_sommaire_cookie)}
cs_init.apply(document)})}

