/****************************************************************************
 * 透明度を利用したロールオーバープラグイン
 ****************************************************************************/
/*=====================================================
meta: {
  title: "jquery-opacity-rollover.js",
  version: "2.1",
  copy: "copyright 2009 h2ham (h2ham.mail@gmail.com)",
  license: "MIT License(http://www.opensource.org/licenses/mit-license.php)",
  author: "THE HAM MEDIA - http://h2ham.seesaa.net/",
  date: "2009-07-21"
  modify: "2009-07-23"
}
=====================================================*/
(function($) {

$.fn.opOver = function(op,oa,durationp,durationa){

var c = {
op:op? op:1.0,
oa:oa? oa:0.6,
durationp:durationp? durationp:'fast',
durationa:durationa? durationa:'fast'
};


$(this).each(function(){
$(this).css({
opacity: c.op,
filter: "alpha(opacity="+c.op*100+")"
}).hover(function(){
$(this).fadeTo(c.durationp,c.oa);
},function(){
$(this).fadeTo(c.durationa,c.op);
})
});
},

$.fn.wink = function(durationp,op,oa){

var c = {
durationp:durationp? durationp:'slow',
op:op? op:1.0,
oa:oa? oa:0.2
};

$(this).each(function(){
$(this).css({
opacity: c.op,
filter: "alpha(opacity="+c.op*100+")"
}).hover(function(){
$(this).css({
opacity: c.oa,
filter: "alpha(opacity="+c.oa*100+")"
});
$(this).fadeTo(c.durationp,c.op);
},function(){
$(this).css({
opacity: c.op,
filter: "alpha(opacity="+c.op*100+")"
});
})
});
}

})(jQuery);

/****************************************************************************
 * メニューにマウスオーバーするとメイン画像が切り替わるナビゲーション
 ****************************************************************************/
