//<![CDATA[	
	$(document).ready(function(){
		var regexp = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
		
		$('#sign-up').click(function(){
			var error = false;
			
			if($('#first').val().replace(/\s+/g,"").length == 0){
				$('#firstname-error').html('Please enter first name');
				error = true;
			}
			else{
				$('#firstname-error').html('');
			}
			
			if($('#last').val().replace(/\s+/g,"").length == 0){
				$('#lastname-error').html('Please enter last name');
				error = true;
			}
			else{
				$('#lastname-error').html('');
			}
			
			if($('#phone').val().replace(/\s+/g,"").length == 0){
				$('#phone-error').html('Please enter phone number');
				error = true;
			}
			else{
				$('#phone-error').html('');
			}
			
			if($('#email').val().replace(/\s+/g,"").length == 0){
				$('#email-error').html('Please enter email address');
				error = true;
			}
			else if($('#email').val().search(regexp) == -1){
				$('#email-error').html('Please enter valid email');
				error = true;
			}
			else{
				$('#email-error').html('');
			}
			
			if(error){
				$('#message').html('Please fill out all required fields. Form will not process unless all required fields (<span class="mandatory">*</span>) are complete.');
			}
			else{
				$('#sign-up').attr('disabled', 'true');
				$('#message').html('Processing... please wait. ');
				
				var formData = 'first=' + encodeURIComponent($('#first').val()) + '&last=' + encodeURIComponent($('#last').val()) + '&email=' + encodeURIComponent($('#email').val()) + '&phone=' + encodeURIComponent($('#phone').val()) + '&timestamp=' + encodeURIComponent($('#timestamp').val()) + '&hash=' + encodeURIComponent($('#hash').val()) + '&event=' + encodeURIComponent($('#event').val()) + '&event-hash=' + encodeURIComponent($('#event-hash').val()) + '&meal=' + encodeURIComponent($('#meal').val()) + '&credits=' + encodeURIComponent($('#credits').val()) + '&list=' + encodeURIComponent($('#list').val()) + '&comments=' + encodeURIComponent($('#comments').val()) + '&organization=' + encodeURIComponent($('#organization').val());
				
				$.ajax({
					type: 'POST',
					url: '../../../../sign-up.php',
					cache: false,
					data: formData,
					dataType: "xml",
					timeout: 10000,
					error: function(ob, status){
						$('#sign-up').attr('disabled', '');
						$('#message').html('Error: ' + status + '. Please try again.');
					},
					success: function(xml){
						$('#sign-up').attr('disabled', '');
						var root = xml.getElementsByTagName('root')[0];
						if(root.getElementsByTagName("error")[0].firstChild.nodeValue == 'false'){
							$('#signupForm')[0].reset();
							$('#formContent').html('<span id="confirm">Thank you! Your submission has been successfully sent.</span><br/><br/><br/>');
						}
						else{
							$('#message').html('Error. Please try again.');
						}
					}
				});
			}
		});
	});
//]]>
