

/* function init_js
 * Initialise le comportement javascript
 * @param null
 */ 

function init_js()
{
  init_menu_citia();
  init_cufon();
  init_modal();
  init_band_lang();
  //init_search();

  $('#bc_contenu .kwicks').kwicks({
    max: 90,
    min : 35,
    spacing : 2,
    duration: 300,
    sticky: true
  });
  
  $("#haut_page").click(function()  {
    $( 'html' ).animate( { scrollTop: 0 }, 'slow' );
  });
  
	$( 'div#band_lang' ).slideDown(); 
  
}

/*
 * créé un cookie afin de ne plus afficher le bandeau multilangue si l'utilisateur le ferme 	
 * le controleur front (fonction : cookie_band_lang) retourne une chaine json dont la clé 'etat' doit être égale à 1 en cas de création réussie du cookie
 * @param null
 */
function init_band_lang(){
	$( 'a#fermer_band_lang' ).live( 'click' , function( event ) {
	  event.preventDefault();
		
		$.ajax({
		  dataType: "json",
		  url: "ctrl_front.php",
		  data: "fct=cookie_band_lang",
		  
		  success: function( data ) {
			}
			
		}); 
	
	  $( this ).parent().remove();
	} );
}

/* function init_cufon
 * Initialise les comportement des élements Cufon
 * @param null
 */   
function init_cufon()
{
  Cufon.replace('h1');
  Cufon.replace('h2[class!="no_cufon"]');
  Cufon.replace('h3[class!="no_cufon"]');
  Cufon.replace('h4[class!="no_cufon"]');
  Cufon.replace('.cufon');
  //Cufon.replace('h5');
  if( $('.chiffres li').length > 1 )
    Cufon.replace('ul.chiffres li');
  
} 

/* function init_menu_citia
 * Gère le menu
 * @param null
 */   
