//20111118
// JavaScript Document

//page scroll
$(function(){
	$("a[href^=#]").click(function(){
		var Hash = $(this.hash);
		var HashOffset = $(Hash).offset().top;
		$("html,body").animate({
			scrollTop: HashOffset
		}, 1000);
		return false;
	});
});

// 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");
		});
});

//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%"});
});



