/*@cc_on _d=document;eval('var document=_d')@*/


$(document).ready(function(){
$("div.supportArea").find("p").css({"visibility":"visible"}).wrap('<div id="pwrap"></div>');
var ref = document.referrer;
if (!ref.match(/(shop\.maclaren)|(192)/)){
$("div.supportArea").find("p").css({"width":"900px"}).wrap('<div id="pwrap"></div>');
$("#pwrap").css({width:"0",overflow:"hidden"})
.animate({ 
width: "897px"
},4000);
}
});




$(document).ready(function(){				   
var href = location.href.split('#')[0];
  if (href.match("192")){
	$(".warapMenu a,.layout_header a").each(function(){
	var e =$(this).attr("href");
	var j =e.replace('http://shop.maclaren.jp','');
	$(this).attr("href",j);
	});
  }
});


/* アイテムタイトル st delate*/

document.open();
document.write('<style type="text/css">  ');
document.write('<!-- ');
document.write('.FS2_body_Goods_GoodsDetail .itemTitle{visibility:hidden;}');
document.write(':root .FS2_body_Goods_GoodsDetail .itemTitle{visibility:visible;}');
document.write('html[xmlns] .FS2_body_Goods_GoodsDetail .itemTitle{visibility:hidden;}');
document.write('.FS2_body_Goods_GoodsDetail .FS2_tableVariation{display:none;}');
document.write('-->  ');
document.write('</style>  ');
document.close();


$(document).ready(function() {
$("body#FS2_body_Goods").find(".layout_content").append('<div class="pageTop"><a href="#">Page Top ▲</a></div>');
if (location.pathname=="/"||location.pathname=="/index.html"){
$("table.layout_table").find(".layout_content").append('<div class="pageTop"><a href="#">Page Top ▲</a></div>');
}
 });




/* アイテムタイトル 表示*/
$(document).ready(function(){
var itemttl = $("h1.itemTitle,h2.itemTitle,h3.itemTitle")
itemttl.each(function(){
var el =$(this).html();
var jl =el.replace(/（/ig,'<span class="jpname">（');
var tl = jl.replace(/）/ig, "）</span>");
$(this).html(tl);
itemttl.css("visibility","visible");
});
});



//配送無料アイコン表示
$(document).ready(function(){
var bstg =$("#FS2_itemlayout_E");
bstg.find("div.FS2_figure").after('<div id="free"><img src="/images/Icon1Button.gif" alt="全国どこでも送料無料！"/></div><div class="clear"></div>');
});

//ファビコン
$(document).ready(function(){
$("title").after('<link rel="shortcut icon" href="/images/favicon.ico">')
});


//カラー一覧に表示
$(document).ready(function() {
$.getScript("/js/minicolor.js");
});


//THからカラーを取得
//$(document).ready(function(){		   
//$("body").append('<div id="colorlist"></div>')
//$(".FS2_tableVariation th:gt(1)").each(function(){
//var cl = '・'+$(this).text();										  
//$("#colorlist").append(cl);	
//});
//console.log($("#colorlist").html());
//$("#colorlist").css("display","none");
//});

	/* カラーオプション、画像切替 */
function cg(pass,color){
$("#colorname").text(color);
var bstg =$("div#FS2_itemlayout_E");
var goodname = bstg.find("h1.itemTitle,h2.itemTitle").html().replace(/(<.*)/ig, "");
bstg.find("img.thumbnail:eq(0)").attr('src',pass+'2_m.jpg').end()
.find("img.thumbnail:eq(1)").attr('src',pass+'1_s.jpg').end()
.find("img.thumbnail:eq(2)").attr('src',pass+'3_s.jpg').end()
.find("div.FS2_thumbnail_container a:eq(0)").attr('href',pass+'2.jpg').end()
.find("div.FS2_thumbnail_container a:eq(1)").attr('href',pass+'1.jpg').end()
.find("div.FS2_thumbnail_container a:eq(2)").attr('href',pass+'3.jpg').end()
.find(".FS2_thumbnail_container img").parent().attr({rel:'slide',title:goodname + ':' +color});
}

	/* アクセサリー、カラーオプション、画像切替 */