function init_menu_citia()
{
  var n1actif = false;
  var n2actif = false;
  var n1courant = false;

  //-------------------------------------------------------------- CLICK N1
  $("#menu li.li_n1").bind("click", function() {
    
    //Gestion MP CITIA
    if( $("a" , this).attr("id") != "mp_306" )
    {
      if( $(this).hasClass("network") && $(".menu_n2 li.li_n2" , this).length == 0 && !$.data(this, "lg_px") )
      {
        $.data(this, "lg_px" , $(this).css("width") );
        $.data(this, "lg_hover_px" , "520px");
        $.data(this, "actif" , false );
        $.data(this, "sselemt" , "#form_login");
      }
      //Initialisation des variables du menu
      if(!$.data(this, "lg_px"))
      {
        var nb_n2 = $(".menu_n2 li.li_n2" , this).length;
        var lg_span_new = 0;
        var lg_caractere = 6.9;
        
        $.data(this, "actif" , false );
        
        $(".menu_n2 li.li_n2 > a" , this).each(function(a) {
          lg_span_new += $(this).text().length;
        });
        
        if(nb_n2 > 4)
          lg_caractere = 5.5;

        var new_val_custom = lg_span_new*lg_caractere+nb_n2*18;
        
        if( new_val_custom > 500 )
          new_val_custom = new_val_custom-50;
  
        $.data(this, "lg_px" , $(this).css("width") );
        $.data(this, "lg_hover_px" , new_val_custom+"px");
        $(".menu_n2" , this).css("width", new_val_custom+"px");
  
        $.data(this, "sselemt" , ".menu_n2");
      }
      //Si on a un n2 d'ouvert, on le ferme
      if( n2actif )
      {
        $("#menu li.li_n1:eq("+parseInt(n1actif-1)+") li.li_n2:eq("+parseInt(n2actif-1)+")").trigger("click");
        n2actif = false;
      } 
      //Est-on sur l'element actif ?
      switch( $.data(this, "actif") )
      {
        //C'est un element inactif
        case false:
          //Si on a un element déjà actif alors on le referme
          if( n1actif && $(this).index() != n1actif-1 )
          {
            $("#menu li.li_n1").eq(n1actif-1).trigger("click");
            n1actif = false;
            //Si on a un element N2 déjà actif alors on le referme
            if( n2actif && $(this).index() != n2actif-1 )
            {
              $("#menu li.li_n1 li.li_n2").eq(n2actif-1).trigger("click");
              n2actif = false;
            }
          }      
          $( $.data(this, "sselemt") , this).show();
          
          //if( $('.menu_n2 li.li_n2', this).length > 1 )
            $(this).addClass("n1_select").css("width", $.data(this, "lg_hover_px") ).css("overflow", "visible");
            
          n1actif = $(this).index()+1;
          $.data(this, "actif" , true );
        break;
        //C'est l'élement actif
        case true:
          $( $.data(this, "sselemt") , this).hide();
          
          //if( $('.menu_n2 li.li_n2', this).length > 1 )
          //{
            $(this).removeClass("n1_select").css("width", $.data(this, "lg_px") );
          //}
          $.data(this, "actif" , false );
          n1actif = false;
        break;
      }
      return false;
    }
  });

  //-------------------------------------------------------------- CLICK N2
  $("#menu li.li_n1 li.li_n2").bind("click", function(event) {
	  event.stopPropagation();
    //Si on a un element déjà actif alors on le referme
    if( n2actif && $(this).index() != n2actif-1 )
    {
      $("#menu li.li_n1:eq("+parseInt(n1actif-1)+") li.li_n2:eq("+parseInt(n2actif-1)+")").toggleClass("li_n2_over").children(".menu_n3").toggle();
      n2actif = $(this).index()+1;
    } 
    else if( n2actif )
      n2actif = false;
    else	  
	   n2actif = $(this).index()+1;
	  
	  $(this).toggleClass("li_n2_over");
    $(".menu_n3" , this).toggle();
  });

  //-------------------------------------------------------------- CLICK N3
  $("#menu li.li_n1 li.li_n2 ul.menu_n3 li").bind("click", function(event) {
	  event.stopPropagation();
	});

  //-------------------------------------------------------------- Ouverture actif n1 et n2
  n1courant = $("#menu li.li_n1.ouvert").index()+1;
  
  if( $("#menu li.li_n1.ouvert") )
  {
    $("#menu li.li_n1.ouvert").trigger("click");
    /* Ouverture auto du n2
    if( $("#menu li.li_n1.ouvert li.li_n2 a.select") )
      $("#menu li.li_n1.ouvert li.li_n2 a.select").parent().trigger("click");*/
  } 
  
  //-------------------------------------------------------------- fermeture click exterieur
  $("body").bind("click", function(event) {
    if( n2actif )
    {
      $("#menu li.li_n1:eq("+parseInt(n1actif-1)+") li.li_n2:eq("+parseInt(n2actif-1)+")").trigger("click");
      n2actif = false;
    }
    if( n1courant != n1actif )
    {
      $("#menu li.li_n1:eq("+parseInt(n1actif-1)+")").trigger("click");
      $("#menu li.li_n1:eq("+parseInt(n1courant-1)+")").trigger("click");
    }  
	});
}

/* function init_accroches
 * Gère les accroches
 * @param null
 */   
function init_accroches()
{
  $(".acces_rapide").each(function(i)  {
    $(this).click(function()  {
      $(location).attr('href',$(this).find("a").attr("href"));
    });
    $("a" , this).hide();
  });
}

/* function init_contact
 * Gère le survol des blocs de contact
 * @param : NULL
 */
function init_contact()
{
  $(".blc_contact").hover(function()  {
    $(this).addClass("hover");
  },
  function()  {
    $(this).removeClass("hover");
  });
}

/* function init_modal
 * Initialise l'interactivité des fenètre modales
 * @param : NULL
 */
