jQuery(function(){
	if (document.URL.match(/localhost(.*)PC/)) {
		s_root = document.URL.replace(/(.*?\/)design\/.*/, '$1www/html/');
	}
	else if (document.URL.match('/localhost/')) {
		s_root = document.URL.replace(/(.*?\/html\/).*/, '$1');
	}
	else {
		s_root = '/';
	}
	
	
	//IE6.0のみpingfix
	if ($.browser.version == '6.0') {
		$("img[src*='.png'], input[type='image'][src*='.png']")
			.css('behavior', 'url("' + s_root + 'js/iepngfix.htc")')
		;
		
//		$("div , h1 , h2 , h3 , h4 , h5 , p , ul , li , dl , dt , dd , table , th , td")
		$("div , h1, p , ul , li , dl , dt , dd")
			.each(
				function () {
					if ($(this).css('background-image').match('\.png')) {
						$(this)
							.css('behavior', 'url("' + s_root + 'js/iepngfix.htc")')
						;
					}
				}
			)
		;
	}
	//ホバー関連
	$("img[src*='/off/'], input[type='image'][src*='/off/'][class!='check_img'][class!='check_all']")
		.hover(
			function () {
				$(this).attr("src", $(this).attr("src").replace('/off/', '/on/'));
			},
			function () {
				$(this).attr("src", $(this).attr("src").replace('/on/', '/off/'));
			}
		)
	;
	
	// チェックボックスのトグル
	//ホバー関連
	$(".check_img")
	.click(
		function () {
			var c = $(this).attr("src").indexOf('/off/', 0);
			if (c > 0) {
				$(this).attr("src", $(this).attr("src").replace('/off/', '/on/'));
			} else {
				$(this).attr("src", $(this).attr("src").replace('/on/', '/off/'));
			}
			return false;
		}
	)
	;
	// 全チェック
	$(".check_all").toggle(
		function (){
			$(this).parents('ul').children('li').each(function(){
				$(this).children().find("input:image").attr("src",$(this).children().find("input:image").attr("src").replace('/off/', '/on/'));
			});
			return false;
		},
		function (){
			$(this).parents('ul').children('li').each(function(){
				$(this).children().find("input:image").attr("src",$(this).children().find("input:image").attr("src").replace('/on/', '/off/'));
			});
			return false;
		}
	);
	
	//背景画像のホバー
	$(".bg-hover")
		.hover(
			function () {
				$(this).css("background-image", $(this).css("background-image").replace('/off/', '/on/'));
			},
			function () {
				$(this).css("background-image", $(this).css("background-image").replace('/on/', '/off/'));
			}
		)
	;
	
	//スポンサー一覧へのポップアップ
	$("a[href^='sponsor.php']")
		.click(
			function () {
				//幅を指定
				var window_height = "570";
				var window_width = "420";
				//ウインドウ名を設定
				var window_name = "sponsor";
				//uriを取得
				var uri = $(this).attr("href");
				//ウインドウを立ち上げる
				obj = window.open(uri, window_name, "scrollbars=no,directories=no,location=no,menubar=no,status=no,toolbar=no,resizable=no,width=" + window_width + ",height=" + window_height);
				obj.focus();
				return false;
			}
		)
	;
	//登録フォームのやつ
	$("input[value*='メールアドレスを入力してください']")
		.focus(
			function () {
				$(this).val('');
			}
		)
	;


});

