/*!
 * liScroll 1.0
 * Examples and documentation at: 
 * http://www.gcmingati.net/wordpress/wp-content/lab/jquery/newsticker/jq-liscroll/scrollanimate.html
 * 2007-2010 Gian Carlo Mingati
 * Version: 1.0.2 (30-MARCH-2009)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * Requires:
 * jQuery v1.2.x or later
 * 
 */


jQuery.fn.liScroll = function(settings) {
		settings = jQuery.extend({
		travelocity: 0.09
		}, settings);
		return this.each(function(){
				var j$strip = jQuery(this);
				j$strip.addClass("newsticker")
				var stripWidth = 0;
				var j$mask = j$strip.wrap("<div class='mask'></div>");
				var j$tickercontainer = j$strip.parent().wrap("<div class='tickercontainer'></div>");
				var containerWidth = j$strip.parent().parent().width();	//a.k.a. 'mask' width 	
				j$strip.find("li").each(function(i){
				stripWidth += jQuery(this, i).outerWidth(true); // thanks to Michael Haszprunar
				});
				j$strip.width(stripWidth);
				var totalTravel = stripWidth+containerWidth;
				var defTiming = totalTravel/settings.travelocity;	// thanks to Scott Waye		
				function scrollnews(spazio, tempo){
				j$strip.animate({left: '-='+ spazio}, tempo, "linear", function(){j$strip.css("left", containerWidth); scrollnews(totalTravel, defTiming);});
				}
				scrollnews(totalTravel, defTiming);
				j$strip.hover(function(){
				jQuery(this).stop();
				},
				function(){
				var offset = jQuery(this).offset();
				var residualSpace = offset.left + stripWidth;
				var residualTime = residualSpace/settings.travelocity;
				scrollnews(residualSpace, residualTime);
				});			
		});	
};

j$(function(){
	j$("ul#ticker").liScroll();
});









