$(function(){
	
	// LIENS PDF
	$("a[href*=.pdf]").click(function(){
		window.open(this.href);
		return false;
	});
	
	var vfmail = /^[a-z0-9._-]+@[a-z0-9.-]{2,}[.][a-z]{2,3}$/

	/**
	 * CONTACT
	 */
	$('#contact_submit_form').click(function(){
		$('label').css({'color':'#333','font-weight':'normal'});

		if ($('#nom').val() == '') {
			$('label[for=nom]').css({'color':'red','font-weight':'bold'});
			$('#nom').focus();
			return false;
		}
		if ($('#prenom').val() == '') {
			$('label[for=prenom]').css({'color':'red','font-weight':'bold'});
			$('#prenom').focus();
			return false;
		}
		if ($('#e_mail').val() == '') {
			$('label[for=e_mail]').css({'color':'red','font-weight':'bold'});
			$('#e_mail').focus();
			return false;
		}
		if (vfmail.test($('#e_mail').val()) == false) {
			$('label[for=e_mail]').css({'color':'red','font-weight':'bold'});
			alert("Veuillez entrer une adresse e-mail valide.");
			$('#e_mail').focus();
			return false;
		}
		if ($('#tel').val() == '') {
			$('label[for=tel]').css({'color':'red','font-weight':'bold'});
			$('#tel').focus();
			return false;
		}
		if ($('#message').val() == '') {
			$('label[for=message]').css({'color':'red','font-weight':'bold'});
			$('#message').focus();
			return false;
		}
		if ($('#captcha').val() == '') {
			$('label[for=captcha]').css({'color':'red','font-weight':'bold'});
			$('#captcha').focus();
			return false;
		}
	});
	
	
	
	/**
	 * CONTACT & ALERTES
	 */
	$('#alertes_submit_form').click(function(){
		$('label').css({'color':'#333','font-weight':'normal'});

		if ($('#nom').val() == '') {
			$('label[for=nom]').css({'color':'red','font-weight':'bold'});
			$('#nom').focus();
			return false;
		}
		if ($('#prenom').val() == '') {
			$('label[for=prenom]').css({'color':'red','font-weight':'bold'});
			$('#prenom').focus();
			return false;
		}
		if ($('#e_mail').val() == '') {
			$('label[for=e_mail]').css({'color':'red','font-weight':'bold'});
			$('#e_mail').focus();
			return false;
		}
		if (vfmail.test($('#e_mail').val()) == false) {
			$('label[for=e_mail]').css({'color':'red','font-weight':'bold'});
			alert("Veuillez entrer une adresse e-mail valide.");
			$('#e_mail').focus();
			return false;
		}
		if ($('#tel').val() == '') {
			$('label[for=tel]').css({'color':'red','font-weight':'bold'});
			$('#tel').focus();
			return false;
		}
		if ($('#message').val() == '') {
			$('label[for=message]').css({'color':'red','font-weight':'bold'});
			$('#message').focus();
			return false;
		}
		if ($('#captcha').val() == '') {
			$('label[for=captcha]').css({'color':'red','font-weight':'bold'});
			$('#captcha').focus();
			return false;
		}
	});
	
	
	
	/**
	 * NEWSLETTERS
	 */
	$('#newsletter_submit_form').click(function(){
		$('label').css({'color':'#333','font-weight':'normal'});

		if ($('#e_mail').val() == '') {
			$('label[for=e_mail]').css({'color':'red','font-weight':'bold'});
			$('#e_mail').focus();
			return false;
		}
		if (vfmail.test($('#e_mail').val()) == false) {
			$('label[for=e_mail]').css({'color':'red','font-weight':'bold'});
			alert("Veuillez entrer une adresse e-mail valide.");
			$('#e_mail').focus();
			return false;
		}
		if ($('#captcha').val() == '') {
			$('label[for=captcha]').css({'color':'red','font-weight':'bold'});
			$('#captcha').focus();
			return false;
		}
	});
	
	
	
	/**
	 * EVENTS
	 */
	$('#events_submit_form').click(function(){
		$('label').css({'color':'#333','font-weight':'normal'});
		$('#labelCivilite').css({'color':'#333','font-weight':'normal'});
		$('#labelFonction').css({'color':'#333','font-weight':'normal'});
		$('#labelSecteur').css({'color':'#333','font-weight':'normal'});
		
		if (!$(".radio_civilite:checked").get(0)) {
			$('#labelCivilite').css({'color':'red','font-weight':'bold'});
			return false;
		}
		if ($('#nom').val() == '') {
			$('label[for=nom]').css({'color':'red','font-weight':'bold'});
			$('#nom').focus();
			return false;
		}
		if ($('#prenom').val() == '') {
			$('label[for=prenom]').css({'color':'red','font-weight':'bold'});
			$('#prenom').focus();
			return false;
		}
		if ($('#fonction option:selected').val() == '0') {
			$('#labelFonction').css({'color':'red','font-weight':'bold'});
			$('#fonction').focus();
			return false;
		}
		if ($('#societe').val() == '') {
			$('label[for=societe]').css({'color':'red','font-weight':'bold'});
			$('#societe').focus();
			return false;
		}
		if ($('#secteur option:selected').val() == '0') {
			$('#labelSecteur').css({'color':'red','font-weight':'bold'});
			$('#secteur').focus();
			return false;
		}
		if ($('#adresse').val() == '') {
			$('label[for=adresse]').css({'color':'red','font-weight':'bold'});
			$('#adresse').focus();
			return false;
		}
		if ($('#cp').val() == '') {
			$('label[for=cp]').css({'color':'red','font-weight':'bold'});
			$('#cp').focus();
			return false;
		}
		if ($('#ville').val() == '') {
			$('label[for=ville]').css({'color':'red','font-weight':'bold'});
			$('#ville').focus();
			return false;
		}
		if ($('#pays').val() == '') {
			$('label[for=pays]').css({'color':'red','font-weight':'bold'});
			$('#pays').focus();
			return false;
		}
		if ($('#tel').val() == '') {
			$('label[for=tel]').css({'color':'red','font-weight':'bold'});
			$('#tel').focus();
			return false;
		}
		if ($('#e_mail').val() == '') {
			$('label[for=e_mail]').css({'color':'red','font-weight':'bold'});
			$('#e_mail').focus();
			return false;
		}
		if (vfmail.test($('#e_mail').val()) == false) {
			$('label[for=e_mail]').css({'color':'red','font-weight':'bold'});
			alert("Veuillez entrer une adresse e-mail valide.");
			$('#e_mail').focus();
			return false;
		}
		if ($('#captcha').val() == '') {
			$('label[for=captcha]').css({'color':'red','font-weight':'bold'});
			$('#captcha').focus();
			return false;
		}
	});
	
	
	
	/**
	 * PUBLICATIONS
	 */
	$('#publication_submit_form').click(function(){
		$('label').css({'color':'#333','font-weight':'normal'});
		$('#labelCivilite').css({'color':'#333','font-weight':'normal'});
		$('#labelFonction').css({'color':'#333','font-weight':'normal'});
		$('#labelSecteur').css({'color':'#333','font-weight':'normal'});
		
		if (!$(".radio_civilite:checked").get(0)) {
			$('#labelCivilite').css({'color':'red','font-weight':'bold'});
			return false;
		}
		if ($('#nom').val() == '') {
			$('label[for=nom]').css({'color':'red','font-weight':'bold'});
			$('#nom').focus();
			return false;
		}
		if ($('#prenom').val() == '') {
			$('label[for=prenom]').css({'color':'red','font-weight':'bold'});
			$('#prenom').focus();
			return false;
		}
		if ($('#fonction option:selected').val() == '0') {
			$('#labelFonction').css({'color':'red','font-weight':'bold'});
			$('#fonction').focus();
			return false;
		}
		if ($('#societe').val() == '') {
			$('label[for=societe]').css({'color':'red','font-weight':'bold'});
			$('#societe').focus();
			return false;
		}
		if ($('#secteur option:selected').val() == '0') {
			$('#labelSecteur').css({'color':'red','font-weight':'bold'});
			$('#secteur').focus();
			return false;
		}
		if ($('#adresse').val() == '') {
			$('label[for=adresse]').css({'color':'red','font-weight':'bold'});
			$('#adresse').focus();
			return false;
		}
		if ($('#cp').val() == '') {
			$('label[for=cp]').css({'color':'red','font-weight':'bold'});
			$('#cp').focus();
			return false;
		}
		if ($('#ville').val() == '') {
			$('label[for=ville]').css({'color':'red','font-weight':'bold'});
			$('#ville').focus();
			return false;
		}
		if ($('#pays').val() == '') {
			$('label[for=pays]').css({'color':'red','font-weight':'bold'});
			$('#pays').focus();
			return false;
		}
		if ($('#tel').val() == '') {
			$('label[for=tel]').css({'color':'red','font-weight':'bold'});
			$('#tel').focus();
			return false;
		}
		if ($('#e_mail').val() == '') {
			$('label[for=e_mail]').css({'color':'red','font-weight':'bold'});
			$('#e_mail').focus();
			return false;
		}
		if (vfmail.test($('#e_mail').val()) == false) {
			$('label[for=e_mail]').css({'color':'red','font-weight':'bold'});
			alert("Veuillez entrer une adresse e-mail valide.");
			$('#e_mail').focus();
			return false;
		}
		if ($('#captcha').val() == '') {
			$('label[for=captcha]').css({'color':'red','font-weight':'bold'});
			$('#captcha').focus();
			return false;
		}
	});

});