
window.addEvent('domready', foldlistInit );

function foldlistInit() 
{
	var listOneCheck = $('top5Worktitle');
	var listTwoCheck = $('top5Frontlines');
	if( listOneCheck != null) {
	    listOne = new foldableTopList('top5Worktitle');
	}
	if( listTwoCheck != null) {
	    listTwo = new foldableTopList('top5Frontlines');
	}
}

var foldableTopList = new Class({
	
	initialize: function(element, options) {
		this.options = Object.extend({
		}, options || {});
		this.addFoldList(element);	
	},
	
	addFoldList: function(title){
	
	    var cssPathHead     = '#' + title + ' h3.atStart'
	    var cssPathContent  = '#' + title + ' div.atStart'
	
        var accordion = new Accordion( cssPathHead, cssPathContent, {
	        opacity: false,
	        show:0,
	        onActive: function(toggler, element){
		        toggler.removeClass('isInactive');
	        },
	        onBackground: function(toggler, element){
		        toggler.addClass('isInactive');
	        }	        
        }, $( title ));
	}
	
});


