jQuery(function(){
	
	//--------------------------------------------------------------------------------
	// ボタンホバー関連
	//--------------------------------------------------------------------------------
	
	$(".hover")
		.hover(
			function () {
				$(this).attr("src", $(this).attr("src").replace('/off/', '/on/'));
			},
			function () {
				$(this).attr("src", $(this).attr("src").replace('/on/', '/off/'));
			}
		)
	;
	
	//--------------------------------------------------------------------------------
	// ウィンドウ関連
	//--------------------------------------------------------------------------------
	
	//フッターリンクのポップアップ
	$("#footer ul li a, #contents form a")
		.click(
			function() {
				if ($(this).attr('title') == 'TOP') {
					return true;
				}
				//uriを取得
				var uri = $(this).attr("href");
				
				//ウインドウを立ち上げる
				var obj = null;
				obj = window.open(uri, "subsize", "directories=0,location=0,menubar=0,status=0,toolbar=0,resizeable=0,width=580,height=640");
				obj.focus();
				delete obj;
				return false;
			}
		)
	;
	
	// 外部リンクのアンカーが押された場合は新規ウインドウで表示する
	$("* a")
		.click(
			function () {
				if ($(this).attr('title') == 'TOP') {
					return true;
				}
				//URLを取得
				var uri = $(this).attr("href").match(/^https?:\/\/.*$/);
				//もし外部リンクの場合はポップアップ
				if (uri) {
					obj = window.open(uri, "_blank");
					obj.focus();
					return false;
				}
				else {
					return true;
				}
			}
		)
	;
	
	//サブサイズ閉じるボタン
	$(".subsize #footer p img")
		.css("cursor","pointer")
		.click(
			function () {
				window.close();
			}
		)
	;
	
	
	//--------------------------------------------------------------------------------
	// メールアドレス入力テキストフィールド用処理
	//--------------------------------------------------------------------------------
	
	//登録テキストフィールド初期化処理
	$("input:text[name='u[email]']")
		.focus(
			function () {
				if ($(this).val() == 'メールアドレスを入力してください') {
					$(this).val('');
				}
			}
		)
		.blur(
			function() {   
				if ($(this).val()=='') {
					$(this).val('メールアドレスを入力してください')
				}   
			}
		)
	;

/*	//お問い合わせテキストフィールド初期化処理
	$("input:text[name='c[email]']")
		.focus(
			function () {
				if ($(this).val() == 'メールアドレスを入力して下さい') {
					$(this).val('');
				}
			}
		)
		.blur(
			function() {   
				if ($(this).val()=='') {
					$(this).val('メールアドレスを入力して下さい')
				}   
			}
		)
	;*/
});