function doSubmit() {
	$.ajax({
		type: "POST",
		url: "ask-the-cio.php",
		data: ({
			submit: true,
			name: $('#questionForm #name').val(),
			email: $('#questionForm #email').val(),
			topic: $('#questionForm #topic').val(),
			question: $('#questionForm #question').val()
		}),
		dataType: "json",
		success: function(data) {
			$('#questionForm input, #questionForm textarea').css({
				'border-color' : '#0055A6'
			});
			$('#questionForm label').css({
				'color' : '#333'
			});
			if (data.error == "none") {
				window.location.href = window.location.href + "?success=true";
			}
			else if (data.error == "mail") {
				alert("There was a problem sending your message");
			}
			else {
				$.each(data.highlight, function(key, val) {
					$('input#' + key).css({
						'border-color' : '#c00'
					});
					$('textarea#' + key).css({
						'border-color' : '#c00'
					});
					$('label[for="' + key + '"]').css({
						'color'	:	'#900'
					});
				});
			}
		}
	});	
}



$(function() {
	$('#questionForm').submit(function() {
		doSubmit();
		return false;
	});
});