/*
Image Navigation plugin 1.0
Hiroshi Sato,2010
http://net-king.com
*/
(function($) {

         function imageNavigationSlide(option) {
             var $active = $('.navi-image a.active', option.elem);
             if ( $active.length == 0 ) $active = $('.navi-image a:last', option.elem);
             var $next =  $active.next().length ? $active.next() : $('.navi-image a:first' ,option.elem);
             $active.addClass('last-active');
             var $active_navi = $(".navi ."+ $active.attr("rel") +"", option.elem); 
             var $next_navi = $(".navi ."+ $next.attr("rel") +"", option.elem); 
             //rolloverImage_out($active_navi,option);
             //rolloverImage_on($next_navi,option);
             $active_navi.removeClass("active");
             $next_navi.addClass("active");
             rolloverImage_chenge(option);
             $next.css({opacity: 0.0})
                 .addClass('active')
                 .animate({opacity: 1.0}, option.animationTime, function() {
                     $active.removeClass("active last-active");
                 });
         }
         function startInterval(option){
             if(option.autoPlay) imageNavigationID = setInterval(function(){ imageNavigationSlide(option) }, option.time );
         }
         function rolloverImage_on(obj, option){
             if (!option.rolloverImage) return;
             $("img.over", obj).stop().fadeTo(option.rolloverTime,1);
         }
         function rolloverImage_out(obj, option){
             if (!option.rolloverImage) return;
             $(".over", obj).fadeTo(option.rolloutTime,0);
         }
         function rolloverImage_chenge(option){
             $(".navi a.active img.over", option.elem).stop().fadeTo(option.rolloverTime,1);
             $(".navi a:not(.active) img.over", option.elem).stop().fadeTo(option.rolloutTime,0);
         }

$.fn.imageNavigation = function(option) {
             //init
             option = $.extend({
               elem:this,
               time: 2000,
               animationTime: 500,
               autoPlay: true,
               rolloverImage: true,
               rolloverTime: 10,
               rolloutTime: 800
             }, option);
             var $active = $('.navi-image a.active', option.elem);
             if ( $active.length == 0 ) {
               $active = $('.navi-image a:first', option.elem);
               $active.addClass("active");
               $(".navi a:first", option.elem).addClass("active");
             }
             
             naviCnt = $(".navi a", option.elem).size();
             for(i=1;i<=naviCnt;i++) {
               $(".navi li:nth-child("+i+") a",option.elem).addClass("navi-"+i).attr("rel","navi-"+i);
               $(".navi-image a:nth-child("+i+")",option.elem).addClass("navi-"+i).attr("rel","navi-"+i);
             }

             $(".navi li a", option.elem).each(function(){
               $(this).css("position", "relative");
               if(option.rolloverImage) {
                 overSrc = $("img", this).attr("src").replace(/^(.+)(\.[a-z]+)$/, "$1_on$2");
                 $(this).prepend('<img src="'+overSrc+'" class="over" />');
                 $("img.over" ,this).css("position", "absolute").css({opacity: 0.0});
               }
             });
             $("a.active img.over", this).stop().css({opacity: 1.0});

             $(".navi a",option.elem).mouseover(function(){
               $active = $('.navi-image a.active', option.elem);
               $next = $(".navi-image a."+$(this).attr("rel")+"");
               $('.navi a', option.elem).removeClass("active");
               $(this).addClass("active");
               //rolloverImage_on(this, option);
               rolloverImage_chenge(this, option);
               if($active.attr("rel") != $next.attr("rel") ) {
                 $active.addClass('last-active');
                 $active.removeClass('active');
                 $next.stop().css({opacity: 0.0})
                 .addClass('active')
                 .animate({opacity: 1.0}, option.animationTime, function() {
                   $active.removeClass('active last-active');
                 });
               }
             }).mouseout(function(){
               rolloverImage_out(this, option);
               $activeING = $(".navi-image a.active:animated",option.elem);
               if($activeING.length !=0 ) {
                 $activeING.stop().css({opacity: 1.0});
                 $(".navi-image a.last-active").each(function(){
                   $(this).removeClass("last-active");
                 });
               }
             });
             
             $(option.elem).mouseover(function(){
               if(option.autoPlay) clearInterval(imageNavigationID);
             }).mouseout(function(){
               startInterval(option);
             });
             startInterval(option);
             
             if(option.rolloverImage){
               $(".navi", option.elem).hover(function(){
               },function(){
                 $("a.active img.over", this).stop().css({opacity: 1.0});
                 rolloverImage_chenge(option);
               });
             }
}

})(jQuery);


/****************************************************************************
 *jQueryのスライドショー、jcarousellite 
 ****************************************************************************/
(function($){$.fn.jCarouselLite=function(o){o=$.extend({btnPrev:null,btnNext:null,btnGo:null,mouseWheel:false,auto:null,speed:200,easing:null,vertical:false,circular:true,visible:3,start:0,scroll:1,beforeStart:null,afterEnd:null},o||{});return this.each(function(){var b=false,animCss=o.vertical?"top":"left",sizeCss=o.vertical?"height":"width";var c=$(this),ul=$("ul",c),tLi=$("li",ul),tl=tLi.size(),v=o.visible;if(o.circular){ul.prepend(tLi.slice(tl-v-1+1).clone()).append(tLi.slice(0,v).clone());o.start+=v}var f=$("li",ul),itemLength=f.size(),curr=o.start;c.css("visibility","visible");f.css({overflow:"hidden",float:o.vertical?"none":"left"});ul.css({margin:"0",padding:"0",position:"relative","list-style-type":"none","z-index":"1"});c.css({overflow:"hidden",position:"relative","z-index":"2",left:"0px"});var g=o.vertical?height(f):width(f);var h=g*itemLength;var j=g*v;f.css({width:f.width(),height:f.height()});ul.css(sizeCss,h+"px").css(animCss,-(curr*g));c.css(sizeCss,j+"px");if(o.btnPrev)$(o.btnPrev).click(function(){return go(curr-o.scroll)});if(o.btnNext)$(o.btnNext).click(function(){return go(curr+o.scroll)});if(o.btnGo)$.each(o.btnGo,function(i,a){$(a).click(function(){return go(o.circular?o.visible+i:i)})});if(o.mouseWheel&&c.mousewheel)c.mousewheel(function(e,d){return d>0?go(curr-o.scroll):go(curr+o.scroll)});if(o.auto)setInterval(function(){go(curr+o.scroll)},o.auto+o.speed);function vis(){return f.slice(curr).slice(0,v)};function go(a){if(!b){if(o.beforeStart)o.beforeStart.call(this,vis());if(o.circular){if(a<=o.start-v-1){ul.css(animCss,-((itemLength-(v*2))*g)+"px");curr=a==o.start-v-1?itemLength-(v*2)-1:itemLength-(v*2)-o.scroll}else if(a>=itemLength-v+1){ul.css(animCss,-((v)*g)+"px");curr=a==itemLength-v+1?v+1:v+o.scroll}else curr=a}else{if(a<0||a>itemLength-v)return;else curr=a}b=true;ul.animate(animCss=="left"?{left:-(curr*g)}:{top:-(curr*g)},o.speed,o.easing,function(){if(o.afterEnd)o.afterEnd.call(this,vis());b=false});if(!o.circular){$(o.btnPrev+","+o.btnNext).removeClass("disabled");$((curr-o.scroll<0&&o.btnPrev)||(curr+o.scroll>itemLength-v&&o.btnNext)||[]).addClass("disabled")}}return false}})};function css(a,b){return parseInt($.css(a[0],b))||0};function width(a){return a[0].offsetWidth+css(a,'marginLeft')+css(a,'marginRight')};function height(a){return a[0].offsetHeight+css(a,'marginTop')+css(a,'marginBottom')}})(jQuery);

