	$(document).ready(function(){

	
	  $('#submit').click(function() {
	      var customerName = $('#customerName').val();
		  var customerEmail = $('#customerEmail').val();
		
		  $("#customerNameField").css("color","#3A3B19");
	      $("#customerEmailField").css("color","#3A3B19");
		  var hasError = false;
		  var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
		  
        	 
		if(customerEmail == '') {
			$("#customerEmailField").css("color","red");
			hasError = true;
		} 
	
	    if(!emailReg.test(customerEmail)) {
			$("#customerEmailField").css("color","red");
			hasError = true;
		}
		
		if(customerName == '') {
			$("#customerNameField").css("color","red");
			hasError = true;
		}

		 		  
		  if(hasError == false) {
		  $('#submit').empty();
		  
		  $('#submit').append('<img src="images/ajax-loader.gif" id="loading" />');
		  
		  $.ajax({
		     url: 'submitEmail.php',
			 type: 'POST',
			 data: 'customerName=' + customerName + '&customerEmail=' + customerEmail,
			    success: function(results) {
			    
				  $('#formcontent').slideUp(2000);
				  $('#aftersubmit').slideDown(2000);
						
		        }
		});
		}
		return false;  
	    
	  });
	  
	});