function showErrors(target, errors) {
    var errorList = $("<ul>");
    for (field in errors) {
        errorList.append("<li>" + errors[field] + "</li>")
    }
    $(target).html("").append(errorList).show(500);
}

function cleanup(target) {
    $(target+' .errors').html("");
    $(target+' .errors').hide();
    clearForm(target+' form');
}

function clearForm(target) {
	$(':input', target)
    .not(':button, :submit, :reset, :hidden')
    .val('')
    .removeAttr('checked')
    .removeAttr('selected');
}
