// JavaScript Document

// Image Roll Over

SITE = {
	basepath : '/',
	preloader : {
		loadedImages: [],
		load: function (url){
			var img = this.loadedImages;
			var l = img.length;
			img[l] = new Image();
			img[l].src = url;
		}
	}
};



$(function(){
	//class="roll"はロールオーバーを設定 (src属性を_on付きのものに差し替える) 
	$('.roll').each(function(){
		this.originalSrc = $(this).attr('src');
		this.rolloverSrc = this.originalSrc.replace(/(\.gif|\.jpg|\.png)/, "_on$1" );
		SITE.preloader.load(this.rolloverSrc);
	});
	
	//通常ロールオーバー
	$('.roll').not($('.rollgroup .roll, .current .roll')).hover(function(){
		$(this).attr('src',this.rolloverSrc);
	},function(){
		$(this).attr('src',this.originalSrc);
	});

//ACCORDION QA
});
$(document).ready(function() {
	$("div.tabContainer dt").hover(function(){
		$(this).css("cursor","pointer"); 
	},function(){
		$(this).css("cursor","default"); 
		});
	$("div.tabContainer dd").css("display","none");
	$("div.tabContainer dt").click(function(){
		$(this).next().slideToggle("normal");
		});
	$("div.tabContainer h3").click(function(){
		$(this).next().slideToggle("normal");
		});
});

//COLOR BOX CUSTOMIZATION 
$(document).ready(function(){
	//Examples of how to assign the ColorBox event to elements
	$("a[rel='cview']").colorbox({transition:"elastic", rel:"nofollow", speed:300});
	$("a[rel='cviewfull']").colorbox({transition:"elastic", rel:"nofollow", speed:300, width:"100%", height:"100%"});
	$(".example5").colorbox({iframe:true, innerWidth:500, innerHeight:380});
	$(".example6").colorbox({iframe:true, innerWidth:880, innerHeight:550});
	$(".example7").colorbox({width:"98%", height:"95%", iframe:true});
	$(".example8").colorbox({width:"90%", inline:true, href:"#inline_example1"});
});

/*scroll*/
$(function(){
// page scroll
	jQuery.easing.quart = function(x, t, b, c, d){
		return -c * ((t=t/d-1)*t*t*t - 1) + b;
	};

	$('.up_right a').click(function(){
		$('html,body').animate({
			scrollTop:0
		}, 900, 'quart');
		return false;
	});
});



//特定の日数だけNewをつける
function NewMark(y,m,d){
	oldDay = new Date(y+"/"+m+"/"+d);
	newDay = new Date();
	n = (newDay - oldDay)/(1000*60*60*24);
	if (n <=30)document.write('<span class="iconNew">NEW!</span>');
} 




