var tgPhotoFlg = 0;$(function(){		//-------------------------------------------------	//playerPhotoのXML読み込み	$.get("/common/dat/player_photo.xml",{},onPlayerPhotoLoadComplete);		//-------------------------------------------------	//当日券情報のXML読み込み	//$.get("/common/dat/today_ticket.xml",{},onTodayTicketLoadComplete);		//-------------------------------------------------	// MEDIA VISION	$("#mv").tabs("> #mv div.mv-panel", {		tabs: 'h3',		effect: 'slide',		initialIndex: mv_index	});		$("#mv").each(function(){		$("#mv h3").hover(			function () { $(this).addClass("hover"); },			function () { $(this).removeClass("hover"); }		);	});			//-------------------------------------------------	// FEATURE	$("#feature #flowpanes").scrollable({		circular: true,		mousewheel: false,		speed: 400	}).navigator({		navi: "#flowtabs",		naviItem: 'a',		activeClass: 'current',		history: false,		event: "mouseover"	}).autoscroll({		autoplay: true,		interval: 6500	});	$("#feature #flowtabs li:eq(0) a").addClass("current");});/** * headlineの初期化 */function loadHeadline() {		//-------------------------------------------------	// HEADLINE	$.get("/common/dat/todays_schedule.xml",function(d){				var $data = $(d);				var $ichigun = $("ichigun", $data);		var $farm = $("farm", $data);				var txt = $("todays_schedule", $data).attr("day") + " ";		txt += "【一軍】 " + $ichigun.text() + " " + id2Tag( $ichigun.attr("weather") ) + "　　";		txt += "【ファーム】 " + $farm.text() + " " + id2Tag( $farm.attr("weather") );		$("#headline .scrollable .items").prepend("<div>"+txt+"</div>");				//initHeadline();						$.get("./headline.txt",function(d) {						var msgs = d.split("\n");			var txt = "";			for ( var i = 0 ; i < msgs.length ; i++ ) {				txt += "<div>" + msgs[i] + "</div>";			}			$("#headline .scrollable .items").append(txt);									if (tgPhotoFlg == "1") {							//選手コメント				$.get("/game/score/flash/pmail.txt", function(d){										if ( d != "") {						var commentArray = d.split("\n");						var c = "<div><a href='http://score.hanshintigers.jp/game/score/comment/'>【 " + commentArray[0] + "】 " + commentArray[1].substr(0, 60) + "</a></div>"												$("#headline .scrollable .items").prepend(c);					}										initHeadline();									});			}			else {				initHeadline();			}					});						//tvの初期化		$("#tv").initTv();		});}/** * headlineの初期化 */function initHeadline() {		$("#headline .scrollable").scrollable({		circular: true,		speed: 600,		keyboard: false,		mousewheel: false	}).autoscroll({		autoplay: true,		interval: 5500,		autopause: false	})		var api = $(".scrollable").data("scrollable");}/** * PlayerPhotoのXMLデータ読み込み完了 * @param {Object} d */ function onPlayerPhotoLoadComplete(d){		data = $(d);	$(d).find("item").each( function(){		img = $(this).attr("src");		url = $(this).attr("href");		title = $("title",this).text();		comment = $("comment",this).text();		url = img.split("/").pop().split("_")[0];		url = "/data/player/2012/" + url + ".html";				//$("#tv-img").prepend( getPlayerPhotoElement(url,img,title,comment) );		$("#tv-img>div:eq(2)").after( getPlayerPhotoElement(url,img,title,comment) );			});	//タイガースフォトのデータ読み込み	$.get("/entertainment/photo/2011/top.cgi",{},onTigersPhotoLoadComplete);	}/** * PlayerPhotoのタグ作成 * @param {Object} url * @param {Object} img * @param {Object} title * @param {Object} comment */function getPlayerPhotoElement( url, img, title, comment ) {		var e = '<div class="wrap"><a href="' + url + '">';	e += '<div class="bnr"><img src="' + img + '" alt="' + title + '" width="652" height="350" /></div>';	e += '<div class="cap"><table><tr><th><img src="/img/top/tv/st_pp.png" alt="PICK UP PLAYER" width="177" height="32" /></th><td><strong>' + title + '</strong><br />' + comment + '</td></tr></table></div>';	e += '</a></div>';	return e;	}/** * タイガースフォトのデータ読み込み完了 * @param {Object} d */function onTigersPhotoLoadComplete(d) {	/* [2011.10.31] TVからタイガースフォト削除	photoData = $("tigersPhotoData:first-child",d);	title = photoData.attr("gameData");	tgPhotoFlg = photoData.attr("topFlg");	photo = $("photoObj:last-child",d);	img = photo.attr("path") + photo.attr("top_l");	comment = photo.text();	url = "http://hanshintigers.jp/entertainment/photo/2011/?" + $("photoObj",d).length;	node = '<div id="tv-tigersphoto" class="wrap"><a href="' + url + '">';	node += '<div class="bnr"><img src="' + img + '" alt="' + title + '" /></div>';	node += '<div class="cap"><table><tr><th><img src="/img/top/tv/st_kp.png" alt="KOSHIEN PHOTO" width="177" height="32" /></th><td><strong>' + title + '</strong><br />' + comment + '</td></tr></table></div>';	node += '</a></div>';	*/		/*$("#tv-img>div:eq(0)").after( node );*/		/* [2011.10.31] TVからタイガースフォト削除	if ( tgPhotoFlg == "1" )	$("#tv-img").prepend(node);	else						$("#tv-img").append(node);	*/		//headlineの初期化	loadHeadline();		//メディアビジョンの写真の部分の初期化	initMediaPhoto( d );	}/** * メディアビジョンの写真の部分の初期化 */function initMediaPhoto( d ) {		var e = '<ul>';	$("photoObj", d ).each( function(){				var $node = $(this);		var img = $node.attr("path") + $node.attr("back_s");		var url = "http://hanshintigers.jp/entertainment/photo/2011/?" + $node.attr("id");		e += '<li><a href="' + url + '"><img src="' + img + '" width="69" height="46" alt="' + $node.text() + '" /></a></li>';			});		e += '<li><a href="/entertainment/photo/2011/"><img src="img/top/mv/photo/bt_other_photo.gif" width="69" height="46" alt="他の写真を見る" class="over" /></a></li>';	e += '</ul>';	$("#mv_koshien_thumbs").append( e );		var index = ( tgPhotoFlg == 0 ) ? 1 : 0;		//フォトの初期化	$("#photo-tabs").tabs("#mv_photo_area > div", {		effect: 'fade',		fadeOutSpeed: 500,		fadeInSpeed: 500,		rotate: true,		interval: 10000,		initialIndex: index,		onClick: function(obj,i) {			if ( i == 0 ) {				$("#photo-tabs td.koshien img").attr("src","img/top/mv/photo/bt_koshien_o.gif")				$("#photo-tabs td.other img").attr("src","img/top/mv/photo/bt_other.gif")			}			else {				$("#photo-tabs td.koshien img").attr("src","img/top/mv/photo/bt_koshien.gif")				$("#photo-tabs td.other img").attr("src","img/top/mv/photo/bt_other_o.gif")			}		}	})	}/** * tvの初期化 */(function() {		var tvID;		jQuery.fn.initTv = function(){		//イメージの数だけボタン追加する		createButton();		$("#tv-buttons").tabs("#tv-img > div.wrap", {			effect: 'fade',			fadeOutSpeed: 500,			fadeInSpeed: 500,			rotate: true,			onClick: function( e, index ){				var $table = $("table", this.getCurrentPane() );								clearInterval( tvID );								tvID = setInterval( function(){					hide( $table.parent(), 400);				}, 3000 );								show( $table.parent(), 200);			}		}).slideshow({			autoplay: true,			interval: 7000		});				$("#tv-img > div.wrap").hover(			function(){				clearInterval( tvID );				show( $(".cap",$(this)), 200);			},			function() {				hide( $(".cap",$(this)), 400 );			}		);	};			/**	 * 出す	 * @param {Object} $e	 * @param {Object} time	 */	function show( $e, time ) {		$e.stop();		$e.css("display","block");		$e.animate(			{				bottom: "0px"			},			time,			"linear"		);	}		/**	 * 隠す	 * @param {Object} $e	 * @param {Object} time	 */	function hide( $e, time ) {		$e.stop();		$e.animate(			{				bottom: "-94px"			},			time,			"linear",			function(){				$(this).css("display","none");			}		);	}		/**	 * ボタン作る	 */	function createButton() {				var w = 0;			$("#tv-nav").append('<ul id="tv-buttons"></ul>');			$("#tv-img div.wrap").each( function(){			$("#tv-buttons").append('<li><a href="javascript:void(0);"></a></li>');			w += 24;		});			w += 2;			//$("#tv-buttons div").css("width", w );	}	})(jQuery);/** * 当日券情報のXML読み込み完了したとき * @param {Object} d */function onTodayTicketLoadComplete( d ) {		data = $(d);	var ticketURL = "/ticket/koshien/today.html";	$("#ticket-game-info").append('<a href="' + ticketURL + '"></a>')		//当日券発表フラグ	//var flg = $("today_ticket",data).attr("flg");	//window.alert( flg );		//更新時間	var updateTime = $("today_ticket",data).attr("updateTime");	//window.alert( updateTime );	$("#ticket-info .ticket-info-area .status th").append("（" + updateTime + " 更新）");		//flg = 1		//当日券情報があるとき	if ( flg == "1" ) {		//試合情報		var info = $("tikectInfo", data);		var gameInfo = info.attr("date") +" "+ info.attr("enemy") +" "+ info.attr("startTime") +" "+ info.attr("stadium");		$("#ticket-game-info a").text(gameInfo);		//チケット情報		$(data).find("sheet").each(function(i){			var sheetName = $(this).attr("name");			var mark = $(this).text();			var val = "";			if (mark == "●") {				val += '<span class="ma">●</span> '			}			else if (mark == "▲") {				val += '<span class="sa">▲</span> '			}			else if (mark == "×") {				val += '<span class="ba">×</span> '			}			val += sheetName;			$("#ticket-sheet td:eq(" + i + ")").html(val);		});	}	//当日券情報が無いとき	else {		//ありません表示		$("#ticket-game-info a").text("現在、当日券情報は発表されていません");	}	initTicket( flg );	}/** * チケット情報の初期化 * @param {Object} flg */function initTicket( flg ) {	if ( flg == "1" )	index = 1;	else				index = 0;	//チケット情報の初期化	$("#ticket-tabs").tabs("#ticket-info > div", {		effect: 'fade',		fadeOutSpeed: 500,		fadeInSpeed: 500,		rotate: true,		interval: 10000,		initialIndex: index,		onClick: function(obj,i) {			if ( i == 0 ) {				$("#ticket-tabs td.pre img").attr("src","img/top/mv/ticket/bt_pre_o.gif")				$("#ticket-tabs td.today img").attr("src","img/top/mv/ticket/bt_today.gif")			}			else {				$("#ticket-tabs td.pre img").attr("src","img/top/mv/ticket/bt_pre.gif")				$("#ticket-tabs td.today img").attr("src","img/top/mv/ticket/bt_today_o.gif")			}		}	})}/** * 天気のIDのをimageタグに変換 * @param {Object} id */function id2Tag(id) {		return '<img src="img/top/weather/mark' + id + '.gif" alt="" />';	}
