var validateEdit={
	container:jQuery("#submit_fields_error"),
	validateRules:{
		name:{
			required:true,
			msg:"Name field required"
		},
		email:{
			required:true,
			msg:"Email field required"
		},
		comment:{
			required:true,
			msg:"Please describe your edit to speed up the approval"
		}
	},
	run:function(){
		var errors=[];
		jQuery.each(this.validateRules, function(id, rule) {
		    var element=jQuery("#"+id);
		    if(rule.required && element.val()===""){
		    	errors.push(id);
		    }
		});
		if(errors.length){
			this.container.html("");
			for (var i = 0; i < errors.length; i++) {
				this.container.append("<li>"+this.validateRules[errors[i]].msg+"</li>")
			}
			return false;
		}else{
			return true;
		}
	},init:function(){
		jQuery.each(this.validateRules, function(id, rule) {
		    var element=jQuery("#"+id);
		    element.val("");
		});
	}
}
validateEdit.init();