/*Initialize*/
$(document).ready(function(){					
	$(" #nav ul ").css({display: "none"}); // Opera Fix
	$(" #nav li").hover(function(){
		$(this).find('ul:first').css({visibility: "visible",display: "none"}).show(400);
	},function(){
		$(this).find('ul:first').css({visibility: "hidden"});
	});
/*Ajax*/
	$("#nav a").live("click", function(event){
		event.preventDefault();
	});
	$(".privacy").live("click", function(event){
		$.ajax({
			url:"./privacy.html",
			cache:false,
			error: function(msg){
				$("#comp").html("エラーが発生しました");
			},
			success: function(msg){
				$("#comp").html(msg);
			}
		});
		event.preventDefault();
	});
	$(".top").live("click", function(event){
		$.ajax({
			url:"./top.html",
			cache:false,
			error: function(msg){
				$("#comp").html("エラーが発生しました");
			},
			success: function(msg){
				$("#comp").html(msg);
			}
		});
		event.preventDefault();
	});
	$(".news").live("click", function(event){
		$.ajax({
			url:"./news.html",
			cache:false,
			error: function(msg){
				$("#comp").html("エラーが発生しました");
			},
			success: function(msg){
				$("#comp").html(msg);
			}
		});
		event.preventDefault();
	});
	$(".link_memberkiyaku").live("click", function(event){
		$.ajax({
			url:"./kiyaku.html",
			cache:false,
			error: function(msg){
				$("#comp").html("エラーが発生しました");
			},
			success: function(msg){
				$("#comp").html(msg);
			}
		});
		event.preventDefault();
	});
	$(".link_memberapply").live("click", function(event){
		$.ajax({
			url:"./memberapply_form.html",
			cache:false,
			error: function(msg){
				$("#comp").html("エラーが発生しました");
			},
			success: function(msg){
				$("#comp").html(msg);
				$.ajax({
					url:"./kiyaku.html",
					cache:false,
					error: function(msg){
						$(".kiyaku").html("エラーが発生しました");
					},
					success: function(msg){
						$(".kiyaku").html(msg);
					}
				});
				$("#memberapply").validate(memberapply_option);
			}
		});
		event.preventDefault();
	});
	$(".manifesto").live("click", function(event){
		$.ajax({
			url:"./manifesto.html",
			cache:false,
			error: function(msg){
				$("#comp").html("エラーが発生しました");
			},
			success: function(msg){
				$("#comp").html(msg);
			}
		});
		event.preventDefault();
	});
	$(".goaisatsu").live("click", function(event){
		$.ajax({
			url:"./goaisatsu.html",
			cache:false,
			error: function(msg){
				$("#comp").html("エラーが発生しました");
			},
			success: function(msg){
				$("#comp").html(msg);
			}
		});
		event.preventDefault();
	});
	$(".artist").live("click", function(event){
		$.ajax({
			url:"./artist.html",
			cache:false,
			error: function(msg){
				$("#comp").html("エラーが発生しました");
			},
			success: function(msg){
				$("#comp").html(msg);
			}
		});
		event.preventDefault();
	});
	$(".interview").live("click", function(event){
		$.ajax({
			url:"./interview.html",
			cache:false,
			error: function(msg){
				$("#comp").html("エラーが発生しました");
			},
			success: function(msg){
				$("#comp").html(msg);
			}
		});
		event.preventDefault();
	});
	$(".stageschedule").live("click", function(event){
		$.ajax({
			url:"./stageschedule.html",
			cache:false,
			error: function(msg){
				$("#comp").html("エラーが発生しました");
			},
			success: function(msg){
				$("#comp").html(msg);
			}
		});
		event.preventDefault();
	});
	$(".place").live("click", function(event){
		$.ajax({
			url:"./place.html",
			cache:false,
			error: function(msg){
				$("#comp").html("エラーが発生しました");
			},
			success: function(msg){
				$("#comp").html(msg);
			}
		});
		event.preventDefault();
	});
	$(".map").live("click", function(event){
		$.ajax({
			url:"./map.html",
			cache:false,
			error: function(msg){
				$("#comp").html("エラーが発生しました");
			},
			success: function(msg){
				$("#comp").html(msg);
			}
		});
		event.preventDefault();
	});
	$(".access").live("click", function(event){
		$.ajax({
			url:"./access.html",
			cache:false,
			error: function(msg){
				$("#comp").html("エラーが発生しました");
			},
			success: function(msg){
				$("#comp").html(msg);
			}
		});
		event.preventDefault();
	});
	$(".beppu").live("click", function(event){
		$.ajax({
			url:"./beppu.html",
			cache:false,
			error: function(msg){
				$("#comp").html("エラーが発生しました");
			},
			success: function(msg){
				$("#comp").html(msg);
			}
		});
		event.preventDefault();
	});
	$(".event").live("click", function(event){
		$.ajax({
			url:"./event.html",
			cache:false,
			error: function(msg){
				$("#comp").html("エラーが発生しました");
			},
			success: function(msg){
				$("#comp").html(msg);
			}
		});
		event.preventDefault();
	});
	$(".ticket").live("click", function(event){
		$.ajax({
			url:"./ticket.html",
			cache:false,
			error: function(msg){
				$("#comp").html("エラーが発生しました");
			},
			success: function(msg){
				$("#comp").html(msg);
			}
		});
		event.preventDefault();
	});
	$(".sponcer").live("click", function(event){
		$.ajax({
			url:"./sponcer.html",
			cache:false,
			error: function(msg){
				$("#comp").html("エラーが発生しました");
			},
			success: function(msg){
				$("#comp").html(msg);
			}
		});
		event.preventDefault();
	});
	$(".supplier").live("click", function(event){
		$.ajax({
			url:"./supplier.html",
			cache:false,
			error: function(msg){
				$("#comp").html("エラーが発生しました");
			},
			success: function(msg){
				$("#comp").html(msg);
			}
		});
		event.preventDefault();
	});
	$(".partner").live("click", function(event){
		$.ajax({
			url:"./partner.html",
			cache:false,
			error: function(msg){
				$("#comp").html("エラーが発生しました");
			},
			success: function(msg){
				$("#comp").html(msg);
			}
		});
		event.preventDefault();
	});
	$(".supporter").live("click", function(event){
		$.ajax({
			url:"./supporter.html",
			cache:false,
			error: function(msg){
				$("#comp").html("エラーが発生しました");
			},
			success: function(msg){
				$("#comp").html(msg);
			}
		});
		event.preventDefault();
	});
	$("#memberapply_confirm_post").live("click", function(event){
		var querydata = $("#memberapply_confirm_post").serialize();
		$.ajax({
			url:"./system/memberapply_post.php",
			cache:false,
			type:"POST",
			data: querydata,
			error: function(msg){
				$("#memberapply_inner").fadeOut("slow",function(){
					$("#memberapply_inner").html("エラーが発生しました");
					$("#memberapply_inner").fadeIn("slow");
				});
				return false;
			},
			success: function(msg){
				$("#memberapply_inner").fadeOut("slow",function(){
					$("#memberapply_inner").html(msg);
					$("#memberapply_inner").fadeIn("slow");
				});
				return false;
			}
		});
		event.preventDefault();
	});
/*Ajax*/
	$.ajax({
		url:"./top.html",
		cache:false,
		error: function(msg){
			$("#comp").html("エラーが発生しました");
		},
		success: function(msg){
			$("#comp").html(msg);
		}
	});
	
	
});
/*Initialize*/