;(function(j$){
/*******************************************************************************************/	
// jquery.pajinate.js - version 0.2
// A jQuery plugin for paginating through any number of DOM elements
// 
// Copyright (c) 2010, Wes Nolte (http://wesnolte.com)
// Liscensed under the MIT License (MIT-LICENSE.txt)
// http://www.opensource.org/licenses/mit-license.php
// Created: 2010-04-16 | Updated: 2010-04-26
/*******************************************************************************************/

	j$.fn.pajinate = function(options){
		// Set some state information
		var current_page = 'current_page';
		var items_per_page = 'items_per_page';
		
		var meta;
	
		// Setup default option values
		var defaults = {
			item_container_id : '.pajinate_vox',
			items_per_page : 10,			
			nav_panel_id : '.page_navigation',
			num_page_links_to_display : 10,			
			start_page : 0,
			nav_label_first : '&laquo;',
			nav_label_prev : '&lsaquo;',
			nav_label_next : '&rsaquo;',
			nav_label_last : '&raquo;'
		};
		var options = j$.extend(defaults,options);
		var j$item_container;
		var j$page_container;
		var j$items;
		var j$nav_panels;
	
		return this.each(function(){
			j$page_container = j$(this);
			j$item_container = j$(this).find(options.item_container_id);
			j$items = j$page_container.find(options.item_container_id).children();
			meta = j$page_container;
			
			// Initialise meta data
			meta.data(current_page,0);
			meta.data(items_per_page, options.items_per_page);
					
			// Get the total number of items
			var total_items = j$item_container.children().size();
			
			// Calculate the number of pages needed
			var number_of_pages = Math.ceil(total_items/options.items_per_page);
			
			// Construct the nav bar
			var more = '<span class="ellipse more">...</span>';
			var less = '<span class="ellipse less">...</span>';
			
			var navigation_html = '<a class="first_link" href="">'+ options.nav_label_first +'</a>';
			navigation_html += '<a class="previous_link" href="">'+ options.nav_label_prev +'</a>'+ less;
			var current_link = 0;
			while(number_of_pages > current_link){
				navigation_html += '<a class="page_link" href="" longdesc="' + current_link +'">'+ (current_link + 1) +'</a>';
				current_link++;
			}
			navigation_html += more + '<a class="next_link" href="">'+ options.nav_label_next +'</a>';
			navigation_html += '<a class="last_link" href="">'+ options.nav_label_last +'</a>';
			
			// And add it to the appropriate area of the DOM	
			j$nav_panels = j$page_container.find(options.nav_panel_id);			
			j$nav_panels.html(navigation_html).each(function(){
			
				j$(this).find('.page_link:first').addClass('first');
				j$(this).find('.page_link:last').addClass('last');
				
			});
			
			// Hide the more/less indicators
			j$nav_panels.children('.ellipse').hide();
			
			// Set the active page link styling
			j$nav_panels.find('.previous_link').next().next().addClass('active_page');
			
			/* Setup Page Display */
			// And hide all pages
			j$items.hide();
			// Show the first page			
			j$items.slice(0, meta.data(items_per_page)).show();

			/* Setup Nav Menu Display */
			// Page number slices
			
			var total_page_no_links = j$page_container.children(options.nav_panel_id+':first').children('.page_link').size();
			options.num_page_links_to_display = Math.min(options.num_page_links_to_display,total_page_no_links);

			j$nav_panels.children('.page_link').hide(); // Hide all the page links
			
			// And only show the number we should be seeing
			j$nav_panels.each(function(){
				j$(this).children('.page_link').slice(0, options.num_page_links_to_display).show();			
			});
			
			/* Bind the actions to their respective links */
			 
			// Event handler for 'First' link
			j$page_container.find('.first_link').click(function(e){
				e.preventDefault();
				
				movePageNumbersRight(j$(this),0);
				goto(0);				
			});			
			
			// Event handler for 'Last' link
			j$page_container.find('.last_link').click(function(e){
				e.preventDefault();
				var lastPage = total_page_no_links - 1;
				movePageNumbersLeft(j$(this),lastPage);
				goto(lastPage);				
			});			
			
			// Event handler for 'Prev' link
			j$page_container.find('.previous_link').click(function(e){
				e.preventDefault();
				showPrevPage(j$(this));
			});
			
			
			// Event handler for 'Next' link
			j$page_container.find('.next_link').click(function(e){
				e.preventDefault();				
				showNextPage(j$(this));
			});
			
			// Event handler for each 'Page' link
			j$page_container.find('.page_link').click(function(e){
				e.preventDefault();
				goto(j$(this).attr('longdesc'));
			});			
			
			// Goto the required page
			goto(parseInt(options.start_page));
			toggleMoreLess();
		});
		
		function showPrevPage(e){
			new_page = parseInt(meta.data(current_page)) - 1;						
			
			// Check that we aren't on a boundary link
			if(j$(e).siblings('.active_page').prev('.page_link').length==true){
				movePageNumbersRight(e,new_page);
				goto(new_page);
			}
				
		};
			
		function showNextPage(e){
			new_page = parseInt(meta.data(current_page)) + 1;
			
			// Check that we aren't on a boundary link
			if(j$(e).siblings('.active_page').next('.page_link').length==true){		
				movePageNumbersLeft(e,new_page);
				goto(new_page);
			}
				
		};
			
		function goto(page_num){
			
			var ipp = meta.data(items_per_page);
			
			var isLastPage = false;
			
			// Find the start of the next slice
			start_from = page_num * ipp;
			
			// Find the end of the next slice
			end_on = start_from + ipp;
			// Hide the current page	
			j$items.hide()
					.slice(start_from, end_on)
					.show();
			
			// Reassign the active class
			j$page_container.find(options.nav_panel_id).children('.page_link[longdesc=' + page_num +']').addClass('active_page')
													 .siblings('.active_page')
													 .removeClass('active_page');										 
			
			// Set the current page meta data							
			meta.data(current_page,page_num);
			
			// Hide the more and/or less indicators
			toggleMoreLess();
		};	
		
		// Methods to shift the diplayed index of page numbers to the left or right
		function movePageNumbersLeft(e, new_p){
			var new_page = new_p;
			
			var j$current_active_link = j$(e).siblings('.active_page');
		
			if(j$current_active_link.siblings('.page_link[longdesc=' + new_page +']').css('display') == 'none'){
				
				j$nav_panels.each(function(){
							j$(this).children('.page_link')
								.hide() // Hide all the page links
								.slice(parseInt(new_page - options.num_page_links_to_display + 1) , new_page + 1)
								.show();		
							});
			}
			
		} 
		
		function movePageNumbersRight(e, new_p){
			var new_page = new_p;
			
			var j$current_active_link = j$(e).siblings('.active_page');
			
			if(j$current_active_link.siblings('.page_link[longdesc=' + new_page +']').css('display') == 'none'){
												
				j$nav_panels.each(function(){
							j$(this).children('.page_link')
								.hide() // Hide all the page links
								.slice( new_page , new_page + parseInt(options.num_page_links_to_display))
								.show();
							});
			}
		}
		
		// Show or remove the ellipses that indicate that more page numbers exist in the page index than are currently shown
		function toggleMoreLess(){
													 
			if(!j$nav_panels.children('.page_link:visible').hasClass('last')){					
				j$nav_panels.children('.pajinate_more').show();
			}else {
				j$nav_panels.children('.pajinate_more').hide();
			}
			
			if(!j$nav_panels.children('.page_link:visible').hasClass('first')){
				j$nav_panels.children('.less').show();
			}else {
				j$nav_panels.children('.less').hide();
			}			
		}
		
	};
	
})(jQuery);




			
			j$(document).ready(function(){
				j$('#paging_container').pajinate({
					num_page_links_to_display : 10,
					items_per_page : 10	
				});
			});										
	
			j$(document).ready(function(){
				j$(' li:.odd, .pajinate_vox > *:odd').css('background-color','#eee');
			});






