jQuery.noConflict();

(function($){//BEGIN jQuery
	$(function(){//BEGIN jQuery.ready()
		/*** ロールオーバー ＆ 対象画像切替 ***
		 ■設定
		 .chimg({
		 exclude: "active",
		 prefix: "",
		 postfix: "_o",
		 targetAttr: "target",
		 prefixAttr: "prefix",
		 postfixAttr: "postfix",
		 rolloverAttr: "rollover",
		 autoActive: false,
		 acceptNotLink: false
		 });
		 */
		//$(".imgover").chimg();
		$(".hdrNav").pageInit({
			".link": "#hdrNav_01",
			".sitemap": "#hdrNav_02"
		}, function(){
			$(this).addClass("active");
		}).chimg({
			autoActive: true
		});
		$(".gNav").pageInit({
			".about": "#gNav_02",
			".news": "#gNav_03",
			".report": "#gNav_04",
			".blog": "#gNav_05",
			".blog-index": "#gNav_05",
			".contact": "#gNav_06"
		}, function(){
			$(this).addClass("active");
		}).chimg({
			autoActive: true
		});
		$(".teamNav").pageInit({
			".team-top": "#teamNav01_01",
			".team-satellite": "#teamNav01_02",
			".team-junior": "#teamNav01_03",
			".team-grade4": "#teamNav02_01",
			".team-grade3": "#teamNav02_02",
			".team-grade2": "#teamNav03_01",
			".team-grade1": "#teamNav03_02",
			".team-child": "#teamNav04_01"
		}, function(){
			$(this).addClass("active");
		}).chimg({
			autoActive: true
		});
		
		
		/*** テーブル(やリスト等)交互色 ***
		 ■引数
		 .alternate({
		 evenClass: "even",
		 oddClass: "odd",
		 onlyTbody: true,
		 childOnly: false,
		 rowTag: false
		 });
		 */
		//$(".coloredRow").alternate();
		$(".tblStyle01").alternate({
			childOnly: true
		});
		
		
		/*** アルバム関連 ***/
		$("#about-album-index, #about-album-list").find("#slideShowImgs .lightbox").each(function(){
			$(this).find("a").myLightBox();
		});
		$("#about-album-index").find(".slideshow img").css("cursor", "pointer").click(function(){
			var $this = $(this);
			var $target = $("#" + $this.attr("targetId") + " a:first");
			$target.triggerHandler("click");
		});
		$("#about-album-list").find("#slideShowImgs li img").each(function(){
			var $this = $(this);
			var width = $this.width(), height = $this.height();
			
			if (width > 200 || height > 200) {
				var rate = width > height ? width / 200 : height / 200;
				width = width / rate;
				height = height / rate;
				$this.width(width).height(height).css("padding", (200 - height) / 2 + "px 0")
			}
		});
		
		
		/*** OB詳細 ***/
		/*** クローズアップOB ***/
		/*** 選手紹介 ***/
		/*** ブログ ***/
		$("#about-ob-detail, #about-closeup-index, .team-player-detail, .blog").find(".imgBox").each(function(){
			$(this).find("a").myLightBox();
		});
		
		
		/*** グラウンド案内図 ***/
		$("#about-ground").find("#gMapControlLinks").each(function(){
			$parent = $(this);
			
			$parent.find("a").click(function(){
				var tFrame = frames["gMapFrame"];
				var target = tFrame.jQuery.gMap.obj["ground"];
				var map = target.map, center = target.data.center;
				markers = target.data.markers;
				
				var g = tFrame.jQuery.gMap.methods;
				
				var $this = $(this);
				var txt = $this.text();
				
				//panTo
				var target = markers[txt];
				tFrame.setTimeout(function(){
					map.panTo(new g.LatLng(target.lat, target.lng));
					target.marker.openInfoWindow(target.contents);
				}, 0);
				
				
				//toggle class
				var actClass = "active";
				$parent.find("." + actClass).removeClass(actClass);
				$this.addClass(actClass);
				
				return false;
			});
		});
		
		
		/*** サイドバー ***/
		var sNavList = function(n){
			return "ul:eq(0)>li:eq(" + n + ")";
		};
		$(".sNavBox").pageInit({
			"#about-index": sNavList(0),
			"#about-vision-index": sNavList(1),
			".about-policy": sNavList(2),
			".about-album": sNavList(3),
			".about-ob": sNavList(4),
			".about-closeup": sNavList(5),
			"#about-ground": sNavList(6),
			
			".contact-join": sNavList(0),
			".contact-match": sNavList(1),
			".contact-inquiry": sNavList(2),
			
			".team-schedule": sNavList(0),
			".team-result": sNavList(1),
			".team-player": sNavList(2)
		}, function(){
			$(this).addClass("active").find("> a").css("color", "#ff0000");
		});
		
		
	});//END jQuery.ready()
	/* myLightBox */
	$.fn.myLightBox = function(config){
	
		config = $.extend({
			imageLoading: "/js/lightbox/images/lightbox-ico-loading.gif",
			imageBtnClose: "/js/lightbox/images/lightbox-btn-close.gif",
			imageBtnPrev: "/js/lightbox/images/lightbox-btn-prev.gif",
			imageBtnNext: "/js/lightbox/images/lightbox-btn-next.gif",
			imageBlank: "/js/lightbox/images/lightbox-blank.gif"
		}, config);
		
		var $tObj = this;
		
		return $tObj.each(function(){
			var $this = $(this);
			$img = $this.is("img") ? $this : $this.find("img");
			$this.attr("title", $img.attr("alt"));
		}).lightBox(config);
	};
	
	
})(jQuery);//END jQuery