function init_modal()
{
  $('.nyroModal').nyroModal();

  $('.nyroModalRefresh').nyroModal(  );

  $(".blc_modal, .mod_btn").click(function(event) {
			$.nyroModalManual({ content: $($(this).attr("href")).html() });
			event.stopPropagation();
  });
}

/* function init_modal_comp
 * Initialise l'interactivité des fenètre modales de class .comp_modal
 * Ces blocs 
 * @param : NULL
 */
function init_modal_comp()
{
  $( $(".comp_modal").attr("href") ).hide();
  
  $(".comp_modal").click(function() {
			$.nyroModalManual({ content: $($(this).attr("href")).html() });
  });
}

/* function init_modal_special
 * Initialise les comportements modaux sur les jury
 * @param NULL
 */
function init_modal_special(elmt_cible)  
{
  $(elmt_cible).click(function() {
			$.nyroModalManual({ content: $($(this).attr("href")).html() });
  });
}

/* function init_connexion
 * Initialise le comportement de la boite de connexion dans le bandeau CITIA
 * Actuellement masqué pour Annecy.org 
 * @param NULL
 */
 /*
function init_connexion()
{
  $("#form_login").bind("click", function(event) {
    event.stopPropagation();
  });
}
*/
/* function init_connexion
 * Initialise le comportement du formulaire de connexion
 * @param id_form String : ID du formulaire à traiter
 */
function init_connexion( id_form )
{
  if( id_form == undefined )
  {
    id_form = "form_login";
    $("#menu #form_login").bind("click", function(event) {
      event.stopPropagation();
    });
  }
  highlight_form();
  var options = {
      dataType:  'json',
      beforeSubmit:  function() {
        no_erreur = true;
        $("#"+id_form +" .error_login").html("");
        
        //console.log( 'identif > '+$( "#"+id_form +" input[name=identifiant]").val()+"  pwd> "+$( "#"+id_form +" input[name=password]").val() );
        //Identifiant
        if( $( "#"+id_form +" input[name=identifiant]").val() == '' )
        {
          $( '#'+id_form+' input[name=identifiant]' ).addClass( "bordure_erreur" ).parent().addClass( "coul_erreur" );
          no_erreur = false;
        }
        if( $( "#"+id_form +" input[name=password]").val() == '' )
        {
          $( '#'+id_form+' input[name=password]' ).addClass( "bordure_erreur" ).parent().addClass( "coul_erreur" );
          no_erreur = false;
        }
        return no_erreur;
      }, 
      success: function(data) {
        if(data.etat)
        {
          $.nyroModalManual({content : "<h4>"+login_success+"</h4>"});
          setTimeout("redir('"+data.url+"')", 2200);
        }
        else
          $( "#"+id_form +" .error_login" ).html(data.er_mess);
      }
    }
    $( "#"+id_form ).ajaxForm(options);  

    $( "#"+id_form +" .lost_pwd" ).nyroModal();
}

/* function init_form_pwd
 * Initialise le comportement du formulaire pour retrouver son mot de passe
 * @param NULL
 */
function init_form_pwd()
{
  //init_highlight_form();
  
  var options = {
    dataType:  "json",
    beforeSubmit:  function() {
      
      if(!verif_chp_formulaire("form_mdp_perdu", ["identifiant_pwd_perdu"]) )
        return false;
    }, 
    success: function(data)  {
      $.nyroModalManual({content : "<p>"+data.code_html+"</p>"});
      setTimeout("$.nyroModalRemove()", 6000);
    }
  };

  $("#form_mdp_perdu").ajaxForm(options);
} 
/* function init_change_mdp
 * Initialise le comportement du formulaire pour changer son mot de passe
 * @param NULL
 */
function init_change_mdp()
{
  //Si c'est le form de changement de mot de passe
  if( $("#form_change_pwd input").length > 1 )
  {
    highlight_form();
    $("#form_change_pwd").submit(function() {
  
      if( !verif_chp_identiques(["mdp" , "mdp2"]) )
          return false;
    });
  }
  //Sinon c'est le form de connexion
  else if( $("#form_change_pwd input").length > 1 )
    init_form_connexion();
}
             