function acg(pass,color){
$("#colorname").text(color);
$("#FS2_itemlayout_E .thumbnail:eq(0)").attr('src',pass+'_m.jpg');
$("#FS2_itemlayout_E .FS2_thumbnail_container a:eq(0)").attr('href',pass+'.jpg');
}
function acgDetoil(detail,accap,detail02,accap02){
var bstg =$("#FS2_itemlayout_E");
	
bstg.find(".thumbnail:eq(1)").attr('src',detail+'_m.jpg');
bstg.find(".FS2_thumbnail_container a:eq(1)").attr('href',detail+'.jpg')
	.wrap('<div class="acc_block"></div>')
	.after('<div class="tx10" id="accap"></div>');
$("#accap").text(accap);
bstg.find(".thumbnail:eq(2)").attr('src',detail02+'_m.jpg');
bstg.find(".FS2_thumbnail_container a:eq(2)").attr('href',detail02+'.jpg')
	.wrap('<div class="acc_block"></div>')
	.after('<div class="tx10" id="accap02"></div>');
$("#accap02").text(accap02);

}



	/* 他年式ストローラリンク生成 */
function otherST(href,ttl,ico){
if (ttl==undefined|ttl==''){
	ttl=$("h1.itemTitle").text();
}
$("td.FS2_itemlayout_td_Right").append('<a class="lic_otherST"><div class="otherST"></div></a>');
$("div.otherST:last").html('以下のカラーの<b>'+ttl +'</b>については&nbsp;<span><img src="/images/arrowGoother.gif"/></span><div class="otherST_in"></div>');
$("a.lic_otherST:last").attr('href',href);
if (ico=='s'){
$("div.otherST:last span").append('&nbsp;<img src="/shop/item/maclaren/design/template02/btn/Icon3Button.gif">')
}
if (ico=='n'){
$("div.otherST:last span").append('&nbsp;<img src="/shop/item/maclaren/design/template02/btn/Icon2Button.gif">')
}
if ($.browser.msie){ //ie
$("div.otherST_in:last").load("/chip02.php?sub="+href+" .FS2_itemPrice_area ul:first",tip);
} else {
$("div.otherST_in:last").load(""+href+" .FS2_itemPrice_area ul:first",tip);
//$.ajax({
//  url: href,
//  contentType: "charset=utf-8",
//  cache: false,
//  success: function(html){
//   parts = ($(html).find(".FS2_itemPrice_area ul:first").parent().html());
//   $("body").append('<div class="result">'+parts+'</div>');
//   tip();
//  }
//});
} //if END
} 

function tip(){
$("div.otherST_in").each(function(i){
  $(this).find("li").find("img").each(function(i){
  $(this).removeAttr("alt");
  $(this).removeAttr("onclick");
  href = $(this).closest("a").attr("href");
  $(this).wrap("<a href='"+href+"'></a>");
  $(this).click(function () {
  	color_on(i);
});
});
});

}

function otherSTnoChip(href,ttl,ico){
if (ttl==undefined|ttl==''){
	ttl=$("h1.itemTitle").text();
}
$("td.FS2_itemlayout_td_Right").append('<a class="lic_otherST"><div class="otherST"></div></a>');
$("div.otherST:last").html('その他の<b>'+ttl +'</b>については&nbsp;<span><img src="/images/arrowGoother.gif"/></span>');
$("a.lic_otherST:last").attr('href',href);
}



/* 詳細画面初期設定、thickbox、カラー表示、アイテムタイトル調整 //セレクトボックス*/

function pri(br){
var bstg =$("#FS2_itemlayout_E");
bstg.find("div.FS2_thumbnail_container a:eq(0)").after('<div class="phcapwrap"><div class="phcap tx10">カラー：<span id="colorname"></span></div></div>').end()
.find("div.FS2_thumbnail_container a").addClass("thickbox").end()
.find("img.thumbnail:eq(0)").attr('galleryimg','no');

//セレクトボックス
selectbox();
function selectbox(){
$("table.GoodsSelectionTable").each(function(){
							  
$(this).after('<dl class="wrapvari"><dt>カラー：</dt><dd>　<select class="vari"><option>選択してください</option></select></dd></dl>');
$(this).next().find("select.vari").attr("name",$("input",this).attr("name"));
$(this).next().find("select.vari option:eq(0)").attr("value","");
$("input",this).each(function(i){
var h = i+1;
//console.log($(this).closest(".FS2_tableVariation").next().find("select.vari").html());
var opop = $(this).closest("table.GoodsSelectionTable")
opop.next().find(".vari option:last").after('<option></option>');
opop.next().find(".vari option:eq("+h+")").text(($(this).parent().parent().parent().text()));
opop.next().find(".vari option:eq("+h+")").attr("name",$(this).attr("name"));
opop.next().find(".vari option:eq("+h+")").attr("value",$(this).attr("value"));
});//FS2_tableVariation input").each end
$("td",this).each(function(i){
var notxt = $(this).html();
if (notxt.match("radio")){}
else {
$(".vari").after('<p class="itemStock tx11">'+$(this).prev().text()+'は在庫を切らせております。</p>');
}
$("table.GoodsSelectionTable").css({display:"none"})
});//FS2_tableVariation td").each end
});
}//selecbox end

//重複した場合非表示
$("div#FS2_itemlayout_E .FS2_noStockText").prev().find(".itemStock").css("display","none")
.end().find("select.vari").attr("disabled","disabled");
}//pro end


