var Validate= {
	// Callback function for ajax check of group existence
	groupExistCallBack : function (data,textstatus,xhr) {
		if (data.exists==0) {
			Validate.newGroup=true;
		}
		else {
			Validate.newGroup=false;
		}
	},
	groupExists : function (name) {

		$.ajax({
			type: 'POST',
	        url: '/code/ajaxresponses/groupexists.php',
	        success: Validate.groupExistCallBack,
	        error: Util.defaultCallbackError,
			data:  "group="+ name,
			dataType: "json",
			async: false
		});
		return !Validate.newGroup;
	},
	checkTextField : function (field,len) {
		return (field.value.length<len);
	}
}