$(document).ready(function(){
	$.nyroModalSettings({
        processHandler: function(settings) {
            var scaleRatio = 1;
            var from = settings.from;
            if (from && from.href && from.href.indexOf('http://www.youtube.com/watch?v=') == 0) {
                $.nyroModalSettings({
                    type: 'swf',
                    width: (640 * scaleRatio),
                    height: (370 * scaleRatio),
                    url: from.href.replace(new RegExp("watch\\?v=", "i"), 'v/')
                });
            } else {
				$.support.boxModel=0;
                $.nyroModalSettings({
					type: 'iframe',
					forceType:'iframe',
                    width: (517),
                    height: (650),
                    url: from.href 
                });
            }
        }
    });

    /* Liens externes */
    $("a[href^='http:']").not("[href*=" + location.hostname + "]").attr('target','_blank').not(":has(img)").not("[id]").after('<img src="/images/icones/icone_externe.gif" alt="external link" style="margin-left:3px;"/>');    
	
    /* pour le champ Votre Courriel en bas de page */
    quiteChamp(document.formulaireNews.courrielNews);
    document.getElementById("courrielNews").className="texteInactif";	    
	
	/* Animation sur les images */
	$("a.animation").hover(function(){
		$(this).stop().fadeTo("fast", 0.5);
	},function(){
		$(this).stop().fadeTo("fast", 1.0);
	})

	
    /*Sous menus gauche*/
    /*$('div#sousMenus').css('height',$('div#sousMenus').outerHeight()+'px')*/
    $('div#sousMenus ul:first-child li:has(ul)').each(function(){
        if($(this).find('a:first-child').hasClass('ferme'))
            {
            $(this).find('ul').css('display','none');
            }
    })
    $('div#sousMenus ul:first-child li:has(ul): a.ouvert,div#sousMenus ul:first-child li:has(ul): a.ferme').click(function(){
        if($(this.parentNode).find('a:first').hasClass('ouvert'))
            {
            $(this.parentNode).find('a:first').removeClass('ouvert');
            $(this.parentNode).find('a:first').addClass('ferme');
            }
        else if($(this.parentNode).find('a:first').hasClass('ferme'))
            {
            $(this.parentNode).find('a:first').removeClass('ferme');
            $(this.parentNode).find('a:first').addClass('ouvert');
            }
        $(this.parentNode).find('ul').toggle(300);
    })
    /* */ 
    $('#interetProgramme a').addClass('btnBleu');
	

	
});

function validerAbonnement(){

  if (!ValiderCourriel(document.formulaireNews.courrielNews.value, ''))
      {
      window.setTimeout('document.formulaireNews.courrielNews.focus();', 100);
      return false;
      }
  
    estEnvoye = true;
    document.formulaireNews.antirobot.value = '1';   
    return true;
}

