// JavaScript Document

/*@cc_on _d=document;eval('var document=_d')@*/

////////////////////////////////////////////////////////
//タブの初期状態を設定
////////////////////////////////////////////////////////
$(function(){

	// 最初に有効にするタブのID
	var activeTabId = "tab_eventinfo";

	// タブ化する
	$("#infoArea ul#tab li img")
		.each(function(){
			var i = this.src.lastIndexOf(".");
			this.defaultSrc = this.src;
			this.overSrc = this.src.substring(0, i) + "_over" + this.src.substring(i);
			this.defaultImg = function() { this.src = this.defaultSrc };
			this.overImg = function() { this.src = this.overSrc };

			if (this.id == activeTabId) {
				this.src = this.overSrc;
			} else {
				$("#" + this.id + "Area").hide();
			}
		})
		.click(function (){
			var clickedTabId = $(this).attr("id");
			if (clickedTabId == activeTabId) {
				return;
			}

			$("#" + activeTabId).each(function(){ this.defaultImg() });
			$("#" + activeTabId	+ "Area").hide();
			$("#" + clickedTabId).each(function(){ this.overImg() });
			$("#" + clickedTabId + "Area").fadeIn();
			
			activeTabId = clickedTabId;
		})
		.hover(
			function() {
				if (activeTabId != $(this).attr("id")) this.overImg();
			},
			function() {
				if (activeTabId != $(this).attr("id")) this.defaultImg();
			}
		)
		.css("cursor","pointer");
});