/*validate option & submit*/
var memberapply_option =	{
	rules:{
		memberapply_name:{
			required: true,
			minlength: 2
		},
		memberapply_furigana:{
			required: true,
			minlength: 2
		},
		memberapply_year: {
			required: true,
			minlength: 1
		},
		memberapply_month: {
			required: true,
			minlength: 1
		},
		memberapply_day: {
			required: true,
			minlength: 2
		},
		memberapply_homezip: {
			required: true,
			minlength: 7
		},
		memberapply_homeaddress: {
			required: true
		},
		memberapply_homephone: {
			required: true,
			minlength: 7
		},
		memberapply_homeemail: {
			required: true,
			email: true
		},
		memberapply_workzip: {
			required: true,
			minlength: 7
		},
		memberapply_workaddress: {
			required: true
		},
		memberapply_workphone: {
			required: true,
			minlength: 7
		},
		memberapply_workemail: {
			required: true,
			email: true
		}
	},
	messages: {
		memberapply_name: "：<span class='error'>*名前を入力してください</span>",
		memberapply_furigana: "：<span class='error'>*フリガナを入力してください</span>",
		memberapply_year: "：<span class='error'>*年を入力してください</span>",
		memberapply_month: "：<span class='error'>*月を入力してください</span>",
		memberapply_day: "：<span class='error'>*日を入力してください</span>",
		memberapply_homezip: "：<span class='error'>*郵便番号を入力してください</span>",
		memberapply_workzip: "：<span class='error'>*郵便番号を入力してください</span>",
		memberapply_homeaddress: "：<span class='error'>*住所を入力してください</span>",
		memberapply_workaddress: "：<span class='error'>*住所を入力してください</span>",
		memberapply_homephone: "：<span class='error'>*電話番号を入力してください</span>",
		memberapply_workphone: "：<span class='error'>*電話番号を入力してください</span>",
		memberapply_homeemail: "：<span class='error'>*メールアドレスを入力してください</span>",
		memberapply_workemail: "：<span class='error'>*メールアドレスを入力してください</span>"
	},
	submitHandler: function(form){
		var querydata = $("#memberapply").serialize();
		$.ajax({
			url:"./system/memberapply_confirm.php",
			cache:false,
			type:"POST",
			data: querydata,
			error: function(msg){
				$("#memberapply_inner").fadeOut("slow",function(){
					$("#memberapply_inner").html("エラーが発生しました");
					$("#memberapply_inner").fadeIn("slow");
				});
				return false;
			},
			success: function(msg){
			$("#memberapply_inner").fadeOut("slow",function(){
					$("#memberapply_inner").html(msg);
					$("#memberapply_inner").fadeIn("slow");
				});
				return false;
			}
		});
		return false;
	}
};