$(document).ready(function(){  
// Form Code
	

   	function getLines(id)
    	{
     		
     		var submission = $('#' + id).val();
     		var trimmed = str = jQuery.trim(submission);
      		return submission.split("\n").length;
      		
    	}

	
	$("#submitRegistration").click(function() {

/* 	$("form#registrationForm").submit(function() { */

   	var attendees = $('#attendeeField').val();   	
   	var hmm = attendees.replace(/\n/g,"-");
   	

	var attCount = getLines('attendeeField');


		if (attendees != '') {
		
			
			$.ajax({
				url: '../assets/code/email.php?attendees='+hmm,
				timeout: 3000,
				type: 'GET',
				error: function() {
					// error function here
					alert('There was an Error in sending your registration.');
				},
				success: function() {
					var message = '<p class="notice">You have requested to register ' + attCount + ' attendee(s).  Please continue to step 2 or reload this page to begin again.</p>';
					$('#registrationFormDiv').html(message);
				}
			});
		
		} else {
		
			return false;
		}
		
	return false; // don't follow the form ACTION - return false to prevent http submission
	
			
	});
	
	
	
	
});