$(document).ready(function(){
	
   //submission scripts
  $('.NLForm').submit( function(){
		//statements to validate the form	
		var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		var email = document.getElementById('NLemail');
		var subscribe = document.getElementById('subscribe');
		if (!filter.test(email.value)) {
			$('.email-missing').show();
			$('.nlEmailEB').addClass('invalid');
		} else {$('.email-missing').hide(); $('.nlEmailEB').removeClass('invalid');}
				
		if ( !filter.test(email.value)){
			return false;
		} 
		
		if (filter.test(email.value)) {
			//hide the form

			$('.NLForm').hide();
		
			//show the loading bar
			$('.loader').append($('.bar'));
			$('.bar').css({display:'block'});
		
			//send the ajax request
			$.post('maillist/mail.php',{
							  email:$('#NLemail').val(),
							  subscribe:$('#subscribe').val(),
							  group: '4'
							},
		
			//return the data
			function(data){
			  //hide the graphic
			  $('.bar').css({display:'none'});
			  $('.loader').append(data);
			});
					
		
		} 
	//stay on the page
			return false;
  });
  
});
