$(document).ready(function() {
$('#search_cat').change(function() {
doForm();
});
$('#searchform input').click(function() {
if(this.id != 'newsletter_email')
 {
 doForm();
 }
 });
 $('#newsletter_link').click(function() {

 var email = $('#newsletter_email').val();
 if(email.length>0)
 {
 var regex = new RegExp("[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?");
 if(regex.test(email)) {
 window.location = '/infolettre?Question12='+email;


 
 
 
 
 


 /*
 $.get('/subscribe',{'nEmail':email},function(data)
 {
 if(typeof data.message != 'undefined')
 {
 alert(data.message);
 }
 else if(typeof data.status != 'undefined')
 {
 alert(data.status);
 }
 },'json');
 return false;
 */
 return false;
 }
 }
 alert('Vous devez entrer votre courriel');
 return false;
 });
 });

 function doForm() {
 val = '';
 $('#searchform input:checked').each(function() {
 val = appendVar(val,this.value);
 });
 $('#search_cat option:selected').each(function() {
 val = appendVar(val,this.value);
 });
 $('#cat_actual').val(val);
 document.getElementById('search_actual').submit();
 }
 function appendVar(val, cat) {
 if(val.length>0) {
 val += ',';
 }
 val += cat;
 return val;
 } 
