
/*  ================================================================================
Menu Scripts
================================================================================  */
$(document).ready(function(){
if ($.browser.msie){
//$("#menu ul li ul li").css("padding-bottom",0);
//if ($.browser.msie && $.browser.version == 6.0){$("#menu ul li ul li").css("padding-bottom",1);$("#menu ul li ul li a span").css("padding-bottom",2);};
};
$('#menu ul li ul li a span').mouseover(function(){$(this).animate({opacity:0.7},70);}).mouseout(function(){$(this).animate({opacity: 1.0},70);});
});




/*  ================================================================================

　Menu Active


$(function($) {
var href = location.href.split('#')[0];
$('#menu ul li a').each(function() {
if (href == this.href){
var cmscheck = $(this).parent().parent().attr("class");
if ( cmscheck !== "cms"){$(this).addClass('on');};
}
});
});
================================================================================  */

$(function($) {
var href = location.href.split('#')[0];
$('#menu ul li a').each(function() {
if (href == this.href)$(this).addClass('on');
});
});


/*  ================================================================================
popup Scripts
================================================================================  */
$(document).ready(function(){
var str = $("body").attr("id");
if (str == 'popup'){
$("#popup #mainCol ul li:nth-child(2n)").addClass("turn");
};
});



/*  ================================================================================
news Scripts
================================================================================  */
$(document).ready(function(){
var str = $("body").attr("id");
if (str == 'news'){
$("#news #mainCol dt.topics").append(" <span>[TOPICS]</span>");
$("#news #mainCol dt.shop").append(" <span>[SHOP]</span>");
$("#news #mainCol dt.update").append(" <span>[UPDATE]</span>");
$("#news #mainCol dd a").each(function(){$(this).parent().append(" <span>&gt;&gt;</span>")});
$("#news #mainCol dd a").mouseover(function(){$(this).parent().each(function(){$(this).find("span").addClass("on");})}).mouseout(function(){$(this).parent().each(function(){$(this).find("span").removeClass("on");})});
};
});

/*  ================================================================================
new_products
================================================================================  */
$(document).ready(function(){
var str = $("body").attr("id");
if (str == 'new_products'){
$("#new_products #mainCol dd.txt a").each(function(){$(this).parent().append(" <span>&gt;&gt;</span>")});
$("#new_products #mainCol dd.txt a").mouseover(function(){$(this).parent().each(function(){$(this).find("span").addClass("on");})}).mouseout(function(){$(this).parent().each(function(){$(this).find("span").removeClass("on");})});
};
});

/*  ================================================================================
categoryDetail Scripts
================================================================================  */
$(document).ready(function(){
var str = $("body").attr("id");
if (str == 'collection'){
$("#mainCol .categoryArchive .item:nth-child(3n)").addClass("turn");

$('#categoryDetail .thumbs li img').mouseover(function(){$(this).animate({opacity: 0.7}, 'fast');}).mouseout(function(){$(this).animate({opacity: 1.0}, 'fast');});
$("#categoryDetail .thumbs li:first").addClass("on").append("<span></span>");;
$("#categoryDetail .thumbs li:last").addClass("turn");

$("#categoryDetail .item").css("display",'none').animate({opacity:0},'fast');
$("#categoryDetail .item:first").css("display",'block').animate({opacity:1},500);

$('#categoryDetail .thumbs li a').click(function(){
$("#categoryDetail .thumbs li").removeClass("on").find("span").remove();
$(this).parent().addClass("on");
var detailNum = $(this).parent().find("a").attr("rel");
$(this).parent().append("<span></span>");
var viewDetail = "#categoryDetail ."+detailNum;
//alert (viewDetail);
$("#categoryDetail .item").animate({opacity:0},'fast').css("display",'none');
$(viewDetail).css("display",'block').delay(200).animate({opacity:1},500);
return false;
});
$("#categoryDetail .item ul li:nth-child(3n)").addClass("turn");
$("#categoryDetail .item ul li:nth-child(4n)").addClass("clr");

//$("#mainCol .categoryArchive .item p a").mouseover(function(){$(this).addClass("hover");}).mouseout(function(){$(this).removeClass("hover");});
$('#mainCol .categoryArchive .item p a').mouseover(function(){$(this).animate({opacity: 0.7}, 'fast');}).mouseout(function(){$(this).animate({opacity: 1.0}, 'fast');});

};

});


$(function(){$('#categoryDetail .thumbs li').hide();});
var i = 0;var int=0;
$(window).bind("load", function() {
var int=setInterval("doThis(i)",200);
});

