$(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('e-mailNL');
		var subscribe = document.getElementById('subscribe');
		if (!filter.test(email.value)) {
			$('.emailNL-missing').show();
			$('#e-mailNL').addClass('invalid');
		} else {$('.emailNL-missing').hide(); $('#e-mailNL').removeClass('invalid');}
		
			if (document.NLform.nameNL.value == "" || document.NLform.nameNL.value == "Name") {
			$('.nameNL-missing').show(); $('#nameNL').addClass('invalid');
		} else {$('.nameNL-missing').hide(); $('#nameNL').removeClass('invalid');}	
	
		if ( (!filter.test(email.value))||(document.NLform.nameNL.value == "") ){
			return false;
		} 
		
		if ((filter.test(email.value)) && (document.NLform.nameNL.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:$('#e-mailNL').val(),
							  name:$('#nameNL').val(),
							  subscribe:$('#subscribe').val(),
							  group: 1
							},
		
			//return the data
			function(data){
			  //hide the graphic
			  $('.bar').css({display:'none'});
			  $('.loader').append(data);
			});
					
		
		} 
	//stay on the page
			return false;
  });
  
});

function fieldclick(preset, value){
	if(preset == value){
		return "";
	}else{
		return value;	
	}
}

function fieldblur(preset, value){
	if(value == "" || value == " " || value == "  " ){
		return preset;
	}else{
		return value;	
	}
}

	
