
/* function init_accueil
 * Initialise la home page
 * @param NULL
 */
function init_accueil()
{
  if( $('#news_flash li').length > 1 )
  {
  	$('#news_flash ul').anythingSlider({
    	width           : 950,
    	height          : 19,
    	delay           : 4000,
    	resumeDelay     : 1000,
    	buildNavigation : false,
    });
  }

  if( $('#slider_une li').length > 1 )
  {
  	$('#slider_une').anythingSlider({
    	width           : 550,
    	height          : 336,
    	delay           : 6000,
    	resumeDelay     : 1000,
    	buildNavigation : false,
    });
  }
  
  if( $('#slider_zoom li').length > 1 )
  {
  	$('#slider_zoom').anythingSlider({
  	  autoPlay        : false,
    	width           : 260,
    	height          : 180,
    	delay           : 6000,
    	resumeDelay     : 1000,
    	buildNavigation : false,
    });
  }
  
  if( $('#slider_citia li').length > 1 )
  {
  	$('#slider_citia').anythingSlider({
  	  autoPlay        : false,
    	width           : 260,
    	height          : 180,
    	delay           : 6000,
    	resumeDelay     : 1000,
    	buildNavigation : false,
    });
  }
  
  
}


/* function init_home_rubriques
 * Initialise la home page du Mifa
 * @param NULL
 */
function init_home_rubriques()
{
	$('#slider_home').anythingSlider({
  	startStopped    : false,
  	width           : 550,
  	height          : 184,
  	autoPlayLocked  : true,
  	delay           : 6000,
  	resumeDelay     : 1000,
  	buildNavigation : false,
  });
}

/* function init_liste_films
 * Initialise une liste de films
 * @param NULL
 */
function init_liste_films() 
{
  $("ul.liste_films li").hover(function() {
    if( $("a.plus_details", this).attr("href") != undefined )
      $(this).toggleClass("over");
  });

  $("ul.liste_films li").click(function() {
    $(location).attr('href',$("a.plus_details", this).attr("href"));
  });
}


/* function init_modal_jury
 * Initialise les comportements modaux sur les jury
 * @param NULL
 */
function init_modal_jury()  
{
  $(".modal_jury").click(function() {
			$.nyroModalManual({ content: $($(this).attr("href")).html() });
  });
}

function init_planlieux( mapname )
{
  $('a.detail_lieu').click( function()
  {
    var valeurhref = $(this).attr("href");
    var idhref     = valeurhref.substr( 1,9 ) + '('+mapname+')';

    $( "#details_lieux blockquote" ).each( function() {
      if( !$(this).hasClass( "masque" ) )
      {
        $(this).addClass( "masque" );
      }
      if( !$(this).hasClass( "hide" ) )
      {
        $(this).addClass( "hide" );
      }
    } );
    $( valeurhref ).removeClass( "masque" );
    $( valeurhref ).removeClass( "hide" );
    eval( idhref );
    return false;
  });
}

/* function init_tab_recap_ntk
 * Initialise le comportement du tableau récapitulatif du network
 * @param NULL
 */
function init_tab_recap_ntk()
{
  $("#tab_recap_ntk tfoot td a").css("visibility" , "hidden");

  $('#tab_recap_ntk td[class!="intitule"]').bind("mouseenter", function() {
    
    num_col = $(this).index();
    
    $(this).addClass("cel_hover");
    
    for(i=0; i < $("#tab_recap_ntk tr").length; i++)
    {
      $("#tab_recap_ntk tr").eq(i).find("td").eq(num_col).addClass("cel_hover");
    }
    
    $("#tab_recap_ntk tr").last().find("td").eq(num_col).removeClass("cel_hover").find("a").css("visibility" , "visible");
  });
  
  $('#tab_recap_ntk td[class!="intitule"]').bind("mouseleave", function() {
    $(this).removeClass("cel_hover");
    
    for(i=0; i < $("#tab_recap_ntk tr").length; i++)
    {
      $("#tab_recap_ntk tr").eq(i).find("td").eq(num_col).removeClass("cel_hover");
    }
    $("#tab_recap_ntk tr").last().find("td").eq(num_col).find("a").css("visibility" , "hidden");
  });
}

/* function init_palmares
 * Initialise la page palmarès
 * @param NULL
 */
function init_palmares()
{
  $(".palm_blc_film").hover(function()  {
    $(".info_comp" , this).stop().animate({height:"110px"}, 250, function() {
      $("a.btn, p" , this).show();
    });
  }, function() {
    $(".info_comp a.btn, .info_comp p" , this).hide();
    $(".info_comp" , this).stop().animate({height:"0px"}, 200);
  });
}
