

//new arrivalは7日間（ミリ秒）

var new_length = 7 * 24 * 60 * 60 * 1000;



function setNewArrival(obj){

	

	$.each(obj.find('.txt-date'),function(){

		var arr = $(this).text().split(" ");

		var d = new Date();

		var str = arr[1] + " " + parseInt(arr[0], 10) + "," + arr[2];

		if(d.getTime() - Date.parse(str) < new_length){

			$(this).parent().prepend('<span class="txt-new">NEW ARRIVAL</span>');

		}

	})

}





$.fn.swapImage = function(src0, src1){

	var dir = this.attr("src").split("/");

	dir.push(dir.pop().replace(src0, src1));

	this.attr("src", dir.join("/"))

}

$.hoverImage = function(obj){

	//グローバルメニュー

	obj.hover(

	function(){

		//オーバー

		$(this).swapImage(".gif", "_on.gif");

	},

	function(){

		//アウト

		$(this).swapImage("_on.gif", ".gif");

	})

	

}



$(function($) {

	//iepngfix

	if($("img[src$='png']").length && $.fn.pngfix){

		

    $("img[src$=png]").pngfix();

  }

	//smooth scroll

	$('a').click(function() {

		var jumpTo = $(this).attr('href');

		

		if(jumpTo.charAt(0) != '#' || $(jumpTo).length == 0) {

			return true;

		}else if(jumpTo == '#siteId') {

		 $.scrollTo($("body"), 1000); return false;

		}

		else if(jumpTo.charAt(0) == '#') {

		 $.scrollTo(jumpTo, 1000); return false;

		}

	});

	//

	

	$('.nolink > img').css('opacity', 0.5);

	

	//半透明になるhover

	$('a > img[class!="swap-hover"]').hover(

	function(){

		if(!$(this).attr('onmouseover')){

			$(this).css('opacity', 0.5);

		}

	},function(){

		$(this).css('opacity', 1);

	});

	

	//画像を入れ替えるhover

	$.hoverImage($('a > img[class="swap-hover"]'));

	

});
