jQuery(function(){
	
	//デフォルトで携帯アドレス入力欄を非表示
	if ($("#select_sex").val() == 2) {
		$(".mail").hide();
	}
	else {
		$(".mb_mail").hide();
	}
	
	
	//各ボタンhover
	$("img, input:image")
		.hover(
			function () {
				$(this).attr('src',$(this).attr('src').replace("/off/", "/on/"));
			},
			function () {
				$(this).attr('src',$(this).attr('src').replace("/on/", "/off/"));
			}
		)
	;
	
	//indexメールアドレス男女切り替え
	$("#sex")
		.change(
			function () {
				var getSexVal = $(this).val();
				
				$("#select_sex").val(getSexVal);
				
				if (getSexVal == 2) {
					$(".mb_mail").show();
					$(".mail").hide();
				}
				else {
					$(".mb_mail").hide();
					$(".mail").show();
				}
			}
		)
	;
	
	//indexの利用規約
	$(".tosAnchor")
		.click(
			function () {
				obj = window.open( $(this).attr('href'), '_blank');
				obj.focus();
				return false;
			}
		)
	;
	
	//スポンサー一覧を別ウィンドウで開く
	$(".sponsor")
		.click(
			function () {
				obj = window.open( $(this).attr('href'), 'sponsor', 'width=630, height=450, scrollbars=no, resizable=no, toolbar=no');
				obj.focus();
				return false;
			}
		)
	;
	
	// スポンサー一覧をのサブウインドウを閉じるボタン
	$(".sponsorClose")
		.click(
			function () {
				window.close();
			}
		)
	;
	
	
	//スポンサーをクリックしたら別ウィンドウで開く
	$(".sponsorClicked")
		.click(
			function () {
				obj = window.open($(this).attr('href'), '');
				return false;
			}
		)
	;
	
	
	//初心者ガイドを別ウィンドウで開く
	$(".beginner")
		.click(
			function () {
				obj = window.open( $(this).attr('href'), 'beginner', 'width=630, height=800, scrollbars=yes, resizable=yes, toolbar=no');
				obj.focus();
				return false;
			}
		)
	;
	
	// サブウインドウを閉じるボタン
	$(".beginnerClose")
		.click(
			function () {
				window.close();
			}
		)
	;
	
	
	//左カラムのアドレス送信フォーム部分
	$(".mbSend")
		.submit(
			function () {
				//メールアカウント、メールドメインのキー、メディアコード取得
				var MobileACLeft  = $(".mbacLeft").val();
				var MobileDomLeft = $(".mbdomLeft").val();
				var MediacodeLeft = $("input[name=mediacode]").val();
				
				window.open( 'mb_check.php?mail_ac='+MobileACLeft+'&mobile_domain='+MobileDomLeft+'&mediacode='+MediacodeLeft+'&flg=1', '', 'width=400, height=330, scrollbars=no, resizable=no, toolbar=no');
				return false;
			}
		)
	;
	
	
	// サブウインドウを閉じるボタン
	$(".mb_compClose")
		.click(
			function () {
				window.close();
			}
		)
	;
	
});