function doThis() {
var imgs = $('#categoryDetail .thumbs li').length;
if (i >= imgs) {clearInterval(int);}
$('#categoryDetail .thumbs li:hidden').eq(0).fadeIn(200);
i++;
}



/*  ================================================================================
Home Scripts
================================================================================  */
$(document).ready(function(){
var str = $("body").attr("id");
if (str == 'home'){
//$('#home #topContents .detail a').mouseover(function(){$(".mv img,p.detail a").animate({opacity: 0.8}, 'fast');}).mouseout(function(){$(".mv img,p.detail a").animate({opacity: 1.0}, 'fast');});
//$("#home #mainCol div.newProducts dl:first").each(function(){$(this).find("dt").addClass("first");});
$('#home #topContents h1 a').mouseover(function(){$(this).animate({opacity:0.7},70);}).mouseout(function(){$(this).animate({opacity: 1.0},70);});
$("#home dt.topics").append(" <span>[TOPICS]</span>");
$("#home dt.shop").append(" <span>[SHOP]</span>");
$("#home dt.update").append(" <span>[UPDATE]</span>");
$("#home div.topics dd p a").each(function(){$(this).parent().append(" <span>&gt;&gt;</span>")});
$("#home div.topics dd a").mouseover(function(){$(this).parent().each(function(){$(this).find("span").addClass("on");})}).mouseout(function(){$(this).parent().each(function(){$(this).find("span").removeClass("on");})});
$("#home #mainCol div.newProducts dl:first").addClass("first");
$('#home #mainCol div.newProducts dl:last').addClass("end");
$("#home div.newProducts dd.txt a").each(function(){$(this).parent().append(" <span>&gt;&gt;</span>")});
$("#home div.newProducts dd.txt a").mouseover(function(){$(this).parent().each(function(){$(this).find("span").addClass("on");})}).mouseout(function(){$(this).parent().each(function(){$(this).find("span").removeClass("on");})});
$("#home #mainCol div.onlineShop dl:first").addClass("first");
$('#home #mainCol div.onlineShop dl:last').addClass("end");
$("#home div.onlineShop dd.txt a").each(function(){$(this).parent().append(" <span>&gt;&gt;</span>")});
$("#home div.onlineShop dd.txt a").mouseover( function(){$(this).parent().each(function(){$(this).find("span").addClass("on");})}).mouseout(function(){$(this).parent().each(function(){$(this).find("span").removeClass("on");})});
}else{
	$('p.siteID a').mouseover(function(){$(this).animate({opacity:0.7},70);}).mouseout(function(){$(this).animate({opacity: 1.0},70);});
};
});

/*  ================================================================================
Shop Scripts
================================================================================  */
$(document).ready(function(){
var str = $("body").attr("id");
if (str == 'shop'){
$('#shop #mainCol p.shopListTop a').mouseover(function(){$(this).animate({opacity: 0.7}, 'fast');}).mouseout(function(){$(this).animate({opacity: 1.0}, 'fast');});
};
});

/*  ================================================================================
faq Scripts
================================================================================  */
$(document).ready(function(){
var str = $("body").attr("id");
if (str == 'faq'){
$("#faq ul.unq li a").mouseover(function(){$(this).parent().addClass("on");}).mouseout(function(){$(this).parent().removeClass("on");});
};
});

/*  ================================================================================
・blank
・IE クリックライン消
・イメージロールオーバー　テキスト＆背景画像用
================================================================================  */
$(document).ready(function () {
$('.blank').click(function(){window.open(this.href, '_blank');return false;});
$("a").focus(function(){$(this).blur();});
$('a img.rollover').mouseover(function(){$(this).animate({opacity: 0.7}, 'fast');}).mouseout(function(){$(this).animate({opacity: 1.0}, 'fast');});
$('p.rollover a,li.rollover a,.pageNavi p.next,.pageNavi p.prev').mouseover(function(){$(this).animate({opacity: 0.7}, 'fast');}).mouseout(function(){$(this).animate({opacity: 1.0}, 'fast');});
$('button.rollover').mouseover(function(){$(this).animate({opacity: 0.7}, 'fast');}).mouseout(function(){$(this).animate({opacity: 1.0}, 'fast');});
});

/*  ================================================================================
イメージロールオーバー スワップ
================================================================================  */
var preLoadImg = new Object();
function initRollOvers(){
$("a img.imgRollover").each(function(){
var imgSrc = this.src;
var sep = imgSrc.lastIndexOf('.');
var onSrc = imgSrc.substr(0, sep) + '_o' + imgSrc.substr(sep, 4);
preLoadImg[imgSrc] = new Image();
preLoadImg[imgSrc].src = onSrc;
$(this).hover(
function() { this.src = onSrc; },
function() { this.src = imgSrc; }
);
});
}
$(function(){
initRollOvers();
});


