jQuery(function(){
								
/***index******************************/

	// regist input
	$("#registForm p.registBtn input")
		.hover(
			function () {
				$(this).attr("src", 'img/index/regist_btn_on.png');
			},
			function () {
				$(this).attr("src", 'img/index/regist_btn.png');
			}
		)
	;

	// loginBtn img
	$("#regist p.loginBtn img")
		.hover(
			function () {
				$(this).attr("src", 'img/index/login_btn_on.png');
			},
			function () {
				$(this).attr("src", 'img/index/login_btn.png');
			}
		)
	;

	// subsize img
	$("body.subsize #close p img")
		.hover(
			function () {
				$(this).attr("src", 'img/subsize/close_btn_on.png');
			},
			function () {
				$(this).attr("src", 'img/subsize/close_btn.png');
			}
		)
	;

	// contact input
	$("body.subsize #main p.sendBtn input")
		.hover(
			function () {
				$(this).attr("src", 'img/subsize/send_btn_on.png');
			},
			function () {
				$(this).attr("src", 'img/subsize/send_btn.png');
			}
		)
	;

	
	//--------------------------------------------------------------------------------
	// ホバー関連の処理
	//--------------------------------------------------------------------------------
	
	
	//IE6外の場合
	$(".hover")
		.hover(
			function () {
				//透過対象の画像でない場合
				if ($(this).attr("src").match(/blank.gif/) == null) {
					$(this).attr("src", $(this).attr("src").replace(/\/on|off\/(.*?\.(:?gif|jpg|png))/, '/on/$1'));
				}
			},
			function () {
				//透過対象の画像でない場合
				if ($(this).attr("src").match(/blank.gif/) == null) {
					$(this).attr("src", $(this).attr("src").replace(/\/on|off\/(.*?\.gif|jpg|png)/, '/off/$1'));
				}
			}
		)
	;	
	
	//IE6対応
	
	// regist input
	$("#registForm p.registBtn input")
		.hover(
			function () {
				$(this).attr("src", 'img/index/on/regist_btn.png');
			},
			function () {
				$(this).attr("src", 'img/index/off/regist_btn.png');
			}
		)
	;	

	// loginBtn img
	$("#login p.loginBtn img")
		.hover(
			function () {
				$(this).attr("src", 'img/index/on/login_btn.png');
			},
			function () {
				$(this).attr("src", 'img/index/off/login_btn.png');
			}
		)
	;	
	/*
	// subsize img
	$("body.subsize #close p img")
		.hover(
			function () {
				$(this).attr("src", 'img/subsize/on/close_btn.png');
			},
			function () {
				$(this).attr("src", 'img/subsize/off/close_btn.png');
			}
		)
	;	
	*/
	
	/*
	
	//フッターリンクのポップアップ
	$("#footer ul li a, .subsizePopup")
		.click(
			function() {
				if ($(this).attr('title') == 'HOME') {
					return true;
				}
				//uriを取得
				var uri = $(this).attr("href");
				
				//ウインドウを立ち上げる
				obj = window.open(uri, "subsize", "directories=0,location=0,menubar=0,status=0,toolbar=0,resizeable=0,width=500,height=520");
				obj.focus();
				return false;
				
			}
		)
	;
	*/
	/*
	//サブサイズ閉じるボタン
	$("body.subsize #close p img")
		.css("cursor","pointer")
		.click(
			function () {
				window.close();
			}
		)
	;
	*/
	//--------------------------------------------------------------------------------
	// メールアドレス入力テキストフィールド用処理
	//--------------------------------------------------------------------------------
/*
	//初期値の場合はグレーアウト
	if ($("input:text[name='email']").val() == 'メールアドレスを入力してください') {
		$("input:text[name='email']").css('color', '#999');
	}
*/
	//登録テキストフィールド初期化処理
	$("input:text[name='email']")
		.focus(
			function () {
				$(this).css('color', '');
				if ($(this).val() == 'メールアドレスを入力してください') {
					$(this).val('');
				}
			}
		)
	;
	
	//登録テキストフィールド初期化処理
	$("input:text[name='p_email']")
		.focus(
			function () {
				$(this).css('color', '');
				if ($(this).val() == 'メールアドレスを入力してください') {
					$(this).val('');
				}
			}
		)
	;
	
	//--------------------------------------------------------------------------------
	//チェックボックス画像切り替え
	//--------------------------------------------------------------------------------
	$(".click")
		.click(
			function () {
				if($(this).attr("src").match("/on/") == "/on/") {
					$(this).attr("src", $(this).attr("src").replace("/on/", "/off/"));
				}
				else {
					$(this).attr("src", $(this).attr("src").replace("/off/", "/on/"));
				}
			}
		)
	;
	
	// 外部リンクのアンカーが押された場合新規ウインドウ
	$("* a")
		.click(
			function () {
				//URLを取得
				var uri = $(this).attr("href").match(/^https?:\/\/.*$/);
				//もし外部リンクの場合はポップアップ
				if (uri) {
					obj = window.open(uri, "_blank");
					obj.focus();
					return false;
				}
				else {
					return true;
				}
			}
		)
	;
});