/* function init_liste_actus
 * Initialise le comportement des liste d'actualité (survol et clique)
 * @param NULL
 */
function init_liste_actus()
{

  $("#liste_actualites li").css("cursor" , "pointer")
                           .hover(function()  {
                              $(this).addClass("actu_over");
                            },function()  {
                              $(this).removeClass("actu_over");
                            })
                           .click(function()  {
                              $(location).attr('href', $("a.btn", this).attr("href") );
                            })
                           .find("a.btn").hide();
}

/* function highlight_form
 * Gère les couleur erreur sur les champs de formulaires
 * Evolution de init_highlight_form plus légère grace à l'utilisation des CSS 
 * @param : null
 */
function highlight_form()
{
  //-- Highlight des champ input
  $("input[type=text][class!='highlight_off'],input[type=password],input[type=file],textarea, select").focus(function(){
    if( $(this).hasClass("bordure_erreur") )
      $(this).removeClass("bordure_erreur").parent().removeClass("coul_erreur");
  });

  //Champs radio insérer dans un label
  $("input[type=radio][class!='highlight_off']").focus(function(){
    if( $(this).parent().parent().hasClass("coul_erreur"))
      $(this).parent().parent().removeClass("coul_erreur").prev().removeClass("coul_erreur");
  });
}

/* function verif_chp_formulaire
 * Vérifier que les champs passé en paramètres sont bien remplis
 * @param : id_form : string : ID du formulaire à vérifier
 * @param : tab_chp : array : tableau contenant les ID des champs à controller 
 */
  function verif_chp_formulaire( id_form, tab_chp )
  {
    var no_erreur = true;
    var options   = {};
    for( i = 0; i < tab_chp.length; i++ )
    {
      if( $( '#'+id_form+' #'+tab_chp[i] ).val() == "" )
      {
        $( '#'+id_form+' #'+tab_chp[i] ).addClass( "bordure_erreur" ).parent().effect( "pulsate", options, 100 ).addClass( "coul_erreur" );
        no_erreur = false;
      }
      else if( $( '#'+id_form+' #'+tab_chp[i] ).hasClass( "bordure_erreur" ) )
        $( '#'+id_form+' #'+tab_chp[i] ).removeClass( "bordure_erreur" ).parent().removeClass( "coul_erreur" );
    }
    return no_erreur;
  }

/* function verif_form_date
 * Vérifier que les champs passé en paramètres sont bien remplis
 * @param : tab_chp : array : tableau contenant les ID des champs à controller 
 */
function verif_form_date(tab_chp)
{  
  var no_erreur = true;
  var options = {};
  for(i=0; i<tab_chp.length; i++)
  {
    if( $('#'+id_form+' #'+tab_chp[i]).val() == "")
    {
      $('#'+id_form+' #'+tab_chp[i]).addClass("bordure_erreur").parent().effect( "pulsate", options, 100 ).addClass("coul_erreur"); //.children("span").text(cst_invalid).removeClass("no_img");
      no_erreur = false;      
    }
    else if( $('#'+id_form+' #'+tab_chp[i]).hasClass("bordure_erreur"))
      $('#'+id_form+' #'+tab_chp[i]).removeClass("bordure_erreur").parent().removeClass("coul_erreur"); //.children("span").html("&nbsp;");  
  }
  return no_erreur;
} 

/* function verif_chp_identiques
 * Vérifier que les champs passé en paramètres sont bien identiques
 * @param : tab_chp : array : tableau contenant les ID des champs à controller 
 */
