new (function(optionObj){
	this.IDs={
		 initStyle:""
	}	  
	this.SELECTORs={
		 parent:""
		,child:""
	}
	this.HTMLs={
		opener:""
	}
	this.hideLimit=10;
	this.ANIMATIONs={
		option:{}
	}
	
	this.openers=[]
	this.hideOuts=[]
	
	this.setStyle=function(){
		document.write("<style id='"+this.IDs.initStyle+"'>"+this.SELECTORs.parent+"{display:none!important}<\/style>");
	}
	this.loadFunction=function(){
		$A($$(this.SELECTORs.parent)).each(this.initialList.bind(this));
		this.displayParent()
	}
	this.initialList=function(parentElem,key){
		var childElems=$A(parentElem.getElementsByTagName(this.SELECTORs.child))
		if(childElems.length <= this.hideLimit) return null;
		
		var hideoutElem = parentElem.cloneNode(false);
		parentElem.insert({after:hideoutElem})

		hideoutElem.hide();
		
		var openerWrapperElem = new Element("div");
		hideoutElem.insert({after:openerWrapperElem})
		if(typeof this.CLASSes.openerWrapper!="undefined") openerWrapperElem.className=this.CLASSes.openerWrapper
		
		var openerElem = new Element("a",{href:"#"})
		openerWrapperElem.insert(openerElem)
		
		openerElem.insert( this.HTMLs.opener )
		
		Event.observe(openerElem,"click",this.clickFunction.bind(this,key),false);
		
		childElems.each(function(childElem,key){
			if( key+1 <= this.hideLimit) return false;
			
			hideoutElem.insert(childElem)
		}.bind(this))
		
		this.openers[key]=openerElem
		this.hideOuts[key]=hideoutElem
		

		parentElem.style.paddingBottom="0px";
		hideoutElem.style.paddingTop="0px";
		openerWrapperElem.style.paddingRight="1em";
	}
	this.clickFunction=function(key,e){
		e.stop();
		this.ANIMATIONs.option.afterFinish=this.afterOpened.bind(this,key)
		
		new Effect.BlindDown(this.hideOuts[key],this.ANIMATIONs.option)
	}
	this.afterOpened=function(key,e){
		this.openers[key].hide()
	}
	this.displayParent=function(){
		//$(this.IDs.initStyle).disabled=true;
		$(this.IDs.initStyle).remove()
	}
	
	// main
	for(var prop in optionObj){
		this[prop]=optionObj[prop]
	}
	this.setStyle()
	
	Event.observe(document,"dom:loaded",this.loadFunction.bind(this),false);
})({
	 IDs:{
		 initStyle:"hideList_style"
	}
	,SELECTORs:{
		 parent:".columns-block"
		,child:"li"
	}
	,hideLimit:10
	,HTMLs:{
		opener:"&raquo;&nbsp;全件表示"
	}
	,CLASSes:{
		openerWrapper:"align-right"
	}
	,ANIMATIONs:{
		option:{
			 duration:0.5
		}
	}
})

