(
/**
 * jQuery.accordion
 * ターゲットタグで、その兄弟タグをアコーディオン
 * @param {jQuery} $ jQuery オブジェクト
 */
function($){
	
	/**
	 * (クラス)
	 * @param {DOM Elements} target DOM Elements
	 */
	$.accordion = function(target){
		this.target = target;
		this.option = {
			speed:"slow"
		}
	}
	
	/**
	 * サブメソッド(インスタンスメソッド)
	 */
	$.extend($.accordion.prototype,{
		setOption:function(option){
			if(!option) return;
			$.extend(this.option, option);
		},
		init:function(){
			$(this.target).next().hide();
			$(this.target).css("cursor","pointer");
		},
		toggle:function(){
			var scope = this;
			$(this.target).click(function(scope){
				// $(this).next().slideToggle();
				$(this).next().animate({height: "toggle", opacity: "toggle"},scope.speed);
			});
		}
	});
	
	/**
	 * 各セレクタでインスタンスを生成する。
	 */
	$.fn.accordion = function(option){
		return this.each(function(){
			var ins = new $.accordion(this);
			ins.init();
			ins.toggle();
		});
	}
}
)(jQuery);