function verif_chp_identiques(tab_chp)
{
  var no_erreur = true;
  var options = {};
  var val_ref = $('#'+tab_chp[0]).val();
  for(i=0; i<tab_chp.length; i++)
  {
    if( $('#'+tab_chp[i]).val() != val_ref || val_ref == '' )
    {
      $('#'+tab_chp[i]).addClass("bordure_erreur").parent().effect( "pulsate", options, 100 ).addClass("coul_erreur"); //.children("span").text(cst_invalid).removeClass("no_img");
      no_erreur = false;
    }
    else if( $(' #'+tab_chp[i]).hasClass("bordure_erreur"))
      $('#'+tab_chp[i]).removeClass("bordure_erreur").parent().removeClass("coul_erreur"); //.children("span").html("&nbsp;");  
  }

  return no_erreur;
} 

/* function verif_form_select_multiple
 * Vérifier qu'un champ select multiple a bien des valeurs de cochée
 * @param: array tab_name_chp_multiple tableau contenant les names des champs à controler
 */
  function verif_form_select_multiple( tab_name_chp_multiple )
  {
    var no_erreur = true;
    var options   = {};
    for( i = 0; i < tab_name_chp_multiple.length; i++ )
    {
      switch( tab_name_chp_multiple[i][1] )
      {
        case "multi":
          //var n = $("select[name='"+tab_name_chp_multiple[i][0]+"[]'] option:selected").length;
          var n = $( "input[name='" + tab_name_chp_multiple[i][0] + "[]']:checked" ).length;
        break;

        case "unique":
         
          var n = $( "select[name='" + tab_name_chp_multiple[i][0] + "'] option:selected" ).attr( "value" );
          //Triche en cas de select multiple mais unique type pays inscription film
          if( !n )
            var n = $( "select[name='" + tab_name_chp_multiple[i][0] + "[]'] option:selected" ).attr( "value" );

          if( !n )     
           n = 0;
        break;
      }
      if( n == 0 )
      {
        $( "#" + tab_name_chp_multiple[i][0] ).addClass( "bordure_erreur" ).parent().effect( "pulsate", options, 100 ).addClass( "coul_erreur" ); //.children( "span" ).text( cst_invalid ).removeClass( "no_img" );
        no_erreur = false;
      }
      else if( $( "#" + tab_name_chp_multiple[i][0] ).parent().hasClass( "coul_erreur" ) )
        $( "#" + tab_name_chp_multiple[i][0] ).removeClass( "bordure_erreur" ).parent().removeClass( "coul_erreur" ); //.children( "span" ).html( "&nbsp;" );
    }
    return no_erreur;
  }

/* function verif_email
 * Vérifie la validité d'un email
 * @param : id_champ_mail mail à controller
 */ 
function verif_email(id_champ_mail)
{
  var no_erreur = true;
  var options = {};

  if (($("#"+id_champ_mail).val().indexOf('@')< 0) || ($("#"+id_champ_mail).val().indexOf('.')< 0))
  {
    $('#'+id_champ_mail).addClass("bordure_erreur").parent().effect( "pulsate", options, 100 ).addClass("coul_erreur");
    no_erreur = false;
  }
  else if($("#"+id_champ_mail).hasClass("bordure_erreur"))
     $("#"+id_champ_mail).removeClass("bordure_erreur").parent().removeClass("coul_erreur");    

  return no_erreur; 
}

/* function verif_form_radio
 * Vérifier que les champs passé en paramètres sont bien cochés
 * @param : id_form : string : ID du formulaire à vérifier
 * @param : tab_chp : array : tableau contenant les ID des champs à controller 
 */