/****************************************************************************
 *jQuery リンクを内包するブロックレベル要素全体がリンクに、Biggerlink 
 ****************************************************************************/
/*
 * jQuery.BiggerLink v2.0.1
 * http://www.ollicle.com/eg/jquery/biggerlink/
 *
 * Copyright (c) 2009 Oliver Boermans
 * http://creativecommons.org/licenses/MIT/
 *
 * 2009-11-22 (22 Nov 2009)
*/ 
(function($) {
$.fn.biggerlink = function(options) {

// Default settings
var settings = {
biggerclass:'bl-bigger', // class added to the first contained link and others that trigger it
hoverclass:'bl-hover', // class added to parent element on hover/focus
hoverclass2:'bl-hover2', // class added to parent element on hover/focus of other links
clickableclass:'bl-hot', // class added to parent element with behaviour
otherstriggermaster: true,// will all links in containing biggerlink element trigger the first link
follow: 'auto'// follow master link on click? : 'auto',true,false
};
if(options) {
$.extend(settings, options);
}
$(this).filter(function(){
 return $('a',this).length > 0;

}).addClass(settings.clickableclass).css('cursor', 'pointer').each(function(i){

// store element references
var big = $(this).data('biggerlink',{hovered:false,focused:false,hovered2:false,focused2:false});
var links = {
all: $('a',this),
big: $(this),
master: $('a:first',this).data('biggerlink',{status:'master'}).addClass(settings.biggerclass),
other: $('a',this).not($('a:first',this)).data('biggerlink',{status:'other'})
};


$('a',this).andSelf().each(function(){
var newdata = $.extend($(this).data('biggerlink'),links);
$(this).data('biggerlink',newdata);
});



// Add title of first link with title to parent if not already set
var thistitle = big.attr('title');
var newtitle = big.data('biggerlink').master.attr('title');
if(newtitle && !thistitle)
{
big.attr('title', newtitle);
}



// events on biggerlink element

big
.mouseover(function(event){
window.status = $(this).data('biggerlink').master.get(0).href;
$(this).addClass(settings.hoverclass);
$(this).data('biggerlink').hovered = true;
})
.mouseout(function(event){
window.status = '';
if(!$(this).data('biggerlink').focused)
{
$(this).removeClass(settings.hoverclass);
}
$(this).data('biggerlink').hovered = false;
})
.bind('click',function(event){

// if clicked direct or non-link
if(!$(event.target).closest('a').length)
{
$(this).data('biggerlink').master.trigger({type:'click',source:'biggerlink'});
event.stopPropagation();
}
});



// focus/blur

links.all
.bind('focus',function(){
$(this).data('biggerlink').big.addClass(settings.hoverclass);
$(this).data('biggerlink').big.data('biggerlink').focused = true;
}).bind('blur',function(){
if(!$(this).data('biggerlink').big.data('biggerlink').hovered)
{
$(this).data('biggerlink').big.removeClass(settings.hoverclass);
}
$(this).data('biggerlink').big.data('biggerlink').focused = false;
});



// click/focus/blur event on master (first) link within biggerlink

links.master
.bind('click',function(event){
if(event.source == 'biggerlink')
{
if(settings.follow === true || settings.follow == 'auto' && event.result !== false)
{
window.location = $(this).attr('href');
}
else
{
event.stopPropagation();
}
}
});


// links other than the first (master) link also within biggerlink

// other links are independent
if(settings.otherstriggermaster)
{
links.other.addClass(settings.biggerclass)
.bind('click',function(event){
// trigger click events on master link instead
$(this).data('biggerlink').master.trigger({type:'click',source:'biggerlink'});

// stop this link being followed
event.preventDefault();

// prevent events on parent elements being triggered
event.stopPropagation();
});
}

// other links are slaves of master link 
else
{
links.other
.bind('focus',function(){
$(this).data('biggerlink').big.addClass(settings.hoverclass2);
$(this).data('biggerlink').big.data('biggerlink').focused2 = true;
})
.bind('blur',function(){
if(!$(this).data('biggerlink').big.data('biggerlink').hovered2)
{
$(this).data('biggerlink').big.removeClass(settings.hoverclass2);
}
$(this).data('biggerlink').big.data('biggerlink').focused2 = false;

})
.bind('mouseover',function(event){
$(this).data('biggerlink').big.addClass(settings.hoverclass2);
$(this).data('biggerlink').big.data('biggerlink').hovered2 = true;
event.stopPropagation();
})
.bind('mouseout',function(event){
if(!$(this).data('biggerlink').big.data('biggerlink').focused2)
{
$(this).data('biggerlink').big.removeClass(settings.hoverclass2);
}
$(this).data('biggerlink').big.data('biggerlink').hovered2 = false;
event.stopPropagation();
});

if(!links.other.attr('title'))
{
links.other.attr('title','');
}
}
});
return this;
};
})(jQuery);

