jQuery(function($) {

	// smooth scroll
	$.easing.easeOutExpo = function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	}
	$('#pageTop a').click(function(){
		$.scrollTo(0, 800, {easing:'easeOutExpo'});
		return false;
	});
	$('.pagetop a').click(function(){
		$.scrollTo(0, 800, {easing:'easeOutExpo'});
		return false;
	});


	/**
	 * lightBox
	 */
	lightBoxOptions = {
		imageLoading:	'/wp-content/themes/wp-haifu/js/images/loading.gif',		// (string) Path and the name of the loading icon
		imageBtnPrev:	'/wp-content/themes/wp-haifu/js/images/prevlabel.gif',	// (string) Path and the name of the prev button image
		imageBtnNext:	'/wp-content/themes/wp-haifu/js/images/nextlabel.gif',	// (string) Path and the name of the next button image
		imageBtnClose:	'/wp-content/themes/wp-haifu/js/images/closelabel.gif',	// (string) Path and the name of the close btn
		imageBlank:	'/wp-content/themes/wp-haifu/js/images/lightbox-blank.gif',	// (string) Path and the name of a blank image (one pixel)
	};
	// photo_list
	$('ul.photo_list').each(function() {
		$('li a[href$=.jpg]', this).lightBox(lightBoxOptions);
	});

	// div.post
	$('div.post').each(function() {
		$('a[href$=.jpg]', this).lightBox(lightBoxOptions);
	});

	/**
	 * slideToggle
	 */
	// faq
	$('div.qa_list dl dd').hide();
	$('div.qa_list dl').each(function(){
		$('dt', this).each(function(i){
			$(this).click(function() {
				$("dd:eq(" + i+ ")", $(this).parent()).slideToggle(200);
			});
		});
	});

});