function verif_form_radio(id_form, tab_chp)
{
  var no_erreur = true;
  var options = {};
  for(i=0; i<tab_chp.length; i++)
  {
    if( $("#"+id_form+" input[name$='"+tab_chp[i]+"']:checked").val() == undefined )
    {
      $("#"+id_form+" input[name$='"+tab_chp[i]+"']").parent().parent().effect( "pulsate", options, 100 ).addClass("coul_erreur").prev().addClass("coul_erreur"); //.children("span").text(cst_invalid).removeClass("no_img");
      //Methode 1 login FB (a supprimer ici et modifier structure HTML login) 
      //$('#'+id_form+' #'+tab_chp[i]).addClass("bordure_erreur").prev().prev().effect( "pulsate", options, 100 ).addClass("coul_erreur");
      no_erreur = false;
    }
    else if( $("#"+id_form+" input[name$='"+tab_chp[i]+"']:checked").parent().parent().hasClass("coul_erreur"))
    {
      $("#"+id_form+" input[name$='"+tab_chp[i]+"']:checked").parent().parent().removeClass("coul_erreur").prev().removeClass("coul_erreur"); //.children("span").html("&nbsp;");
    } 
  }
  return no_erreur;
}

/* function verif_form_duree
 * Vérifier que les champs passé en paramètres sont bien cochés
 * @param : id_form : string : ID du formulaire à vérifier
 * @param : tab_chp : array : tableau contenant les ID des champs à controller 
 */
function verif_form_duree( tab_name_chp )
{
  var no_erreur = true;
  var options = {};

  var n = $("select[name='"+tab_name_chp[0]+"'] option:selected").val();
  var o = $("select[name='"+tab_name_chp[1]+"'] option:selected").val();
  var p = $("select[name='"+tab_name_chp[2]+"'] option:selected").val();

  if ( n + o + p == 0 )
  {
    $("#"+tab_name_chp[0]).addClass("bordure_erreur");
    $("#"+tab_name_chp[1]).addClass("bordure_erreur");
    $("#"+tab_name_chp[2]).addClass("bordure_erreur").parent().effect( "pulsate", options, 100 ).addClass("coul_erreur"); //.children("span").text(cst_invalid).removeClass("no_img");
    no_erreur = false;
  }
  else if ( $("#"+tab_name_chp[0]).hasClass("bordure_erreur") || $("#"+tab_name_chp[1]).hasClass("bordure_erreur") || $("#"+tab_name_chp[2]).hasClass("bordure_erreur") ) {
    $("#"+tab_name_chp[0]);
    $("#"+tab_name_chp[1]);
    $("#"+tab_name_chp[2]).removeClass("bordure_erreur").parent().removeClass("coul_erreur"); //.children("span").html("&nbsp;");
  }

  return no_erreur; 
}

/* function TextLimit (mi,ni plugin intégré ci dessous en version mini)
 * Limite le nombre de caractère saisie dans un textarea
 * usage  : $("#id_textarea").textLimit(500,function( length, limit, reached  )  { });
 * @param : nb_char : Integer : Nombre de caractère à limiter
 */
 (function(a){a.fn.clearTextLimit=function(){return this.each(function(){this.onkeydown=this.onkeyup=null})};a.fn.textLimit=function(b,c){if(typeof c!=="function")var c=function(){};return this.each(function(){this.limit=b;this.callback=c;this.onkeydown=this.onkeyup=function(){if(a(this).val().length>this.limit){this.value=this.value.substr(0,this.limit)}this.reached=this.limit-this.value.length;this.reached=this.reached<=0?true:false;return this.callback(this.value.length,this.limit,this.reached)}})}})(jQuery)


/* function init_player
 * Initialise un player
 * @param : player > type de player concerné
 * @param : id_html > id html concerné
 */
function init_player( player , id_html )
{
  switch(player)
  {
    case "jerowing":
      if(id_html == "extrait_son")
      {
        $("#"+id_html).flash({
          src: '/resources/swf/mediaplayer.swf',
          width: 344,
          height: 20,
          flashvars: {
            author: 'Etienne perruchon',
            description: 'Thême musical du festival d\'Annecy', 
            duration: '33',
            file :'/resources/son/annecy_festival.mp3',
            backcolor : '0x0d0d1a',
            frontcolor : "0xffffff" ,
            lightcolor : "0x96bd0d"
          }
        },
        { version: 9 }
        );
      }
    break;
  }
};

/* function init_module_archive_programme
 * Fonction générique d'initialisation du module (appelée en paramètre statique par le module)
 * @param : NULL
 */
