$(function()
{
	
	
	
	
	
	
	// go through each form assigning a handler to save buttons
	// making sure that all labels 

	var errorAlert = '<div id="errorAlert">\
						<strong>Error</strong><br/>\
						Please fill in all required fields (marked with an asterisk) before submitting the form.\
						</div>';

	$('form input:submit').click(function()
	{
		var ret = true;
		var f = $(this).parent();
		$('label[class="required"]').each(function()
		{
			var lf = $(this).attr('for');
			var e = $('*[name="' + lf + '"]', f);
			var v = e.val();
			if ( v == '' )
			{
				e.addClass('errorInput').effect("pulsate", { times: 3 }, 150);
				$('#errorAlert').remove();
				$('p.adminDescription').after(errorAlert);
				$('#errorAlert').show();
				ret = false;
			}
			else
			{
				$('#errorAlert').hide();
				e.removeClass('errorInput');
			}
		});
		return ret;
	});
	
	
	// disallow unnecessary characters
	$('#contactName').alpha({allow: " "});
	$('#contactNumber').numeric({allow: " +"});
	$('#contactEmail').alphanumeric({allow: "_.@-"});

	// $('password').alphanumeric();
	
	// line check input
	$('#lineCheckInput').numeric({allow: " +"});
	
});
