$(document).ready(function(){
	



   //submission scripts
  $('.newsForm').submit( function(){
		//statements to validate the form	
		var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		var news = document.getElementById('news');
		if (!filter.test(news.value)) {
			$('.news-missing').show();
		} else {$('.news-missing').hide();}
		if ((!filter.test(news.value))){
			return false;
		}
		if ((filter.test(news.value))) {
   			
			//hide the form
			$('.newsForm').hide();
		
			//show the loading bar
			$('.news_loader').append($('.bar'));
			$('.news_bar').css({display:'block'});
		
			//send the ajax request
			$.post('includes/news_handler.php',{news:$('#news').val(),},
		
			//return the data
			function(data)
			{
			  //hide the graphic
			  $('.news_bar').css({display:'none'});
			  $('.news_loader').append(data);
			});
			
			//waits 2000, then closes the form and fades out
			//setTimeout('$("#backgroundPopup").fadeOut("slow"); $("#contactForm").slideUp("slow")', 2000);
			
			//stay on the page
			return false;
		} 
  }); 
});
