﻿/// <reference path="jsoul_base.js" />
/// <reference path="jsoul_effect.js" />
//<![CDATA[ 
$.$(pageLoader);
function pageLoader(){
	$("#Content").effectList({handler:"#SwitchItem",menus:"h3",boxies:"$div,className,context"});
}
/*******************JSoul原型扩展方法 [特效类型]******************/
JSoul.fn.extend({
	effectList:function(oArgs){
	/// <summary>特效：列表控制</summary>
	/// <param name="oArgs" type="Object">参数表达式</param>
	/// <returns type="JSoul" />
		if(this.length == 1){
			this.handler = JSoul.find(oArgs.handler, this[0])[0];
			this.handler.Main = this;
			this.handler.onclick = JSoul.effectListClick;
			this.menus = JSoul(oArgs.menus, this[0]);
			this.boxies = JSoul(oArgs.boxies, this[0]).effectSpread(0.05,10);
			JSoul.setRelate(this, this.menus, this.boxies, JSoul.effectList);
		}
		return this;
	}
});
JSoul.extend({
	effectList:function(handler, box){
	/// <summary>特效：列表控制</summary>
	/// <param name="handler" type="Object">控制器</param>
	/// <param name="box" type="Object">控制对象</param>
		handler.onclick = function(){
		/// <summary>特效：点击</summary>
			if(this.className == "choosed")this.Close();
			else this.Open();
		};
		handler.Open = function(){
		/// <summary>特效：打开</summary>
			if(this.className != "choosed"){
				JSoul.attr(this,"className","choosed");
				this.Relate.toMaxHeight();
			}
		};
		handler.Close = function(){
		/// <summary>特效：关闭</summary>
			if(this.className == "choosed"){
				JSoul.attr(this,"className","");
				this.Relate.toMinHeight();
			}
		};
	},
	effectListClick:function(){
	/// <summary>控制整体列表</summary>
		if(this.className == "close"){
			JSoul.bindEvent(this, [["innerHTML", "Open all item"],["className", ""]]);
			this.Main.menus.run("Close");
		}else{
			JSoul.bindEvent(this, [["innerHTML", "Close all item"],["className", "close"]]);
			this.Main.menus.run("Open");
		}
		this.blur();
	}
});
//]]>