
jQuery(function($) {

	/**
	 * AjaxZip2
	 * http://www.kawa.net/works/ajax/ajaxzip2/ajaxzip2.html
	 */
//	AjaxZip2.JSONDATA = '../js/ajaxzip2/data';
//	$('#fillAdressButton').click(function() {
//		AjaxZip2.zip2addr('your-zip1','your-pref','your-addr','your-zip2');
//	});

	/**
	 * 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-matsuri/js/images/loading.gif',	// (string) Path and the name of the loading icon
		imageBtnPrev:	'/wp/wp-content/themes/wp-matsuri/js/images/prevlabel.gif',	// (string) Path and the name of the prev button image
		imageBtnNext:	'/wp/wp-content/themes/wp-matsuri/js/images/nextlabel.gif',	// (string) Path and the name of the next button image
		imageBtnClose:	'/wp/wp-content/themes/wp-matsuri/js/images/closelabel.gif',	// (string) Path and the name of the close btn
		imageBlank:	'/wp/wp-content/themes/wp-matsuri/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], a[href$=.jpeg], a[href$=.JPG], a[href$=.JPG], a[href$=.png], a[href$=.gif]', this).lightBox(lightBoxOptions);
	});

});