/****************************************************************************
 * FAQページの折りたたみとタブのJavaScript
 ****************************************************************************/

// 折りたたみ
$(document).ready(function() {
$(".qaArea dt").hover(function(){
$(this).css("cursor","pointer"); 
},function(){
$(this).css("cursor","default"); 
});
$(".qaArea dd").css("display","none");
$(".qaArea dt").click(function(){
$(this).next().slideToggle("normal");
});
});
// 折りたたみここまで

// タブ
// jQuery_Auto 0.9
// Automatic functions for webpages (using the wonderful jQuery library)

// Copyright: (c) 2006, Michal Tatarynowicz (tatarynowicz@gmail.com)
// Licenced as Public Domain (http://creativecommons.org/licenses/publicdomain/)
// $Id: jquery_auto.js 426 2006-05-06 19:54:39Z Michał $

// Initialization
$.auto = {
init: function() {
for (module in $.auto) {
if ($.auto[module].init)
$.auto[module].init();
}
}
};
$(document).ready($.auto.init);
// Switches tabs on click
$.auto.tabs = {
init: function() {
$('.qaContainer').each(function(){
var f = $.auto.tabs.click;
var group = this;
$('.tab li, li.tab', group).each(function(){
this.group = group;
$(this).click(f);
$('#'+this.id+'_area').hide();
}).filter(':first').trigger('click');
});
},
click: function() {
var tab = $('#'+this.id+'_area').get(0);
$('.tab li, li.tab', this.group).each(function(){
$(this).removeClass('active');
$('#'+this.id+'_area').hide();
});
$(this).addClass('active');
$(tab).show();
this.blur();
return false;
}
};
// タブここまで