/*
 * FeatureList - simple and easy creation of an interactive "Featured Items" widget
 * Examples and documentation at: http://jqueryglobe.com/article/feature_list/
 * Version: 1.0.0 (01/09/2009)
 * Copyright (c) 2009 jQueryGlobe
 * Licensed under the MIT License: http://en.wikipedia.org/wiki/MIT_License
 * Requires: jQuery v1.3+
*/
;(function(j$) {
	j$.fn.featureList = function(options) {
		var tabs	= j$(this);
		var output	= j$(options.output);

		new jQuery.featureList(tabs, output, options);

		return this;	
	};

	j$.featureList = function(tabs, output, options) {
		function slide(nr) {
			if (typeof nr == "undefined") {
				nr = visible_item + 1;
				nr = nr >= total_items ? 0 : nr;
			}

			tabs.removeClass('current').filter(":eq(" + nr + ")").addClass('current');

			output.stop(true, true).filter(":visible").fadeOut();
			output.filter(":eq(" + nr + ")").fadeIn(function() {
				visible_item = nr;	
			});
		}

		var options			= options || {}; 
		var total_items		= tabs.length;
		var visible_item	= options.start_item || 0;

		options.pause_on_hover		= options.pause_on_hover		|| true;
		options.transition_interval	= options.transition_interval	|| 5000;

		output.hide().eq( visible_item ).show();
		tabs.eq( visible_item ).addClass('current');

		tabs.click(function() {
			if (j$(this).hasClass('current')) {
				return false;	
			}

			slide( tabs.index( this) );
		});

		if (options.transition_interval > 0) {
			var timer = setInterval(function () {
				slide();
			}, options.transition_interval);

			if (options.pause_on_hover) {
				tabs.mouseenter(function() {
					clearInterval( timer );

				}).mouseleave(function() {
					clearInterval( timer );
					timer = setInterval(function () {
						slide();
					}, options.transition_interval);
				});
			}
		}
	};
})(jQuery);

	j$(document).ready(function() {

			j$.featureList(
				j$("#event_tabs li a"),
				j$("#output li"), {
					start_item	:	0
				}
			);
		});




//カートにいれる


jQuery.preloadImages = function()
{
	for(var i = 0; i<arguments.length; i++)
	jQuery("<img>").attr("src", arguments[i]);
}
jQuery.preloadImages("/images/common/icon/cart.gif", "/images/common/icon/carto.gif", "/images/common/icon/soldout.gif", "/images/common/icon/soldouto.gif", "/images/common/icon/checkout.gif", "/images/common/icon/checkouto.gif");

jQuery(document).ready(function(){
	
	j$("#slidebar li a").hover(
		function(){
			var iconName = j$(this).children("img").attr("src");
			var origen = iconName.split(".gif")[0];
			j$(this).children("img").attr({src: "" + origen + "o.gif"});
			j$(this).css("cursor", "pointer");
			j$(this).animate({ width: "120px" }, {queue:false, duration:"normal"} );
			j$(this).children("span").animate({opacity: "show"}, "fast");
		}, 
		function(){
			var iconName = j$(this).children("img").attr("src");
			var origen = iconName.split("o.")[0];
			j$(this).children("img").attr({src: "" + origen + ".gif"});			
			j$(this).animate({ width: "17px" }, {queue:false, duration:"normal"} );
			j$(this).children("span").animate({opacity: "hide"}, "fast");
		});
});