function init_module_archive_programme()
{
  //init_blc_detail("btn_info");
  
  $(".blc_comp").hide();
  $(".bloc_tab a.btn").click(function() {
    $(this).toggleClass( "plus_details moins_details" ).parent().find(".blc_comp").toggle("fast");
    event.stopPropagation();
    
    return false;
  });

  $(".bloc_tab").click(function() {
    $("a.btn", this).trigger("click");
  });

  init_modal();      
}

/* function init_vue_rdv
 * Fonction générique d'initialisation du module rendez-vous
 * @param : NULL
 */
function init_vue_rdv()
{
  var hash = location.hash;
  $(".blc_comp, .intrv_2").hide();
  
  $(".bloc_tab a.btn").click(function(event) {
    $(this).toggleClass( "plus moins" ).parent().toggleClass("blc_actif").find(".blc_comp, .intrv_1, .intrv_2").toggle();
    event.stopPropagation();

    return false;
  });
  
  $(".bloc_tab").click(function() {
    $("a.btn", this).trigger("click");
  });

  //On accordéonne l'ensemble si on a bien défini le classement par titre
  
  if( $("h3.bloc_tab").length > 1 )
  {
    $("h3.bloc_tab").next().hide();
    $("h3.bloc_tab").click(function() {
      $(this).next().toggle();
    });
    //$(".blc_accordeon").accordion({active: false, clearStyle: true, autoHeight: false });    
  } 

    
  //Si on a un element spéciale à afficher (précisé dans le #hash) alors on l'affiche et on focalise dessus
  if( hash != '' )
  {
    var hash_simple = hash.substring(1, hash.length);
    
    $('a[rel="'+hash_simple+'"]').trigger("click");
    $('a[rel="'+hash_simple+'"]').parent().parent().prev().trigger("click");

    var pos_elmt = $('a[rel="'+hash_simple+'"]').offset();
    var from_top = pos_elmt.top - ( $('a[rel="'+hash_simple+'"]').parent().height() + 100 );
    $( 'html' ).animate( { scrollTop: from_top } );    
  }
}


/* function init_programmation
 * @desc: Gère le comportement du service programmation
 * @param: null
 * @return Void 
 */
function init_programmation()
{
  if( $(".liste_programme").html() != null )
  {
    $(".liste_programme li").click(function() {
     $(location).attr('href', $("a" ,this).attr("href") );
    });
  }
  else 
    init_liste_films();

}

/* function init_tooltip
 * Initialise les tooltip générique
 * @param NULL
 */
function init_tooltip()
{
  $("a.info_bulle").simpletooltip();
}


/* function redir
 * Redirige la page courante vers l'url passé en paramètr
 * @param : String url
 */
function redir(url)
{
  $(location).attr('href',url);
}

/* function rotation_pub
 * Créé un slider pour les bannières multiples
 * @param : String duree_aff Durée pour chaque pub
 */
function rotation_pub(duree_aff)
{

  if(duree_aff = '')
    duree_aff = 5000;
  
	$('.espace_pub_250 ul').anythingSlider({
  	width           : 250,
  	height          : 250,
  	delay           : 5000,
  	resumeDelay     : 1000,
  	buildNavigation : false,
  	buildArrows : false,
  	animationTime   : 1    
  });
}
/* function init_cat_photos_video
 * Initialise le comportement JS des catégories photos et vidéo
 * @param : Null
 */
function init_cat_photos_video()
{
  $("div.blc_vignette_cat").click(function()  {
    window.location = $("a", this).attr("href");
  });
}
/* function init_voeux
 * Initialise le flash des voeux
 * @param String annee
 * @param String lang 
 */
function init_voeux(annee, lang)
{
  $("#voeux"+annee).flash(
          { src: './resources/swf/carte_voeux_citia_'+lang+'.swf',
            width: 810,
            height: 920 },
          { version: 8 }
      );
}
