jQuery(function($) {
	/**
	 * jquery.scrollTo.js settings
	 */
	// smooth scroll
	$.easing.easeOutExpo = function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	}
	// anchor
	$('a[href^=#]').click(function(){
		var id = $(this).attr('href');
		var offset = Math.floor($(id).offset().top);
		var windowHeight = document.documentElement.clientHeight;
		var bodyHeight = $('body').height();
		var scroll = ( bodyHeight - offset > windowHeight ) ? offset : bodyHeight - windowHeight;
		$.scrollTo(scroll, 800, {easing:'easeOutExpo'});
		return false;
	});
	// page top
	$('#pageTop a', '.pageTop a').click(function(){
		$.scrollTo(0, 800, {easing:'easeOutExpo'});
		return false;
	});

	/**
	 * jquery.lightbox.js settings
	 */
	var lightBoxOptions = {
		imageLoading:	'/wp/wp-content/themes/wp-chiyoda/js/images/loading.gif',	// (string) Path and the name of the loading icon
		imageBtnPrev:	'/wp/wp-content/themes/wp-chiyoda/js/images/prevlabel.gif',	// (string) Path and the name of the prev button image
		imageBtnNext:	'/wp/wp-content/themes/wp-chiyoda/js/images/nextlabel.gif',	// (string) Path and the name of the next button image
		imageBtnClose:	'/wp/wp-content/themes/wp-chiyoda/js/images/closelabel.gif',	// (string) Path and the name of the close btn
		imageBlank:	'/wp/wp-content/themes/wp-chiyoda/js/images/lightbox-blank.gif'	// (string) Path and the name of a blank image (one pixel)
	};
	// article_content
	$('div.article_content').each(function() {
		$('a[href$=.jpg]', this).lightBox(lightBoxOptions);
		$('a[href$=.png]', this).lightBox(lightBoxOptions);
		$('a[href$=.gif]', this).lightBox(lightBoxOptions);
	});

});

