
Cufon.replace('h1,#content h3,#contextuelPart h3,#bloc_1 h2,#bloc_2 h2,.coups_coeur h2,.categoryTitle,.tt_haut,.detail_projet div.right h2,.parlez_de_nous,#stat_projets *,.page_evenements h2,.tt2,.nom_auteur,#commentform legend,.events .date_event,.events .titre_event,#ssblog #social .pays');
Cufon.replace('#ssblog #menu a,#ssblog #social a,.nom_auteur a',{hover: {color: '#333'}});

var ie6 = false;
$(document).ready(function () {//last bloc evenements
$('.block_evenements ul li:last-child').addClass('last');
/* roll */
jQuery(".roll").hover(function(){jQuery(this).attr("src", jQuery(this).attr("src").split('_0').join('_1'))}, function(){jQuery(this).attr("src", jQuery(this).attr("src").split('_1').join('_0'))}); 
/**/
						
	if(jQuery.browser.version == "6.0" && jQuery.browser.msie){
		ie6 = true;
	}
	if(ie6) {
		initNavigation();
		fixPostsHeight();
	}


initInputTextEvents("#contextuelPart");
initInputTextEvents("#commentaires_form");

	//formulaire de contact
	$('#commentform').submit(function(){
		$message_erreur = '';
		if($('#author').val() == ''){
			$message_erreur += '<li>Le champ "nom" est obligatoire</li>';
		}
		if($('#comment').val() == ''){
			$message_erreur += '<li>Le champ "commentaire" est obligatoire</li>';
		}
		if($message_erreur != ''){
			$('#commentform .message_erreur').remove();
			$('#comment_form_part').prepend('<ul class="message_erreur">' + $message_erreur + '</ul>');
			return false;
		}
		return true;
	});
	
	
	
	
	
	
	
	
	
	
	
	
	

});

function fixPostsHeight(){
	var posts = $("#allposts .seePost");
	posts.each(function(){	
		var height = $(this).parent().height();
		$(this).height(height);
	});
}

function initInputTextEvents(elm){
	var input = elm +" .text input";
	var textarea = elm +" .textarea textarea";
	$(input+","+textarea).each(function(){
		this.value = this.defaultValue;
	});
	$(input+","+textarea).bind("focus",function(){
		if($(this).attr("value") == this.defaultValue) this.value = ""
	});
	$(input+","+textarea).bind("blur",function(){
		if($(this).attr("value") == "") this.value = this.defaultValue
	});
}

function initNavigation(){
	var menu = $("#menu");
	$("#menu .cat").hover(
	function () {	
			$(this).find(".navN2").css("display","block");
		},
		function () {	
			$(this).find(".navN2").css("display","none");
		}
	);
}


function isValidEmailAddress(emailAddress) {
	var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
	return pattern.test(emailAddress);
}

