$(function() {
	$("input:text, textarea").each(function() {
		validated = document.getElementById("validate_" + this.id);
		label = $(this).parent().prev().find("label").text();
		check_count = 0;
		$(this).bind("blur", function() {			
			if ($(this).hasClass("require")) {
				if (this.value.length == 0) {
					$(validated).text(label + "を入力してください");
				}
				else {
					$(validated).text("OK");
				}
			}
			if ($(this).hasClass("email")) {
				if (/^[0-9a-zA-Z._-]+@[0-9a-zA-Z._-]+$/.test(this.value) == false) {
					$(validated).text(label + "が不正です");
				} else {
					$(validated).text("OK");
				}
			}
		})
	});
	
//	$("input:submit").each(function() {
//		$(this).attr("disabled", "true");
//	});

	$("form").submit(function() {
		
	})
});
