// noWrap.js
// Permet d'éviter les mots "solitaires" sur une deuxième ligne pour les titre de news
// Dans tous fichiers news, une var page_type est placée
// -> si var page_type == "titre_lien" (tt fichiers excepté "news_article.php") : le code s'applique sur "h2 a"
// -> si var page_type == "titre" ("news_article.php") : le code s'applique sur "h2"

$(document).ready(function() {

	var h2all, h2a, h2b;
	
	if( page_type == "titre_lien" ){
		$('h2 a').each(function() {
			h2all = $(this).text();
			h2a = h2all.slice(0, h2all.lastIndexOf(' '));
			h2b = '&nbsp;' + h2all.slice(h2all.lastIndexOf(' ')+1);
			$(this).html(h2a + h2b);
		});
	}else{
		$('h2').each(function() {
			h2all = $(this).text();
			h2a = h2all.slice(0, h2all.lastIndexOf(' '));
			h2b = '&nbsp;' + h2all.slice(h2all.lastIndexOf(' ')+1);
			$(this).html(h2a + h2b);
		});	
	}
	
});
