// ロールオーバー
$(function () {
    $.rollover = {
        init: function () {
            $('a img,input[type="image"]').not('[src*="_on."]')
                .bind('mouseover', this.over)
                .bind('mouseout',  this.out)
                .each(this.preload);
        },

        over : function () {
            this.setAttribute('src', this.getAttribute('src').replace('_off.', '_on.'));
        },

        out : function () {
            this.setAttribute('src', this.getAttribute('src').replace('_on.', '_off.'));
        },

        preload : function () {
            new Image().src = this.getAttribute('src').replace('_off.', '_on.');
        }
    };

    $.rollover.init();
});


//flatheight
$(window).bind('load',function(){
    var sets = [], temp = [];
    $('ul.special li').each(function(i) {
        temp.push(this);
        if (i % 4 == 3) {
            sets.push(temp);
            temp = [];
        }
    });
    if (temp.length) sets.push(temp);
    $.each(sets, function() {
        $(this).flatHeights();
    });

    $('ul.uniform li').each(function(i) {
        temp.push(this);
        if (i % 4 == 3) {
            sets.push(temp);
            temp = [];
        }
    });
    $('ul.traininguniform li').each(function(i) {
        temp.push(this);
        if (i % 4 == 3) {
            sets.push(temp);
            temp = [];
        }
    });
    if (temp.length) sets.push(temp);
    $.each(sets, function() {
        $(this).flatHeights();
    });

    $('ul.adboard li').each(function(i) {
        temp.push(this);
        if (i % 4 == 3) {
            sets.push(temp);
            temp = [];
        }
    });
    if (temp.length) sets.push(temp);
    $.each(sets, function() {
        $(this).flatHeights();
    });

    $('ul.media li').each(function(i) {
        temp.push(this);
        if (i % 4 == 3) {
            sets.push(temp);
            temp = [];
        }
    });
    if (temp.length) sets.push(temp);
    $.each(sets, function() {
        $(this).flatHeights();
    });

    $('ul.goods li').each(function(i) {
        temp.push(this);
        if (i % 4 == 3) {
            sets.push(temp);
            temp = [];
        }
    });
    if (temp.length) sets.push(temp);
    $.each(sets, function() {
        $(this).flatHeights();
    });

    $('ul.hp li').each(function(i) {
        temp.push(this);
        if (i % 4 == 3) {
            sets.push(temp);
            temp = [];
        }
    });
    if (temp.length) sets.push(temp);
    $.each(sets, function() {
        $(this).flatHeights();
    });

    $('ul.supplier li').each(function(i) {
        temp.push(this);
        if (i % 4 == 3) {
            sets.push(temp);
            temp = [];
        }
    });
    if (temp.length) sets.push(temp);
    $.each(sets, function() {
        $(this).flatHeights();
    });

    $('ul.support li').each(function(i) {
        temp.push(this);
        if (i % 4 == 3) {
            sets.push(temp);
            temp = [];
        }
    });
    if (temp.length) sets.push(temp);
    $.each(sets, function() {
        $(this).flatHeights();
    });


    var sets = [], temp = [];
    $('table.goods p.name').each(function(i) {
        temp.push(this);
        if (i % 3 == 2) {
            sets.push(temp);
            temp = [];
        }
    });
    if (temp.length) sets.push(temp);
    $.each(sets, function() {
        $(this).flatHeights();
    });



    var sets = [], temp = [];
    $('div.section ul.gallery.player2012 li a').flatHeights();



});


$(function(){
    $("div.navigation:even").addClass("odd");
    $("div.navigation:odd").addClass("even");
});


// jcarousellite.js
$(function() {
$("#scroll_panel").jCarouselLite({
visible : 5,
auto:2500,
speed:800
});
});


//cel stripe
$(document).ready(function(){
$("tr.week:even").css("background-color","#fff");
$("tr.week:odd").css("background-color","#e9e9e9");
});

$(document).ready(function(){
$("tr.rank:even").css("background-color","#fff");
$("tr.rank:odd").css("background-color","#e9e9e9");
});


//fancybox
$(document).ready(function(){
	$("a[href$='jpg'],a[href$='gif'],a[href$='png']").attr('rel', 'gallery').fancybox({
		'overlayOpacity':	'0.5',
		'overlayColor'	:	'#000',
		'showCloseButton'	: false,
		'titlePosition' 		: 'inside',
		'titleFormat'		: formatTitle
	});
	
function formatTitle(title, currentArray, currentIndex, currentOpts) {
    return '<div id="tip7-title"><span><a href="javascript:;" onclick="$.fancybox.close();"><img src="http://blaublitz.jp/wp-content/themes/theme_BB_tora01/img/fancybox/closelabel.gif" /></a></span>' + (title && title.length ? '<strong>' + title + '</strong>' : '' ) + '' + currentArray.length + ' 枚中の ' + (currentIndex + 1) + ' 枚目 ' + '</div>';
}

});

$(document).ready(function(){
 $("#support_rules_button, #support_rules_button2").fancybox({
		'overlayOpacity':	'0.5',
		'overlayColor'	:	'#000',
		'showCloseButton'	: false,
		'titlePosition' 		: 'inside',
		'titleFormat'		: formatTitle
	});
	
function formatTitle(title, currentArray, currentIndex, currentOpts) {
    return '<div id="tip7-title"><span><a href="javascript:;" onclick="$.fancybox.close();"><img src="http://blaublitz.jp/wp-content/themes/theme_BB_tora01/img/fancybox/closelabel.gif" /></a></span>' + (title && title.length ? '<strong>' + title + '</strong>' : '' ) + '' + currentArray.length + ' 枚中の ' + (currentIndex + 1) + ' 枚目 ' + '</div>';
}

});
