$(function() { 
	
	$("a.spip_out").attr("target", "_blank");
	
	$("#documents_portfolio a").fancybox();

	$(".texte_article a").each(function() {
		var url = $(this).attr('href');
		var extension = url.substr(url.length-3, url.length);
		if(extension == "pdf") { $(this).attr("target", "_blank"); } 
	});
	
	if($("#documents_portfolio_diapo").length > 0) {
		$('#documents_portfolio_diapo').innerfade({ timeout: 3000, speed: "slow", type: 'random', containerheight: $('#documents_portfolio_diapo').css("height") });
	}
	
	$('#gauche h2:first').wrap('<div class="h2wrapper" />').after('<br class="nettoyeur" />');
	
	$('div#liens_top ul li:last-child').addClass('last_item');
	
	
	$('div#menu_lang').hover(function() {
		$('div#choix_langue').css('display', 'block');
	}, function() {
		$('div#choix_langue').css('display', 'none');
	});


	if( $('#recherche').attr('value')=='' )
		$('#recherche').attr('value', $('#recherche_top #bt_recherche').attr('title'));

	$('#recherche').focus(function() {
		if( $('#recherche').attr('value')==$('#recherche_top #bt_recherche').attr('title') )
			$('#recherche').attr('value', '');
	}).blur(function() {
		if( $('#recherche').attr('value')=='' )
			$('#recherche').attr('value', $('#recherche_top #bt_recherche').attr('title'));
	});

	/*
	$('div.lien_bas_home h2 a').each(function() {
		var txt = $(this).html().replace(" ", "<br />");
		$(this).html(txt);
	});
	
	$('#mydiaporama ul').innerfade({
		speed: 'slow',
		timeout: 5000,
		containerheight: '356px'
	});
	$('div#diaporama_home ul li div strong').css('opacity', .7);
	*/
	



	$(window).bind('resize', function () {
		if( $('body.page_sommaire').length ) {
			// hop.
		}
	});
	








	
	
	
	$('div.texte_article blockquote').wrapInner('<div class="blockquote"></div>');
	


	/* videos popups */
	$("a[href*=popupflash]").fancybox({
		'width'				: 945,
		'height'			: 652,
        'autoScale'     	: false,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});
	
	
	if ( $.browser.msie && $.browser.version<8 )
		$('body').addClass('ie');
});



