
function validate(id, value) {
	$.post('index.php?validate', {i: id, v: value}, function(data) {
		if(data.s == true) {
			$('#error-'+id).html('');
			// adding input-ok class back in will make the field show green and put a check mark in it
			$('#'+id).removeClass('input-error input-ok');//.addClass('input-ok');
			// record the goal, as per James Charlesworth request 11/4/2010
			_gaq.push(['_trackPageview', '/virtual/contact-form-submit']);
		} else {
			$('#error-'+id).html(data.m);
			$('#'+id).removeClass('input-error input-ok').addClass('input-error');
		}
	});
}

$(document).ready(function() {
	$(".validate-item").each(function(i, el) {
		$(el).blur(function() {
			validate(el.id, $(el).val());
		});
	});
});