//IE label 対策
j$(function () {
//IE Label img
        if (j$.browser.msie) {
                j$('label').click(function () {
                        j$('#' + j$(this).attr('for')).focus().click();
                });
        }
});



// game slideup

j$(document).ready(function(){
				j$('.boxgrid.slidedown').hover(function(){
					j$(".cover", this).stop().animate({top:'-180px'},{queue:false,duration:300});
				}, function() {
					j$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:600});
				});
			});
			
			

// mainmenu fade

j$(function(){
j$('#menuwrap ul li .sub').hide();
j$('#menuwrap ul li').hover(
function(){
j$('#menuwrap ul li').not(j$('.sub', this)).stop();
j$('.sub', this).fadeIn(90);
},
function(){
j$('.sub', this).fadeOut(90);
}
);

});



// common tabs

(function(j$) {
j$.organicTabs = function(el, options) {
var base = this;
base.j$el = j$(el);
base.j$nav = base.j$el.find(".nav");
base.init = function() {
base.options = j$.extend({},j$.organicTabs.defaultOptions, options);

j$(".hide").css({
"position": "relative",
"top": 0,
"left": 0,
"display": "none"
}); 

base.j$nav.delegate("li > a", "click", function() {
var curList = base.j$el.find("a.current").attr("href").substring(1),
j$newList = j$(this),
listID = j$newList.attr("href").substring(1),
j$allListWrap = base.j$el.find(".tab_list_wrap"),
curListHeight = j$allListWrap.height();
j$allListWrap.height(curListHeight);
        
if ((listID != curList) && ( base.j$el.find(":animated").length == 0)) {
base.j$el.find("#"+curList).fadeOut(base.options.speed, function() {
base.j$el.find("#"+listID).fadeIn(base.options.speed);
var newHeight = base.j$el.find("#"+listID).height();
j$allListWrap.animate({
height: newHeight
});
base.j$el.find(".nav li a").removeClass("current");
j$newList.addClass("current");
});
}
return false;
});

};
base.init();
};

j$.organicTabs.defaultOptions = {
"speed": 300
};

j$.fn.organicTabs = function(options) {
return this.each(function() {
(new j$.organicTabs(this, options));
});
};

})(jQuery);

j$(function() {
j$("#topicswrap").organicTabs({
"speed": 200
});
j$("#tabwrap").organicTabs({
"speed": 200
});
});



//tooltip 

(function(j$){  
j$.fn.tooltip = function (tipColor, supCont) {

if (tipColor === 'null') {
tipColor = 'light';
} 

var tipName = tipColor + 'Tip';
var tipFrame = '<div class="' + tipName + '"><div class="content"></div><div class="bottom">&nbsp;</div></div>';
var animSpeed = 300;
var tinyTip;
var tText;
j$(this).hover(function() {
j$('body').append(tipFrame);
var divTip = 'div.'+tipName;
tinyTip = j$(divTip);
tinyTip.hide();
if (supCont === 'title') {
var tipCont = j$(this).attr('title');
} else if (supCont !== 'title') {
var tipCont = supCont;
}
j$(divTip + ' .content').html(tipCont);
tText = j$(this).attr('title');
j$(this).attr('title', '');
var yOffset = tinyTip.height() + 2;
var xOffset = (tinyTip.width() / 2) - (j$(this).width() / 2);
var pos = j$(this).offset();
var nPos = pos;
nPos.top = pos.top - yOffset;
nPos.left = pos.left - xOffset;
tinyTip.css('position', 'absolute').css('z-index', '1000');
tinyTip.css(nPos).fadeIn(animSpeed);

}, function() {

j$(this).attr('title', tText);
tinyTip.fadeOut(animSpeed, function() {
j$(this).remove();
});			
});		
}
})(jQuery);
j$(document).ready(function() {
j$('a.tTip').tooltip('light', 'title');
});





j$(function(){
        j$('ul.list02').css('display','none');
        j$('ul.list03').css('display','none');
    });
j$(function(){

    var handler = j$('#accordion p'),
    menus = j$('#accordion ul');
    handler.click(function(){
        var _thisMenu = j$(this).next();
        if(_thisMenu.is(':visible')){
        _thisMenu.show();
        }
        else {
       
        menus.slideUp(350);
        _thisMenu.slideDown(350);
        }
    });
});
