/*---------------------------------------------------------------------------------------------------------------
　　可変グリッド(jquery.masonry.js)(CSSと関連あり)
---------------------------------------------------------------------------------------------------------------*/

if (navigator.userAgent.indexOf("Opera") > -1) { 
  $(function(){
    initMasonry();
  });
} else {
  $(window).load(function(){
    initMasonry();
  });
}


function initMasonry() {
  if ($('.col8').size() > 0) { // This block was appended by MOTOO 2011-11-03
    $('#container').css({'min-width': '840px'});
  }
  else if ($('.col6').size() > 0) {
    $('#container').css({'min-width': '630px'});
  }
  
  $('#container').masonry({
    itemSelector: '.box',
    columnWidth: 104,
    isAnimated: true,
    animated: "farst"
  });
}


/*---------------------------------------------------------------------------------------------------------------
　　ツリーメニュー(jquery.treeview.js)(CSSと関連あり)
---------------------------------------------------------------------------------------------------------------*/

$(function() {
 $("#tree").treeview({
  collapsed: true,
  animated: "farst",
  prerendered: true,
  persist: "cookie"
 });
});

/*---------------------------------------------------------------------------------------------------------------
　　商品ページ・フォトスライド（jquery.galleryview.js）(CSSと関連あり)
---------------------------------------------------------------------------------------------------------------*/
$(document).ready(function(){
   $('#jqgv').galleryView({
    panel_width: 554,
    panel_height: 430,
    frame_width: 48,
    frame_height: 60
  });
});


/*---------------------------------------------------------------------------------------------------------------
　　マウスオーバー時に背景の色をアニメーションしながら変更(jquery.ui.js)
---------------------------------------------------------------------------------------------------------------*/

$(document).ready(function(){
  $(".boxbody_a,.boxbody_o").hover(function() {
   $(this).stop().animate({ backgroundColor: "#fff979"}, 250);
   },function() {
   $(this).stop().animate({ backgroundColor: "#ffffff" }, 150);
   });
});


/*---------------------------------------------------------------------------------------------------------------
     ページ内スムーズスクロール(jquery.easing.js)
---------------------------------------------------------------------------------------------------------------*/
$(function() {
 $('a[href*=#]').click(function() {
  if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
   var target = $(this.hash);
   target = target.length && target;
   if (target.length) {
    var sclpos = 50;
    var scldurat = 800;
    var targetOffset = target.offset().top - sclpos;
    $('html,body')
     .animate({scrollTop: targetOffset}, {duration: scldurat, easing: "easeOutExpo"});
    return false;
   }
  }
 });
});




/*---------------------------------------------------------------------------------------------------------------
     スライドショー色々(jquery.cycle.all.js)
---------------------------------------------------------------------------------------------------------------*/

/*--【index新商品大画像用】イメージとコンテンツのスライドショー（1）(CSSと関連あり)----*/
$('.cycle_index01').cycle({ 
    fx: 'fade', 
    pause: 1,
    random: 1,
    speed:  1000,
    timeout: 6000, 
    delay: -2000 
});


/*--【支払方法用】イメージとコンテンツのスライドショー(CSSと関連あり)----*/
$('.cycle_payment01').cycle({ 
    fx: 'turnDown', 
    pause: 1,
    random: 1,
    timeout: 12000, 
    delay: -2000 
});




/*--カテゴリー・メーカー・デザイナー一覧のスライドショー(CSSと関連あり)----*/
$('.cycle_content01').cycle({ 
    fx: 'scrollLeft', 
    pause: 1,
	speed: 700,
    timeout: 6000, 
    delay: -2000 
});





/*--新商品用・イメージとコンテンツのスライドショー（1）(CSSと関連あり)----*/
$('.cycle_cont01').cycle({ 
    fx: 'turnDown', 
    pause: 1,
    random: 1,
    timeout: 6000, 
    delay: -2000 
});



/*--商品ページ下、カテゴリー別商品・スライドショー（uncover/ランダム表示）　----*/
$('.cycle_cate01').cycle({
    fx: 'uncover',
    pause: 1,
    timeout: 5000,
    random: 1,
    direction: 'right'
});




/*---------------------------------------------------------------------------------------------------------------
     index--カルーセル　(jquery.jcarousel.js)
---------------------------------------------------------------------------------------------------------------*/

/*--index用　----*/
function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

$(document).ready(function() {

    // index
    $('#carousel01').jcarousel({
        auto: 5,
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });

    // series
	$('#carousel02').jcarousel({
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });

});


/*---------------------------------------------------------------------------------------------------------------
     ライトボックス　(jquery.fancybox.js)
---------------------------------------------------------------------------------------------------------------*/

/*--商品ページ用　----*/

$(document).ready(function() {
  $("a[rel=lightbox_g01]").fancybox({
	'titlePosition': 'inside',
	'titleFormat': function(title, currentArray, currentIndex, currentOpts) {
                   return '<span class="f-23-fb">' + (currentIndex + 1) + ' / ' + currentArray.length + '  </span>' + (title.length ? ' &nbsp; ' + title : '') ;
                            }
  });
});



$(document).ready(function() {
  $("a[rel=lightbox_g02]").fancybox({
	'titlePosition': 'inside',
	'titleFormat': function(title, currentArray, currentIndex, currentOpts) {
                   return '<span class="f-23-fb">' + (currentIndex + 1) + ' / ' + currentArray.length + '  </span>' + (title.length ? ' &nbsp; ' + title : '') ;
                            }
  });
});



$(document).ready(function() {
  $("a[rel=lightbox_g03]").fancybox({
	'titlePosition': 'inside',
	'titleFormat': function(title, currentArray, currentIndex, currentOpts) {
                   return '<span class="f-23-fb">' + (currentIndex + 1) + ' / ' + currentArray.length + '  </span>' + (title.length ? ' &nbsp; ' + title : '') ;
                            }
  });
});


$(document).ready(function() {
  $("a[rel=lightbox_g04]").fancybox({
	'titlePosition': 'inside',
	'titleFormat': function(title, currentArray, currentIndex, currentOpts) {
                   return '<span class="f-23-fb">' + (currentIndex + 1) + ' / ' + currentArray.length + '  </span>' + (title.length ? ' &nbsp; ' + title : '') ;
                            }
  });
});



$(document).ready(function() {
  $("a[rel=lightbox_g05]").fancybox({
	'titlePosition': 'inside',
	'titleFormat': function(title, currentArray, currentIndex, currentOpts) {
                   return '<span class="f-23-fb">' + (currentIndex + 1) + ' / ' + currentArray.length + '  </span>' + (title.length ? ' &nbsp; ' + title : '') ;
                            }
  });
});



$(document).ready(function() {
  $("a[rel=lightbox_g06]").fancybox({
	'titlePosition': 'inside',
	'titleFormat': function(title, currentArray, currentIndex, currentOpts) {
                   return '<span class="f-23-fb">' + (currentIndex + 1) + ' / ' + currentArray.length + '  </span>' + (title.length ? ' &nbsp; ' + title : '') ;
                            }
  });
});








