
try{


$(document).ready(function(){

	/* ログインフォームにフォーカス */
	$("#LOGIN_USERID").focus();


	/*  メッセージボックス */
	$(".messageError,.messageSuccess")
	.hide()
	.fadeIn('slow')
	.click(function(){
		$(this).slideUp('fast');
	});


	/*  一覧テーブルの行の偶数、奇数番目にクラスを振る  */
	$(".list tbody").each(function(){
		$(this).find("tr:nth-child(even)").addClass('even')
		       .find("tr:nth-child(odd)").addClass('odd');
	});


	/*  検索フォームにfocusクラス */
	$(".searchForm input[type=text]")
	.focus(function(){
		$(this).toggleClass('focus');
	})
	.blur(function(){
		$(this).toggleClass('focus');
	});


	/*  会員写真をポップアップウインドウで表示  */
	$("a.photo").click(function(){
		window.open(this.href,'photo','width=350,height=450,resizeable=yes').focus();
		return false;
	});


	/*  フォームのリセット  */
	$(":reset").click(function() {
        $(this.form).find(':input').each(function() {
            switch (this.type) {
            case 'password':
            case 'select-multiple':
            case 'select-one':
            case 'text':
            case 'textarea':
                $(this).val('');
                break;
            case 'checkbox':
            case 'radio':
                this.checked = false;
                break;
            case 'hidden':
                break;
            }
        });
        return false;
    });


	/* リンク画像にマウスをのせたら半透明にする */
/*
	$("a img, input[type=image]").hover(
		function(){$(this).css('opacity', 0.6);},
		function(){$(this).css('opacity', 1);}
	);
*/

	/*  カウントダウン   */
	$("#countDown").each(function(){
		var obj = $(this);
		var count = parseInt(obj.text());
		var timerID = setInterval(
			function()
			{
				count--;
				obj.text(count);
				if (count <= 0)
				{
					clearInterval(timerID);
				}
			},1000);
		return false;
	});


	/* テキストエリアをリサイズできるようにする */
	$("textarea:not(.processed)").TextAreaResizer();


	/* テーブルのソート機能 */
	$("#sortTable").tablesorter();



	/* バリデーション */
	$("#formMemberAdd,#formMemberEdit").validate({
		rules : {
			name: {
				required: true
			},
			furigana: {
				required: true
			},
			birth_nen: {
				required: true
			},
			birth_month: {
				required: true
			},
			birth_day: {
				required: true
			},
			jusho: {
				required: true
			},
			shincho: {
				required: true
			},
			shumi: {
				maxlength: 32
			},
			shinzoku: {
				maxlength: 20
			},
			pr: {
				maxlength: 25
			},
			kibo: {
				maxlength: 40
			}
		},

		errorLabelContainer: ".messageError",
		errorClass: "validateError"
	});
	
	
	/* 会員ステータス変更ボタンの分岐処理 */
	(function(){
		var form = $("#formChangeStatus");
		$("button", form).click(function(e){
			$("input[name=status]", form).attr('value', $(this).attr('value'));
			if (confirm(this.title)){
				return true;
			}
			e.preventDefault();
			e.stopPropagation();
			return false;
		});
	})();


});

}catch(err){}

