var admin = {
	contextPath : null,
	button : null,
	
	init : function(context,button) {
		var self = this;
		self.contextPath = context;
		self.button = button;
	},

	checkRegUser : function(obj) {
		var self = this;
		if(!/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/.test($('#'+obj).val())){		
			$("#emailformaterror").show();
			return ;
		}
		$.ajax({
			type : "POST",
			data : "user.email="+$('#'+obj).val(),
			url : self.contextPath + "/user!checkRegUser.do",
			success : function (resMsg) {
				if (resMsg == "success") {					
					$("#errorInfo").hide();
					$("#emailformaterror").hide();
					$("#successInfo").show();
					$('#'+self.button).attr("disabled",false);
				} else {					
					$("#successInfo").hide();
					$("#errorInfo").show();
					$("#emailformaterror").hide();													
					$('#'+self.button).attr("disabled",true);
				}
			}			
		});
	}
}
