$(function(){
var ua = navigator.userAgent;
if((ua.indexOf('iPhone') > 0) || ua.indexOf('iPod') > 0 || (ua.indexOf('Android') > 0 && ua.indexOf('Mobile') > 0)){
$('head').prepend('');
} else {
$('head').prepend('');
}
});
$(window).on('load scroll resize',function() {
var w = $(window).width();
var x = 768;
var sp = '_sp.';
var pc = '_pc.';
$('.chg').each(function (){
var $this = $(this);
if (w <= x) {
$this.attr('src', $this.attr('src').replace(pc, sp));
} else {
$this.attr('src', $this.attr('src').replace(sp, pc));
}
});
});
$(function() {
$('.thumbs li').hover(function (){
var src = $(this).find('img').attr('src');
$(this).parents('.thumbs').find('.thumb').attr('src',src);
});
});
//header
$(function() {
var head = '.js-headerInfo';
var headH = 0;
setInterval(function(){
headH = parseFloat(-($(head).height() / 2));
$(head).animate({'margin-top':headH},function(){
$(head).removeAttr('style').children('li').eq(0).insertAfter($(head).children('li').eq(1));
});
},5500);
});
//スムーズスクロール
$(function(){
$('a[href^=#]').click(function() {
var speed = 1600; // ミリ秒
var href= $(this).attr("href");
var target = $(href === "#" || href === "" ? 'html' : href);
var position = target.offset().top;
$('body,html').animate({scrollTop:position}, speed, 'swing');
return false;
});
});
$('#intel ul li.btn1').click(function () {
$('#intel ul li.btn1').hide();
$('#intel ul li.block2').show();
$('#intel ul li.btn2').show();
});
$('#intel ul li.btn2').click(function () {
$('#intel ul li.btn1').show();
$('#intel ul li.block2').hide();
$('#intel ul li.btn2').hide();
});
$('#intel_sp ul li.btn1').click(function () {
$('#intel_sp ul li.btn1').hide();
$('#intel_sp ul li.block2').show();
$('#intel_sp ul li.btn2').show();
});
$('#intel_sp ul li.btn2').click(function () {
$('#intel_sp ul li.btn1').show();
$('#intel_sp ul li.block2').hide();
$('#intel_sp ul li.btn2').hide();
});
$(function(){
$('ul.color li').click(function () {
var index = $('ul.color li').index(this);
if(index<=2){
$('#pcimg1 img').hide();
}else if(index<=7){;
$('#pcimg2 img').hide();
}else if(index<=9){;
$('#pcimg3 img').hide();
}else if(index<=12){;
$('#pcimg4 img').hide();
}
$('.pcimg').eq(index).show();
});
});
$(function() {
$('#btn_top').hide();
$(window).scroll(function(){
if($(window).scrollTop() > 0) {
$('#btn_top').show();
} else {
$('#btn_top').hide();
}
});
});