var j$ = jQuery;

// スクロール
j$(function(){
     j$(".scroll").click(function(){
     j$('html,body').animate({ scrollTop: j$(j$(this).attr("href")).offset().top }, 'slow','swing');
     return false;
     })
});

// メニューアコーディオン
j$(function(){
	j$(".maincategory").each(function(){
		j$("a.open", this).each(function(index){
			var $this = j$(this);

		$this.next().hide();
			$this.click(function(){
				var params = {height:"toggle", opacity:"toggle"};
				j$(this).next().animate(params).parent().siblings();
				if($this.hasClass("open"))
					$this.toggleClass("close");
				return false;
			
			});
		});
	});
});

// 曲リスト背景色きりかえ
j$(document).ready(function(){
  // 偶数行にのみクラスを指定
  j$('table#ChargeOfSong tr:even').addClass('even-row');
});
j$(document).ready(function(){
  // 偶数行にのみクラスを指定
  j$('table#pamphList tr:even').addClass('even-row');
});
j$(document).ready(function(){
  // 偶数行にのみクラスを指定
  j$('table#kksList tr:even').addClass('even-row');
});

/**
 * jQuery.rollover
 *
 * @version    1.0.4
 * @author     Hiroshi Hoaki <rewish.org@gmail.com>
 * @copyright  2010-2011 Hiroshi Hoaki
 * @license    http://rewish.org/license/mit The MIT License
 * @link       http://rewish.org/javascript/jquery_rollover_plugin
 */
jQuery.fn.rollover = function(suffix) {
	suffix = suffix || '_on';
	var check = new RegExp(suffix + '\\.\\w+$');
	return this.each(function() {
		var img = jQuery(this);
		var src = img.attr('src');
		if (check.test(src)) return;
		var _on = src.replace(/\.\w+$/, suffix + '$&');
		jQuery('<img>').attr('src', _on);
		img.hover(
			function() { img.attr('src', _on); },
			function() { img.attr('src', src); }
		);
	});
};

jQuery(document).ready(function($) {
	j$('a.rollOver img').rollover();
	j$('form input:image').rollover();
	j$('a.rollOver img,form input:image').rollover('-over');
});

// ドロップメニュー
jQuery.noConflict();
j$(function() {
	j$(".mainMenu").droppy();
});

// colorbox
j$(document).ready(function(){
	j$("a[rel='box']").colorbox();
	j$(".flkks01").colorbox({iframe:true, innerWidth:800, innerHeight:600});
	j$(".flkks02").colorbox({iframe:true, innerWidth:800, innerHeight:600});
	j$(".flkks03").colorbox({iframe:true, innerWidth:800, innerHeight:600});
	j$(".flkks04").colorbox({iframe:true, innerWidth:750, innerHeight:550});
	j$(".flkks05").colorbox({iframe:true, innerWidth:750, innerHeight:550});
	j$(".ytbe").colorbox({iframe:true, width:650, height:550});
});

// movie tabs
j$(document).ready(function(){
	j$('#edMovie .mvList').hide();
	j$('#edMovie .mvList:first').show();
	j$('#edMovie ul.edMovieTab li:first').addClass('active');
	j$('#edMovie ul.edMovieTab li a').click(function(){
		j$('#edMovie ul.edMovieTab li').removeClass('active');
		j$(this).parent().addClass('active'); 
		var currentTab = j$(this).attr('href'); 
		j$('#edMovie .mvList').hide();
		j$(currentTab).show();
		return false;
	});
});