/*セレクトボックスの中止*/
function NOselectbox(){
	$("table.GoodsSelectionTable").css({display:"block"});
	$("dl.wrapvari").css({display:"none"});
}

// cookie で　colorピンポイント
function color_on(clr_value){
$.cookie('clr', clr_value,{ path:'/'});
}

// cookie で　color
function cookiecolor(){
if ($.cookie('clr')){//クッキーが無ければ、".chip li（または.chip02 li）"の0番目（最初の）オンクリックを実行
var ck = 0;
var ck = $.cookie('clr');
} else {
var ck = 0;}
var actn = $(".chip li:eq("+ck+") ,.chip02 li:eq("+ck+") ").html().match(/cg.*;/);

actn = String(actn);
String.prototype.detitize = function()
{
  var str = "" + this;
  str = str.split("&#039;").join("'");
  str = str.split('&#123;').join("{");
  str = str.split('&#125;').join("}");
  str = str.split("&quot;").join('"');
  str = str.split("&gt;").join(">");
  str = str.split("&lt;").join("<");
  str = str.split("&amp;").join("&");
  return str;
}
actn = actn.detitize();
if($.browser.msie && $.browser.version < 8){
actn = String(actn);
actn = (actn.replace(/".*/ig, ""));
}
if(ck == 0){
actn = String(actn);
actn = String(actn.replace(/ad\(\);|rm\(\);/ig, ""));
}

eval(''+ actn +''); //クッキーがあれば、そのインデックス番号の".chip li"のオンクリックを実行

$.cookie('clr', '', { expires: -1 ,path:'/'});//終わったのでクッキーを消す

}//end cookie で　color

// cookie で　color for acc
function cookiecolor_acc(){
if ($.cookie('clr')){//クッキーが無ければ、".chip li（または.chip02 li）"の0番目（最初の）オンクリックを実行
var ck = 0;
var ck = $.cookie('clr');
} else {
var ck = 0;}
var actn = $(".chip li:eq("+ck+") ,.chip02 li:eq("+ck+") ").html().match(/acg.*;/);

actn = String(actn);
String.prototype.detitize = function()
{
  var str = "" + this;
  str = str.split("&#039;").join("'");
  str = str.split('&#123;').join("{");
  str = str.split('&#125;').join("}");
  str = str.split("&quot;").join('"');
  str = str.split("&gt;").join(">");
  str = str.split("&lt;").join("<");
  str = str.split("&amp;").join("&");
  return str;
}
actn = actn.detitize();
if($.browser.msie && $.browser.version < 8){
actn = String(actn);
actn = (actn.replace(/".*/ig, ""));
}
if(ck == 0){
actn = String(actn);
actn = String(actn.replace(/ad\(\);|rm\(\);/ig, ""));
}

eval(''+ actn +''); //クッキーがあれば、そのインデックス番号の".chip li"のオンクリックを実行

$.cookie('clr', '', { expires: -1 ,path:'/'});//終わったのでクッキーを消す

}//end cookie で　color for acc

//$(document).ready(function(){
//if ($.cookie('tst')){
//$(".logo img").css("width","300px")
//}
//});

//テスト用メニューインクルード
//$(document).ready(function(){
//if ($.cookie('tst')){
//var href = location.href.split(/[#?]/)[0];
//if (!href.match("strollerlist")){
//$(".warapMenu").load("/strollerlist.html .warapMenu > *",function(){curnew();});
//}
//}
//});
//
//function curnew(){
////$(".warapMenu > .warapMenu").removeClass("warapMenu");
//var href = location.href.split(/[#?]/)[0];
//$('.warapMenu a').each(function() {
//if (href.match(this.href)){
//	  $(this).find("img:not(.menuCat)").attr("src",$(this).find("img").attr("src").replace("_off.", "_on."));
//}else if (href.match(/techno_XT\d\d|techno_classic\d\d/)){
//	  $(".menu_Techno").find("img").attr("src",$(".menu_Techno").find("img").attr("src").replace("_off.", "_on."));
//}else if (href.match(/vogue|\/ryder\d\d/)){
//	  $(".menu_VogueRyder").find("img").attr("src",$(".menu_VogueRyder").find("img").attr("src").replace("_off.", "_on."))
//}else if (href.match(/twin_triumph/)){
//	  $(".menu_TwinTriumph").find("img").attr("src",$(".menu_TwinTriumph").find("img").attr("src").replace("_off.", "_on."))
//}else if (href.match(/quest_sport|quest_mod/)){
//	  $(".menu_Quest").find("img").attr("src",$(".menu_Quest").find("img").attr("src").replace("_off.", "_on."))
//}else if (href.match(/MACLAREN_sport/)){
//	  $(".menu_macSport").find("img").attr("src",$(".menu_macSport").find("img").attr("src").replace("_off.", "_on."))	  		  
//}else if (href.match(/volo\d\d|white_volo\d\d|volo_seatliner_set/)){
//	  $(".menu_Volo").find("img").attr("src",$(".menu_Volo").find("img").attr("src").replace("_off.", "_on."))
//}else if (href.match(/daytripper\d\d/)){
//	  $(".menu_Daytripper").find("img").attr("src",$(".menu_Daytripper").find("img").attr("src").replace("_off.", "_on."))
//}else if (href.match(/triumph/)){
//	  $(".menu_Triumph").find("img").attr("src",$(".menu_Triumph").find("img").attr("src").replace("_off.", "_on."))
//}else if (href.match("accessories")){
//	  $(".menu_acce").find("img").attr("src",$(".menu_acce").find("img").attr("src").replace("_off.", "_on."));
//}
//});
//if (href.match("http://shop.maclaren.jp/index.html")){
//	  $(".navi .navi_home").find("img").attr("src",$(".navi .navi_home").find("img").attr("src").replace("_off.", "_on."));
//}else if (href.match("stroller")){
//	  $(".navi .navi_st").find("img").attr("src",$(".navi .navi_st").find("img").attr("src").replace("_off.", "_on."));
//}else if (href.match("accessories")){
//	  $(".navi .navi_ac").find("img").attr("src",$(".navi .navi_ac").find("img").attr("src").replace("_off.", "_on."));
//}else if (href.match("navigator")){
//	  $(".navi .navi_na").find("img").attr("src",$(".navi .navi_na").find("img").attr("src").replace("_off.", "_on."));
//}else if (href.match("warranty")){
//	  $(".navi .navi_w").find("img").attr("src",$(".navi .navi_w").find("img").attr("src").replace("_off.", "_on."));	  
//}
//
//$(document).ready(function(){				   
//var href = location.href.split('#')[0];
//  if (href.match("192")){
//	$(".warapMenu a,.layout_header a").each(function(){
//	var e =$(this).attr("href");
//	var j =e.replace('http://shop.maclaren.jp','');
//	$(this).attr("href",j);
//	});
//  }
//});
//
//$(".layout_menu .warapMenu .ranking p a img,.layout_content dl dd a img").hover(function(){
//$(this).css("opacity", "0.5");
//$(this).fadeTo("slow", 1.0);
//});
//
//smartRollover();
//
//$("body").prepend('<link rel="stylesheet" type="text/css" href="/css/test.css"/>')
//$(".mac .supportArea p").css("letter-spacing","-0.1em")


//}//function curnew ED
	

	/* 関連画像表示 */

function detail(path){
var ab= new Array("a","b","c","d","e","f","g","h","i");
$("div#STdetail p").each(function(i){
var dImg = path +ab[i];
$(this).wrap('<div class="STdetail_block"><a class="preview" name="'+dImg+'.jpg"></a></div>')
.parent().attr("title",$("#STdetail p:eq("+i+")").text()).end()
.before('<img src="'+ dImg+ '_s.jpg" style="width:140px; height:auto;"/>');
});
$(window).load(function (){
imagePreview();
});
}
	

	/* カレントリンク処理 */

jQuery(function($) {
var href = location.href.split('#')[0];
$('td.layout_menu div.warapMenu a:not(.not)').each(function() {
if (href.match(this.href)){
	  $(this).find("img").attr("src",$(this).find("img").attr("src").replace("_off.", "_on."));
}
});
var navi =  $("div.navi");
if (href.match("http://shop.maclaren.jp/index.html")){
	  navi.find(".navi_home").find("img").attr("src",$(".navi .navi_home").find("img").attr("src").replace("_off.", "_on."));
}else if (href.match("stroller")){
	  navi.find(".navi_st").find("img").attr("src",$(".navi .navi_st").find("img").attr("src").replace("_off.", "_on."));
}else if (href.match("accessories")){
	  navi.find(".navi_ac").find("img").attr("src",$(".navi .navi_ac").find("img").attr("src").replace("_off.", "_on."));
}else if (href.match("navigator")){
	  navi.find(".navi_na").find("img").attr("src",$(".navi .navi_na").find("img").attr("src").replace("_off.", "_on."));
}else if (href.match("warranty")){
	  navi.find(".navi_w").find("img").attr("src",$(".navi .navi_w").find("img").attr("src").replace("_off.", "_on."));	  
}
});//jQuery(function($)ED

	/* 割らんてぃ */
function otherWA(){
$(".otherWA").hover(
  function () {
    $(this).addClass("otherWAhover");
  },
  function () {
    $(this).removeClass("otherWAhover");
  }
);
}



/*
 * Image preview script 
 * written by Alen Grakalic (http://cssglobe.com)
 */
this.imagePreview = function(){	
	/* CONFIG */
		xOffset = 460;
		yOffset = -280;
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
	/* END CONFIG */
	$("#STdetail a.preview").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "<br/>" + this.t : "";
		$("body").append("<p id='preview'><img src='"+ this.name +"' alt='Image preview' /><p->"+ c +"</p></p>");								 
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		$("#preview").remove();
    });	
	$("#STdetail a.preview").mousemove(function(e){
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};
//* Image preview script  END




(function($){$.fn.lazyload=function(options){var settings={threshold:0,failurelimit:0,event:"scroll",effect:"show",container:window};if(options){$.extend(settings,options);}
var elements=this;if("scroll"==settings.event){$(settings.container).bind("scroll",function(event){var counter=0;elements.each(function(){if(!$.belowthefold(this,settings)&&!$.rightoffold(this,settings)){$(this).trigger("appear");}else{if(counter++>settings.failurelimit){return false;}}});var temp=$.grep(elements,function(element){return!element.loaded;});elements=$(temp);});}
return this.each(function(){var self=this;$(self).attr("original",$(self).attr("src"));if("scroll"!=settings.event||$.belowthefold(self,settings)||$.rightoffold(self,settings)){if(settings.placeholder){$(self).attr("src",settings.placeholder);}else{$(self).removeAttr("src");}
self.loaded=false;}else{self.loaded=true;}
$(self).one("appear",function(){if(!this.loaded){$("<img />").bind("load",function(){$(self).hide().attr("src",$(self).attr("original"))
[settings.effect](settings.effectspeed);self.loaded=true;}).attr("src",$(self).attr("original"));};});if("scroll"!=settings.event){$(self).bind(settings.event,function(event){if(!self.loaded){$(self).trigger("appear");}});}});};$.belowthefold=function(element,settings){if(settings.container===undefined||settings.container===window){var fold=$(window).height()+$(window).scrollTop();}
else{var fold=$(settings.container).offset().top+$(settings.container).height();}
return fold<=$(element).offset().top-settings.threshold;};$.rightoffold=function(element,settings){if(settings.container===undefined||settings.container===window){var fold=$(window).width()+$(window).scrollLeft();}
else{var fold=$(settings.container).offset().left+$(settings.container).width();}
return fold<=$(element).offset().left-settings.threshold;};$.extend($.expr[':'],{"below-the-fold":"$.belowthefold(a, {threshold : 0, container: window})","above-the-fold":"!$.belowthefold(a, {threshold : 0, container: window})","right-of-fold":"$.rightoffold(a, {threshold : 0, container: window})","left-of-fold":"!$.rightoffold(a, {threshold : 0, container: window})"});})(jQuery);


$(window).load(function (){ 
var ua = $.browser;//01st
if(ua.msie|ua.safari/*|ua.mozilla*/){
$("#FS2_itemlayout_E img.thumbnail,#STdetail img,#FS2_Recommend_List img").lazyload({
threshold : 0,
placeholder : "/images/gray.gif",
effect : "fadeIn" 
}); 
}
});

/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */


jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};

///Cookie pluginEND


///NaviStrollerOver

$(document).ready(function(){
$("td.layout_menu div.warapMenu div.ranking p a img,div#Stroller dl dd a img,.wink").hover(function(){
$(this).css("opacity", "0.5");
$(this).fadeTo("slow", 1.0);
});
});

///NaviStrollerOverEND

///FAQアコーディオン
$(function()
{
	$("div#faq div").hide();
	$("div#faq h2").each(function(i)
	{
		
		$(this).hover(function(){
			$(this).css({'cursor':'pointer','color':'#ee1100'});//#e6e4de
		},function(){
			$(this).css({'cursor':'default','color':'#000'});
		});
				
		$(this).click(function()
		{
			$(this).next("div").toggle("normal");			
		});
	});
});

///FAQアコーディオンEND



