﻿/*--------------------------------
	価格表示
--------------------------------*/

$(function(){

	// 標準価格の表示を調整
	$(".regularPrice").each(function(){
		var price = $(this).text();
		price = price.replace(/,/g, "");					// 一旦カンマを全消去
		price = price.match(/\d+/)[0];						// 数字だけ抽出する
		price = price.replace(/(\d)(\d\d\d)$/g, "$1,$2");	// カンマ区切りを施す
		price = price.replace(/(\d)(\d\d\d,)/g, "$1,$2");	// カンマ区切りを施す
		price = price + "円";
		$(this)
			.text(price)
			.wrapInner("<del>")
		;
	});

	// 販売価格の表示を調整
	$(".salePrice").each(function(){
		var price = $(this).text();
		price = price.replace(/,/g, "");					// 一旦カンマを全消去
		price = price.match(/\d+/)[0];						// 数字だけ抽出する
		price = price.replace(/(\d)(\d\d\d)$/g, "$1,$2");	// カンマ区切りを施す
		price = price.replace(/(\d)(\d\d\d,)/g, "$1,$2");	// カンマ区切りを施す
		price = price + "円";
		$(this).text(price);
	});

});

/*--------------------------------
	サムネイル画像にオリジナルへのリンクをつける
--------------------------------*/

$(function(){
	$("img.thumb")
		.css("cursor", "pointer")
		.bind("click", function(){
			$.fancybox({
				'href'			: this.src.replace(/(\/[^\/]*)$/m, "/origin$1"),
				'title'			: this.alt,
				'type'			: 'image',
				'titlePosition'	: 'inside',
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'elastic'
			});
			return false;
		})
	;
});