/*-----------------------------------------------------
スムーズスクロール
-----------------------------------------------------*/
jQuery.fn.extend({
scrollTo : function(speed, easing) {
if(!$(this)[0].hash || $(this)[0].hash == "#") {
return false;
}
return this.each(function() {
var targetOffset = $($(this)[0].hash).offset().top;
$('html,body').animate({scrollTop: targetOffset}, speed, easing);
});
}
});

$(document).ready(function(){
$('.pageTop a,.unq a').click(function() {
$(this).scrollTo(1000);
return false;
});
});

/*  ================================================================================
ポップアップ
================================================================================  */
(function($) {
$.fn.openwin = function(settings) {
settings = jQuery.extend({
option		: {
width		: false,
height		: false,
top			: false,
left		: false,
menubar		: "no",
toolbar		: "no",
location	: "no",
status		: "no",
resizable	: "no",
scrollbars	: "no",
directories	: "no",
titlebar	: "yes",
fullscreen	: "no"
},
target		: "_blank",
blur		: false,
focus		: false
}, settings);

this.click(function() {
var options = [];
if($(this).attr("rel")) {
var rel = $(this).attr("rel").split(",");
var reloption = {};
for(var i in rel) {
var a = rel[i].split("=");
reloption[a[0]] = a[1];
}
}
for(var k in settings.option) {
var v = settings.option[k];
if(reloption) {
if(reloption[k]) {
v = reloption[k];
}
}
if(v != false) {
options.push(k + "=" + v);
}
}
var target = settings.target;
if(reloption) {
if(reloption["target"]) {
target = reloption["target"];
}
}
var win = window.open($(this).attr("href"), target, options.join(","));
if(settings.blur == true) {
win.blur();
}
if(settings.focus == true) {
win.focus();
}
return false;
});
}
})(jQuery);

$(document).ready(function() {
if ($.browser.msie ){
$('a.popup').openwin({option:{width	:502,height:520,scrollbars:"yes",location:"no",directories:"no"},target:"popup",focus:true});
$('a.onlineContact').openwin({option:{width	:522,height:520,scrollbars:"yes",location:"no",directories:"no"},target:"popup",focus:true});
}else{
$('a.popup').openwin({option:{width	:502,height:520,scrollbars:"yes",location:"no",directories:"no"},target:"popup",focus:true});
$('a.onlineContact').openwin({option:{width	:522,height:520,scrollbars:"yes",location:"no",directories:"no"},target:"popup",focus:true});
};
});


/*
CSS Browser Selector v0.4.0 (Nov 02, 2010)
Rafael Lima (http://rafael.adm.br)
http://rafael.adm.br/css_browser_selector
License: http://creativecommons.org/licenses/by/2.5/
Contributors: http://rafael.adm.br/css_browser_selector#contributors
*/
function css_browser_selector(u){var ua=u.toLowerCase(),is=function(t){return ua.indexOf(t)>-1},g='gecko',w='webkit',s='safari',o='opera',m='mobile',h=document.documentElement,b=[(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3.5')?g+' ff3 ff3_5':is('firefox/3.6')?g+' ff3 ff3_6':is('firefox/3')?g+' ff3':is('gecko/')?g:is('opera')?o+(/version\/(\d+)/.test(ua)?' '+o+RegExp.$1:(/opera(\s|\/)(\d+)/.test(ua)?' '+o+RegExp.$2:'')):is('konqueror')?'konqueror':is('blackberry')?m+' blackberry':is('android')?m+' android':is('chrome')?w+' chrome':is('iron')?w+' iron':is('applewebkit/')?w+' '+s+(/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?m+' j2me':is('iphone')?m+' iphone':is('ipod')?m+' ipod':is('ipad')?m+' ipad':is('mac')?'mac':is('darwin')?'mac':is('webtv')?'webtv':is('win')?'win'+(is('windows nt 6.0')?' vista':''):is('freebsd')?'freebsd':(is('x11')||is('linux'))?'linux':'','js']; c = b.join(' '); h.className += ' '+c; return c;}; css_browser_selector(navigator.userAgent);



(function($){
  $.fn.gmap = function(lat, lng) {
    var mapdiv = $(this).get(0);
    var myOptions = {
      zoom: 16,
      center: new google.maps.LatLng(lat,lng),
      mapTypeId: google.maps.MapTypeId.ROADMAP,
      scaleControl: true,
      mapTypeControl: true
    };
    var map = new google.maps.Map(mapdiv, myOptions);
    var marker = new google.maps.Marker({
      position: myOptions.center,
      map: map
    });
  };
})(jQuery);
