$(document).ready(function(){

	/*初期設定*/
	var url="http://www.ricepower-net.com";
	
	/*ロード*/
	setTimeout(showheader,500);
	setTimeout(showtopimage,1000);
	setTimeout(showheadimage,1000);
	setTimeout(showcontainer,2000);
	setTimeout(showshoplist,2000);
	
	/*シリーズ*/
	$("div#container div div#lineup div.series").find("a:last").addClass("last");
	$("div#sidebar div.series div.block h3 a").each(function(){
		$(this).html($(this).html().replace(/ /ig,"<br/>"));
	});
	
	/*シリーズ 現在のページ*/
	var path_array = location.href.split("/");
	var path_now = path_array.pop();
	var block = $("div#sidebar div.series div.block");
	var now = block.find("a[href*=" + path_now + "]").parent("div");
	now.addClass("now");
	
	/*バリアケアシリーズ BCNo.11追加*/
	var bcblock = $("div#sidebar div.barriercare div.block");
	bcblock.eq(2).addClass("before");
	var bc = '<div class="block step bcno11"><a class="photo" href="'+url+'/products/barriercareno11.html"><img src="'+url+'/wp-content/uploads/photo-barriercareno11-100x100.jpg" /></a><h3 class="barriercare"><a href="'+url+'/products/barriercareno11.html">バリアケアNo.11</a></h3><p>皮膚の水分保持能を改善し、セラミドなどの細胞間脂質の生成を促進。</p></div>';
	$("div#sidebar div.series div.before").before(bc);
	
	/*STEP追加*/
	$("div#sidebar div.series div.step").children("h3").before('<p class="step jgif"></p>');
	
	/*STEP ナンバリング*/
	$("div#sidebar div.barriercare div.block").each(function(i){
		i = i+1;
		$(this).children("p.step").text("STEP" + i).removeClass("step").attr("id", "step" + i);
	});
	
	/*シリーズ マウス操作*/
	$("div#sidebar div.series div.block").live('click', function(){	
		window.location=$(this).find("a").attr("href");
		return false;
	});
	$("div#sidebar div.series div.block").live('mouseover', function(){
		$(this).addClass("hover");
	});
	$("div#sidebar div.series div.block").live('mouseout', function(){
		$(this).removeClass("hover");
	});
	
	/*ロゴ画像置換*/
	$(".jpng").jQIR("png", url+"/wp-content/themes/ricepowernet/images/");//png、imageフォルダの指定
	$(".jjpg").jQIR("jpg", url+"/wp-content/themes/ricepowernet/images/");//jpg
	$(".jgif").jQIR("gif", url+"/wp-content/themes/ricepowernet/images/");//gif
	
	/*ロゴマウスオーバー*/
	$("#header div.left a#logo, #headershoponly div.top a#logo, #headershoponly div.bottom a#infomationdesk").hover(
		function(){$(this).animate({opacity:"0.5"},500)
		},
		function(){$(this).animate({opacity:"1"},500)
		});

	$("div.execphpwidget,div.textwidget").each(function(){
		$(this).replaceWith($(this).html());
	});
	
	/*トップイメージオーバー*/
	$("#topimage a.topimg").hover(
		function(){$(this).animate({opacity:"0.5"},500)
		},
		function(){$(this).animate({opacity:"1"},500)
		});
	
	/*グローバルメニュー*/
	$("div#nav ul li.customer a:first").addClass("first");
	$("div#nav ul li.customer a:last, div#nav ul li.area a:last").addClass("last");
	
	/*商品ロゴマウスオーバー*/
	$("div#content div.productinfo h1 a").hover(
		function(){$(this).animate({opacity:"0.5"},500)
		},
		function(){$(this).animate({opacity:"1"},500)
		});
	
	/*新着情報*/
	$("div#container div#content div#archive ul li:odd").addClass("odd");
	
	/*商品ラインナップ*/
	$("div#container div div#lineup div:last").addClass("last");
	$("div#container div div#lineup2 div ul li").each(function(){
		$(this).html($(this).html().replace(/®/ig,""));
	});
	
	/*サイドバー*/
	$("div#sidebar").each(function(){
		$(this).html($(this).html().replace(/®/ig,""));
	});
	
	/*サブメニュー*/
	$("div#submenu").each(function(){
		$(this).html($(this).html().replace(/®/ig,""));
	});
	
	/*ショップリスト*/
	$("div#shoplist table tr:odd th, div#shoplist table tr:odd td, div#container div.othershop table tr:odd th, div#container div.othershop table tr:odd td, div#container div.shop table tr:odd th, div#container div.shop table tr:odd td, div#basic table tr:odd th, div#basic table tr:odd td").addClass("odd");
	$("div#shoplist table tr").find("th:last, td:last").addClass("last");
	
	/*サブナビゲーション*/
	$("div.subnav ul").css("opacity", 0.8);
	$("div.subnav ul").hover(
		function(){$(this).animate({opacity:"1"},500)
		},
		function(){$(this).animate({opacity:"0.8"},500)
		});
	$("div.subnav ul").find("li:first").addClass("first");
	
	/*サイトマップ*/
	$("div#sitemap").each(function(){
		$(this).html($(this).html().replace(/®/ig,""));
	});
	
	/*テキストエリア*/
	$("div.download textarea")
		.focus(function(){
			$(this).select();
		})
		.click(function(){
			$(this).select();
			return false;
		});

	/*その他の加盟店テーブル数*/
	$("div#shoplist table tfoot tr td").append(
		parseInt($("div#shoplist table tbody tr").length+1) + "店");

	/*アイコンマウスオーバー*/
	$("div.icon a").hover(
		function(){$(this).animate({opacity:"0.5"},500)
		},
		function(){$(this).animate({opacity:"1"},500)
		});
	
	/*外部リンク*/
	$('a[href^="http"]').not('[href*="http://www.ricepower-net.com/"]').not('[href^=#]').click(
		function(){window.open(this.href,'_blank');
			return false;
		});

});

function showheader(){
	$("div#header")
	.animate({
		filter:"alpha(opacity=100)",
		opacity:"1"
	},"slow");
};

function showcontainer(){
	$("div#container")
	.animate({
		filter:"alpha(opacity=100)",
		opacity:"1"
	},"slow");
};

function showtopimage(){
	$("div#topimage")
	.animate({
		filter:"alpha(opacity=100)",
		opacity:"1"
	},"slow");
};

function showheadimage(){
	$("div#headimage")
	.animate({
		filter:"alpha(opacity=100)",
		opacity:"1"
	},"slow");
};

function showshoplist(){
	$("div#shoplist")
	.animate({
		filter:"alpha(opacity=100)",
		opacity:"1"
	},"slow");
};
